Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ICU-15647] Replace Rose::Dialog with Hds::Modal in admin ui only #2623

Merged
merged 25 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c140e76
sort list
laurenolivia Dec 9, 2024
168b65f
refactor: πŸ’‘ Replace Rose::Dialog with Hds::Modal
laurenolivia Dec 11, 2024
a32d3d9
refactor targets-host-sources-test
laurenolivia Dec 12, 2024
4b33743
refactor update-test
laurenolivia Dec 12, 2024
5a3fb98
update test selectors
laurenolivia Dec 17, 2024
1262944
refactor delete test
laurenolivia Dec 17, 2024
5fbba97
refactor org scope test
laurenolivia Dec 17, 2024
90893e1
refactor delete scope and auth-method tests
laurenolivia Dec 17, 2024
8ac601e
refactor update host catalogs tests
laurenolivia Dec 17, 2024
374be12
refactor credential-stores credential update tests
laurenolivia Dec 17, 2024
9dfda3c
refactor credential-stores credentials delete tests
laurenolivia Dec 17, 2024
1a6a65f
refactor scopes update tests
laurenolivia Dec 17, 2024
1365c0f
refactor storage buckets delete test
laurenolivia Dec 17, 2024
104bacc
refactor storage buckets delete test
laurenolivia Dec 17, 2024
1c8bddf
refactor credential library update test
laurenolivia Dec 17, 2024
7c2948c
refactor targest workers test
laurenolivia Dec 17, 2024
ba4dddf
refactor workers create tags test
laurenolivia Dec 17, 2024
ad730f1
refactor global scope test
laurenolivia Dec 17, 2024
e894d27
refactor users update test
laurenolivia Dec 17, 2024
3b95181
refactor host catalogs delete test
laurenolivia Dec 17, 2024
caf5bdb
refactor credential-store update tests
laurenolivia Dec 17, 2024
9fdf553
refactor host catalogs, hosts and sets update tests
laurenolivia Dec 17, 2024
3aa5813
remove unused vars
laurenolivia Dec 18, 2024
d4d4cec
rename selectors, remove attrs
laurenolivia Dec 20, 2024
0730e67
add @onDismiss callback
laurenolivia Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions addons/rose/app/styles/rose/components/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
* SPDX-License-Identifier: BUSL-1.1
*/

// This list is sorted in ascending order to improve readability

@import 'button';
@import 'card';
laurenolivia marked this conversation as resolved.
Show resolved Hide resolved
@import 'cards';
@import 'code-editor';
@import 'dialog';
@import 'dropdown';
@import 'form';
@import 'frame';
@import 'header';
@import 'layout';
@import 'icon';
@import 'layout';
@import 'list';
@import 'card';
@import 'cards';
@import 'page-header';
@import 'metadata-list';
@import 'nav';
@import 'page-header';
@import 'toolbar';
@import 'code-editor';
@import 'metadata-list';
61 changes: 32 additions & 29 deletions ui/admin/app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -132,33 +132,36 @@
{{/if}}

<PendingConfirmations as |confirmation accept deny|>
<Rose::Dialog
@heading={{if
confirmation.options.title
(t confirmation.options.title)
(t 'actions.confirm')
}}
@dismissButtonText={{t 'actions.cancel'}}
@icon='flight-icons/svg/alert-triangle-16'
@style='warning'
@modal={{true}}
@dismiss={{deny}}
as |dialog|
>
<dialog.body>
<p>{{confirmation.text}}</p>
</dialog.body>
<dialog.footer>
<Rose::Button @style='primary' {{on 'click' accept}}>
{{if
confirmation.options.confirm
(t confirmation.options.confirm)
(t 'actions.ok')
}}
</Rose::Button>
<Rose::Button @style='secondary' {{on 'click' deny}}>
{{t 'actions.cancel'}}
</Rose::Button>
</dialog.footer>
</Rose::Dialog>
<Hds::Modal @color='warning' as |M|>
laurenolivia marked this conversation as resolved.
Show resolved Hide resolved
<M.Header @icon='alert-triangle' @onDismiss={{deny}}>
{{if
confirmation.options.title
(t confirmation.options.title)
(t 'actions.confirm')
}}
</M.Header>
<M.Body>
<Hds::Text::Body @tag='p'>
{{confirmation.text}}
</Hds::Text::Body>
</M.Body>
<M.Footer>
<Hds::ButtonSet>
<Hds::Button
@text={{if
confirmation.options.confirm
(t confirmation.options.confirm)
(t 'actions.ok')
}}
@color='primary'
{{on 'click' accept}}
/>
<Hds::Button
@text={{t 'actions.cancel'}}
@color='secondary'
{{on 'click' deny}}
/>
</Hds::ButtonSet>
</M.Footer>
</Hds::Modal>
</PendingConfirmations>
11 changes: 5 additions & 6 deletions ui/admin/tests/acceptance/auth-methods/delete-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_LDAP } from 'api/models/auth-method';
import * as commonSelectors from 'admin/tests/helpers/selectors';

