2fb4ee2d5a
* add catch for fail on save. isError is not being set to true, so set it in the catch * add conditionally to only catch 403 permission errors. Otherwise it will catch and return an unhelpful error message for when you are trying to save a duplicate secret * add in code comment * remove catch and pass version 2 secret model to Error handler inside template * replace Error model with modelForData to catch errors on the correct model * add back in space * replace error model with modelForData
60 lines
1.7 KiB
Handlebars
60 lines
1.7 KiB
Handlebars
<form class="{{if showAdvancedMode 'advanced-edit' 'simple-edit'}}" onsubmit={{action "createOrUpdateKey" "create"}}>
|
|
<div class="field box is-fullwidth is-sideless is-marginless">
|
|
<NamespaceReminder @mode="create" @noun="secret" />
|
|
<MessageError @model={{modelForData}} @errorMessage={{error}} />
|
|
<label class="is-label" for="kv-key">Path for this secret</label>
|
|
<p class="control is-expanded">
|
|
{{input
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
data-test-secret-path="true"
|
|
id="kv-key"
|
|
class="input"
|
|
value=(get modelForData modelForData.pathAttr)
|
|
}}
|
|
</p>
|
|
{{#if modelForData.isFolder}}
|
|
<p class="help is-danger">
|
|
The secret path may not end in <code>/</code>
|
|
</p>
|
|
{{/if}}
|
|
</div>
|
|
<SecretEditDisplay
|
|
@showAdvancedMode={{showAdvancedMode}}
|
|
@codemirrorString={{codemirrorString}}
|
|
@secretData={{secretData}}
|
|
@isV2={{isV2}}
|
|
@model={{model}}
|
|
@canEditV2Secret={{canEditV2Secret}}
|
|
@editActions={{hash
|
|
codemirrorUpdated=(action "codemirrorUpdated")
|
|
formatJSON=(action "formatJSON")
|
|
handleKeyDown=(action "handleKeyDown")
|
|
handleChange=(action "handleChange")
|
|
deleteRow=(action "deleteRow")
|
|
addRow=(action "addRow")
|
|
}}
|
|
/>
|
|
<div class="field is-grouped box is-fullwidth is-bottomless">
|
|
<div class="control">
|
|
<button
|
|
type="submit"
|
|
disabled={{buttonDisabled}}
|
|
class="button is-primary"
|
|
data-test-secret-save=true
|
|
>
|
|
Save
|
|
</button>
|
|
</div>
|
|
<div class="control">
|
|
{{#secret-link
|
|
mode="list"
|
|
secret=model.parentKey
|
|
class="button"
|
|
}}
|
|
Cancel
|
|
{{/secret-link}}
|
|
</div>
|
|
</div>
|
|
</form>
|