* refactor: 💡 application state ability dependent descriptions ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-15813
188 lines
6.2 KiB
Handlebars
188 lines
6.2 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.alias.title_plural'}}
|
|
<DocLink @doc='alias' @iconSize='large' />
|
|
</h2>
|
|
<p>{{t 'resources.alias.description'}}</p>
|
|
</page.header>
|
|
|
|
<page.actions>
|
|
{{#if (can 'create model' this.scope collection='aliases')}}
|
|
{{#if @model.doAliasesExist}}
|
|
<Hds::Button
|
|
@route='scopes.scope.aliases.new'
|
|
@text={{t 'resources.alias.titles.new'}}
|
|
/>
|
|
{{/if}}
|
|
{{/if}}
|
|
</page.actions>
|
|
|
|
<page.body class='search-filtering'>
|
|
{{#if @model.doAliasesExist}}
|
|
<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.aliases}}
|
|
<Hds::Table
|
|
@model={{@model.aliases}}
|
|
@columns={{array
|
|
(hash label=(t 'resources.alias.title'))
|
|
(hash label=(t 'resources.alias.titles.points_to'))
|
|
(hash label=(t 'resources.scope.title'))
|
|
(hash label=(t 'resources.alias.titles.resource_id'))
|
|
(hash label=(t 'titles.actions') isVisuallyHidden=true)
|
|
}}
|
|
@valign='middle'
|
|
>
|
|
<:body as |B|>
|
|
<B.Tr data-test-alias-row={{B.data.alias.id}}>
|
|
<B.Td>
|
|
{{#if (can 'read model' B.data.alias)}}
|
|
<LinkTo
|
|
@route='scopes.scope.aliases.alias'
|
|
@model={{B.data.alias.id}}
|
|
>
|
|
{{B.data.alias.value}}
|
|
</LinkTo>
|
|
{{else}}
|
|
<Hds::Text::Body @tag='p'>
|
|
{{B.data.alias.value}}
|
|
</Hds::Text::Body>
|
|
{{/if}}
|
|
{{#if B.data.alias.description}}
|
|
<Hds::Text::Body @tag='p'>
|
|
{{B.data.alias.description}}
|
|
</Hds::Text::Body>
|
|
{{/if}}
|
|
</B.Td>
|
|
<B.Td>
|
|
{{#if B.data.target.displayName}}
|
|
<div class='aliases-list-cell-item'>
|
|
<span><Hds::Icon @name='target' @isInline={{true}} /></span>
|
|
<span> {{B.data.target.displayName}} </span>
|
|
</div>
|
|
{{else}}
|
|
<Hds::Text::Body
|
|
@tag='p'
|
|
@size='100'
|
|
@weight='medium'
|
|
@color='faint'
|
|
>
|
|
{{t 'titles.not-set'}}
|
|
</Hds::Text::Body>
|
|
{{/if}}
|
|
</B.Td>
|
|
<B.Td>
|
|
<Hds::Badge @text={{t 'titles.global'}} @icon='globe' />
|
|
</B.Td>
|
|
<B.Td>
|
|
{{#if B.data.alias.destination_id}}
|
|
<Hds::Copy::Snippet
|
|
@textToCopy={{B.data.alias.destination_id}}
|
|
@color='secondary'
|
|
/>
|
|
{{/if}}
|
|
</B.Td>
|
|
<B.Td>
|
|
{{#let
|
|
(hash
|
|
canUpdate=(can 'update model' B.data.alias)
|
|
canDelete=(can 'delete model' B.data.alias)
|
|
)
|
|
as |perms|
|
|
}}
|
|
{{#if (or perms.canUpdate perms.canDelete)}}
|
|
<Hds::Dropdown as |dd|>
|
|
|
|
<dd.ToggleIcon
|
|
@icon='more-horizontal'
|
|
@text={{t 'actions.manage'}}
|
|
@hasChevron={{false}}
|
|
@size='small'
|
|
/>
|
|
{{#if perms.canUpdate}}
|
|
<dd.Interactive
|
|
@route='scopes.scope.aliases.alias'
|
|
@model={{B.data.alias.id}}
|
|
>
|
|
{{t 'actions.edit'}}
|
|
</dd.Interactive>
|
|
{{#if B.data.alias.destination_id}}
|
|
<dd.Interactive
|
|
@color='action'
|
|
{{on 'click' (fn this.clearAlias B.data.alias)}}
|
|
>
|
|
{{t 'actions.clear'}}
|
|
</dd.Interactive>
|
|
{{/if}}
|
|
{{/if}}
|
|
|
|
{{#if perms.canDelete}}
|
|
<dd.Interactive
|
|
@color='critical'
|
|
{{on 'click' (fn this.deleteAlias B.data.alias)}}
|
|
>
|
|
{{t 'actions.delete'}}
|
|
</dd.Interactive>
|
|
{{/if}}
|
|
</Hds::Dropdown>
|
|
|
|
{{/if}}
|
|
{{/let}}
|
|
</B.Td>
|
|
</B.Tr>
|
|
</:body>
|
|
</Hds::Table>
|
|
<Rose::Pagination
|
|
@totalItems={{@model.totalItems}}
|
|
@currentPage={{this.page}}
|
|
@currentPageSize={{this.pageSize}}
|
|
/>
|
|
{{else}}
|
|
<Hds::ApplicationState data-test-no-alias-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.alias.title_plural')
|
|
}}
|
|
/>
|
|
</Hds::ApplicationState>
|
|
{{/if}}
|
|
{{else}}
|
|
<Hds::ApplicationState as |A|>
|
|
<A.Header @title={{t 'resources.alias.messages.none.title'}} />
|
|
<A.Body @text={{this.messageDescription}} />
|
|
{{#if (can 'create model' this.scope collection='aliases')}}
|
|
<A.Footer as |F|>
|
|
<F.LinkStandalone
|
|
@icon='plus-circle'
|
|
@iconPosition='leading'
|
|
@route='scopes.scope.aliases.new'
|
|
@text={{t 'resources.alias.messages.none.link'}}
|
|
/>
|
|
</A.Footer>
|
|
{{/if}}
|
|
</Hds::ApplicationState>
|
|
{{/if}}
|
|
|
|
</page.body>
|
|
</Rose::Layout::Page> |