module('Acceptance | auth-methods | delete', function (hooks) {
setupApplicationTest(hooks);
Expand All @@ -21,8 +22,6 @@ module('Acceptance | auth-methods | delete', function (hooks) {
let featuresService;
let getAuthMethodCount;

const DIALOG_DELETE_BTN_SELECTOR = '.rose-dialog .rose-button-primary';
const DIALOG_CANCEL_BTN_SELECTOR = '.rose-dialog .rose-button-secondary';
const ERROR_MSG_SELECTOR =
'[data-test-toast-notification] .hds-alert__description';

Expand Down Expand Up @@ -176,7 +175,7 @@ module('Acceptance | auth-methods | delete', function (hooks) {
await click(`[href="${urls.authMethod}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click(DIALOG_DELETE_BTN_SELECTOR);
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);

assert.strictEqual(currentURL(), urls.authMethods);
assert.strictEqual(getAuthMethodCount(), authMethodCount - 1);
Expand All @@ -192,7 +191,7 @@ module('Acceptance | auth-methods | delete', function (hooks) {
await click(`[href="${urls.ldapAuthMethod}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click(DIALOG_DELETE_BTN_SELECTOR);
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);

assert.strictEqual(currentURL(), urls.authMethods);
assert.strictEqual(getAuthMethodCount(), authMethodCount - 1);
Expand All @@ -207,7 +206,7 @@ module('Acceptance | auth-methods | delete', function (hooks) {
await click(`[href="${urls.authMethod}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click(DIALOG_CANCEL_BTN_SELECTOR);
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);

assert.strictEqual(currentURL(), urls.authMethod);
assert.strictEqual(getAuthMethodCount(), authMethodCount);
Expand All @@ -223,7 +222,7 @@ module('Acceptance | auth-methods | delete', function (hooks) {
await click(`[href="${urls.ldapAuthMethod}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click(DIALOG_CANCEL_BTN_SELECTOR);
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);

assert.strictEqual(currentURL(), urls.ldapAuthMethod);
assert.strictEqual(getAuthMethodCount(), authMethodCount);
Expand Down
8 changes: 4 additions & 4 deletions ui/admin/tests/acceptance/credential-library/update-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ module('Acceptance | credential-libraries | update', function (hooks) {
try {
await visit(urls.credentialLibraries);
} catch (e) {
assert.dom(commonSelectors.DIALOG_UNSAVED_CHANGES).isVisible();
assert.dom(commonSelectors.MODAL_WARNING).isVisible();

await click(commonSelectors.DIALOG_UNSAVED_CHANGES_DISCARD);
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);

assert.strictEqual(currentURL(), urls.credentialLibraries);
assert.notEqual(
Expand Down Expand Up @@ -215,9 +215,9 @@ module('Acceptance | credential-libraries | update', function (hooks) {
try {
await visit(urls.credentialLibraries);
} catch {
assert.dom(commonSelectors.DIALOG_UNSAVED_CHANGES).isVisible();
assert.dom(commonSelectors.MODAL_WARNING).isVisible();

await click(commonSelectors.DIALOG_UNSAVED_CHANGES_CANCEL);
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);

assert.strictEqual(currentURL(), urls.credentialLibrary);
assert.notEqual(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { click, currentURL, visit } from '@ember/test-helpers';
import { Response } from 'miragejs';
import * as commonSelectors from 'admin/tests/helpers/selectors';

module(
'Acceptance | credential-stores | credentials | delete',
Expand Down Expand Up @@ -182,7 +183,7 @@ module(
await visit(urls.usernamePasswordCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog footer .rose-button-primary');
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.credentials);
assert.strictEqual(
getUsernamePasswordCredentialCount(),
Expand All @@ -198,7 +199,7 @@ module(
await visit(urls.usernameKeyPairCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog footer .rose-button-primary');
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.credentials);
assert.strictEqual(
getUsernameKeyPairCredentialCount(),
Expand All @@ -213,7 +214,7 @@ module(
await visit(urls.jsonCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog footer .rose-button-primary');
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.credentials);
assert.strictEqual(getJSONCredentialCount(), jsonCredentialCount - 1);
});
Expand All @@ -226,7 +227,7 @@ module(
await visit(urls.usernamePasswordCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog footer .rose-button-secondary');
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.usernamePasswordCredential);
assert.strictEqual(
getUsernamePasswordCredentialCount(),
Expand All @@ -242,7 +243,7 @@ module(
await visit(urls.usernameKeyPairCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog footer .rose-button-secondary');
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.usernameKeyPairCredential);
assert.strictEqual(
getUsernameKeyPairCredentialCount(),
Expand All @@ -257,7 +258,7 @@ module(
await visit(urls.jsonCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog footer .rose-button-secondary');
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.jsonCredential);
assert.strictEqual(getJSONCredentialCount(), jsonCredentialCount);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';

module(
'Acceptance | credential-stores | credentials | update',
Expand Down Expand Up @@ -322,11 +323,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
assert.dom('.rose-dialog').isVisible();
await click(
'.rose-dialog-footer button:first-of-type',
'Click Discard',
);
assert.dom(commonSelectors.MODAL_WARNING).isVisible();
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentials);
assert.notEqual(
this.server.schema.credentials.where({ type: 'username_password' })
Expand All @@ -349,11 +347,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
assert.dom('.rose-dialog').isVisible();
await click(
'.rose-dialog-footer button:first-of-type',
'Click Discard',
);
assert.dom(commonSelectors.MODAL_WARNING).isVisible();
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentials);
assert.notEqual(
this.server.schema.credentials.where({ type: 'ssh_private_key' })
Expand All @@ -376,11 +371,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
assert.dom('.rose-dialog').isVisible();
await click(
'.rose-dialog-footer button:first-of-type',
'Click Discard',
);
assert.dom(commonSelectors.MODAL_WARNING).isVisible();
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentials);
assert.notEqual(
this.server.schema.credentials.where({ type: 'json' }).models[0].name,
Expand All @@ -403,8 +395,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
assert.dom('.rose-dialog').isVisible();
await click('.rose-dialog-footer button:last-child', 'Click Cancel');
assert.dom(commonSelectors.MODAL_WARNING).isVisible();
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.usernamePasswordCredential);
assert.strictEqual(find('[name="name"]').value, mockInput);
assert.strictEqual(
Expand All @@ -429,8 +421,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
assert.dom('.rose-dialog').isVisible();
await click('.rose-dialog-footer button:last-child', 'Click Cancel');
assert.dom(commonSelectors.MODAL_WARNING).isVisible();
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.usernameKeyPairCredential);
assert.strictEqual(find('[name="name"]').value, mockInput);
assert.strictEqual(
Expand All @@ -455,8 +447,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
assert.dom('.rose-dialog').isVisible();
await click('.rose-dialog-footer button:last-child', 'Click Cancel');
assert.dom(commonSelectors.MODAL_WARNING).isVisible();
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.jsonCredential);
assert.strictEqual(find('[name="name"]').value, mockInput);
assert.strictEqual(
Expand Down
16 changes: 8 additions & 8 deletions ui/admin/tests/acceptance/credential-store/update-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ module('Acceptance | credential-stores | update', function (hooks) {
try {
await visit(urls.credentialStores);
} catch (e) {
assert.ok(find('.rose-dialog'));
await click('.rose-dialog-footer button:first-child', 'Click Discard');
assert.ok(find(commonSelectors.MODAL_WARNING));
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentialStores);
assert.notEqual(
this.server.schema.credentialStores.where({ type: 'static' }).models[0]
Expand All @@ -245,8 +245,8 @@ module('Acceptance | credential-stores | update', function (hooks) {
try {
await visit(urls.credentialStores);
} catch (e) {
assert.ok(find('.rose-dialog'));
await click('.rose-dialog-footer button:first-child', 'Click Discard');
assert.ok(find(commonSelectors.MODAL_WARNING));
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentialStores);
assert.notEqual(
this.server.schema.credentialStores.where({ type: 'vault' }).models[0]
Expand All @@ -269,8 +269,8 @@ module('Acceptance | credential-stores | update', function (hooks) {
try {
await visit(urls.credentialStores);
} catch (e) {
assert.ok(find('.rose-dialog'));
await click('.rose-dialog-footer button:last-child');
assert.ok(find(commonSelectors.MODAL_WARNING));
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.staticCredentialStore);
assert.notEqual(
this.server.schema.credentialStores.where({ type: 'static' }).models[0]
Expand All @@ -293,8 +293,8 @@ module('Acceptance | credential-stores | update', function (hooks) {
try {
await visit(urls.credentialStores);
} catch (e) {
assert.ok(find('.rose-dialog'));
await click('.rose-dialog-footer button:last-child');
assert.ok(find(commonSelectors.MODAL_WARNING));
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.vaultCredentialStore);
assert.notEqual(
this.server.schema.credentialStores.where({ type: 'vault' }).models[0]
Expand Down
5 changes: 3 additions & 2 deletions ui/admin/tests/acceptance/host-catalogs/delete-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import * as commonSelectors from 'admin/tests/helpers/selectors';

module('Acceptance | host-catalogs | delete', function (hooks) {
setupApplicationTest(hooks);
Expand Down Expand Up @@ -97,7 +98,7 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
await click(`[href="${urls.hostCatalog}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog .rose-button-primary');
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);

assert
.dom('[data-test-toast-notification] .hds-alert__description')
Expand All @@ -115,7 +116,7 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
await click(`[href="${urls.hostCatalog}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog .rose-button-secondary');
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);

assert.strictEqual(getHostCatalogCount(), hostCatalogCount);
assert.strictEqual(currentURL(), urls.hostCatalog);
Expand Down
Loading
Loading