2022-04-20 18:40:27 +00:00
|
|
|
<PageHeader as |p|>
|
|
|
|
<p.top>
|
|
|
|
<KeyValueHeader @path="vault.cluster.secrets.backend.show" @mode={{this.mode}} @root={{@root}} @showCurrent={{true}} />
|
|
|
|
</p.top>
|
|
|
|
<p.levelLeft>
|
|
|
|
<h1 class="title is-3" data-test-secret-header="true">
|
2022-04-26 14:23:31 +00:00
|
|
|
{{#if this.isDistributing}}
|
|
|
|
Distribute key
|
|
|
|
{{else if (eq @mode "create")}}
|
2022-04-20 18:40:27 +00:00
|
|
|
Create key
|
|
|
|
{{else if (eq @mode "edit")}}
|
|
|
|
Edit key
|
|
|
|
{{else}}
|
|
|
|
{{@model.id}}
|
|
|
|
{{/if}}
|
|
|
|
</h1>
|
|
|
|
</p.levelLeft>
|
|
|
|
</PageHeader>
|
|
|
|
|
2022-04-26 14:23:31 +00:00
|
|
|
{{#if this.isDistributing}}
|
2022-04-26 19:17:42 +00:00
|
|
|
<Keymgmt::Distribute @backend={{@model.backend}} @key={{@model.id}} @onClose={{fn (mut this.isDistributing) false}} />
|
2022-04-26 14:23:31 +00:00
|
|
|
{{else}}
|
|
|
|
{{#if (eq this.mode "show")}}
|
|
|
|
<div class="tabs-container box is-sideless is-fullwidth is-paddingless is-marginless" data-test-keymgmt-key-toolbar>
|
|
|
|
<nav class="tabs">
|
|
|
|
<ul>
|
2022-05-20 15:41:24 +00:00
|
|
|
<li class={{if (not-eq @tab "versions") "active"}}>
|
2022-04-26 14:23:31 +00:00
|
|
|
<LinkTo
|
|
|
|
@route="vault.cluster.secrets.backend.show"
|
|
|
|
@model={{@model.id}}
|
|
|
|
@query={{hash tab=""}}
|
|
|
|
data-test-tab="Details"
|
|
|
|
>
|
|
|
|
Details
|
|
|
|
</LinkTo>
|
|
|
|
</li>
|
2022-05-20 15:41:24 +00:00
|
|
|
<li class={{if (eq @tab "versions") "active"}}>
|
2022-04-26 14:23:31 +00:00
|
|
|
<LinkTo
|
|
|
|
@route="vault.cluster.secrets.backend.show"
|
|
|
|
@model={{@model.id}}
|
|
|
|
@query={{hash tab="versions"}}
|
|
|
|
data-test-tab="Versions"
|
|
|
|
>
|
|
|
|
Versions
|
|
|
|
</LinkTo>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
<Toolbar>
|
|
|
|
<ToolbarActions>
|
2022-05-20 15:41:24 +00:00
|
|
|
{{#unless @model.distribution}}
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="toolbar-link"
|
|
|
|
{{on "click" (fn (mut this.isDistributing) true)}}
|
|
|
|
data-test-keymgmt-key-distribute
|
|
|
|
>
|
|
|
|
Distribute key
|
|
|
|
</button>
|
|
|
|
{{/unless}}
|
2022-04-26 14:23:31 +00:00
|
|
|
{{#if @model.canDelete}}
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="toolbar-link"
|
|
|
|
disabled={{not @model.deletionAllowed}}
|
|
|
|
{{on "click" (fn (mut this.isDeleteModalOpen) true)}}
|
|
|
|
data-test-keymgmt-key-destroy
|
2022-04-20 18:40:27 +00:00
|
|
|
>
|
2022-04-26 14:23:31 +00:00
|
|
|
Destroy key
|
|
|
|
</button>
|
|
|
|
{{/if}}
|
|
|
|
{{#if @model.provider}}
|
|
|
|
<ConfirmAction
|
|
|
|
@buttonClasses="toolbar-link"
|
2022-05-20 15:41:24 +00:00
|
|
|
@onConfirmAction={{perform this.removeKey}}
|
2022-04-26 14:23:31 +00:00
|
|
|
@confirmTitle="Remove this key?"
|
|
|
|
@confirmMessage="This will remove all versions of the key from the KMS provider. The key will stay in Vault."
|
|
|
|
@confirmButtonText="Remove"
|
2022-05-20 15:41:24 +00:00
|
|
|
@isRunning={{this.removeKey.isRunning}}
|
2022-04-26 14:23:31 +00:00
|
|
|
data-test-keymgmt-key-remove
|
2022-04-20 18:40:27 +00:00
|
|
|
>
|
2022-04-26 14:23:31 +00:00
|
|
|
Remove key
|
|
|
|
</ConfirmAction>
|
|
|
|
{{/if}}
|
|
|
|
{{#if (or @model.canDelete @model.provider)}}
|
|
|
|
<div class="toolbar-separator"></div>
|
|
|
|
{{/if}}
|
|
|
|
<ConfirmAction
|
|
|
|
@buttonClasses="toolbar-link"
|
2022-05-20 15:41:24 +00:00
|
|
|
@onConfirmAction={{perform this.rotateKey}}
|
2022-04-26 14:23:31 +00:00
|
|
|
@confirmTitle="Rotate this key?"
|
|
|
|
@confirmMessage="After rotation, all key actions will default to using the newest version of the key."
|
|
|
|
@confirmButtonText="Rotate"
|
2022-05-20 15:41:24 +00:00
|
|
|
@isRunning={{this.rotateKey.isRunning}}
|
2022-04-26 14:23:31 +00:00
|
|
|
data-test-keymgmt-key-rotate
|
|
|
|
>
|
|
|
|
Rotate key
|
|
|
|
</ConfirmAction>
|
|
|
|
{{#if @model.canEdit}}
|
|
|
|
<ToolbarSecretLink
|
|
|
|
@secret={{@model.id}}
|
|
|
|
@mode="edit"
|
|
|
|
@replace={{true}}
|
2022-10-18 15:46:02 +00:00
|
|
|
@queryParams={{hash itemType="key"}}
|
2022-04-26 14:23:31 +00:00
|
|
|
@data-test-edit-link={{true}}
|
|
|
|
>
|
|
|
|
Edit key
|
|
|
|
</ToolbarSecretLink>
|
|
|
|
{{/if}}
|
|
|
|
</ToolbarActions>
|
|
|
|
</Toolbar>
|
|
|
|
{{/if}}
|
2022-04-20 18:40:27 +00:00
|
|
|
|
2022-04-26 14:23:31 +00:00
|
|
|
{{#if this.isMutable}}
|
|
|
|
<form {{on "submit" (perform this.saveKey)}}>
|
|
|
|
<div class="box is-sideless is-fullwidth is-marginless">
|
|
|
|
{{#let (if (eq @mode "create") "createFields" "updateFields") as |fieldsKey|}}
|
|
|
|
{{#each (get @model fieldsKey) as |attr|}}
|
|
|
|
<FormField data-test-field={{true}} @attr={{attr}} @model={{@model}} />
|
|
|
|
{{/each}}
|
|
|
|
<div class="field is-grouped box is-fullwidth is-bottomless">
|
|
|
|
<div class="control">
|
|
|
|
<button
|
|
|
|
type="submit"
|
|
|
|
disabled={{this.saveTask.isRunning}}
|
|
|
|
class="button is-primary {{if this.saveTask.isRunning 'is-loading'}}"
|
|
|
|
data-test-keymgmt-key-submit
|
|
|
|
>
|
|
|
|
{{if this.isCreating "Create key" "Update"}}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="control">
|
|
|
|
<LinkTo
|
|
|
|
@route={{if this.isCreating @root.path "vault.cluster.secrets.backend.show"}}
|
|
|
|
@model={{if this.isCreating @root.model @model.id}}
|
2022-09-07 15:44:27 +00:00
|
|
|
@query={{unless this.isCreating (hash itemType="key") (hash itemType="")}}
|
2022-04-26 14:23:31 +00:00
|
|
|
@disabled={{this.savekey.isRunning}}
|
|
|
|
class="button"
|
|
|
|
data-test-keymgmt-key-cancel
|
|
|
|
>
|
|
|
|
Cancel
|
|
|
|
</LinkTo>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/let}}
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
{{else if (eq @tab "versions")}}
|
|
|
|
{{#each @model.versions as |version|}}
|
|
|
|
<div class="list-item-row" data-test-keymgmt-key-version>
|
|
|
|
<div class="columns is-mobile">
|
|
|
|
<div class="column is-3 has-text-weight-bold">
|
|
|
|
<Icon @name="history" class="has-text-grey-light" />
|
|
|
|
<span>Version {{version.id}}</span>
|
|
|
|
</div>
|
|
|
|
<div class="column is-3 has-text-grey">
|
|
|
|
{{date-from-now version.creation_time addSuffix=true}}
|
|
|
|
</div>
|
|
|
|
<div class="column is-6 is-flex-center">
|
|
|
|
{{#if (eq @model.minEnabledVersion version.id)}}
|
|
|
|
<Icon @name="check-circle-fill" class="has-text-success" />
|
|
|
|
<span data-test-keymgmt-key-current-min>Current mininum enabled version</span>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
2022-04-20 18:40:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/each}}
|
2022-04-26 14:23:31 +00:00
|
|
|
{{else}}
|
|
|
|
<div class="has-top-margin-xl has-bottom-margin-s">
|
2022-05-20 15:41:24 +00:00
|
|
|
<h2 class="title is-5 has-border-bottom-light">Key Details</h2>
|
2022-04-26 14:23:31 +00:00
|
|
|
{{#each @model.showFields as |attr|}}
|
|
|
|
<InfoTableRow
|
|
|
|
@alwaysRender={{true}}
|
|
|
|
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
|
|
|
@value={{get @model attr.name}}
|
|
|
|
@defaultShown={{attr.options.defaultShown}}
|
|
|
|
@formatDate={{if (eq attr.type "date") "MMM d yyyy, h:mm:ss aaa"}}
|
|
|
|
/>
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
|
|
|
<div class="has-top-margin-xl has-bottom-margin-s">
|
2022-05-20 15:41:24 +00:00
|
|
|
<h2 class="title is-5 {{if @model.distribution 'has-border-bottom-light' 'is-borderless'}}">
|
2022-04-26 14:23:31 +00:00
|
|
|
Distribution Details
|
|
|
|
</h2>
|
2022-05-20 15:41:24 +00:00
|
|
|
{{#if @model.provider.permissionsError}}
|
2022-04-20 18:40:27 +00:00
|
|
|
<EmptyState
|
|
|
|
@title="You are not authorized"
|
|
|
|
@subTitle="Error 403"
|
2022-04-26 14:23:31 +00:00
|
|
|
@message={{concat
|
|
|
|
"You must be granted permissions to see whether this key is distributed. Ask your administrator if you think you should have access to LIST /"
|
|
|
|
@model.backend
|
|
|
|
"/key/"
|
|
|
|
@model.name
|
|
|
|
"/kms."
|
|
|
|
}}
|
2022-04-20 18:40:27 +00:00
|
|
|
@icon="minus-circle"
|
|
|
|
/>
|
2022-05-20 15:41:24 +00:00
|
|
|
{{else if (is-empty-value @model.provider)}}
|
|
|
|
<EmptyState
|
|
|
|
@title="Key not distributed"
|
|
|
|
@message="When this key is distributed to a destination, those details will appear here."
|
|
|
|
data-test-keymgmt-dist-empty-state
|
|
|
|
>
|
|
|
|
{{#if @model.canListProviders}}
|
|
|
|
<button type="button" class="link" {{on "click" (fn (mut this.isDistributing) true)}}>
|
|
|
|
Distribute key
|
|
|
|
<Icon @name="chevron-right" />
|
|
|
|
</button>
|
|
|
|
{{/if}}
|
|
|
|
</EmptyState>
|
2022-04-26 14:23:31 +00:00
|
|
|
{{else}}
|
|
|
|
<InfoTableRow @label="Distributed" @value={{@model.provider}}>
|
2022-05-20 15:41:24 +00:00
|
|
|
<LinkTo @route="vault.cluster.secrets.backend.show" @model={{@model.provider}} @query={{hash itemType="provider"}}>
|
2022-04-26 14:23:31 +00:00
|
|
|
<Icon @name="check-circle-fill" class="has-text-success" />{{@model.provider}}
|
|
|
|
</LinkTo>
|
|
|
|
</InfoTableRow>
|
|
|
|
{{#if @model.distribution}}
|
|
|
|
{{#each @model.distFields as |attr|}}
|
|
|
|
<InfoTableRow
|
|
|
|
@alwaysRender={{true}}
|
|
|
|
@label={{capitalize (or attr.label (humanize (dasherize attr.name)))}}
|
|
|
|
@value={{if
|
|
|
|
(eq attr.name "protection")
|
|
|
|
(uppercase (get @model.distribution attr.name))
|
|
|
|
(get @model.distribution attr.name)
|
|
|
|
}}
|
|
|
|
@defaultShown={{attr.defaultShown}}
|
|
|
|
@helperText={{attr.subText}}
|
|
|
|
@formatDate={{if (eq attr.type "date") "MMM d yyyy, h:mm:ss aaa"}}
|
|
|
|
/>
|
|
|
|
{{/each}}
|
|
|
|
{{else}}
|
|
|
|
<EmptyState
|
|
|
|
@title="You are not authorized"
|
|
|
|
@subTitle="Error 403"
|
2022-05-20 15:41:24 +00:00
|
|
|
@message={{concat
|
|
|
|
"You must be granted permissions to view distribution details for this key. Ask your administrator if you think you should have access to GET /"
|
|
|
|
@model.backend
|
|
|
|
"/key/"
|
|
|
|
@model.name
|
|
|
|
"/kms."
|
|
|
|
}}
|
2022-04-26 14:23:31 +00:00
|
|
|
@icon="minus-circle"
|
|
|
|
/>
|
|
|
|
{{/if}}
|
2022-04-20 18:40:27 +00:00
|
|
|
{{/if}}
|
2022-04-26 14:23:31 +00:00
|
|
|
</div>
|
|
|
|
{{/if}}
|
2022-04-20 18:40:27 +00:00
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
<ConfirmationModal
|
|
|
|
@title="Destroy key?"
|
|
|
|
@onClose={{fn (mut this.isDeleteModalOpen) false}}
|
|
|
|
@isActive={{this.isDeleteModalOpen}}
|
|
|
|
@confirmText={{@model.name}}
|
|
|
|
@toConfirmMsg="deleting the key"
|
|
|
|
@onConfirm={{fn this.deleteKey @model.id}}
|
|
|
|
>
|
|
|
|
<p>
|
|
|
|
Destroying the
|
|
|
|
<strong>{{@model.name}}</strong>
|
|
|
|
key means that the underlying data will be lost and the key will become unusable for cryptographic operations. It is
|
|
|
|
unrecoverable.
|
|
|
|
</p>
|
|
|
|
<MessageError @model={{this.model}} @errorMessage={{this.error}} />
|
|
|
|
</ConfirmationModal>
|