open-vault/ui/lib/kmip/addon/templates/components/edit-form-kmip-role.hbs
Matthew Irish 68f3b90978
UI - kmip role edit form (#6973)
* extend edit form with a custom kmip role form

* adjust model fields and use new kmip role edit form

* customize serialize adapter hook for kmip/role

* refresh list routes in the list mixin

* style up kmip role edit form

* return a promise from preSave so that the queue helper waits to call save

* add serialize tests for the kmip/role adapter

* rename component to edit-form-kmip-role

* add tests for edit-form-kmip-role

* add some clarifying comments

* make input more realistic in tests

* remove delete toolbar
2019-06-25 15:57:50 -05:00

64 lines
2 KiB
Handlebars

<form {{action (queue (action "preSave" model) (perform save model)) on="submit"}}>
<MessageError @model={{model}} data-test-edit-form-error />
<div class="box is-sideless is-fullwidth is-marginless">
<NamespaceReminder @mode="save" />
{{#if (eq @mode "create")}}
<FormField
data-test-field
@attr={{hash name="name" type="string"}}
@model={{model}}
/>
{{/if}}
<h3 class="title is-5">
Allowed Operations
</h3>
{{#each (array
(hash label="Allow all" value="operationAll")
(hash label="Allow none" value="operationNone")
(hash label="Let me choose" value="choose")
) as |displayType|}}
<RadioButton
@value={{displayType.value}}
@groupValue={{this.display}}
@changed={{queue
(action (mut this.display))
(action "updateModel")
}}
@name="role-display"
@radioId={{displayType.value}}
@classNames="vlt-radio is-block"
>
<label for={{displayType.value}} />
{{displayType.label}}
</RadioButton>
{{/each}}
{{#if (eq this.display "choose")}}
<div class="box is-sideless is-shadowless is-marginless">
{{#each this.model.fields as |attr|}}
<FormField
data-test-field
@attr={{attr}}
@model={{model}}
/>
{{/each}}
</div>
{{/if}}
</div>
<div class="field is-grouped is-grouped-split is-fullwidth box is-bottomless">
<div class="field is-grouped">
<div class="control">
<button type="submit" data-test-edit-form-submit class="button is-primary {{if save.isRunning 'loading'}}" disabled={{save.isRunning}}>
{{saveButtonText}}
</button>
</div>
{{#if cancelLinkParams}}
<div class="control">
{{#link-to params=cancelLinkParams class="button"}}
Cancel
{{/link-to}}
</div>
{{/if}}
</div>
</div>
</form>