2022-06-20 20:39:16 +00:00
|
|
|
<form class="new-secure-variables" autocomplete="off" {{on "submit" this.save}}
|
|
|
|
{{did-insert this.appendItemIfEditing}}
|
|
|
|
>
|
2022-06-10 14:05:34 +00:00
|
|
|
{{!-- TODO: {{if this.parseError 'is-danger'}} on inputs --}}
|
|
|
|
<div>
|
|
|
|
<label>
|
2022-06-17 19:05:08 +00:00
|
|
|
<span>
|
|
|
|
Path
|
|
|
|
</span>
|
2022-06-10 14:05:34 +00:00
|
|
|
<Input
|
|
|
|
@type="text"
|
|
|
|
@value={{@model.path}}
|
|
|
|
placeholder="/path/to/variable"
|
|
|
|
class="input path-input {{if this.duplicatePathWarning "error"}}"
|
|
|
|
disabled={{not @model.isNew}}
|
|
|
|
{{on "input" this.validatePath}}
|
|
|
|
{{autofocus}}
|
2022-06-17 19:05:08 +00:00
|
|
|
/>
|
2022-06-10 14:05:34 +00:00
|
|
|
</label>
|
|
|
|
{{#if this.duplicatePathWarning}}
|
|
|
|
<p class="duplicate-path-error help is-danger">
|
2022-06-17 19:05:08 +00:00
|
|
|
There is already a Secure Variable located at
|
|
|
|
{{@model.path}}
|
|
|
|
.
|
2022-06-10 14:05:34 +00:00
|
|
|
<br />
|
2022-06-17 19:05:08 +00:00
|
|
|
Please choose a different path, or
|
|
|
|
<LinkTo
|
|
|
|
@route="variables.variable.edit"
|
|
|
|
@model={{this.duplicatePathWarning.path}}
|
|
|
|
>
|
|
|
|
edit the existing Secure Variable
|
|
|
|
</LinkTo>
|
|
|
|
.
|
2022-06-10 14:05:34 +00:00
|
|
|
</p>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
2022-06-10 18:59:47 +00:00
|
|
|
{{#each this.keyValues as |entry iter|}}
|
2022-06-17 19:05:08 +00:00
|
|
|
<div class="key-value">
|
|
|
|
<label>
|
|
|
|
<span>
|
|
|
|
Key
|
|
|
|
</span>
|
|
|
|
<Input
|
|
|
|
@type="text"
|
|
|
|
@value={{entry.key}}
|
|
|
|
class="input"
|
|
|
|
{{autofocus ignore=(eq iter 0)}}
|
|
|
|
{{on "input" (fn this.validateKey entry)}}
|
2022-06-10 14:05:34 +00:00
|
|
|
/>
|
2022-06-17 19:05:08 +00:00
|
|
|
</label>
|
|
|
|
<SecureVariableForm::InputGroup @entry={{entry}} />
|
|
|
|
{{#if (eq entry this.keyValues.lastObject)}}
|
|
|
|
<button
|
|
|
|
class="add-more button is-info is-inverted"
|
|
|
|
type="button"
|
|
|
|
disabled={{not (and entry.key entry.value)}}
|
|
|
|
{{on "click" this.appendRow}}
|
|
|
|
>
|
|
|
|
Add More
|
|
|
|
</button>
|
|
|
|
{{else}}
|
|
|
|
<button
|
|
|
|
class="delete-row button is-danger is-inverted"
|
|
|
|
type="button"
|
|
|
|
{{on "click" (action this.deleteRow entry)}}
|
|
|
|
>
|
|
|
|
Delete
|
|
|
|
</button>
|
|
|
|
{{/if}}
|
|
|
|
{{#each-in entry.warnings as |k v|}}
|
|
|
|
<span class="key-value-error help is-danger">
|
|
|
|
{{v}}
|
|
|
|
</span>
|
|
|
|
{{/each-in}}
|
|
|
|
</div>
|
2022-06-10 14:05:34 +00:00
|
|
|
{{/each}}
|
|
|
|
<footer>
|
|
|
|
<button
|
|
|
|
disabled={{this.shouldDisableSave}}
|
2022-06-17 19:05:08 +00:00
|
|
|
class="button is-primary"
|
|
|
|
type="submit"
|
|
|
|
>
|
|
|
|
Save
|
|
|
|
{{pluralize "Variable" @this.keyValues.length}}
|
|
|
|
</button>
|
2022-06-10 14:05:34 +00:00
|
|
|
</footer>
|
2022-06-17 19:05:08 +00:00
|
|
|
</form>
|