From c434fefda25ee480812306e1a6ee46af92684208 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Thu, 9 Dec 2021 09:45:24 +0000 Subject: [PATCH] ui: Fixup notifications for tokens using and topology intention saving (#11763) --- .../consul/intention/notifications/index.hbs | 24 +++++++++++++++++++ .../app/components/hashicorp-consul/index.hbs | 9 ++++++- .../app/routes/dc/services/show/topology.js | 4 ++-- .../consul-ui/app/services/feedback.js | 14 +++++------ 4 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 ui/packages/consul-ui/app/components/consul/intention/notifications/index.hbs diff --git a/ui/packages/consul-ui/app/components/consul/intention/notifications/index.hbs b/ui/packages/consul-ui/app/components/consul/intention/notifications/index.hbs new file mode 100644 index 0000000000..b6921fbe7a --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/intention/notifications/index.hbs @@ -0,0 +1,24 @@ +{{#if (eq @type 'create')}} + {{#if (eq @status 'success') }} + Your intention has been added. + {{else}} + There was an error adding your intention. + {{/if}} +{{else if (eq @type 'update') }} + {{#if (eq @status 'success') }} + Your intention has been saved. + {{else}} + There was an error saving your intention. + {{/if}} +{{ else if (eq @type 'delete')}} + {{#if (eq @status 'success') }} + Your intention was deleted. + {{else}} + There was an error deleting your intention. + {{/if}} +{{/if}} +{{#let @error.errors.firstObject as |error|}} + {{#if error.detail }} +
{{concat '(' (if error.status (concat error.status ': ')) error.detail ')'}} + {{/if}} +{{/let}} diff --git a/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs b/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs index 8a7336f9c1..b19f471dbb 100644 --- a/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs +++ b/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs @@ -39,13 +39,20 @@ There was an error, please check your SecretID/Token {{/if}} {{else}} - {{#if (eq flash.model 'token')}} + {{#if (or (eq type 'use') (eq flash.model 'token'))}} + {{else if (eq flash.model 'intention')}} + {{else if (eq flash.model 'role')}} this.success(item, action), - error: e => this.error(e, action), + success: item => this.success(item, action, undefined, modelName), + error: e => this.error(e, action, undefined, modelName), }; } @@ -39,7 +39,7 @@ export default class FeedbackService extends Service { // here.. action: getAction(), item: item, - model: model + model: model, }); } } @@ -55,7 +55,7 @@ export default class FeedbackService extends Service { type: getStatus(TYPE_SUCCESS), // and here action: getAction(), - model: model + model: model, }); } else { this.notify.add({ @@ -63,7 +63,7 @@ export default class FeedbackService extends Service { type: getStatus(TYPE_ERROR, e), action: getAction(), error: e, - model: model + model: model, }); } }