diff --git a/ui/.gitignore b/ui/.gitignore index 6680946d45..944ab0c512 100644 --- a/ui/.gitignore +++ b/ui/.gitignore @@ -17,6 +17,7 @@ /npm-debug.log* /testem.log /yarn-error.log +/.storybook/preview-head.html # ember-try /.node_modules.ember-try/ diff --git a/ui/.storybook/preview-head.html b/ui/.storybook/preview-head.html deleted file mode 100644 index d35e63834d..0000000000 --- a/ui/.storybook/preview-head.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - diff --git a/ui/app/helpers/secret-query-params.js b/ui/app/helpers/secret-query-params.js new file mode 100644 index 0000000000..483700274b --- /dev/null +++ b/ui/app/helpers/secret-query-params.js @@ -0,0 +1,10 @@ +import { helper } from '@ember/component/helper'; + +export function secretQueryParams([backendType]) { + if (backendType === 'transit') { + return { tab: 'actions' }; + } + return; +} + +export default helper(secretQueryParams); diff --git a/ui/app/macros/lazy-capabilities.js b/ui/app/macros/lazy-capabilities.js index 2169d61ef2..a20fb88ea1 100644 --- a/ui/app/macros/lazy-capabilities.js +++ b/ui/app/macros/lazy-capabilities.js @@ -4,7 +4,7 @@ // // export default DS.Model.extend({ // //pass the template string as the first arg, and be sure to use '' around the -// //paramerters that get interpolated in the string - that's how the template function +// //parameters that get interpolated in the string - that's how the template function // //knows where to put each value // zeroAddressPath: lazyCapabilities(apiPath`${'id'}/config/zeroaddress`, 'id'), // diff --git a/ui/app/models/transit-key.js b/ui/app/models/transit-key.js index 3f2e029a3d..c3797b5932 100644 --- a/ui/app/models/transit-key.js +++ b/ui/app/models/transit-key.js @@ -7,14 +7,38 @@ import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities'; const { attr } = DS; const ACTION_VALUES = { - encrypt: 'supportsEncryption', - decrypt: 'supportsDecryption', - datakey: 'supportsEncryption', - rewrap: 'supportsEncryption', - sign: 'supportsSigning', - hmac: true, - verify: true, - export: 'exportable', + encrypt: { + isSupported: 'supportsEncryption', + description: 'Looks up wrapping properties for the given token', + glyph: 'lock-closed', + }, + decrypt: { + isSupported: 'supportsDecryption', + description: 'Decrypts the provided ciphertext using this key', + glyph: 'envelope-unsealed--outline', + }, + datakey: { + isSupported: 'supportsEncryption', + description: 'Generates a new key and value encrypted with this key', + glyph: 'key', + }, + rewrap: { + isSupported: 'supportsEncryption', + description: 'Rewraps the ciphertext using the latest version of the named key', + glyph: 'refresh-default', + }, + sign: { + isSupported: 'supportsSigning', + description: 'Get the cryptographic signature of the given data', + glyph: 'edit', + }, + 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', + }, + export: { isSupported: 'exportable', description: 'Get the named key', glyph: 'exit' }, }; export default DS.Model.extend({ @@ -56,13 +80,15 @@ export default DS.Model.extend({ }, supportedActions: computed('type', function() { - return Object.keys(ACTION_VALUES).filter(name => { - const isSupported = ACTION_VALUES[name]; - if (typeof isSupported === 'boolean') { - return isSupported; - } - return get(this, isSupported); - }); + return Object.keys(ACTION_VALUES) + .filter(name => { + const { isSupported } = ACTION_VALUES[name]; + return typeof isSupported === 'boolean' || get(this, isSupported); + }) + .map(name => { + const { description, glyph } = ACTION_VALUES[name]; + return { name, description, glyph }; + }); }), canDelete: computed('deletionAllowed', 'lastLoadTS', function() { @@ -116,9 +142,7 @@ export default DS.Model.extend({ return types; }), - backend: attr('string', { - readOnly: true, - }), + backend: attr('string'), rotatePath: lazyCapabilities(apiPath`${'backend'}/keys/${'id'}/rotate`, 'backend', 'id'), canRotate: alias('rotatePath.canUpdate'), diff --git a/ui/app/styles/components/transit-card.scss b/ui/app/styles/components/transit-card.scss new file mode 100644 index 0000000000..1fb0cec046 --- /dev/null +++ b/ui/app/styles/components/transit-card.scss @@ -0,0 +1,41 @@ +.transit-card-container { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(240px, 0.2fr)); + grid-template-rows: 1fr; + align-content: start; + grid-gap: 2rem; + margin-top: $spacing-l; +} + +.transit-card { + border-radius: $radius; + box-shadow: 0 0 0 1px rgba($grey-dark, 0.3), $box-shadow-middle; + display: grid; + grid-template-columns: 0.45fr 2fr; + padding: $spacing-m; + + .transit-icon { + justify-self: center; + } + + .transit-action-description { + font-family: $family-sans; + font-size: $size-8; + color: $grey; + } + + .title { + color: $grey; + font-size: $size-7; + margin-bottom: $spacing-xxs; + } + + &:hover { + box-shadow: 0 0 0 1px $blue-500, $box-shadow-middle; + background: $blue-010; + + .title { + color: initial; + } + } +} diff --git a/ui/app/styles/core.scss b/ui/app/styles/core.scss index 15bafbc0c5..9ae37b8119 100644 --- a/ui/app/styles/core.scss +++ b/ui/app/styles/core.scss @@ -88,6 +88,7 @@ @import './components/token-expire-warning'; @import './components/toolbar'; @import './components/tool-tip'; +@import './components/transit-card'; @import './components/unseal-warning'; @import './components/ui-wizard'; @import './components/vault-loading'; diff --git a/ui/app/templates/components/selectable-card.hbs b/ui/app/templates/components/selectable-card.hbs index bb69888640..6c55fe0285 100644 --- a/ui/app/templates/components/selectable-card.hbs +++ b/ui/app/templates/components/selectable-card.hbs @@ -1,7 +1,7 @@ {{!-- conditional to check if SelectableCard is apart of a CSS Grid, if yes return grid item class --}} {{#if gridContainer}}
{{subText}}
@@ -10,7 +10,7 @@{{subText}}
diff --git a/ui/app/templates/components/transit-edit.hbs b/ui/app/templates/components/transit-edit.hbs index f4457a3cab..43d46153b4 100644 --- a/ui/app/templates/components/transit-edit.hbs +++ b/ui/app/templates/components/transit-edit.hbs @@ -20,5 +20,4 @@ - {{partial (concat 'partials/transit-form-' mode)}} diff --git a/ui/app/templates/components/transit-key-actions.hbs b/ui/app/templates/components/transit-key-actions.hbs index 3ab25a7221..c9833edcc9 100644 --- a/ui/app/templates/components/transit-key-actions.hbs +++ b/ui/app/templates/components/transit-key-actions.hbs @@ -9,7 +9,6 @@ data-test-transit-key-rotate="true" > Rotate encryption key -{{supportedAction.description}}
+