claire bontempo e88b6b117e
UI: update overview card action handling (#27785)
* yield all overview card actions

* yield remaining overview card content to the correct block

* close overview card in test

* fix typo

* fix route typo, add selectors where needed

* fix class typo add one more selector
2024-07-16 12:40:35 -07:00

85 lines
2.8 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
~}}
<TabPageHeader @model={{@backendModel}} @breadcrumbs={{@breadcrumbs}}>
<:toolbarActions>
{{#if @promptConfig}}
<ToolbarLink @route="configure" data-test-toolbar-action="config">
Configure LDAP
</ToolbarLink>
{{/if}}
</:toolbarActions>
</TabPageHeader>
{{#if @promptConfig}}
<ConfigCta />
{{else}}
<div class="is-grid has-top-margin-l grid-2-columns grid-gap-2">
<OverviewCard
@cardTitle="Roles"
@subText="The total number of roles that have been set up in this secret engine in order to generate credentials."
>
<:action>
<Hds::Link::Standalone @text="Create new" @route="roles.create" @icon="plus" @iconPosition="trailing" />
</:action>
<:content>
<h2 class="title is-2 has-font-weight-normal has-top-margin-m" data-test-roles-count>
{{or @roles.length "None"}}
</h2>
</:content>
</OverviewCard>
<OverviewCard
@cardTitle="Libraries"
@subText="The total number of libraries that have been created for service account management."
>
<:action>
<Hds::Link::Standalone @text="Create new" @route="libraries.create" @icon="plus" @iconPosition="trailing" />
</:action>
<:content>
<h2 class="title is-2 has-font-weight-normal has-top-margin-m" data-test-libraries-count>
{{or @libraries.length "None"}}
</h2>
</:content>
</OverviewCard>
</div>
<div class="is-grid has-top-margin-l grid-2-columns grid-gap-2">
<AccountsCheckedOut
@libraries={{@libraries}}
@statuses={{@librariesStatus}}
@showLibraryColumn={{true}}
@onCheckInSuccess={{transition-to "vault.cluster.secrets.backend.ldap.overview"}}
class="is-flex-half"
/>
<div>
<OverviewCard @cardTitle="Generate credentials" @subText="Quickly generate credentials by typing the role name.">
<:content>
<div class="has-top-margin-m is-flex">
<SearchSelect
class="is-flex-1"
@ariaLabel="Role"
@placeholder="Select a role"
@disallowNewItems={{true}}
@options={{@roles}}
@selectLimit="1"
@fallbackComponent="input-search"
@onChange={{this.selectRole}}
@renderInPlace={{true}}
/>
<div>
<Hds::Button
@text="Get credentials"
@color="secondary"
class="has-left-margin-s"
disabled={{not this.selectedRole}}
{{on "click" this.generateCredentials}}
data-test-generate-credential-button
/>
</div>
</div>
</:content>
</OverviewCard>
</div>
</div>
{{/if}}