open-vault/ui/app/templates/components/secret-version-menu.hbs
Matthew Irish a4b6bb8626
kv v2 display bugs (#7307)
* fix switch css

* allow breadcrumbs container to grow if it's overflowed so that it's still usable

* close the dropdowns on destructive actions that cause a route refresh

* use new attachCapabilities for context menus on auth methods to get rid of an error
2019-08-13 16:54:51 -05:00

89 lines
3.8 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 (queue (action D.actions.close) (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 is-destroy"
@confirmTitle="Delete version?"
@confirmMessage="This version will no longer be able to be read, but the underlying data will not be removed and can still be undeleted."
@onConfirmAction={{action (queue (action D.actions.close) (action "deleteVersion" "delete"))}}
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 is-destroy"
@confirmTitle="Permanently delete?"
@confirmMessage="This version will no longer be able to be read, and cannot be undeleted."
@onConfirmAction={{action (queue (action D.actions.close) (action "deleteVersion" "destroy"))}}
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>