open-vault/ui/app/templates/components/generated-item-list.hbs
claire bontempo 7bc177abc6
UI/Adds pagination to auth methods list (#13054)
* adds pagination to auth methods list

* adds changelog
2021-11-04 16:35:20 -07:00

106 lines
3.3 KiB
Handlebars

<PageHeader as |p|>
<p.top>
{{#key-value-header path="vault.cluster.access.methods"}}
<li>
<span class="sep">
/
</span>
{{#link-to "vault.cluster.access.methods"}}
methods
{{/link-to}}
</li>
{{/key-value-header}}
</p.top>
<p.levelLeft>
<h1 class="title is-3">
{{methodModel.id}}
</h1>
</p.levelLeft>
</PageHeader>
{{#with (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">
<ul>
{{#each tabs as |tab|}}
{{#link-to
params=tab.routeParams
tagName="li"
data-test-auth-section-tab=true
}}
{{#link-to params=tab.routeParams}}
{{tab.label}}
{{/link-to}}
{{/link-to}}
{{/each}}
</ul>
</nav>
</div>
{{/if}}
{{/with}}
<Toolbar>
<ToolbarActions>
<ToolbarLink
data-test-create={{itemType}}
@type="add"
@params={{array
"vault.cluster.access.method.item.create"
itemType
}}>
Create
{{singularize itemType}}
</ToolbarLink>
</ToolbarActions>
</Toolbar>
<ListView @items={{model}} @itemNoun={{itemType}} @paginationRouteName="vault.cluster.access.method.item.list" 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.">
{{#link-to
"vault.cluster.access.method.item.create"
itemType
class="link"
}}
Create {{singularize itemType}}
{{/link-to}}
</list.empty>
{{else if list.item}}
<ListItem @linkParams={{array "vault.cluster.access.method.item.show"
itemType list.item.id}} as |Item|>
<Item.content>
<Icon @glyph="folder-outline" class="has-text-grey-light" @size="l" />{{list.item.id}}
</Item.content>
<Item.menu as |Menu|>
<li class="action">
{{#link-to "vault.cluster.access.method.item.show" list.item.id class="is-block"}}
View {{singularize itemType}}
{{/link-to}}
</li>
<li class="action">
{{#link-to "vault.cluster.access.method.item.edit" list.item.id class="is-block"}}
Edit {{singularize itemType}}
{{/link-to}}
</li>
<li>
<Menu.Message
@id={{list.item.id}}
@buttonClasses="link is-destroy"
@onConfirm={{action
(perform
Item.callMethod
"destroyRecord"
list.item
(concat "Successfully deleted " (singularize itemType) " " list.item.id ".")
(concat "There was an error deleting this " (singularize itemType))
(action "refreshItemList")
)
}}
@message={{concat "Are you sure you want to delete " (singularize itemType) " " list.item.id "?"}}
data-test-secret-delete="true"
@triggerText={{concat "Delete " (singularize itemType)}}/>
</li>
</Item.menu>
</ListItem>
{{/if}}
</ListView>