diff --git a/ui/admin/app/components/form/credential-store/index.hbs b/ui/admin/app/components/form/credential-store/index.hbs
index f972854c1..b70183ed3 100644
--- a/ui/admin/app/components/form/credential-store/index.hbs
+++ b/ui/admin/app/components/form/credential-store/index.hbs
@@ -2,6 +2,7 @@
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.isSaving}}
+ @error={{@model.errors.base}}
@showEditToggle={{if @model.isNew false true}}
as |form|
>
@@ -18,16 +19,38 @@
@value={{@model.name}}
@label={{t 'form.name.label'}}
@helperText={{t 'form.name.help'}}
+ @error={{@model.errors.name}}
readonly={{false}}
- />
+ as |field|
+ >
+ {{#if @model.errors.name}}
+
+ {{#each @model.errors.name as |error|}}
+ {{error.message}}
+ {{/each}}
+
+ {{/if}}
+
+ disabled={{@model.isSaving}}
+ readonly={{false}}
+ as |field|
+ >
+ {{#if @model.errors.description}}
+
+ {{#each @model.errors.description as |error|}}
+ {{error.message}}
+ {{/each}}
+
+ {{/if}}
+
{
return new Response(
@@ -118,7 +119,7 @@ module('Acceptance | credential-stores', function (hooks) {
);
});
await visit(urls.newCredentialStore);
- await click('form [type="submit"]', 'Click new'); // Issue starts here
+ await click('[type="submit"]');
assert.ok(
find('[role="alert"]').textContent.trim(),
'The request was invalid.'
@@ -153,9 +154,7 @@ module('Acceptance | credential-stores', function (hooks) {
assert.equal(find('[name="name"]').value, instances.credentialStore.name);
});
- // Skip this test for now. The request is successful
- // but we are expecting to not be.
- test.skip('saving an existing credential store with invalid fields displays error messages', async function (assert) {
+ test('saving an existing credential store with invalid fields displays error messages', async function (assert) {
assert.expect(2);
this.server.patch('/credential-stores/:id', () => {
return new Response(
@@ -190,7 +189,7 @@ module('Acceptance | credential-stores', function (hooks) {
);
});
- test.skip('can discard unsaved credential store changes via dialog', async function (assert) {
+ test('can discard unsaved credential store changes via dialog', async function (assert) {
assert.expect(5);
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
@@ -198,13 +197,14 @@ module('Acceptance | credential-stores', function (hooks) {
await visit(urls.credentialStore);
await click('form [type="button"]', 'Activate edit mode');
+ await fillIn('[name="name"]', 'random string');
assert.equal(currentURL(), urls.credentialStore);
try {
await visit(urls.credentialStores);
} catch (e) {
assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:first-child');
+ await click('.rose-dialog-footer button:first-child', 'Click Discard');
assert.equal(currentURL(), urls.credentialStores);
assert.notEqual(
this.server.schema.credentialStores.all().models[0].name,
@@ -212,4 +212,27 @@ module('Acceptance | credential-stores', function (hooks) {
);
}
});
+
+ test('can cancel discard unsaved credential store via dialog', async function (assert) {
+ assert.expect(5);
+ const confirmService = this.owner.lookup('service:confirm');
+ confirmService.enabled = true;
+ assert.notEqual(instances.credentialStore.name, 'random string');
+ await visit(urls.credentialStore);
+ await click('form [type="button"]', 'Activate edit mode');
+ await fillIn('[name="name"]', 'random string');
+ assert.equal(currentURL(), urls.credentialStore);
+
+ try {
+ await visit(urls.credentialStores);
+ } catch (e) {
+ assert.ok(find('.rose-dialog'));
+ await click('.rose-dialog-footer button:last-child');
+ assert.equal(currentURL(), urls.credentialStore);
+ assert.notEqual(
+ this.server.schema.credentialStores.all().models[0].name,
+ 'random string'
+ );
+ }
+ });
});