Icu 10209 use hds table in member list view (#1794)

* chore: 🤖 Retire rose form textarea

✅ Closes: ICU-9425

* refactor: 💡 Added the disabled feature requested by Dharini

* refactor: 💡 Rose tables to HDS tables in Users

* refactor: 💡 Removed implementation of rose tables in users

* refactor: 💡 use hds table in groups list view

* refactor: 💡 Removed the group list class Dharini mentioned

* refactor: 💡 Resolved the conflicts in user list table and group

* refactor: 💡 Use hds table in role list view

* refactor: 💡 Use HDS tables for user accounts

* refactor: 💡 Fixed the linting error

* refactor: 💡 Use HDS tables in member list view

* refactor: 💡 Use HDS tables in member list view

---------

Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>
This commit is contained in:
NatashaKabandDharini Jeeva authored and GitHub committed 2023-07-23 22:02:24 -04:00
1 parent b82d316e9b
commit b81084fb8d
2 files changed
+61 -57

No files matched your search

@@ -26,62 +26,63 @@
<page.body>
{{#if @model.members}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
<row.headerCell>{{t 'resources.scope.title'}}</row.headerCell>
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.members as |member|}}
<body.row as |row|>
<row.headerCell>
{{member.displayName}}
{{#if member.accountName}}
<br /><Hds::Badge @text={{member.accountName}} />
<Hds::Table
@model={{@model.members}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'form.id.label'))
(hash label=(t 'resources.scope.title'))
(hash label=(t 'titles.actions'))
}}
@valign='middle'
>
<:body as |B|>
<B.Tr>
<B.Td>
<span class='hds-font-weight-semibold'>{{#if
(can 'read group' B.data)
}}
{{B.data.displayName}}
{{#if B.data.accountName}}
<br /><Hds::Badge @text={{B.data.accountName}} />
{{/if}}
{{/if}}
</row.headerCell>
<row.cell>
<Copyable
@text={{member.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{member.id}}</code>
</Copyable>
</row.cell>
<row.cell>
<ScopeBadge @scope={{member.scopeModel}} />
</row.cell>
<row.cell>
{{#if (can 'removeMembers group' @model.group)}}
<Rose::Dropdown
@icon='flight-icons/svg/more-horizontal-16'
@iconOnly={{true}}
@showCaret={{false}}
@dropdownRight={{true}}
</span>
</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>
<ScopeBadge @scope={{B.data.scopeModel}} />
</B.Td>
<B.Td>
{{#if (can 'removeMembers group' @model.group)}}
<Hds::Dropdown as |dd|>
<dd.ToggleIcon
@icon='more-horizontal'
@text={{t 'actions.manage'}}
as |dropdown|
>
<dropdown.button
@style='danger'
{{on
'click'
(route-action 'removeMember' @model.group member)
}}
>
{{t 'actions.remove'}}
</dropdown.button>
</Rose::Dropdown>
{{/if}}
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
@hasChevron={{false}}
/>
<dd.Interactive
@color='critical'
@text={{t 'actions.remove'}}
{{on
'click'
(route-action 'removeMember' @model.group B.data)
}}
/>
</Hds::Dropdown>
{{/if}}
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{else}}
@@ -69,7 +69,8 @@ module('Acceptance | groups | members', function (hooks) {
assert.expect(2);
await visit(urls.members);
assert.strictEqual(findAll('tbody tr').length, membersCount);
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, membersCount - 1);
});
@@ -99,7 +100,8 @@ module('Acceptance | groups | members', function (hooks) {
});
await visit(urls.members);
assert.strictEqual(findAll('tbody tr').length, membersCount);
await click('tbody tr .rose-dropdown-button-danger');
await click('.hds-dropdown-toggle-icon');
await click('tbody tr .hds-dropdown-list-item button');
assert.ok(find('[role="alert"]'));
});
@@ -146,7 +148,8 @@ module('Acceptance | groups | members', function (hooks) {
assert.expect(4);
await visit(urls.members);
assert.strictEqual(findAll('tbody tr').length, membersCount);
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, membersCount - 1);
await click('.rose-layout-page-actions a');
assert.strictEqual(currentURL(), urls.addMembers);