Icu 10370 use hds table in injected app credential sources (#1828)
* refactor: 💡 Use HDS tables in user accounts * refactor: 💡 Use HDS table in injected app credential sources --------- Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
This commit is contained in:
1 parent
ef0e3b60e7
commit
60626e49b1
2 files changed
+81
-92
No files matched your search
+71
-86
@@ -28,94 +28,79 @@
|
||||
<page.body>
|
||||
{{#if @model.injectedApplicationCredentialSources}}
|
||||
|
||||
<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.injectedApplicationCredentialSources
|
||||
as |injectedApplicationCredentialSource|
|
||||
}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>
|
||||
{{#if injectedApplicationCredentialSource.isUnknown}}
|
||||
{{injectedApplicationCredentialSource.displayName}}
|
||||
{{else}}
|
||||
{{#if injectedApplicationCredentialSource.isStatic}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.credential-stores.credential-store.credentials.credential'
|
||||
@models={{array
|
||||
injectedApplicationCredentialSource.credential_store_id
|
||||
injectedApplicationCredentialSource.id
|
||||
}}
|
||||
>
|
||||
{{injectedApplicationCredentialSource.displayName}}
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.credential-stores.credential-store.credential-libraries.credential-library'
|
||||
@models={{array
|
||||
injectedApplicationCredentialSource.credential_store_id
|
||||
injectedApplicationCredentialSource.id
|
||||
}}
|
||||
>
|
||||
{{injectedApplicationCredentialSource.displayName}}
|
||||
</LinkTo>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<p>{{injectedApplicationCredentialSource.description}}</p>
|
||||
</row.headerCell>
|
||||
<row.cell>
|
||||
<CredSourceTypeBadge
|
||||
@model={{injectedApplicationCredentialSource}}
|
||||
/>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Copyable
|
||||
@text={{injectedApplicationCredentialSource.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{injectedApplicationCredentialSource.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.injectedApplicationCredentialSources}}
|
||||
@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 B.data.isUnknown}}
|
||||
{{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
|
||||
'removeInjectedApplicationCredentialSource'
|
||||
@model
|
||||
injectedApplicationCredentialSource
|
||||
)
|
||||
}}
|
||||
>
|
||||
{{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
|
||||
'removeInjectedApplicationCredentialSource'
|
||||
@model
|
||||
B.data
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</Hds::Dropdown>
|
||||
{{/if}}
|
||||
</B.Td>
|
||||
</B.Tr>
|
||||
</:body>
|
||||
</Hds::Table>
|
||||
|
||||
{{else}}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ module(
|
||||
test('can navigate to a vault type credential library', async function (assert) {
|
||||
assert.expect(1);
|
||||
await visit(urls.injectedApplicationCredentialSources);
|
||||
await click('main tbody .rose-table-header-cell:nth-child(1) a');
|
||||
await click('main tbody tr .hds-table__td:nth-child(1) a');
|
||||
await a11yAudit();
|
||||
assert.strictEqual(currentURL(), urls.credentialLibrary);
|
||||
});
|
||||
@@ -146,7 +146,7 @@ module(
|
||||
],
|
||||
});
|
||||
await visit(urls.injectedApplicationCredentialSources);
|
||||
await click('main tbody .rose-table-header-cell:nth-child(1) a');
|
||||
await click('main tbody tr .hds-table__td:nth-child(1) a');
|
||||
await a11yAudit();
|
||||
assert.strictEqual(currentURL(), urls.credential);
|
||||
});
|
||||
@@ -346,7 +346,8 @@ module(
|
||||
const credentialLibraryCount = getCredentialLibraryCount();
|
||||
await visit(urls.injectedApplicationCredentialSources);
|
||||
assert.strictEqual(findAll('tbody tr').length, credentialLibraryCount);
|
||||
await click('tbody tr .rose-dropdown-button-danger');
|
||||
await click('.hds-dropdown-toggle-icon');
|
||||
await click('tbody tr .hds-dropdown-list-item button');
|
||||
assert.strictEqual(
|
||||
findAll('tbody tr').length,
|
||||
credentialLibraryCount - 1
|
||||
@@ -368,7 +369,8 @@ module(
|
||||
const credentialCount = getCredentialCount();
|
||||
await visit(urls.injectedApplicationCredentialSources);
|
||||
assert.strictEqual(findAll('tbody tr').length, credentialCount);
|
||||
await click('tbody tr .rose-dropdown-button-danger');
|
||||
await click('.hds-dropdown-toggle-icon');
|
||||
await click('tbody tr .hds-dropdown-list-item button');
|
||||
assert.strictEqual(findAll('tbody tr').length, credentialCount - 1);
|
||||
await visit(urls.addInjectedApplicationCredentialSources);
|
||||
assert.strictEqual(findAll('tbody tr').length, credentialCount + 1);
|
||||
@@ -406,7 +408,8 @@ module(
|
||||
const count = getCredentialLibraryCount();
|
||||
await visit(urls.injectedApplicationCredentialSources);
|
||||
assert.strictEqual(findAll('tbody tr').length, count);
|
||||
await click('tbody tr .rose-dropdown-button-danger');
|
||||
await click('.hds-dropdown-toggle-icon');
|
||||
await click('tbody tr .hds-dropdown-list-item button');
|
||||
assert.dom('[role="alert"]').isVisible();
|
||||
});
|
||||
|
||||
@@ -432,7 +435,8 @@ module(
|
||||
const count = getCredentialCount();
|
||||
await visit(urls.injectedApplicationCredentialSources);
|
||||
assert.strictEqual(findAll('tbody tr').length, count);
|
||||
await click('tbody tr .rose-dropdown-button-danger');
|
||||
await click('.hds-dropdown-toggle-icon');
|
||||
await click('tbody tr .hds-dropdown-list-item button');
|
||||
assert.dom('[role="alert"]').isVisible();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user