8f5d62139c
* initial setup, modify toolbar header * footer buttons setup * setup first delete version delete method * clean up * handle destory all versions * handle undelete * conditional for modal and undelete * remove delete from version area * modelForData in permissions * setup for soft delete and modify adpater to allow DELETE in additon to POST * dropdown for soft delete * stuck * handle all soft deletes * conditional for destroy all versions * remove old functionality from secret-version-menu * glimmerize secret-version-menu * Updated secret version menu and version history * Updated icons and columns in version history * create new component * clean up * glimmerize secret delete menu * fix undelete * Fixed radio labels in version delete menu * handle v1 delete * refining * handle errors with flash messages * add changelog * fix test * add to test * amend test * address PR comments * whoopies * add urlEncoding Co-authored-by: Arnav Palnitkar <arnav@hashicorp.com>
140 lines
4.6 KiB
Handlebars
140 lines
4.6 KiB
Handlebars
<PageHeader as |p|>
|
|
<p.top>
|
|
<KeyValueHeader @baseKey={{baseKey}} @path="vault.cluster.secrets.backend.list" @mode={{mode}} @root={{root}} @showCurrent={{true}} />
|
|
</p.top>
|
|
<p.levelLeft>
|
|
<h1 class="title is-3">
|
|
{{#if (eq mode "create") }}
|
|
Create secret
|
|
{{else if (and isV2 (eq mode 'edit'))}}
|
|
Create new version
|
|
{{else if (eq mode 'edit')}}
|
|
Edit secret
|
|
{{else}}
|
|
{{key.id}}
|
|
{{/if}}
|
|
</h1>
|
|
</p.levelLeft>
|
|
</PageHeader>
|
|
|
|
<Toolbar>
|
|
{{#unless (and (eq mode 'show') isWriteWithoutRead)}}
|
|
<ToolbarFilters>
|
|
<Toggle
|
|
@name="json"
|
|
@status="success"
|
|
@size="small"
|
|
@disabled={{and (eq mode 'show') secretDataIsAdvanced}}
|
|
@checked={{showAdvancedMode}}
|
|
@onChange={{action "toggleAdvanced"}}
|
|
>
|
|
<span class="has-text-grey">JSON</span>
|
|
</Toggle>
|
|
</ToolbarFilters>
|
|
{{/unless}}
|
|
<ToolbarActions>
|
|
{{#if (eq mode 'show')}}
|
|
<SecretDeleteMenu
|
|
@modelForData={{this.modelForData}}
|
|
@model={{this.model}}
|
|
@navToNearestAncestor={{this.navToNearestAncestor}}
|
|
@isV2={{isV2}}
|
|
@refresh={{action 'refresh'}}
|
|
/>
|
|
{{/if}}
|
|
{{#if (and (eq mode 'show') (or canEditV2Secret canEdit))}}
|
|
{{#let (concat 'vault.cluster.secrets.backend.' (if (eq mode 'show') 'edit' 'show')) as |targetRoute|}}
|
|
{{#unless (and isV2 (or isWriteWithoutRead modelForData.destroyed modelForData.deleted))}}
|
|
<BasicDropdown
|
|
@class="popup-menu"
|
|
@horizontalPosition="auto-right"
|
|
@verticalPosition="below"
|
|
@onClose={{action "clearWrappedData"}}
|
|
as |D|
|
|
>
|
|
<D.trigger
|
|
data-test-popup-menu-trigger="true"
|
|
@class={{concat "toolbar-link" (if D.isOpen " is-active")}}
|
|
@tagName="button"
|
|
>
|
|
Copy
|
|
<Chevron @direction="down" @isButton={{true}} />
|
|
</D.trigger>
|
|
<D.content @class="popup-menu-content is-wide">
|
|
<nav class="box menu">
|
|
<ul class="menu-list">
|
|
<li class="action">
|
|
<CopyButton
|
|
@class="link link-plain has-text-weight-semibold is-ghost"
|
|
@clipboardText={{codemirrorString}}
|
|
@success={{action (set-flash-message "JSON Copied!")}}
|
|
data-test-copy-button
|
|
>
|
|
Copy JSON
|
|
</CopyButton>
|
|
</li>
|
|
<li class="action">
|
|
{{#if showWrapButton}}
|
|
<button
|
|
class="link link-plain has-text-weight-semibold is-ghost {{if isWrapping "is-loading"}}"
|
|
type="button"
|
|
{{action "handleWrapClick"}}
|
|
data-test-wrap-button
|
|
disabled={{isWrapping}}
|
|
>
|
|
Wrap secret
|
|
</button>
|
|
{{else}}
|
|
<MaskedInput
|
|
@class="has-padding"
|
|
@displayOnly={{true}}
|
|
@allowCopy={{true}}
|
|
@value={{wrappedData}}
|
|
@success={{action "handleCopySuccess"}}
|
|
@error={{action "handleCopyError"}}
|
|
/>
|
|
{{/if}}
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</D.content>
|
|
</BasicDropdown>
|
|
{{/unless}}
|
|
{{/let}}
|
|
{{/if}}
|
|
|
|
{{#if (and (eq @mode "show") this.isV2 (not @model.failedServerRead))}}
|
|
<SecretVersionMenu
|
|
@version={{this.modelForData}}
|
|
@onRefresh={{action 'refresh'}}
|
|
@model={{this.model}}
|
|
/>
|
|
{{/if}}
|
|
|
|
{{#if (and (eq mode 'show') (or canEditV2Secret canEdit))}}
|
|
{{#let (concat 'vault.cluster.secrets.backend.' (if (eq mode 'show') 'edit' 'show')) as |targetRoute|}}
|
|
{{#if isV2}}
|
|
<ToolbarLink
|
|
@params={{array targetRoute model.id (query-params version=this.modelForData.version)}}
|
|
@data-test-secret-edit="true"
|
|
@replace={{true}}
|
|
@type="add"
|
|
>
|
|
Create new version
|
|
</ToolbarLink>
|
|
{{else}}
|
|
<ToolbarLink
|
|
@params={{array targetRoute model.id}}
|
|
@data-test-secret-edit="true"
|
|
@replace={{true}}
|
|
>
|
|
Edit secret
|
|
</ToolbarLink>
|
|
{{/if}}
|
|
{{/let}}
|
|
{{/if}}
|
|
</ToolbarActions>
|
|
</Toolbar>
|
|
|
|
{{partial partialName}}
|