refactor: 💡 Refactor credential-stores-list to use Hds (#2066)

Refactor `credential-stores-list` to use `Hds::Tables`

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11723
This commit is contained in:
Devon Anderson authored and GitHub committed 2024-01-05 11:18:22 -05:00
1 parent f40878034d
commit cf0f4ab56a
1 file changed
+43 -45
@@ -34,53 +34,51 @@
<page.body>
{{#if @model}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |credentialStore|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read credential-store' credentialStore)}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store'
@model={{credentialStore.id}}
>
{{credentialStore.displayName}}
</LinkTo>
{{else}}
{{credentialStore.displayName}}
{{/if}}
<p>{{credentialStore.description}}</p>
</row.headerCell>
<row.cell>
<Hds::Badge
@text={{t
(concat
'resources.credential-store.types.' credentialStore.type
)
}}
/>
</row.cell>
<row.cell>
<Copyable
@text={{credentialStore.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
<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}}
>
<code>{{credentialStore.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{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>