Skip to content

Commit

Permalink
@type to @color on flash messages
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Feb 8, 2023
1 parent 5a2e375 commit 0292e9a
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 28 deletions.
3 changes: 2 additions & 1 deletion ui/app/components/job-page/parts/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import classic from 'ember-classic-decorator';
@tagName('')
export default class Title extends Component {
@service router;
@service flashMessages;

job = null;
title = null;
Expand Down Expand Up @@ -37,7 +38,7 @@ export default class Title extends Component {
this.flashMessages.add({
title: 'Job Purged',
message: `You have purged ${this.job.name}`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/policy-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class PolicyEditorComponent extends Component {

this.flashMessages.add({
title: 'Policy Saved',
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
Expand All @@ -55,7 +55,7 @@ export default class PolicyEditorComponent extends Component {
this.flashMessages.add({
title: `Error creating Policy ${this.policy.name}`,
message: error,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/variable-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default class VariableFormComponent extends Component {
this.flashMessages.add({
title: 'Variable saved',
message: `${this.path} successfully saved`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
Expand All @@ -245,7 +245,7 @@ export default class VariableFormComponent extends Component {
this.flashMessages.add({
title: `Error saving ${this.path}`,
message: error,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down
4 changes: 2 additions & 2 deletions ui/app/controllers/clients/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export default class ClientController extends Controller.extend(
this.flashMessages.add({
title: 'Metadata added',
message: `${key} successfully saved`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 3000,
});
Expand All @@ -329,7 +329,7 @@ export default class ClientController extends Controller.extend(
this.flashMessages.add({
title: `Error saving Metadata`,
message: error,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down
4 changes: 2 additions & 2 deletions ui/app/controllers/jobs/run/templates/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ export default class JobsRunTemplatesManageController extends Controller {
this.flashMessages.add({
title: 'Job template deleted',
message: `${model.path} successfully deleted`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
} catch (err) {
this.flashMessages.add({
title: `Job template could not be deleted.`,
message: err,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down
4 changes: 2 additions & 2 deletions ui/app/controllers/jobs/run/templates/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class JobsRunTemplatesNewController extends Controller {
this.flashMessages.add({
title: 'Job template saved',
message: `${this.templateName} successfully saved`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
Expand All @@ -73,7 +73,7 @@ export default class JobsRunTemplatesNewController extends Controller {
this.flashMessages.add({
title: 'Job template cannot be saved.',
message: e,
type: 'error',
color: 'critical',
destroyOnClick: false,
timeout: 5000,
});
Expand Down
8 changes: 4 additions & 4 deletions ui/app/controllers/jobs/run/templates/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class JobsRunTemplatesController extends Controller {
this.flashMessages.add({
title: 'Job template saved',
message: `${this.model.path} successfully editted`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
Expand All @@ -47,7 +47,7 @@ export default class JobsRunTemplatesController extends Controller {
this.flashMessages.add({
title: 'Job template cannot be editted.',
message: e,
type: 'error',
color: 'critical',
destroyOnClick: false,
timeout: 5000,
});
Expand All @@ -61,7 +61,7 @@ export default class JobsRunTemplatesController extends Controller {
this.flashMessages.add({
title: 'Job template deleted',
message: `${this.model.path} successfully deleted`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
Expand All @@ -70,7 +70,7 @@ export default class JobsRunTemplatesController extends Controller {
this.flashMessages.add({
title: `Job template could not be deleted.`,
message: err,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down
8 changes: 4 additions & 4 deletions ui/app/controllers/policies/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class PoliciesPolicyController extends Controller {
yield this.policy.save();
this.flashMessages.add({
title: 'Policy Deleted',
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
Expand All @@ -48,7 +48,7 @@ export default class PoliciesPolicyController extends Controller {
this.flashMessages.add({
title: `Error deleting Policy ${this.policy.name}`,
message: err,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down Expand Up @@ -78,7 +78,7 @@ export default class PoliciesPolicyController extends Controller {
this.flashMessages.add({
title: 'Example Token Created',
message: `${newToken.secret}`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 30000,
customAction: {
Expand Down Expand Up @@ -106,7 +106,7 @@ export default class PoliciesPolicyController extends Controller {
yield this.refreshTokens();
this.flashMessages.add({
title: 'Token successfully deleted',
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
Expand Down
4 changes: 2 additions & 2 deletions ui/app/controllers/variables/variable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export default class VariablesVariableIndexController extends Controller {
this.flashMessages.add({
title: 'Variable deleted',
message: `${this.model.path} successfully deleted`,
type: 'success',
color: 'success',
destroyOnClick: false,
timeout: 5000,
});
} catch (err) {
this.flashMessages.add({
title: `Error deleting ${this.model.path}`,
message: err,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down
2 changes: 1 addition & 1 deletion ui/app/routes/allocations/allocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class AllocationRoute extends Route.extend(WithWatchers) {
this.flashMessages.add({
title: `Error: Not Found`,
message: `Allocation of id: ${allocId} was not found.`,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down
2 changes: 1 addition & 1 deletion ui/app/routes/jobs/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class JobsRunIndexRoute extends Route {
this.flashMessages.add({
title: `Error loading job template`,
message: error404.detail,
type: 'error',
color: 'critical',
destroyOnClick: false,
sticky: true,
});
Expand Down
2 changes: 1 addition & 1 deletion ui/app/services/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default class TokenService extends Service {
message: `Your token access expires ${moment(
this.selfToken.expirationTime
).fromNow()}`,
type: 'error',
color: 'warning',
destroyOnClick: false,
sticky: true,
customCloseAction: () => {
Expand Down
2 changes: 0 additions & 2 deletions ui/app/styles/core/notifications.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
$bonusRightPadding: 20px;

section.notifications {
position: fixed;
bottom: 20px;
Expand Down
4 changes: 2 additions & 2 deletions ui/app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<Hds::Toast
@color={{or flash.color "neutral"}}
@onDismiss={{
(queue
queue
(action close)
(action (optional flash.customCloseAction))
)

}}
as |T|>
{{#if flash.title}}
Expand Down

0 comments on commit 0292e9a

Please sign in to comment.