vault/ui/app/components/generated-item-list.hbs
2025-08-01 10:04:25 -06:00

115 lines
3.9 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<PageHeader as |p|>
<p.top>
<Hds::Breadcrumb>
<Hds::Breadcrumb::Item @text="Auth Methods" @route="vault.cluster.access.methods" data-test-access-methods />
<Hds::Breadcrumb::Item @text={{@methodModel.id}} @current={{true}} />
</Hds::Breadcrumb>
</p.top>
<p.levelLeft>
<h1 class="title is-3">
{{@methodModel.id}}
</h1>
</p.levelLeft>
</PageHeader>
{{#let (tabs-for-auth-section @methodModel "authConfig" @paths) as |tabs|}}
{{#if tabs.length}}
<div class="tabs-container box is-sideless is-fullwidth is-paddingless is-marginless">
<nav class="tabs" aria-label="navigation to manage {{@methodModel.id}}">
<ul>
{{#each tabs as |tab|}}
<li>
<LinkTo @route={{tab.route}} @models={{tab.routeParams}} data-test-link-to="generated-tab">
{{tab.label}}
</LinkTo>
</li>
{{/each}}
</ul>
</nav>
</div>
{{/if}}
{{/let}}
<Toolbar>
<ToolbarActions>
<ToolbarLink
@route="vault.cluster.access.method.item.create"
@models={{array @methodModel.id @itemType}}
@type="add"
data-test-entity-create-link={{@itemType}}
>
Create
{{singularize @itemType}}
</ToolbarLink>
</ToolbarActions>
</Toolbar>
<ListView
@items={{@model}}
@itemNoun={{@itemType}}
@paginationRouteName="vault.cluster.access.method.item.list"
@paginationRouteParams={{array @methodModel.id @itemType}}
as |list|
>
{{#if list.empty}}
<list.empty
@title="No {{pluralize @itemType}} yet"
@message="A list of {{pluralize @itemType}} will be listed here. Create your first {{@itemType}} to get started."
>
<Hds::Link::Standalone
@icon="plus"
@text="Create {{singularize @itemType}}"
@route="vault.cluster.access.method.item.create"
@models={{array @methodModel.id @itemType}}
/>
</list.empty>
{{else if list.item}}
<ListItem @linkParams={{array "vault.cluster.access.method.item.show" @methodModel.id @itemType list.item.id}} as |Item|>
<Item.content>
<Icon @name="folder" class="has-text-grey-light" />{{list.item.id}}
</Item.content>
<Item.menu>
<Hds::Dropdown @isInline={{true}} @listPosition="bottom-right" as |dd|>
<dd.ToggleIcon
@icon="more-horizontal"
@text="Overflow options"
@hasChevron={{false}}
data-test-popup-menu-trigger
/>
<dd.Interactive
@route="vault.cluster.access.method.item.show"
@models={{array @methodModel.id @itemType list.item.id}}
>View {{singularize @itemType}}</dd.Interactive>
<dd.Interactive
@route="vault.cluster.access.method.item.edit"
@models={{array @methodModel.id @itemType list.item.id}}
>Edit {{singularize @itemType}}</dd.Interactive>
<dd.Interactive @color="critical" {{on "click" (fn (mut this.itemToDelete) list.item)}}>
Delete
{{singularize @itemType}}
</dd.Interactive>
</Hds::Dropdown>
</Item.menu>
{{#if (eq list.item this.itemToDelete)}}
<ConfirmModal
@color="critical"
@onClose={{fn (mut this.itemToDelete) null}}
@onConfirm={{action
(perform
Item.callMethod
"destroyRecord"
this.itemToDelete
(concat "Successfully deleted " (singularize @itemType) " " this.itemToDelete.id ".")
(concat "There was an error deleting this " (singularize @itemType))
(action "refreshItemList")
)
}}
@confirmTitle="Delete {{singularize @itemType}}?"
@confirmMessage="Are you sure you want to delete {{singularize @itemType}} {{this.itemToDelete.id}}?"
/>
{{/if}}
</ListItem>
{{/if}}
</ListView>