diff --git a/ui/app/templates/components/transform-show-transformation.hbs b/ui/app/templates/components/transform-show-transformation.hbs index 22a4ec8e4..72a68dbc8 100644 --- a/ui/app/templates/components/transform-show-transformation.hbs +++ b/ui/app/templates/components/transform-show-transformation.hbs @@ -3,7 +3,7 @@ {{#if (eq attr.type "object")}} {{info-table-row label=(capitalize (or attr.options.label (humanize (dasherize attr.name)))) value=(stringify (get model attr.name))}} {{else}} - {{info-table-row label=(capitalize (or attr.options.label (humanize (dasherize attr.name)))) value=(get model attr.name)}} + {{info-table-row label=(capitalize (or attr.options.label (humanize (dasherize attr.name)))) value=(get model attr.name) type=attr.type}} {{/if}} {{/each}} @@ -18,8 +18,12 @@
- {{#let "vault write /encode/ value= tweak=" as |copyEncodeCommand|}} - vault write <backend>/encode/<your role name> value=<enter your value here> tweak=<base-64 string> + {{#let (concat + "vault write " model.backend "/encode/" + (if (and (take 1 model.allowed_roles) (eq model.allowed_roles.length 1)) (take 1 model.allowed_roles) "") + " value=" + (if (and (eq model.type 'fpe') (eq model.tweak_source "supplied")) " tweak_source=")) as |copyEncodeCommand|}} + {{copyEncodeCommand}} @@ -35,8 +39,12 @@
- {{#let "vault write /decode/ value= tweak=" as |copyDecodeCommand|}} - vault write <backend>/decode/<your role name> value=<enter your value here> tweak=<base-64 string> + {{#let (concat + "vault write " model.backend "/decode/" + (if (and (take 1 model.allowed_roles) (eq model.allowed_roles.length 1)) (take 1 model.allowed_roles) "") + " value=" + (if (and (eq model.type 'fpe') (eq model.tweak_source "supplied")) " tweak_source=")) as |copyDecodeCommand|}} + {{copyDecodeCommand}} diff --git a/ui/app/templates/components/transformation-edit.hbs b/ui/app/templates/components/transformation-edit.hbs index a09314927..8566b42aa 100644 --- a/ui/app/templates/components/transformation-edit.hbs +++ b/ui/app/templates/components/transformation-edit.hbs @@ -11,9 +11,9 @@

{{#if (eq mode "create") }} - Create Transformation + Create transformation {{else if (eq mode 'edit')}} - Edit Transformation + Edit transformation {{else}} Transformation {{model.id}} {{/if}} @@ -24,22 +24,19 @@ {{#if (eq mode "show")}} - {{!-- TODO: update these actions, show delete grey out if not allowed --}} - {{#if (or model.canUpdate model.canDelete)}} + {{#if (or capabilities.canUpdate capabilities.canDelete)}}
{{/if}} - {{#if model.canDelete}} - {{!-- TODO only allow deletion when not in use by a role --}} - Delete transformation - + {{/if}} - {{#if model.canUpdate }} + {{#if capabilities.canUpdate }} {{/if}} + + +

+ Deleting the {{model.name}} transformation means that the underlying keys are lost and the data encoded by the transformation are unrecoverable and cannot be decoded. +

+ +
diff --git a/ui/lib/core/addon/components/info-table-row.js b/ui/lib/core/addon/components/info-table-row.js index 2fadd1fa4..4f1a84b21 100644 --- a/ui/lib/core/addon/components/info-table-row.js +++ b/ui/lib/core/addon/components/info-table-row.js @@ -18,7 +18,7 @@ import layout from '../templates/components/info-table-row'; * @param label=null {string} - The display name for the value. * @param helperText=null {string} - Text to describe the value displayed beneath the label. * @param alwaysRender=false {Boolean} - Indicates if the component content should be always be rendered. When false, the value of `value` will be used to determine if the component should render. - * + * @param [type=array] {string} - The type of value being passed in. This is used for when you want to trim an array. For example, if you have an array value that can equal length 15+ this will trim to show 5 and count how many more are there */ export default Component.extend({ layout, diff --git a/ui/lib/core/addon/templates/components/info-table-row.hbs b/ui/lib/core/addon/templates/components/info-table-row.hbs index bd7f3afcd..0e290980b 100644 --- a/ui/lib/core/addon/templates/components/info-table-row.hbs +++ b/ui/lib/core/addon/templates/components/info-table-row.hbs @@ -29,7 +29,11 @@ /> No {{/if}} {{else}} - {{value}} + {{#if (eq type 'array')}} + {{if (gte value.length 10) (concat (take 5 value) ", and " (dec 5 value.length) " more.") value}} + {{else}} + {{value}} + {{/if}} {{/if}}
{{/if}}