Files
threshold-ui/ui/admin/app/templates/scopes/scope/credential-stores/index.hbs
T
Cameron Perera eb4ec5f6de refactor: 💡 update Dropdown component to have name & toggleText (#2218)
* refactor: 💡 update Dropdown component to have name & toggleText

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13336

* test: 💍 remove hds class selector

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13336
2024-04-12 14:55:33 -04:00

153 lines
4.7 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: MPL-2.0
}}
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<Breadcrumbs::Container />
</page.breadcrumbs>
<page.header>
<h2>
{{t 'resources.credential-store.title_plural'}}
<DocLink @doc='credential-store' @iconSize='large' />
</h2>
{{#if @model.credentialStoresExist}}
<p>{{t 'resources.credential-store.description'}}</p>
{{/if}}
</page.header>
<page.actions>
{{#if (can 'create model' this.scope collection='credential-stores')}}
{{#if @model.credentialStoresExist}}
<Hds::Button
@route='scopes.scope.credential-stores.new'
@text={{t 'resources.credential-store.titles.new'}}
/>
{{/if}}
{{/if}}
</page.actions>
<page.body class='search-filtering'>
{{#if @model.credentialStoresExist}}
<Hds::SegmentedGroup as |S|>
<S.TextInput
@value={{this.search}}
@type='search'
placeholder={{t 'actions.search'}}
aria-label={{t 'actions.search'}}
{{on 'input' this.handleSearchInput}}
/>
<S.Generic>
<Dropdown
name='type'
@toggleText={{t 'form.type.label'}}
@itemOptions={{this.credStoreTypeOptions}}
@checkedItems={{this.types}}
@applyFilter={{fn this.applyFilter 'types'}}
/>
</S.Generic>
</Hds::SegmentedGroup>
<FilterTags @filters={{this.filters}} />
{{#if @model.credentialStores}}
<Hds::Table
@model={{@model.credentialStores}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'form.type.label'))
(hash label=(t 'form.id.label'))
}}
@density='short'
@valign='middle'
>
<:body as |B|>
<B.Tr>
<B.Td>
{{#if (can 'read credential-store' B.data)}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store'
@model={{B.data.id}}
>
{{B.data.displayName}}
</LinkTo>
{{else}}
<Hds::Text::Body @tag='p'>
{{B.data.displayName}}
</Hds::Text::Body>
{{/if}}
<Hds::Text::Body @tag='p'>
{{B.data.description}}
</Hds::Text::Body>
</B.Td>
<B.Td>
<Hds::Badge
@text={{t
(concat 'resources.credential-store.types.' B.data.type)
}}
/>
</B.Td>
<B.Td>
<Hds::Copy::Snippet
@textToCopy={{B.data.id}}
@color='secondary'
/>
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{else}}
<Hds::ApplicationState data-test-no-credential-store-results as |A|>
<A.Header @title={{t 'titles.no-results-found'}} />
<A.Body
@text={{t
(if
this.search
'descriptions.no-search-results'
'descriptions.no-filter-results'
)
query=this.search
resource=(t 'resources.credential-store.title_plural')
}}
/>
</Hds::ApplicationState>
{{/if}}
{{else}}
<Hds::ApplicationState as |A|>
<A.Header
@title={{t 'resources.credential-store.messages.welcome.title'}}
/>
<A.Body
{{! can list (at least): show default welcome message}}
{{! can create (only): show create-but-not-list welcome message}}
{{! can neither list nor create: show neither-list-nor-create welcome message}}
@text={{t
(if
(can 'list model' this.scope collection='credential-stores')
'resources.credential-store.description'
(if
(can 'create model' this.scope collection='credential-stores')
'descriptions.create-but-not-list'
'descriptions.neither-list-nor-create'
)
)
resource=(t 'resources.credential-store.title_plural')
}}
/>
{{#if (can 'create model' this.scope collection='credential-stores')}}
<A.Footer as |F|>
<F.Link::Standalone
@icon='plus-circle'
@text={{t 'titles.new'}}
@route='scopes.scope.credential-stores.new'
/>
</A.Footer>
{{/if}}
</Hds::ApplicationState>
{{/if}}
</page.body>
</Rose::Layout::Page>