Refactor `credential-stores-list` to use `Hds::Tables` ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11723
122 lines
3.5 KiB
Handlebars
122 lines
3.5 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}}
|
|
<p>{{t 'resources.credential-store.description'}}</p>
|
|
{{/if}}
|
|
</page.header>
|
|
|
|
<page.actions>
|
|
|
|
{{#if (can 'create model' this.scope collection='credential-stores')}}
|
|
{{#if @model}}
|
|
<Rose::LinkButton
|
|
@route='scopes.scope.credential-stores.new'
|
|
@style='primary'
|
|
>
|
|
{{t 'resources.credential-store.titles.new'}}
|
|
</Rose::LinkButton>
|
|
{{/if}}
|
|
{{/if}}
|
|
</page.actions>
|
|
|
|
<page.body>
|
|
{{#if @model}}
|
|
|
|
<Hds::Table
|
|
@model={{@model}}
|
|
@columns={{array
|
|
(hash label=(t 'form.name.label'))
|
|
(hash label=(t 'form.type.label'))
|
|
(hash label=(t 'form.id.label'))
|
|
}}
|
|
@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}}
|
|
<Rose::Layout::Centered>
|
|
<Rose::Message
|
|
@title={{t 'resources.credential-store.messages.welcome.title'}}
|
|
as |message|
|
|
>
|
|
<message.description>
|
|
{{#if (can 'list model' this.scope collection='credential-stores')}}
|
|
{{! can list (at least): show default welcome message}}
|
|
{{t 'resources.credential-store.description'}}
|
|
{{else if
|
|
(can 'create model' this.scope collection='credential-stores')
|
|
}}
|
|
{{! can create (only): show create-but-not-list welcome message}}
|
|
{{t
|
|
'descriptions.create-but-not-list'
|
|
resource=(t 'resources.credential-store.title_plural')
|
|
}}
|
|
{{else}}
|
|
{{! can neither list nor create }}
|
|
{{t
|
|
'descriptions.neither-list-nor-create'
|
|
resource=(t 'resources.credential-store.title_plural')
|
|
}}
|
|
{{/if}}
|
|
</message.description>
|
|
{{#if (can 'create model' this.scope collection='credential-stores')}}
|
|
<message.link @route='scopes.scope.credential-stores.new'>
|
|
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
|
|
{{t 'titles.new'}}
|
|
</message.link>
|
|
{{/if}}
|
|
</Rose::Message>
|
|
</Rose::Layout::Centered>
|
|
|
|
{{/if}}
|
|
|
|
</page.body>
|
|
|
|
</Rose::Layout::Page> |