open-vault/ui/app/templates/components/mount-backend-form.hbs

66 lines
2.4 KiB
Handlebars

<PageHeader as |p|>
<p.levelLeft>
<h1 class="title is-3 title-with-icon" data-test-mount-form-header="true">
{{#if this.showEnable}}
{{#let (find-by "type" @mountModel.type @mountTypes) as |typeInfo|}}
<Icon @name={{or typeInfo.glyph typeInfo.type}} @size="24" class="has-text-grey-light" />
{{#if (eq @mountType "secret")}}
{{concat "Enable " typeInfo.displayName " Secrets Engine"}}
{{else}}
{{concat "Enable " typeInfo.displayName " Authentication Method"}}
{{/if}}
{{/let}}
{{else if (eq @mountType "secret")}}
Enable a Secrets Engine
{{else}}
Enable an Authentication Method
{{/if}}
</h1>
</p.levelLeft>
</PageHeader>
<div class="box is-sideless is-fullwidth is-marginless">
<NamespaceReminder @mode="enable" @noun={{if (eq @mountType "secret") "Secret Engine" "Auth Method"}} />
<MessageError @errorMessage={{this.errorMessage}} />
{{#if @mountModel.type}}
<form {{on "submit" (perform this.mountBackend)}}>
<FormFieldGroups
@model={{@mountModel}}
@renderGroup="default"
@modelValidations={{this.modelValidations}}
@onKeyUp={{this.onKeyUp}}
/>
<FormFieldGroups @model={{@mountModel}} @renderGroup="Method Options" />
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<button
type="submit"
data-test-mount-submit="true"
class="button is-primary {{if this.mountBackend.isRunning 'loading'}}"
disabled={{this.mountBackend.isRunning}}
>
{{#if (eq @mountType "secret")}}
Enable Engine
{{else}}
Enable Method
{{/if}}
</button>
</div>
<div class="control">
<button data-test-mount-back type="button" class="button" {{on "click" (fn this.setMountType "")}}>
Back
</button>
</div>
{{#if this.invalidFormAlert}}
<div class="control">
<AlertInline @type="danger" @paddingTop={{true}} @message={{this.invalidFormAlert}} @mimicRefresh={{true}} />
</div>
{{/if}}
</div>
</form>
{{else}}
{{! Type not yet set, show type options }}
<MountBackend::TypeForm @setMountType={{this.setMountType}} @mountType={{@mountType}} />
{{/if}}
</div>