Skip to content

Commit 25935dc

Browse files
chore: πŸ€– Add initial page layout for code editor + sidebar (#3180)
* chore: πŸ€– Add initial page layout for code editor + sidebar * test: πŸ’ add missing a11y ignores for exisitng color issue βœ… Closes: https://hashicorp.atlassian.net/browse/ICU-18460
1 parent e91bf99 commit 25935dc

File tree

10 files changed

+180
-0
lines changed

10 files changed

+180
-0
lines changed

β€Žaddons/core/translations/actions/en-us.yamlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ retry: Retry
2323
play: Play
2424
pause: Pause
2525
resume: Resume
26+
export: Export
2627
get-topic-help: Get help for this topic
2728
copy-to-clipboard: Copy to Clipboard
2829
copy-error-detail-to-clipboard: Copy error detail to clipboard

β€Žaddons/core/translations/resources/en-us.yamlβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,9 @@ role:
660660
read-only-user:
661661
name: Read-Only User
662662
description: Can view but not modify any resources
663+
edit-grants:
664+
title: Edit Grants
665+
description: Modify existing grant strings or add new grant strings to this role.
663666
scope:
664667
title: Scope
665668
title_plural: Scopes
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{!
2+
Copyright IBM Corp. 2021, 2026
3+
SPDX-License-Identifier: BUSL-1.1
4+
}}
5+
6+
<Rose::Form class='full-width' as |form|>
7+
{{! TODO: Add responsive options to @colspan once we upgrade to HDS v6.0.0}}
8+
<Hds::Layout::Grid @gap='32' as |LG|>
9+
<LG.Item @colspan={{2}}>
10+
{{! TODO: Add grants code editor. }}
11+
</LG.Item>
12+
13+
<LG.Item @colspan={{1}}>
14+
{{! TODO: Add string options and actions. }}
15+
</LG.Item>
16+
</Hds::Layout::Grid>
17+
18+
<form.actions class='margin-top-l'>
19+
<:actions>
20+
<Hds::ButtonSet>
21+
<Hds::Button type='submit' @text={{t 'actions.save'}} />
22+
<Hds::Button @text={{t 'actions.cancel'}} @color='secondary' />
23+
<Hds::Button
24+
@text={{t 'actions.export'}}
25+
@color='tertiary'
26+
@icon='upload'
27+
/>
28+
</Hds::ButtonSet>
29+
</:actions>
30+
</form.actions>
31+
</Rose::Form>

