2021-06-15 15:21:54 +00:00
{{ # if ( and ( or @ model .isNew @ canEditV2Secret ) @ isV2 ( not @ model .failedServerRead ) ) }}
<div data-test-metadata-fields class="form-section box is-shadowless is-fullwidth">
<label class="title is-5">
Secret metadata
</label>
{{ # each @ model .fields as | attr | }}
<FormField
data-test-field
@attr= {{ attr }}
@model= {{ @ model }}
@onKeyUp= {{ @ onKeyUp }}
@validationMessages= {{ @ validationMessages }}
2019-04-16 20:27:23 +00:00
/>
2021-06-15 15:21:54 +00:00
{{ / each }}
</div>
{{ / if }}
2019-04-16 20:27:23 +00:00
2021-06-15 15:21:54 +00:00
{{ # if @ showWriteWithoutReadWarning }}
{{ # if ( and @ isV2 @ model .failedServerRead ) }}
<AlertBanner
@type="warning"
@message="Your policies prevent you from reading metadata for this secret and the current version's data. Creating a new version of the secret with this form will not be able to use the check-and-set mechanism. If this is required on the secret, then you will need access to read the secret's metadata."
@class="is-marginless"
data-test-v2-no-cas-warning
/>
{{ else if @ isV2 }}
<AlertBanner
@type="warning"
@message="Your policies prevent you from reading the current secret version. Saving this form will create a new version of the secret and will utilize the available check-and-set mechanism."
@class="is-marginless"
data-test-v2-write-without-read
/>
2018-10-09 04:22:29 +00:00
{{ else }}
2021-06-15 15:21:54 +00:00
<AlertBanner
@type="warning"
@message="Your policies prevent you from reading the current secret data. Saving using this form will overwrite the existing values."
@class="is-marginless"
data-test-v1-write-without-read
/>
{{ / if }}
{{ / if }}
{{ # if @ showAdvancedMode }}
<div class="form-section">
<JsonEditor
@title= {{ if isV2 "Version Data" "Secret Data" }}
@value= {{ @ codemirrorString }}
@valueUpdated= {{ action @ editActions .codemirrorUpdated }}
@onFocusOut= {{ action @ editActions .formatJSON }} >
</JsonEditor>
</div>
{{ else }}
<div class="form-section">
<label class="title is-5">
{{ # if isV2 }}
Version data
{{ else }}
Secret data
{{ / if }}
</label>
{{ # each @ secretData as | secret in dex | }}
<div class="info-table-row">
<div class="column is-one-quarter info-table-row-edit">
<Input
data-test-secret-key= {{ true }}
@value= {{ secret .name }}
placeholder="key"
@change= {{ action @ editActions .handleChange }}
2021-07-13 17:47:50 +00:00
class="input"
2021-06-15 15:21:54 +00:00
@autocomplete="off"
@spellcheck="false"
{{ on "keyup" ( fn @ onKeyUp "key" secret .name ) }}
/>
</div>
<div class="column info-table-row-edit">
<MaskedInput
@name= {{ secret .name }}
@onKeyDown= {{ @ editActions .handleKeyDown }}
@onChange= {{ @ editActions .handleChange }}
@value= {{ secret .value }}
data-test-secret-value="true"
/>
</div>
<div class="column is-narrow info-table-row-edit">
{{ # if ( eq @ secretData .length ( in c in dex ) ) }}
<button type="button" {{ action @ editActions .addRow }} class="button is-outlined is-primary" data-test-secret-add-row="true">
Add
</button>
2018-10-15 14:40:54 +00:00
{{ else }}
2021-06-15 15:21:54 +00:00
<button
class="button has-text-grey is-expanded is-icon"
type="button"
{{ action @ editActions .deleteRow secret .name }}
aria-label="Delete row"
>
<Icon
@glyph="trash"
@size="l"
class="has-text-grey-light"
/>
</button>
2018-10-15 14:40:54 +00:00
{{ / if }}
2018-10-09 04:22:29 +00:00
</div>
2018-10-15 14:40:54 +00:00
</div>
2021-06-15 15:21:54 +00:00
{{ # if @ validationMessages .key }}
<AlertInline
@type="danger"
@message= {{ @ validationMessages .key }}
@paddingTop=true
@isMarginless=true
/>
{{ / if }}
{{ / each }}
</div>
{{ / if }}