Skip to content

Commit

Permalink
Incorporate Ember Flight Icons (#12976)
Browse files Browse the repository at this point in the history
* adds ember-flight-icons dependecy

* adds inline-json-import babel plugin

* adds flight icon styling

* updates Icon component to support flight icons

* updates Icon component usages to new api and updates name values to flight icon set when available

* fixes tests

* updates icon story with flight mappings and fixes issue with flight icons not rendering in storybook

* adds changelog

* fixes typo in sign action glyph name in transit-key model

* adds comments to icon-map

* updates Icon component to use only supported flight icon sizes

* adds icon transform codemod

* updates icon transform formatting to handle edge case

* runs icon transform on templates

* updates Icon usage in toolbar-filter md and story

* updates tests
  • Loading branch information
zofskeez authored Dec 7, 2021
1 parent 3e82946 commit d811271
Show file tree
Hide file tree
Showing 169 changed files with 832 additions and 407 deletions.
3 changes: 3 additions & 0 deletions changelog/12976.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: Adds flight icons to UI
```
4 changes: 4 additions & 0 deletions ui/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { configure, addParameters, addDecorator } from '@storybook/ember';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import theme from './theme.js';
import flightIconSprite from '@hashicorp/flight-icons/svg-sprite/svg-sprite-module';

function loadStories() {
// automatically import all files ending in *.stories.js
Expand All @@ -18,6 +19,9 @@ addParameters({
addDecorator(storyFn => {
const { template, context } = storyFn();

// flight icon sprite must be inserted into dom for icon lookup via use element
document.getElementById('root').insertAdjacentHTML('afterbegin', flightIconSprite.trim());

// This adds styling to the Canvas tab.
const styles = {
style: {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/regex-validator.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<AlertInline @type="danger" @message="Your regex doesn't match the subject string" />
{{else}}
<div class="message-inline">
<Icon @glyph="check-circle-fill" class="has-text-success" aria-hidden="true" />
<Icon @name="check-circle-fill" class="has-text-success" />
<p data-test-inline-success-message>Your regex matches the subject string</p>
</div>
{{/if}}
Expand Down
9 changes: 4 additions & 5 deletions ui/app/components/status-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ export default Component.extend({
type: 'cluster',
itemTag: null,
glyphName: computed('type', function() {
const glyphs = {
cluster: 'status-indicator',
user: 'user-square-outline',
};
return glyphs[this.type];
return {
cluster: 'circle-dot',
user: 'user',
}[this.type];
}),
});
2 changes: 1 addition & 1 deletion ui/app/components/toolbar-secret-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { computed } from '@ember/object';
export default OuterHTML.extend({
glyph: computed('type', function() {
if (this.type == 'add') {
return 'plus-plain';
return 'plus';
} else {
return 'chevron-right';
}
Expand Down
22 changes: 15 additions & 7 deletions ui/app/models/transit-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const ACTION_VALUES = {
encrypt: {
isSupported: 'supportsEncryption',
description: 'Looks up wrapping properties for the given token',
glyph: 'lock-closed',
glyph: 'lock-fill',
},
decrypt: {
isSupported: 'supportsDecryption',
description: 'Decrypts the provided ciphertext using this key',
glyph: 'envelope-unsealed--outline',
glyph: 'mail-open',
},
datakey: {
isSupported: 'supportsEncryption',
Expand All @@ -23,20 +23,28 @@ const ACTION_VALUES = {
rewrap: {
isSupported: 'supportsEncryption',
description: 'Rewraps the ciphertext using the latest version of the named key',
glyph: 'refresh-default',
glyph: 'reload',
},
sign: {
isSupported: 'supportsSigning',
description: 'Get the cryptographic signature of the given data',
glyph: 'edit',
glyph: 'pencil-tool',
},
hmac: {
isSupported: true,
description: 'Generate a data digest using a hash algorithm',
glyph: 'shuffle',
},
hmac: { isSupported: true, description: 'Generate a data digest using a hash algorithm', glyph: 'remix' },
verify: {
isSupported: true,
description: 'Validate the provided signature for the given data',
glyph: 'check-circle-outline',
glyph: 'check-circle',
},
export: {
isSupported: 'exportable',
description: 'Get the named key',
glyph: 'external-link',
},
export: { isSupported: 'exportable', description: 'Get the named key', glyph: 'exit' },
};

export default Model.extend({
Expand Down
2 changes: 1 addition & 1 deletion ui/app/styles/components/console-ui-panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
margin-left: calc(#{$console-spacing} - 0.33rem);
position: relative;

.hs-icon {
svg {
position: absolute;
left: 0;
top: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@
width: 32px;
height: 32px;
}

.flight-icon {
&.flight-icon-display-inline {
vertical-align: middle;
margin: 0px 4px;
}
}
2 changes: 1 addition & 1 deletion ui/app/styles/core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@
@import './components/vlt-table';

// bulma-free-zone
@import './components/hs-icon';
@import './components/icon';
8 changes: 2 additions & 6 deletions ui/app/templates/components/alert-popup.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
<div class="column is-narrow message-icon">
<Icon
aria-hidden="true"
@size="l"
@glyph="{{type.glyph}}"
@name={{type.glyph}}
/>
</div>
<div class="column">
<button type="button" class="close-button" {{action close}}>
<Icon
@glyph="cancel-plain"
@aria-label="Close"
/>
<Icon @name="x" aria-label="Close" />
</button>
<div class="message-title">
{{type.text}}
Expand Down
8 changes: 4 additions & 4 deletions ui/app/templates/components/cluster-info.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<LinkTo @route="vault.cluster.replication" @invokeAction={{@onLinkClick}}>
<div class="level is-mobile">
<span class="level-left">Enable</span>
<Icon @glyph="plus-circle-outline" @class="has-text-grey-light level-right" />
<Icon @name="plus-circle" class="has-text-grey-light level-right" />
</div>
</LinkTo>
</li>
Expand Down Expand Up @@ -66,22 +66,22 @@
<LinkTo @route="vault.cluster.settings.seal" @model={{@cluster.name}} @invokeAction={{@onLinkClick}}>
<div class="level is-mobile">
<span class="level-left">Unsealed</span>
<Icon @glyph="check-circle-outline" class="has-text-success level-right" />
<Icon @name="check-circle" class="has-text-success level-right" />
</div>
</LinkTo>
{{else}}
<span class="menu-item">
<div class="level is-mobile">
<span class="level-left">Unsealed</span>
<Icon @glyph="check-circle-outline" class="has-text-success level-right" />
<Icon @name="check-circle" class="has-text-success level-right" />
</div>
</span>
{{/if}}
{{else}}
<span class="menu-item">
<div class="level is-mobile">
<span class="level-left has-text-danger">Sealed</span>
<Icon @glyph="cancel-circle-outline" class="has-text-danger level-right" />
<Icon @name="x-circle" class="has-text-danger level-right" />
</div>
</span>
{{/if}}
Expand Down
5 changes: 4 additions & 1 deletion ui/app/templates/components/console/command-input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<input onkeyup={{action 'handleKeyUp'}} value={{value}} autocomplete="off" spellcheck="false" />
<ToolTip @horizontalPosition="auto-right" @verticalPosition={{if isFullscreen "above" "below"}} as |d|>
<d.trigger @tagName="button" @type="button" @class={{concat "button is-compact" (if isFullscreen " active")}} @click={{action "fullscreen"}} @data-test-tool-tip-trigger={{true}}>
<Icon @size="l" @glyph={{if isFullscreen "expand-less" "expand-more"}} aria-label={{if isFullscreen "Minimize" "Maximize"}} />
<Icon
@name={{if isFullscreen "minimize" "maximize"}}
aria-label={{if isFullscreen "Minimize" "Maximize"}}
/>
</d.trigger>
<d.content @class="tool-tip">
<div class="box">
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/console/log-command.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{!-- using Icon here instead of Chevron because two nested tagless components results in a rendered line break between the tags breaking the layout in the <pre> --}}
<pre class="console-ui-command"><Icon @glyph="chevron-right" aria-hidden="true" />{{content}}</pre>
<pre class="console-ui-command"><Icon @name="chevron-right" />{{content}}</pre>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{! template-lint-disable no-triple-curlies}}
<div class="console-ui-alert has-text-danger">
<Icon @glyph="cancel-circle-fill" aria-hidden="true" />
<Icon @name="x-circle-fill" />
<pre>{{{content}}}</pre>
</div>
2 changes: 1 addition & 1 deletion ui/app/templates/components/console/log-error.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="console-ui-alert has-text-danger">
<Icon @glyph="cancel-circle-fill" aria-hidden="true" />
<Icon @name="x-circle-fill" />
<pre>{{content}}</pre>
</div>
2 changes: 1 addition & 1 deletion ui/app/templates/components/console/log-help.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="console-ui-alert has-text-grey">
<Icon @glyph="info-circle-fill" aria-hidden="true" />
<Icon @name="info" />
<pre>Usage: vault &lt;command&gt; [args]

Commands:
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/console/log-success.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="console-ui-alert has-text-success">
<Icon @glyph="check-circle-fill" aria-hidden="true" />
<Icon @name="check-circle-fill" />
<pre>{{content}}</pre>
</div>
2 changes: 1 addition & 1 deletion ui/app/templates/components/console/ui-panel.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<button type="button" class="button is-ghost console-close-button" {{action "closeConsole"}}>
<Icon @glyph="cancel-plain" aria-label="Close console" />
<Icon @name="x" aria-label="Close console" />
</button>
<div class="console-ui-panel-content">
<div class="content">
Expand Down
6 changes: 3 additions & 3 deletions ui/app/templates/components/control-group.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<MessageError @model={{model}} />
<div class="control-group-header {{if isSuccess 'is-success'}}">
<p>
<Icon @glyph={{if isSuccess "check-circle-fill" "lock-closed"}} />
<Icon @name={{if isSuccess "check-circle-fill" "lock-fill"}} />
<strong data-test-banner-prefix>{{bannerPrefix}}</strong>
<span data-test-banner-text>{{bannerText}}</span>
</p>
Expand Down Expand Up @@ -42,7 +42,7 @@
<div class="authorizations" data-test-authorizations>
{{#if (gt model.authorizations.length 0)}}
<span class="has-text-success">
<Icon @glyph="check-circle-outline" />
<Icon @name="check-circle" />
</span>
Already approved by
{{#each model.authorizations as |authorization index|}}
Expand All @@ -54,7 +54,7 @@
{{/each}}
{{else}}
<span class="has-text-grey">
<Icon @glyph="check-circle-outline" />
<Icon @name="check-circle" />
</span>
Awaiting authorization.
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/database-connection.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<EmptyState
@title="Database type unavailable"
@subTitle="Not supported in the UI"
@icon="disabled"
@icon="skip"
@message="This database type cannot be viewed in the UI. You will have to use the API or CLI to perform actions here."
@bottomBorder={{true}}
>
Expand Down
4 changes: 2 additions & 2 deletions ui/app/templates/components/file-to-array-buffer.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<label class="file-label">
<input class="file-input" type="file" onchange={{action "pickedFile"}} data-test-file-input>
<span class="file-cta button">
<Icon @glyph="upload" class="has-light-grey-text" />
<Icon @name="upload" class="has-light-grey-text" />
Choose a file…
</span>
<span class="file-name has-text-grey-dark" data-test-text-file-input-label=true>
{{or this.fileName "No file chosen"}}
</span>
{{#if this.fileName}}
<button type="button" class="file-delete-button" {{action 'clearFile'}} data-test-text-clear>
<Icon @glyph="cancel-circle-outline" />
<Icon @name="x-circle" />
</button>
{{/if}}
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<EmptyState
@title={{errorTitle}}
@subTitle="Error {{@model.errorHttpStatus}}"
@icon="alert-circle-outline"
@icon="alert-circle"
@bottomBorder={{true}}
@message={{@model.errorMessage}}
>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/generated-item-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<ListItem @linkParams={{array "vault.cluster.access.method.item.show"
itemType list.item.id}} as |Item|>
<Item.content>
<Icon @glyph="folder-outline" class="has-text-grey-light" @size="l" />{{list.item.id}}
<Icon @name="folder" class="has-text-grey-light" />{{list.item.id}}
</Item.content>
<Item.menu as |Menu|>
<li class="action">
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/hover-copy-button.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@clipboardText={{copyValue}}
@success={{action (mut tooltipText) "Copied!"}}
>
<Icon @glyph="copy-action" aria-label="Copy" />
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
</T.trigger>
<T.content @class="tool-tip">
Expand Down
8 changes: 4 additions & 4 deletions ui/app/templates/components/identity/item-aliases.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
}}
<div class="columns is-mobile">
<div class="column is-10">
<LinkTo @route="vault.cluster.access.identity.aliases.show" @models={{array item.id "details"}} class="has-text-black has-text-weight-semibold"><Icon
@glyph="user-square-outline"
class="has-text-grey-light"
/><span class="has-text-weight-semibold">{{item.name}}</span></LinkTo>
<LinkTo @route="vault.cluster.access.identity.aliases.show" @models={{array item.id "details"}} class="has-text-black has-text-weight-semibold">
<Icon @name="user" class="has-text-grey-light" />
<span class="has-text-weight-semibold">{{item.name}}</span>
</LinkTo>
<div class="has-text-grey">
{{item.id}}
</div>
Expand Down
4 changes: 2 additions & 2 deletions ui/app/templates/components/identity/item-groups.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{#each @model.directGroupIds as |gid|}}
<LinkTo @route="vault.cluster.access.identity.show" @models={{array "groups" gid "details"}} class="list-item-row">
<Icon
@glyph="folder-outline"
@name="folder"
class="has-text-grey-light"
/>{{gid}}
</LinkTo>
Expand All @@ -14,7 +14,7 @@
}}
<LinkTo @route="vault.cluster.access.identity.show" @models={{array "groups" gid "details"}} class="has-text-black">
<Icon
@glyph="folder-outline"
@name="folder"
class="has-text-grey-light"
/>{{gid}}
</LinkTo>
Expand Down
12 changes: 4 additions & 8 deletions ui/app/templates/components/identity/item-members.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
}}
<div class="columns is-mobile">
<div class="column is-10">
<LinkTo @route="vault.cluster.access.identity.show" @models={{array "groups" gid "details"}} class="is-block has-text-black has-text-weight-semibold"><Icon
@glyph="folder-outline"
class="has-text-grey-light"
/>{{gid}}</LinkTo>
<LinkTo @route="vault.cluster.access.identity.show" @models={{array "groups" gid "details"}} class="is-block has-text-black has-text-weight-semibold">
<Icon @name="folder" class="has-text-grey-light" />{{gid}}
</LinkTo>
</div>
<div class="column has-text-right">
{{#if @model.canEdit}}
Expand All @@ -36,10 +35,7 @@
@route="vault.cluster.access.identity.show"
@models={{array "entities" gid "details"}}
class="is-block has-text-black has-text-weight-semibold">
<Icon
@glyph="user-square-outline"
class="has-text-grey-light"
/>{{gid}}
<Icon @name="user" class="has-text-grey-light" />{{gid}}
</LinkTo>
</div>
<div class="column has-text-right">
Expand Down
5 changes: 1 addition & 4 deletions ui/app/templates/components/identity/item-parent-groups.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
<div class="columns is-mobile">
<div class="column is-10">
<LinkTo @route="vault.cluster.access.identity.show" @models={{array "groups" gid "details"}} class="is-block has-text-black has-text-weight-semibold">
<Icon
@glyph="folder-outline"
class="has-text-grey-light"
/>{{gid}}
<Icon @name="folder" class="has-text-grey-light" />{{gid}}
</LinkTo>
</div>
<div class="column has-text-right">
Expand Down
Loading

0 comments on commit d811271

Please sign in to comment.