2018-06-12 21:06:37 +00:00
|
|
|
<PageHeader as |p|>
|
|
|
|
<p.top>
|
|
|
|
{{key-value-header
|
|
|
|
baseKey=baseKey
|
|
|
|
path="vault.cluster.secrets.backend.list"
|
|
|
|
mode=mode
|
|
|
|
root=root
|
|
|
|
showCurrent=true
|
|
|
|
}}
|
|
|
|
</p.top>
|
|
|
|
<p.levelLeft>
|
2018-04-03 14:16:57 +00:00
|
|
|
<h1 class="title is-3">
|
|
|
|
{{#if (eq mode "create") }}
|
|
|
|
Create Secret
|
2018-10-11 03:42:18 +00:00
|
|
|
{{else if (and isV2 (eq mode 'edit'))}}
|
|
|
|
Create New Version
|
2018-04-03 14:16:57 +00:00
|
|
|
{{else if (eq mode 'edit')}}
|
|
|
|
Edit Secret
|
|
|
|
{{else}}
|
|
|
|
{{key.id}}
|
|
|
|
{{/if}}
|
|
|
|
</h1>
|
2018-06-12 21:06:37 +00:00
|
|
|
</p.levelLeft>
|
2018-10-09 04:22:29 +00:00
|
|
|
<p.levelRight>
|
|
|
|
{{#if canDelete}}
|
2018-10-10 04:44:08 +00:00
|
|
|
<ConfirmAction
|
|
|
|
@buttonClasses="button is-compact is-ghost has-icon-right"
|
|
|
|
@onConfirmAction={{action "deleteKey"}}
|
|
|
|
@confirmMessage={{if isV2
|
|
|
|
(concat "Are you sure you want to delete " model.id " AND ALL ITS VERSIONS?")
|
|
|
|
(concat "Are you sure you want to delete " model.id "?")
|
|
|
|
}}
|
|
|
|
@cancelButtonText="Cancel"
|
2018-10-09 04:22:29 +00:00
|
|
|
data-test-secret-delete="true"
|
2018-10-10 04:44:08 +00:00
|
|
|
>
|
2018-10-09 04:22:29 +00:00
|
|
|
Delete secret <ICon @glyph="chevron-right" @size="11" />
|
2018-10-10 04:44:08 +00:00
|
|
|
</ConfirmAction>
|
2018-10-09 04:22:29 +00:00
|
|
|
{{/if}}
|
|
|
|
</p.levelRight>
|
2018-06-12 21:06:37 +00:00
|
|
|
</PageHeader>
|
2018-10-10 04:44:08 +00:00
|
|
|
<div class="secret-control-bar">
|
|
|
|
<div class="control">
|
|
|
|
<input
|
|
|
|
data-test-secret-json-toggle=true
|
|
|
|
id="json"
|
|
|
|
type="checkbox"
|
|
|
|
name="json"
|
|
|
|
class="switch is-rounded is-success is-small"
|
|
|
|
checked={{showAdvancedMode}}
|
|
|
|
onchange={{action "toggleAdvanced" value="target.checked"}}
|
|
|
|
disabled={{and (eq mode 'show') secretDataIsAdvanced}}
|
|
|
|
/>
|
|
|
|
<label for="json" class="has-text-grey">JSON</label>
|
|
|
|
</div>
|
|
|
|
{{#if (and (eq mode 'show') canEdit)}}
|
|
|
|
<div class="control">
|
|
|
|
<LinkTo
|
2018-10-11 17:17:47 +00:00
|
|
|
@params={{array (concat 'vault.cluster.secrets.backend.' (if (eq mode 'show') 'edit' 'show')) model.id (if isV2 (query-params version=this.modelForData.version))}}
|
2018-10-10 04:44:08 +00:00
|
|
|
@replace={{true}}
|
|
|
|
class="link link-plain has-text-weight-semibold"
|
|
|
|
>
|
2018-10-11 17:17:47 +00:00
|
|
|
{{#if isV2}}
|
|
|
|
Create new version
|
|
|
|
{{else}}
|
|
|
|
Edit Secret
|
|
|
|
{{/if}}
|
2018-10-10 04:44:08 +00:00
|
|
|
</LinkTo>
|
2018-04-03 14:16:57 +00:00
|
|
|
</div>
|
2018-10-10 04:44:08 +00:00
|
|
|
{{/if}}
|
|
|
|
{{#if (and (eq @mode "show") this.isV2)}}
|
|
|
|
<div class="control">
|
|
|
|
<BasicDropdown
|
|
|
|
@class="popup-menu"
|
|
|
|
@horizontalPosition="auto-right"
|
|
|
|
@verticalPosition="below"
|
|
|
|
as |D|
|
|
|
|
>
|
|
|
|
<D.trigger
|
|
|
|
data-test-popup-menu-trigger="true"
|
|
|
|
@class={{concat "popup-menu-trigger button is-ghost has-text-grey" (if D.isOpen " is-active")}}
|
|
|
|
@tagName="button"
|
|
|
|
>
|
|
|
|
Version {{this.modelForData.version}}
|
|
|
|
<ICon @glyph="chevron-right" @size="11" />
|
|
|
|
</D.trigger>
|
|
|
|
<D.content @class="popup-menu-content ">
|
|
|
|
<nav class="box menu">
|
|
|
|
<ul class="menu-list">
|
|
|
|
{{#if this.modelForData.destroyed}}
|
|
|
|
<li class="action has-text-grey">
|
|
|
|
<button type="button" class="link" disabled >
|
|
|
|
The data for {{this.model.id}} version {{this.modelForData.version}} has been destroyed.
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
{{else}}
|
|
|
|
<li class="action">
|
|
|
|
{{#if this.modelForData.deleted}}
|
|
|
|
<button type="button" class="link" {{action "deleteVersion" "undelete"}}>
|
2018-10-11 03:06:20 +00:00
|
|
|
Undelete version
|
2018-10-10 04:44:08 +00:00
|
|
|
</button>
|
|
|
|
{{else}}
|
|
|
|
<ConfirmAction
|
|
|
|
@buttonClasses="link has-text-danger"
|
|
|
|
@containerClasses="message-body is-block"
|
|
|
|
@messageClasses="is-block"
|
|
|
|
@onConfirmAction={{action "deleteVersion" "delete"}}
|
|
|
|
@confirmMessage={{
|
|
|
|
concat "Are you sure you want to delete " model.id " version " this.modelForData.version "?"
|
|
|
|
}}
|
|
|
|
@cancelButtonText="Cancel"
|
|
|
|
data-test-secret-v2-delete="true"
|
|
|
|
>
|
2018-10-11 03:06:20 +00:00
|
|
|
Delete version
|
2018-10-10 04:44:08 +00:00
|
|
|
</ConfirmAction>
|
|
|
|
{{/if}}
|
|
|
|
</li>
|
|
|
|
{{!-- TODO - check if canDestroy --}}
|
|
|
|
{{#if true}}
|
|
|
|
<li class="action">
|
|
|
|
<ConfirmAction
|
|
|
|
@buttonClasses="link has-text-danger"
|
|
|
|
@containerClasses="message-body is-block"
|
|
|
|
@messageClasses="is-block"
|
|
|
|
@onConfirmAction={{action "deleteVersion" "destroy"}}
|
|
|
|
@confirmMessage={{
|
|
|
|
concat "This will permanently destroy " model.id " version " this.modelForData.version ". Are you sure you want to do this?"
|
|
|
|
}}
|
|
|
|
@cancelButtonText="Cancel"
|
|
|
|
data-test-secret-v2-destroy="true"
|
|
|
|
>
|
2018-10-11 03:06:20 +00:00
|
|
|
Permanently destroy version
|
2018-10-10 04:44:08 +00:00
|
|
|
</ConfirmAction>
|
|
|
|
</li>
|
|
|
|
{{/if}}
|
|
|
|
{{/if}}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</D.content>
|
|
|
|
</BasicDropdown>
|
2018-04-03 14:16:57 +00:00
|
|
|
</div>
|
2018-10-10 04:44:08 +00:00
|
|
|
<div class="control">
|
|
|
|
<BasicDropdown
|
|
|
|
@class="popup-menu"
|
|
|
|
@horizontalPosition="auto-right"
|
|
|
|
@verticalPosition="below"
|
|
|
|
as |D|
|
|
|
|
>
|
|
|
|
<D.trigger
|
|
|
|
data-test-popup-menu-trigger="true"
|
|
|
|
@class={{concat "popup-menu-trigger button is-ghost has-text-grey" (if D.isOpen " is-active")}}
|
|
|
|
@tagName="button"
|
|
|
|
>
|
|
|
|
History <ICon @glyph="chevron-right" @size="11" />
|
|
|
|
</D.trigger>
|
|
|
|
<D.content @class="popup-menu-content ">
|
|
|
|
<nav class="box menu">
|
|
|
|
<h5 class="list-header">Versions</h5>
|
|
|
|
<ul class="menu-list">
|
|
|
|
{{#each (reverse this.model.versions) as |secretVersion|}}
|
|
|
|
<li class="action">
|
2018-10-11 03:06:20 +00:00
|
|
|
<LinkTo class="link" @params={{array (query-params version=secretVersion.version)}}>
|
2018-10-10 04:44:08 +00:00
|
|
|
Version {{secretVersion.version}}
|
2018-10-11 03:06:20 +00:00
|
|
|
{{#if (eq secretVersion.version this.model.currentVersion)}}
|
2018-10-10 04:44:08 +00:00
|
|
|
<ICon @glyph="checkmark-circled-outline" @excludeIconClass={{true}} @size="13" @class="has-text-success is-pulled-right" />
|
|
|
|
{{else if secretVersion.deleted}}
|
|
|
|
<ICon @glyph="cancel-square-outline" @size="13" @excludeIconClass={{true}} @class="has-text-grey is-pulled-right" />
|
|
|
|
{{/if}}
|
2018-10-11 03:06:20 +00:00
|
|
|
</LinkTo>
|
2018-10-10 04:44:08 +00:00
|
|
|
</li>
|
|
|
|
{{/each}}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</D.content>
|
|
|
|
</BasicDropdown>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
2018-04-03 14:16:57 +00:00
|
|
|
</div>
|
|
|
|
{{partial partialName}}
|