refactor: 💡 Migrate host-catalog/host-list to use Hds (#2044)

* refactor: 💡 Migrate `host-catalog/host-list` to use `Hds`

Migrate `host-catalog/host-list` to use `Hds::Table`

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

* refactor: 💡 `Hds::Text` refactor

Refactored `code` and `p` tag elements to use new `HDS::Text` elements

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11729
This commit is contained in:
Devon Anderson authored and GitHub committed 2023-12-14 14:48:10 -05:00
1 parent 0bbc33d073
commit 4550cd0965
1 file changed
+41 -44
@@ -22,52 +22,49 @@
<page.body>
{{#if @model.hosts}}
<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>
<row.headerCell>{{t 'form.address.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.hosts as |host|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read model' host)}}
<LinkTo
@route='scopes.scope.host-catalogs.host-catalog.hosts.host'
@model={{host.id}}
>
{{host.displayName}}
</LinkTo>
{{else}}
{{host.displayName}}
{{/if}}
<p>{{host.description}}</p>
</row.headerCell>
<row.cell>
<HostCatalogTypeBadge @model={{host}} />
</row.cell>
<row.cell>
<Copyable
@text={{host.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
<Hds::Table
@model={{@model.hosts}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'form.type.label'))
(hash label=(t 'form.id.label'))
(hash label=(t 'form.address.label'))
}}
>
<:body as |B|>
<B.Tr>
<B.Td>
{{#if (can 'read model' B.data)}}
<LinkTo
@route='scopes.scope.host-catalogs.host-catalog.hosts.host'
@model={{B.data.id}}
>
<code>{{host.id}}</code>
</Copyable>
</row.cell>
<row.cell>
<code>{{host.address}}</code>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{B.data.displayName}}
</LinkTo>
{{else}}
{{B.data.displayName}}
{{/if}}
<Hds::Text::Body @tag='p'>{{B.data.description}}</Hds::Text::Body>
</B.Td>
<B.Td>
<HostCatalogTypeBadge @model={{B.data}} />
</B.Td>
<B.Td>
<Copyable
@text={{B.data.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<Hds::Text::Code>{{B.data.id}}</Hds::Text::Code>
</Copyable>
</B.Td>
<B.Td>
<Hds::Text::Code>{{B.data.address}}</Hds::Text::Code>
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{else}}
<Rose::Layout::Centered>