Icu 10366 use hds table in brokered credential sources (#1802)

* refactor: 💡 Use HDS tables in user accounts

* refactor: 💡 Use HDS tables in brokered-credential-sources
This commit is contained in:
NatashaKab authored and GitHub committed 2023-07-27 12:51:52 -04:00
1 parent 05d62f3da5
commit 790048a8d6
2 files changed
+81 -94

No files matched your search

@@ -26,92 +26,77 @@
<page.body>
{{#if @model.brokeredCredentialSources}}
<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 'titles.actions'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each
@model.brokeredCredentialSources
as |brokeredCredentialSource|
}}
<body.row as |row|>
<row.headerCell>
{{#if (cannot 'read credential' brokeredCredentialSource)}}
{{brokeredCredentialSource.displayName}}
{{else}}
{{#if brokeredCredentialSource.isStatic}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store.credentials.credential'
@models={{array
brokeredCredentialSource.credential_store_id
brokeredCredentialSource.id
}}
>
{{brokeredCredentialSource.displayName}}
</LinkTo>
{{else}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store.credential-libraries.credential-library'
@models={{array
brokeredCredentialSource.credential_store_id
brokeredCredentialSource.id
}}
>
{{brokeredCredentialSource.displayName}}
</LinkTo>
{{/if}}
{{/if}}
<p>{{brokeredCredentialSource.description}}</p>
</row.headerCell>
<row.cell>
<CredSourceTypeBadge @model={{brokeredCredentialSource}} />
</row.cell>
<row.cell>
<Copyable
@text={{brokeredCredentialSource.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{brokeredCredentialSource.id}}</code>
</Copyable>
</row.cell>
<row.cell>
{{#if (can 'removeCredentialSources target' @model)}}
<Rose::Dropdown
@icon='flight-icons/svg/more-horizontal-16'
@iconOnly={{true}}
@showCaret={{false}}
@dropdownRight={{true}}
@text={{t 'actions.manage'}}
as |dropdown|
<Hds::Table
@model={{@model.brokeredCredentialSources}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'form.type.label'))
(hash label=(t 'form.id.label'))
(hash label=(t 'titles.actions'))
}}
@valign='middle'
>
<:body as |B|>
<B.Tr>
<B.Td>
{{#if (cannot 'read credential' B.data)}}
{{B.data.displayName}}
{{else}}
{{#if B.data.isStatic}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store.credentials.credential'
@models={{array B.data.credential_store_id B.data.id}}
>
<dropdown.button
@style='danger'
{{on
'click'
(route-action
'removeBrokeredCredentialSource'
@model
brokeredCredentialSource
)
}}
>
{{t 'actions.remove'}}
</dropdown.button>
</Rose::Dropdown>
{{B.data.displayName}}
</LinkTo>
{{else}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store.credential-libraries.credential-library'
@models={{array B.data.credential_store_id B.data.id}}
>
{{B.data.displayName}}
</LinkTo>
{{/if}}
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{/if}}
<p>{{B.data.description}}</p>
</B.Td>
<B.Td>
<CredSourceTypeBadge @model={{B.data}} />
</B.Td>
<B.Td>
<Copyable
@text={{B.data.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{B.data.id}}</code>
</Copyable>
</B.Td>
<B.Td>
{{#if (can 'removeCredentialSources target' @model)}}
<Hds::Dropdown as |dd|>
<dd.ToggleIcon
@icon='more-horizontal'
@text={{t 'actions.manage'}}
@hasChevron={{false}}
/>
<dd.Interactive
@color='critical'
@text={{t 'actions.remove'}}
{{on
'click'
(route-action
'removeBrokeredCredentialSource' @model B.data
)
}}
/>
</Hds::Dropdown>
{{/if}}
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{else}}