2020-09-17 19:08:06 +00:00
|
|
|
<PageHeader as |p|>
|
|
|
|
<p.top>
|
2021-04-26 16:23:57 +00:00
|
|
|
<KeyValueHeader
|
2021-12-17 03:44:29 +00:00
|
|
|
@baseKey={{hash display=this.model.id id=this.model.idForNav}}
|
2021-04-26 16:23:57 +00:00
|
|
|
@path="vault.cluster.secrets.backend.list"
|
2021-12-17 03:44:29 +00:00
|
|
|
@mode={{this.mode}}
|
|
|
|
@root={{this.root}}
|
2021-04-26 16:23:57 +00:00
|
|
|
@showCurrent={{true}}
|
|
|
|
/>
|
2020-09-17 19:08:06 +00:00
|
|
|
</p.top>
|
|
|
|
<p.levelLeft>
|
|
|
|
<h1 class="title is-3" data-test-secret-header="true">
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if (eq this.mode "create")}}
|
2020-09-17 19:08:06 +00:00
|
|
|
Create Template
|
2021-12-17 03:44:29 +00:00
|
|
|
{{else if (eq this.mode "edit")}}
|
2020-09-17 19:08:06 +00:00
|
|
|
Edit Template
|
|
|
|
{{else}}
|
2021-12-17 03:44:29 +00:00
|
|
|
Template
|
|
|
|
<code>{{this.model.id}}</code>
|
2020-09-17 19:08:06 +00:00
|
|
|
{{/if}}
|
|
|
|
</h1>
|
|
|
|
</p.levelLeft>
|
|
|
|
</PageHeader>
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if (eq this.mode "show")}}
|
2020-09-17 19:08:06 +00:00
|
|
|
<Toolbar>
|
|
|
|
<ToolbarActions>
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if this.capabilities.canDelete}}
|
|
|
|
<button type="button" class="toolbar-link" onclick={{action "delete"}} data-test-transformation-template-delete>
|
2020-09-17 19:08:06 +00:00
|
|
|
Delete template
|
|
|
|
</button>
|
2021-12-17 03:44:29 +00:00
|
|
|
<div class="toolbar-separator"></div>
|
2020-09-17 19:08:06 +00:00
|
|
|
{{/if}}
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if this.capabilities.canUpdate}}
|
2020-09-17 19:08:06 +00:00
|
|
|
<ToolbarSecretLink
|
2021-12-17 03:44:29 +00:00
|
|
|
@secret={{concat this.model.idPrefix this.model.id}}
|
2020-09-17 19:08:06 +00:00
|
|
|
@mode="edit"
|
2021-12-17 03:44:29 +00:00
|
|
|
@data-test-edit-link={{true}}
|
|
|
|
@replace={{true}}
|
2020-09-17 19:08:06 +00:00
|
|
|
>
|
|
|
|
Edit template
|
|
|
|
</ToolbarSecretLink>
|
|
|
|
{{/if}}
|
|
|
|
</ToolbarActions>
|
|
|
|
</Toolbar>
|
|
|
|
{{/if}}
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if (or (eq this.mode "edit") (eq this.mode "create"))}}
|
|
|
|
<form onsubmit={{action "createOrUpdate" this.mode}}>
|
|
|
|
<div class="box is-sideless is-fullwidth is-marginless">
|
|
|
|
<MessageError @model={{this.model}} />
|
|
|
|
<NamespaceReminder @mode={{this.mode}} @noun="transform template" />
|
|
|
|
{{#each this.model.attrs as |attr|}}
|
|
|
|
{{#if (and (eq attr.name "name") (eq this.mode "edit"))}}
|
|
|
|
<label for={{attr.name}} class="is-label">
|
|
|
|
{{attr.options.label}}
|
|
|
|
</label>
|
|
|
|
{{#if attr.options.subText}}
|
|
|
|
<p class="sub-text">{{attr.options.subText}}</p>
|
|
|
|
{{/if}}
|
|
|
|
<input
|
|
|
|
data-test-input={{attr.name}}
|
|
|
|
id={{attr.name}}
|
|
|
|
autocomplete="off"
|
|
|
|
spellcheck="false"
|
|
|
|
value={{or (get this.model attr.name) attr.options.defaultValue}}
|
|
|
|
readonly={{true}}
|
|
|
|
class="field input is-readOnly"
|
|
|
|
type={{attr.type}}
|
|
|
|
/>
|
|
|
|
{{else}}
|
|
|
|
<FormField data-test-field @attr={{attr}} @model={{this.model}} />
|
2020-09-17 19:08:06 +00:00
|
|
|
{{/if}}
|
2021-12-17 03:44:29 +00:00
|
|
|
{{/each}}
|
2020-09-17 19:08:06 +00:00
|
|
|
</div>
|
2021-12-17 03:44:29 +00:00
|
|
|
<div class="field is-grouped-split box is-fullwidth is-bottomless">
|
|
|
|
<div class="control">
|
|
|
|
<button
|
|
|
|
type="submit"
|
|
|
|
disabled={{this.buttonDisabled}}
|
|
|
|
class="button is-primary"
|
|
|
|
data-test-template-transform-create={{true}}
|
|
|
|
>
|
|
|
|
{{#if (eq this.mode "create")}}
|
|
|
|
Create template
|
|
|
|
{{else if (eq this.mode "edit")}}
|
|
|
|
Save
|
|
|
|
{{/if}}
|
|
|
|
</button>
|
|
|
|
<SecretLink
|
|
|
|
@mode={{if (eq this.mode "create") "list" "show"}}
|
|
|
|
@class="button"
|
|
|
|
@secret={{concat this.model.idPrefix this.model.id}}
|
|
|
|
>
|
|
|
|
Cancel
|
|
|
|
</SecretLink>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2020-09-17 19:08:06 +00:00
|
|
|
{{else}}
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if this.model.displayErrors}}
|
2020-09-21 20:36:07 +00:00
|
|
|
<div class="has-top-margin-s">
|
2021-12-17 03:44:29 +00:00
|
|
|
<MessageError @model={{this.model}} />
|
2020-09-21 20:36:07 +00:00
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#each this.model.attrs as |attr|}}
|
2020-09-21 20:36:07 +00:00
|
|
|
{{#if (eq attr.type "object")}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<InfoTableRow
|
|
|
|
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
|
|
|
@value={{stringify (get this.model attr.name)}}
|
|
|
|
/>
|
2020-09-21 20:36:07 +00:00
|
|
|
{{else if (eq attr.type "array")}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<InfoTableRow
|
|
|
|
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
|
|
|
@value={{get this.model attr.name}}
|
|
|
|
@type={{attr.type}}
|
|
|
|
@viewAll={{attr.name}}
|
|
|
|
/>
|
2020-09-21 20:36:07 +00:00
|
|
|
{{else}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<InfoTableRow
|
|
|
|
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
|
|
|
@value={{get this.model attr.name}}
|
|
|
|
/>
|
2020-09-21 20:36:07 +00:00
|
|
|
{{/if}}
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
2021-12-17 03:44:29 +00:00
|
|
|
{{/if}}
|