open-vault/ui/app/templates/vault/cluster/access/namespaces/index.hbs
Matthew Irish c31671ce04
Bug fix - ui context menu (#6018)
* add dot-to-dash helper

* fix context menu on policy page and add test for deletion

* use dot-to-dash where we use confirm component

* fix acceptance test
2019-01-09 12:30:19 -06:00

60 lines
2.2 KiB
Handlebars

{{#if (has-feature "Namespaces")}}
<PageHeader as |p|>
<p.levelLeft>
<h1 class="title is-3">
Namespaces
</h1>
</p.levelLeft>
<p.levelRight>
{{#link-to 'vault.cluster.access.namespaces.create' class="button has-icon-right is-ghost is-compact"}}
Create namespace
<ICon @glyph="chevron-right" @size=11 />
{{/link-to}}
</p.levelRight>
</PageHeader>
<ListView @items={{model}} @itemNoun="namespace" @emptyActions="empty-action-namespaces" as |list|>
<ListItem as |Item|>
<Item.content>
{{list.item.id}}
</Item.content>
<Item.menu>
{{#with (concat currentNamespace (if currentNamespace "/") list.item.id) as |targetNamespace|}}
{{#if (contains targetNamespace accessibleNamespaces)}}
<li class="action">
{{#link-to "vault.cluster.secrets" (query-params namespace=targetNamespace) class="is-block"}}
Switch to namespace
{{/link-to}}
</li>
{{/if}}
{{/with}}
<li class="action">
<ConfirmAction
@confirmButtonClasses="button is-primary"
@confirmButtonText="Remove"
@buttonClasses="link is-destroy"
@onConfirmAction={{action
(perform
Item.callMethod
"destroyRecord"
list.item
(concat "Successfully deleted namespace: " list.item.id)
"There was an error deleting this namespace: "
(action "refreshNamespaceList")
)
}}
@confirmMessage={{concat "Are you sure you want to delete " list.item.id "?"}}
@showConfirm={{get this (concat "shouldDelete-" (dot-to-dash list.item.id))}}
@class={{if (get this (concat "shouldDelete-" (dot-to-dash list.item.id))) "message is-block is-warning is-outline"}}
@containerClasses="message-body is-block"
@messageClasses="is-block"
>
Delete
</ConfirmAction>
</li>
</Item.menu>
</ListItem>
</ListView>
{{else}}
<UpgradePage @title="Namespaces" @minimumEdition="Vault Enterprise Pro" />
{{/if}}