vault/ui/lib/ldap/addon/components/page/libraries.hbs
claire bontempo 79ed357954
UI: Make empty state links consistent (#25209)
* round one of updating empty state actions

* second round of empty states

* update tests

* add changelog
2024-02-02 16:56:53 -08:00

94 lines
3.1 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
~}}
<TabPageHeader @model={{@backendModel}} @breadcrumbs={{@breadcrumbs}}>
<:toolbarFilters>
{{#if (and (not @promptConfig) @libraries)}}
<FilterInput
aria-label="Filter libraries"
placeholder="Filter libraries"
value={{this.filterValue}}
@wait={{200}}
@onInput={{fn (mut this.filterValue)}}
/>
{{/if}}
</:toolbarFilters>
<:toolbarActions>
{{#if @promptConfig}}
<ToolbarLink @route="configure" data-test-toolbar-action="config">
Configure LDAP
</ToolbarLink>
{{else}}
<ToolbarLink @route="libraries.create" @type="add" data-test-toolbar-action="library">
Create library
</ToolbarLink>
{{/if}}
</:toolbarActions>
</TabPageHeader>
{{#if @promptConfig}}
<ConfigCta />
{{else if (not this.filteredLibraries)}}
{{#if this.filterValue}}
<EmptyState @title="There are no libraries matching &quot;{{this.filterValue}}&quot;" />
{{else}}
<EmptyState
data-test-config-cta
@title="No libraries created yet"
@message="Use libraries to manage a set of highly privileged accounts that can be shared among a team."
/>
{{/if}}
{{else}}
<div class="has-bottom-margin-s">
{{#each this.filteredLibraries as |library|}}
<ListItem @linkPrefix={{this.mountPoint}} @linkParams={{array "libraries.library.details" library.name}} as |Item|>
<Item.content>
<Icon @name="folder" />
<span data-test-library={{library.name}}>{{library.name}}</span>
</Item.content>
<Item.menu>
{{#if library.libraryPath.isLoading}}
<li class="action">
<Hds::Button disabled @color="tertiary" @icon="loading" @text="loading" @isIconOnly={{true}} />
</li>
{{else}}
<li class="action">
<LinkTo
class="has-text-black has-text-weight-semibold"
data-test-edit
@route="libraries.library.edit"
@model={{library}}
@disabled={{not library.canEdit}}
>
Edit
</LinkTo>
</li>
<li class="action">
<LinkTo
class="has-text-black has-text-weight-semibold"
data-test-details
@route="libraries.library.details"
@model={{library}}
@disabled={{not library.canRead}}
>
Details
</LinkTo>
</li>
{{#if library.canDelete}}
<ConfirmAction
data-test-delete
@id={{library.id}}
@isInDropdown={{true}}
@buttonText="Delete"
@confirmMessage="This library and associated accounts will be permanently deleted. You will not be able to recover it."
@onConfirmAction={{fn this.onDelete library}}
/>
{{/if}}
{{/if}}
</Item.menu>
</ListItem>
{{/each}}
</div>
{{/if}}