open-vault/ui/app/templates/partials/role-ssh/form.hbs
Matthew Irish 757afb4de9
UI - no jquery (#6768)
* add no-jquery rule and move event listeners to ember-concurrency tasks

* remove unnecessary onchange and handleKeyDown actions

* add element.closest polyfill and convert linked-block to use native dom apis

* update pretender, fetch, page-object, add optional-features, remove ember/jquery

* turn off jquery inclusion

* remove jQuery.isPlainObject usage

* violatedDirective isn't always formatted the same

* use fetch and the ember-fetch adapter mixin

* move to fetch and lowercase headers for pretender

* display non-ember-data errors

* use new async fn test style and lowercase headers in auth service test

* setContext is not necessary with the new style tests and ember-cli-page-object - it actually triggers jquery usage

* update ember-fetch, ember-cli-pretender

* wait for permissions check

* lowercase header name in auth test

* refactor transit tests to one test per key type

* simplify pollCluster helper

* stop flakey tests by prefering the native fetch

* avoid uncaught TransitionAborted error by navigating directly to unseal

* unset model on controller after unloading it because controllers are singletons

* update yarn.lock
2019-06-20 08:37:27 -05:00

53 lines
1.6 KiB
Handlebars

<form onsubmit={{action "createOrUpdate" "create"}}>
<div class="box is-sideless is-fullwidth is-marginless">
{{message-error model=model}}
<NamespaceReminder @mode={{mode}} @noun="SSH role" />
{{#if model.attrsForKeyType}}
{{#with (if (eq model.keyType 'otp') 3 4) as |numRequired|}}
{{#each (take numRequired model.attrsForKeyType) as |attr|}}
{{#unless (and (eq mode 'edit') (eq attr.name 'name'))}}
{{partial "partials/form-field-from-model"}}
{{/unless}}
{{/each}}
{{toggle-button
toggleAttr="showOptions"
toggleTarget=this
openLabel="Hide options"
closedLabel="More options"
data-test-toggle-more="true"
}}
{{#if showOptions}}
<div class="box is-marginless">
{{#each (drop numRequired model.attrsForKeyType) as |attr|}}
{{partial "partials/form-field-from-model"}}
{{/each}}
</div>
{{/if}}
{{/with}}
{{/if}}
</div>
<div class="field is-grouped-split box is-fullwidth is-bottomless">
<div class="control">
<button
type="submit"
disabled={{buttonDisabled}}
class="button is-primary"
data-test-role-ssh-create=true
>
{{#if (eq mode 'create')}}
Create role
{{else if (eq mode 'edit')}}
Save
{{/if}}
</button>
{{#secret-link
mode=(if (eq mode "create") "list" "show")
class="button"
secret=model.id
}}
Cancel
{{/secret-link}}
</div>
</div>
</form>