* refactor: 💡 application state ability dependent descriptions ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-15813
117 lines
3.1 KiB
Handlebars
117 lines
3.1 KiB
Handlebars
{{!
|
|
Copyright (c) HashiCorp, Inc.
|
|
SPDX-License-Identifier: BUSL-1.1
|
|
}}
|
|
|
|
<Rose::Layout::Page as |page|>
|
|
|
|
<page.breadcrumbs>
|
|
<Breadcrumbs::Container />
|
|
</page.breadcrumbs>
|
|
|
|
<page.header>
|
|
<h2>
|
|
{{t 'resources.group.title_plural'}}
|
|
<DocLink @doc='group' @iconSize='large' />
|
|
</h2>
|
|
{{#if @model.doGroupsExist}}
|
|
<p>{{t 'resources.group.description'}}</p>
|
|
{{/if}}
|
|
</page.header>
|
|
|
|
<page.actions>
|
|
{{#if (can 'create model' this.scope collection='groups')}}
|
|
{{#if @model.doGroupsExist}}
|
|
<Hds::Button
|
|
@route='scopes.scope.groups.new'
|
|
@text={{t 'resources.group.titles.new'}}
|
|
/>
|
|
{{/if}}
|
|
{{/if}}
|
|
</page.actions>
|
|
|
|
<page.body class='search-filtering'>
|
|
|
|
{{#if @model.doGroupsExist}}
|
|
<Hds::SegmentedGroup as |S|>
|
|
<S.TextInput
|
|
@value={{this.search}}
|
|
@type='search'
|
|
placeholder={{t 'actions.search'}}
|
|
aria-label={{t 'actions.search'}}
|
|
{{on 'input' this.handleSearchInput}}
|
|
/>
|
|
</Hds::SegmentedGroup>
|
|
{{#if @model.groups}}
|
|
|
|
<Hds::Table
|
|
@model={{@model.groups}}
|
|
@columns={{array
|
|
(hash label=(t 'form.name.label'))
|
|
(hash label=(t 'form.id.label'))
|
|
}}
|
|
@density='short'
|
|
@valign='middle'
|
|
>
|
|
<:body as |B|>
|
|
<B.Tr>
|
|
<B.Td>
|
|
{{#if (can 'read group' B.data)}}
|
|
<LinkTo
|
|
@route='scopes.scope.groups.group'
|
|
@model={{B.data.id}}
|
|
>
|
|
{{B.data.displayName}}
|
|
</LinkTo>
|
|
{{else}}
|
|
{{B.data.displayName}}
|
|
{{/if}}
|
|
<p>{{B.data.description}}</p>
|
|
</B.Td>
|
|
<B.Td>
|
|
<Hds::Copy::Snippet
|
|
@textToCopy={{B.data.id}}
|
|
@color='secondary'
|
|
/>
|
|
</B.Td>
|
|
</B.Tr>
|
|
</:body>
|
|
</Hds::Table>
|
|
<Rose::Pagination
|
|
@totalItems={{@model.totalItems}}
|
|
@currentPage={{this.page}}
|
|
@currentPageSize={{this.pageSize}}
|
|
/>
|
|
{{else}}
|
|
<Hds::ApplicationState data-test-no-groups-results as |A|>
|
|
<A.Header @title={{t 'titles.no-results-found'}} />
|
|
<A.Body
|
|
@text={{t
|
|
'descriptions.no-search-results'
|
|
query=this.search
|
|
resource=(t 'resources.group.title_plural')
|
|
}}
|
|
/>
|
|
</Hds::ApplicationState>
|
|
{{/if}}
|
|
|
|
{{else}}
|
|
<Hds::ApplicationState as |A|>
|
|
<A.Header @title={{t 'resources.group.messages.welcome.title'}} />
|
|
<A.Body @text={{this.messageDescription}} />
|
|
{{#if (can 'create model' this.scope collection='groups')}}
|
|
<A.Footer as |F|>
|
|
<F.LinkStandalone
|
|
@icon='plus-circle'
|
|
@text={{t 'titles.new'}}
|
|
@route='scopes.scope.groups.new'
|
|
/>
|
|
</A.Footer>
|
|
{{/if}}
|
|
</Hds::ApplicationState>
|
|
|
|
{{/if}}
|
|
|
|
</page.body>
|
|
|
|
</Rose::Layout::Page> |