05f6b0ae97
* updates dropdown transform codemod to apply @defaultClass arg to Content component * runs codemod and transforms class to @defaultClass on basic dropdown Content component * adds changelog entry * removes changelog entry
112 lines
4.1 KiB
Handlebars
112 lines
4.1 KiB
Handlebars
{{! template-lint-configure simple-unless "warn" }}
|
|
<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 @editActions.toggleAdvanced}}
|
|
>
|
|
<span class="has-text-grey">JSON</span>
|
|
</Toggle>
|
|
</ToolbarFilters>
|
|
{{/unless}}
|
|
<ToolbarActions>
|
|
{{#if (eq @mode "show")}}
|
|
<SecretDeleteMenu
|
|
@modelForData={{@modelForData}}
|
|
@model={{@model}}
|
|
@navToNearestAncestor={{@navToNearestAncestor}}
|
|
@isV2={{@isV2}}
|
|
@refresh={{action @editActions.refresh}}
|
|
@canReadSecretMetadata={{@canReadSecretMetadata}}
|
|
/>
|
|
{{/if}}
|
|
{{#if (and (eq @mode "show") @canUpdateSecretData)}}
|
|
{{#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")}}
|
|
@htmlTag="button"
|
|
>
|
|
Copy
|
|
<Chevron @direction="down" @isButton={{true}} />
|
|
</D.Trigger>
|
|
<D.Content @defaultClass="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={{stringify @modelForData.secretData}}
|
|
@success={{action (set-flash-message "JSON Copied!")}}
|
|
data-test-copy-button
|
|
>
|
|
Copy JSON
|
|
</CopyButton>
|
|
</li>
|
|
<li class="action">
|
|
{{#if this.showWrapButton}}
|
|
<button
|
|
class="link link-plain has-text-weight-semibold is-ghost {{if this.isWrapping "is-loading"}}"
|
|
type="button"
|
|
{{on "click" this.handleWrapClick}}
|
|
data-test-wrap-button
|
|
disabled={{this.isWrapping}}
|
|
>
|
|
Wrap secret
|
|
</button>
|
|
{{else}}
|
|
<MaskedInput
|
|
@class="has-padding"
|
|
@displayOnly={{true}}
|
|
@allowCopy={{true}}
|
|
@value={{this.wrappedData}}
|
|
@success={{action "handleCopySuccess"}}
|
|
@error={{action "handleCopyError"}}
|
|
/>
|
|
{{/if}}
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</D.Content>
|
|
</BasicDropdown>
|
|
{{/unless}}
|
|
{{/if}}
|
|
|
|
{{#if (and (eq @mode "show") @isV2 (not @model.failedServerRead))}}
|
|
<SecretVersionMenu @version={{@modelForData}} @onRefresh={{action @editActions.refresh}} @model={{@model}} />
|
|
{{/if}}
|
|
|
|
{{#if (and (eq @mode "show") @canUpdateSecretData)}}
|
|
{{#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=@modelForData.version)}}
|
|
@data-test-secret-edit="true"
|
|
@replace={{true}}
|
|
@type="add"
|
|
@disabled={{@model.failedServerRead}}
|
|
@disabledTooltip="Metadata read access is required to create new version"
|
|
>
|
|
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> |