vault/ui/app/templates/components/kv-object-editor.hbs
Angel Garbarino 9e4a095c71
UI add custom metadata to KV2 (#12169)
* initial setup

* form field editType kv is very helpful

* setting up things

* setup two routes for metadata

* routing

* clean up routing

* meh router changes not my favorite but its working

* show metadata

* add controller for backendCrumb mixin

* setting up edit metadata and trimming SecretEditMetadata component

* add edit metadata save functionality

* create new version work

* setup model and formfieldgroups for added config data.

* add config network request to secret-engine

* fix validations on config

* add config rows

* breaking up secret edit

* add validation for metadata on create

* stuff, but broken now on metadata tab

* fix metadata route error

* permissions

* saving small text changes

* permissions

* cleanup

* some test fixes and convert secret create or update to glimmer

* all these changes fix secret create kv test

* remove alert banners per design request

* fix error for array instead of object in jsonEditor

* add changelog

* styling

* turn into glimmer component

* cleanup

* test failure fix

* add delete or

* clean up

* remove all hardcoded for api integration

* add helper and fix create mode on create new version

* address chelseas pr comments

* add jsdocs to helper

* fix test
2021-08-31 09:41:41 -06:00

74 lines
2.0 KiB
Handlebars

{{#if label}}
<label class="title {{if small-label 'is-5' 'is-4'}}" data-test-kv-label="true">
{{label}}
{{#if helpText}}
<InfoTooltip>
{{helpText}}
</InfoTooltip>
{{/if}}
</label>
{{#if subText}}
<p class="has-padding-bottom">
{{subText}}
</p>
{{/if}}
{{/if}}
{{#if (get validationMessages name)}}
<div>
<AlertInline
@type="danger"
@message={{get validationMessages name}}
@paddingTop=true
/>
</div>
{{/if}}
{{#each kvData as |row index|}}
<div class="columns is-variable" data-test-kv-row>
<div class="column is-one-quarter">
<Input data-test-kv-key={{true}} @value={{row.name}} placeholder="key" @change={{action "updateRow" row index}} class="input" />
</div>
<div class="column">
<Textarea
data-test-kv-value={{true}}
@name={{row.name}}
class="input {{if (get validationMessages name) "has-error-border"}}"
@change={{action "updateRow" row index}}
@value={{row.value}}
@wrap="off"
class="input"
placeholder="value"
@rows={{1}}
onkeyup={{action
(action "handleKeyUp" name)
value="target.value"
}}
/>
</div>
<div class="column is-narrow">
{{#if (eq kvData.length (inc index))}}
<button type="button" {{action "addRow"}} class="button is-outlined is-primary" data-test-kv-add-row=true>
Add
</button>
{{else}}
<button
class="button has-text-grey is-expanded is-icon"
type="button"
{{action "deleteRow" row index}}
aria-label="Delete row"
data-test-kv-delete-row
>
<Icon @glyph="trash" @size="l" />
</button>
{{/if}}
</div>
</div>
{{/each}}
{{#if kvHasDuplicateKeys}}
<AlertBanner
@type="warning"
@message="More than one key shares the same name. Please be sure to have unique key names or some data may be lost when saving."
@class="is-marginless"
data-test-duplicate-error-warnings
/>
{{/if}}