From 790048a8d65d51dbd9bc086b040bb53546c80940 Mon Sep 17 00:00:00 2001 From: NatashaKab <133793701+NatashaKab@users.noreply.github.com> Date: Thu, 27 Jul 2023 12:51:52 -0400 Subject: [PATCH] Icu 10366 use hds table in brokered credential sources (#1802) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 💡 Use HDS tables in user accounts * refactor: 💡 Use HDS tables in brokered-credential-sources --- .../target/brokered-credential-sources.hbs | 153 ++++++++---------- .../brokered-credential-sources-test.js | 22 +-- 2 files changed, 81 insertions(+), 94 deletions(-) diff --git a/ui/admin/app/templates/scopes/scope/targets/target/brokered-credential-sources.hbs b/ui/admin/app/templates/scopes/scope/targets/target/brokered-credential-sources.hbs index 602edea1d..d76f32d34 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/brokered-credential-sources.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/brokered-credential-sources.hbs @@ -26,92 +26,77 @@ {{#if @model.brokeredCredentialSources}} - - - - {{t 'form.name.label'}} - {{t 'form.type.label'}} - {{t 'form.id.label'}} - {{t 'titles.actions'}} - - - - {{#each - @model.brokeredCredentialSources - as |brokeredCredentialSource| - }} - - - {{#if (cannot 'read credential' brokeredCredentialSource)}} - {{brokeredCredentialSource.displayName}} - {{else}} - {{#if brokeredCredentialSource.isStatic}} - - {{brokeredCredentialSource.displayName}} - - {{else}} - - {{brokeredCredentialSource.displayName}} - - {{/if}} - {{/if}} - -

{{brokeredCredentialSource.description}}

-
- - - - - - {{brokeredCredentialSource.id}} - - - - {{#if (can 'removeCredentialSources target' @model)}} - + <:body as |B|> + + + {{#if (cannot 'read credential' B.data)}} + {{B.data.displayName}} + {{else}} + {{#if B.data.isStatic}} + - - {{t 'actions.remove'}} - - + {{B.data.displayName}} + + {{else}} + + {{B.data.displayName}} + {{/if}} - -
- {{/each}} -
-
+ {{/if}} + +

{{B.data.description}}

+ + + + + + + {{B.data.id}} + + + + {{#if (can 'removeCredentialSources target' @model)}} + + + + + {{/if}} + + + + {{else}} diff --git a/ui/admin/tests/acceptance/targets/brokered-credential-sources-test.js b/ui/admin/tests/acceptance/targets/brokered-credential-sources-test.js index eb6e47021..34876591c 100644 --- a/ui/admin/tests/acceptance/targets/brokered-credential-sources-test.js +++ b/ui/admin/tests/acceptance/targets/brokered-credential-sources-test.js @@ -131,7 +131,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) { test('can navigate to a vault type credential library', async function (assert) { assert.expect(1); await visit(urls.brokeredCredentialSources); - 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); }); @@ -142,7 +142,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) { brokeredCredentialSourceIds: [...randomlySelectedCredentials], }); await visit(urls.brokeredCredentialSources); - 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); }); @@ -155,9 +155,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) { }); await visit(urls.brokeredCredentialSources); assert.false(featuresService.isEnabled('json-credentials')); - assert - .dom('.rose-table-row:nth-child(3)') - .includesText(jsonCredential.name); + assert.dom('.hds-table__tr:nth-child(3)').includesText(jsonCredential.name); assert.dom(`[href="${urls.jsonCredential}"]`).doesNotExist(); }); @@ -328,7 +326,8 @@ module('Acceptance | targets | brokered credential sources', function (hooks) { const availableCredentialsCount = getCredentialCount(); await visit(urls.brokeredCredentialSources); 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); await visit(urls.addBrokeredCredentialSources); assert.strictEqual( @@ -346,7 +345,8 @@ module('Acceptance | targets | brokered credential sources', function (hooks) { const availableCredentialsCount = getCredentialLibraryCount(); await visit(urls.brokeredCredentialSources); 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.addBrokeredCredentialSources); assert.strictEqual( @@ -362,7 +362,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) { (item) => item !== 'remove-credential-sources' ); await visit(urls.brokeredCredentialSources); - assert.dom('tbody tr .rose-dropdown-button-danger').doesNotExist(); + assert.dom('tbody tr .hds-dropdown-list-item button').doesNotExist(); }); test('removing a target credential library which errors displays error messages', async function (assert) { @@ -385,7 +385,8 @@ module('Acceptance | targets | brokered credential sources', function (hooks) { const count = getCredentialLibraryCount(); await visit(urls.brokeredCredentialSources); 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(); }); @@ -409,7 +410,8 @@ module('Acceptance | targets | brokered credential sources', function (hooks) { const count = getCredentialCount(); await visit(urls.brokeredCredentialSources); 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(); }); });