refactor: 💡 Migrate host-catalogs list to Hds::Table (#2055)

* refactor: 💡 Migrate host-catalogs list to `Hds::Table`

Migrated host-catalogs list to use `Hds::Table` instead of `Rose::Table`

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

* refactor: 💡 use `Hds::Text` component

Use `Hds::Text::Code` component for `code` element.

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

* refactor: 💡 Use `Hds::Text` and `Hds::Code::Snippet`

Refactor element to use `Hds`

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

* refactor: 💡 refactor incorrect usage of `Hds::Code::Snippet`

Refactor incorrect usage of `Hds::Code::Snippet`

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11726
This commit is contained in:
Devon Anderson authored and GitHub committed 2024-01-02 12:02:26 -05:00
1 parent 01d4a329ab
commit d4adbe4317
1 file changed
+36 -39
@@ -36,46 +36,43 @@
{{#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 |hostCatalog|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read host-catalog' hostCatalog)}}
<LinkTo
@route='scopes.scope.host-catalogs.host-catalog'
@model={{hostCatalog.id}}
>
{{hostCatalog.displayName}}
</LinkTo>
{{else}}
{{hostCatalog.displayName}}
{{/if}}
<p>{{hostCatalog.description}}</p>
</row.headerCell>
<row.cell>
<HostCatalogTypeBadge @model={{hostCatalog}} />
</row.cell>
<row.cell>
<Copyable
@text={{hostCatalog.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'))
}}
>
<:body as |B|>
<B.Tr>
<B.Td>
{{#if (can 'read host-catalog' B.data)}}
<LinkTo
@route='scopes.scope.host-catalogs.host-catalog'
@model={{B.data.id}}
>
<code>{{hostCatalog.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>
<HostCatalogTypeBadge @model={{B.data}} />
</B.Td>
<B.Td>
<Hds::Copy::Snippet
@color='secondary'
@textToCopy={{B.data.id}}
/>
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{else}}