Files
nomad/ui/app/components/secure-variable-form.hbs
Phil Renaud ca5969efdd Secure Variables UI: /variables/new and /variables/*path (#13069)
* variables.new initialized

* Hacky but savey

* Variable wildcard route and multiple creatable at a time

* multiple KVs per variable

* PR Prep cleanup and lintfix

* Delog

* Data mocking in mirage for variables

* Linting fixes

* Re-implement absent params

* Adapter and model tests

* Moves the path-as-id logic to a serializer instead of adapter

* Classic to serializer and lint cleanup

* Pluralized save button (#13140)

* Autofocus modifier and better Add More button UX (#13145)

* Secure Variables: show/hide functionality when adding new values (#13137)

* Flight Icons added and show hide functionality

* PR cleanup

* Linting cleanup

* Position of icon moved to the right of input

* PR feedback addressed

* Delete button and stylistic changes to show hide

* Hmm, eslint doesnt like jsdoc-usage as only reason for import

* More closely match the button styles and delete test

* Simplified new.js model

* Secure Variables: /variables/*path/edit route and functionality (#13170)

* Variable edit page init

* Significant change to where we house model methods

* Lintfix

* Edit a variable tests

* Remove redundant tests

* Asserts expected

* Mirage factory updated to reflect model state
2022-07-11 13:34:04 -04:00

72 lines
1.9 KiB
Handlebars

<form
class="new-secure-variables"
{{on "submit" this.save}}
autocomplete="off"
>
{{!-- TODO: {{if this.parseError 'is-danger'}} on inputs --}}
<div>
<label>
<span>Path</span>
<Input
@type="text"
@value={{@model.path}}
placeholder="/path/to/variable"
class="input"
{{autofocus}}
/>
</label>
</div>
{{#each @model.keyValues as |entry iter|}}
<div class="key-value">
<label>
<span>Key</span>
<Input
@type="text"
@value={{entry.key}}
class="input"
{{autofocus ignore=(eq iter 0)}}
/>
</label>
<label class="value-label">
<span>Value
</span>
<Input
@type={{this.valueFieldType}}
@value={{entry.value}}
class="input value-input"
autocomplete="new-password" {{!-- prevent auto-fill --}}
/>
<button
class="show-hide-values button is-light"
type="button"
tabindex="-1"
{{on "click" this.toggleShowHide}}
>
<FlightIcon
@name={{if this.shouldHideValues "eye-off" "eye"}}
@title={{if this.shouldHideValues "Show Values" "Hide Values"}}
/>
</button>
</label>
{{#if (eq entry @model.keyValues.lastObject)}}
<button
{{on "click" this.appendRow}}
class="add-more button is-info is-inverted" type="button">Add More</button>
{{else}}
<button
{{on "click" (action this.deleteRow entry)}}
class="delete-row button is-danger is-inverted" type="button">Delete</button>
{{/if}}
</div>
{{/each}}
<footer>
<button
disabled={{this.shouldDisableSave}}
class="button is-primary" type="submit">Save {{pluralize 'Variable' @model.keyValues.length}}</button>
</footer>
</form>