open-vault/ui/app/templates/components/secret-version-menu.hbs

97 lines
4.1 KiB
Handlebars

<BasicDropdown
@class="popup-menu"
@horizontalPosition="auto-right"
@verticalPosition="below"
as |D|
>
<D.trigger
data-test-popup-menu-trigger="true"
@class={{concat "toolbar-link" (if D.isOpen " is-active")}}
@tagName="button"
>
{{#if useDefaultTrigger}}
<Icon aria-label="More options" @glyph="more-horizontal" class="has-text-black auto-width" />
{{else}}
Version {{this.version.version}}
<Chevron @direction="down" @isButton={{true}} />
{{/if}}
</D.trigger>
<D.content @class="popup-menu-content ">
<nav class="box menu">
<ul class="menu-list">
{{#if (has-block)}}
{{yield}}
{{/if}}
{{#if this.version.destroyed}}
<li class="action has-text-grey">
<button type="button" class="link" disabled >
The data for {{this.version.path}} version {{this.version.version}} has been destroyed.
</button>
</li>
{{else}}
{{#if isFetchingVersionCapabilities}}
<li class="action">
<button disabled type="button" class="link button is-loading is-transparent">
loading
</button>
</li>
{{else}}
<li class="action">
{{#if this.version.deleted}}
{{#if canUndeleteVersion}}
<button type="button" class="link" {{action "deleteVersion" "undelete"}}>
Undelete version
</button>
{{else}}
<button type="button" class="link" disabled >
The data for {{this.version.path}} version {{this.version.version}} has been deleted. You do not have the permisssion to undelete it.
</button>
{{/if}}
{{else if canDeleteVersion}}
<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 " this.version.path " version " this.version.version "?"
}}
@cancelButtonText="Cancel"
data-test-secret-v2-delete="true"
>
Delete version
</ConfirmAction>
{{else}}
<button type="button" class="link" disabled >
You do not have the permissions to delete the data for this secret.
</button>
{{/if}}
</li>
{{#if canDestroyVersion}}
<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 " this.version.path " version " this.version.version ". Are you sure you want to do this?"
}}
@cancelButtonText="Cancel"
data-test-secret-v2-destroy="true"
>
Permanently destroy version
</ConfirmAction>
</li>
{{else}}
<button type="button" class="link" disabled >
You do not have the permissions to destroy the data for this secret.
</button>
{{/if}}
{{/if}}
{{/if}}
</ul>
</nav>
</D.content>
</BasicDropdown>