β€Žui/admin/app/components/roles/role/actions/index.hbsβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
>
4646
{{t 'resources.role.grant-templates.actions.add-grant-templates'}}
4747
</dd.Interactive>
48+
<dd.Interactive
49+
@route='scopes.scope.roles.role.edit-grants'
50+
data-test-manage-dropdown-grants
51+
>
52+
{{t 'resources.role.edit-grants.title'}}
53+
</dd.Interactive>
4854
{{/if}}
4955
{{#if perms.canDelete}}
5056
{{#if

β€Žui/admin/app/router.jsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Router.map(function () {
5858
this.route('manage-custom-scopes');
5959
this.route('manage-org-projects', { path: ':org_id' });
6060
});
61+
this.route('edit-grants');
6162
});
6263
this.route('new');
6364
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Copyright IBM Corp. 2021, 2026
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
6+
import Route from '@ember/routing/route';
7+
8+
export default class ScopesScopeRolesRoleEditGrantsRoute extends Route {}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{!
2+
Copyright IBM Corp. 2021, 2026
3+
SPDX-License-Identifier: BUSL-1.1
4+
}}
5+
6+
{{page-title (t 'resources.role.edit-grants.title')}}
7+
<Breadcrumbs::Item
8+
@text={{t 'resources.role.edit-grants.title'}}
9+
@route='scopes.scope.roles.role.edit-grants'
10+
/>
11+
12+
<Rose::Layout::Page as |page|>
13+
14+
<page.header>
15+
<Hds::PageHeader as |PH|>
16+
<PH.Breadcrumb>
17+
<Breadcrumbs::Container />
18+
</PH.Breadcrumb>
19+
<PH.Title>
20+
{{t 'resources.role.edit-grants.title'}}
21+
{{! TODO: Add correct doc link once it's created}}
22+
{{! <DocLink @doc='role.' /> }}
23+
</PH.Title>
24+
<PH.Description>
25+
{{t 'resources.role.edit-grants.description'}}
26+
</PH.Description>
27+
</Hds::PageHeader>
28+
</page.header>
29+
30+
<page.body>
31+
<Form::Role::EditGrants />
32+
</page.body>
33+
34+
</Rose::Layout::Page>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
* Copyright IBM Corp. 2021, 2026
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
6+
import { module, test } from 'qunit';
7+
import { visit, click, currentURL } from '@ember/test-helpers';
8+
import { setupApplicationTest } from 'admin/tests/helpers';
9+
import * as selectors from './selectors';
10+
import { setRunOptions } from 'ember-a11y-testing/test-support';
11+
12+
module('Acceptance | roles/edit grants', function (hooks) {
13+
setupApplicationTest(hooks);
14+
15+
const instances = {
16+
scopes: {
17+
global: null,
18+
},
19+
role: null,
20+
};
21+
22+
const urls = {
23+
role: null,
24+
editGrants: null,
25+
};
26+
27+
hooks.beforeEach(async function () {
28+
instances.scopes.global = this.server.schema.scopes.find('global');
29+
instances.role = this.server.create('role', {
30+
scope: instances.scopes.global,
31+
});
32+
urls.role = `/scopes/global/roles/${instances.role.id}`;
33+
urls.editGrants = `${urls.role}/edit-grants`;
34+
});
35+
36+
test('can navigate to edit grants for roles with proper authorization', async function (assert) {
37+
setRunOptions({
38+
rules: {
39+
'color-contrast': {
40+
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2026-02-27
41+
enabled: false,
42+
},
43+
},
44+
});
45+
46+
await visit(urls.role);
47+
48+
assert.true(instances.role.authorized_actions.includes('set-grants'));
49+
50+
await click(selectors.MANAGE_DROPDOWN_ROLES);
51+
await click(selectors.MANAGE_DROPDOWN_EDIT_GRANTS);
52+
53+
assert.strictEqual(currentURL(), urls.editGrants);
54+
});
55+
56+
test('cannot navigate to edit grants for roles without proper authorization', async function (assert) {
57+
setRunOptions({
58+
rules: {
59+
'color-contrast': {
60+
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2026-02-27
61+
enabled: false,
62+
},
63+
},
64+
});
65+
66+
instances.role.authorized_actions =
67+
instances.role.authorized_actions.filter(
68+
(action) => action !== 'set-grants',
69+
);
70+
await visit(urls.role);
71+
72+
assert.false(instances.role.authorized_actions.includes('set-grants'));
73+
74+
await click(selectors.MANAGE_DROPDOWN_ROLES);
75+
76+
assert.dom(selectors.MANAGE_DROPDOWN_EDIT_GRANTS).doesNotExist();
77+
assert.strictEqual(currentURL(), urls.role);
78+
});
79+
});

β€Žui/admin/tests/acceptance/roles/selectors.jsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const MANAGE_DROPDOWN_ADD_PRINCIPALS =
1616
'[data-test-manage-role-principals]';
1717
export const MANAGE_DROPDOWN_ADD_GRANT_TEMPLATES =
1818
'[data-test-manage-role-grant-templates]';
19+
export const MANAGE_DROPDOWN_EDIT_GRANTS = '[data-test-manage-dropdown-grants]';
1920

2021
export const ROLE_BADGE = (id) =>
2122
`tbody [data-test-role-row="${id}"] td:nth-child(2) .hds-badge__text`;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Copyright IBM Corp. 2021, 2026
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
6+
import { module, test } from 'qunit';
7+
import { setupTest } from 'ember-qunit';
8+
9+
module('Unit | Route | scopes/scope/roles/role/edit-grants', function (hooks) {
10+
setupTest(hooks);
11+
12+
test('it exists', function (assert) {
13+
let route = this.owner.lookup('route:scopes/scope/roles/role/edit-grants');
14+
assert.ok(route);
15+
});
16+
});

0 commit comments

Comments
Β (0)