refactor: 💡 Migrate credentials-list to Hds::Table (#2059)

* refactor: 💡 Migrate `credentials-list` to `Hds::Table`

Migrate `credentials-list` to `Hds::Table`

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

* refactor: 💡 Refactor table to use `B.data`

Originally the Proxy(Array) was not being taking in as a correct model
object when using the `@columns` synthax, now it seems to work perfectly
fine.

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11725
This commit is contained in:
Devon Anderson authored and GitHub committed 2024-01-05 12:23:46 -05:00
1 parent cf0f4ab56a
commit adfa118ae5
2 files changed
+40 -40

No files matched your search

@@ -28,46 +28,46 @@
<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 |credential|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read credential' credential)}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store.credentials.credential'
@model={{credential.id}}
>
{{credential.displayName}}
</LinkTo>
{{else}}
{{credential.displayName}}
{{/if}}
<p>{{credential.description}}</p>
</row.headerCell>
<row.cell>
<CredSourceTypeBadge @model={{credential}} />
</row.cell>
<row.cell>
<Copyable
@text={{credential.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' B.data)}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store.credentials.credential'
@model={{B.data.id}}
>
<code>{{credential.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>
<CredSourceTypeBadge @model={{B.data}} />
</B.Td>
<B.Td>
<Hds::Copy::Snippet
@color='secondary'
@textToCopy={{B.data.id}}
/>
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{else}}
@@ -81,7 +81,7 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
await click(`[href="${urls.credentials}"]`);
assert.strictEqual(currentURL(), urls.credentials);
assert
.dom('.rose-table-body .rose-table-row')
.dom('tbody tr')
.isVisible({ count: this.server.schema.credentials.all().models.length });
});