diff --git a/ui/core/app/routes/scopes/scope/groups.js b/ui/core/app/routes/scopes/scope/groups.js index 0344e53f1..8c872a9c2 100644 --- a/ui/core/app/routes/scopes/scope/groups.js +++ b/ui/core/app/routes/scopes/scope/groups.js @@ -36,10 +36,13 @@ export default class ScopesScopeGroupsRoute extends Route { */ @action async save(group) { + const { isNew } = group; try { await group.save(this.scopeAdapterOptions()); this.refresh(); - this.notify.success(this.intl.t('notify.save-success')); + this.notify.success(this.intl.t( + isNew ? 'notify.create-success' : 'notify.save-success' + )); this.transitionTo('scopes.scope.groups.group', group); } catch (error) { //TODO: replace with translated strings @@ -56,8 +59,8 @@ export default class ScopesScopeGroupsRoute extends Route { try { await group.destroyRecord(this.scopeAdapterOptions()); this.refresh(); + this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.groups'); - this.notify.success(this.intl.t('notify.group.delete-success')); } catch (error) { //TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/app/routes/scopes/scope/projects.js b/ui/core/app/routes/scopes/scope/projects.js index 775dc5ad6..09a305150 100644 --- a/ui/core/app/routes/scopes/scope/projects.js +++ b/ui/core/app/routes/scopes/scope/projects.js @@ -5,6 +5,7 @@ import { action } from '@ember/object'; export default class ScopesScopeProjectsRoute extends Route { // =services + @service intl; @service notify; // =methods @@ -52,11 +53,13 @@ export default class ScopesScopeProjectsRoute extends Route { */ @action async save(project) { + const { isNew } = project; try { await project.save(); this.refresh(); - // TODO: replace with translated strings - this.notify.success('Save succeeded.'); + this.notify.success(this.intl.t( + isNew ? 'notify.create-success' : 'notify.save-success' + )); this.transitionTo('scopes.scope.projects.project', project); } catch (error) { // TODO: replace with translated strings @@ -73,9 +76,8 @@ export default class ScopesScopeProjectsRoute extends Route { try { await project.destroyRecord(); this.refresh(); + this.notify.success('notify.delete-success'); this.transitionTo('scopes.scope.projects'); - // TODO: replace with translated strings - this.notify.success('Deleted project succesfully.'); } catch (error) { // TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/app/routes/scopes/scope/roles.js b/ui/core/app/routes/scopes/scope/roles.js index fd451c719..5b6b45106 100644 --- a/ui/core/app/routes/scopes/scope/roles.js +++ b/ui/core/app/routes/scopes/scope/roles.js @@ -36,10 +36,13 @@ export default class ScopesScopeRolesRoute extends Route { */ @action async save(role) { + const { isNew } = role; try { await role.save(this.scopeAdapterOptions()); this.refresh(); - this.notify.success(this.intl.t('notify.save-success')); + this.notify.success(this.intl.t( + isNew ? 'notify.create-success' : 'notify.save-success' + )); this.transitionTo('scopes.scope.roles.role', role); } catch (error) { // TODO: replace with translated strings @@ -56,7 +59,7 @@ export default class ScopesScopeRolesRoute extends Route { try { await role.destroyRecord(this.scopeAdapterOptions()); this.refresh(); - this.notify.success(this.intl.t('notify.role.delete-success')); + this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.roles'); } catch (error) { // TODO: replace with translated strings diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js index 8f4f65905..e70c25f2f 100644 --- a/ui/core/app/routes/scopes/scope/users.js +++ b/ui/core/app/routes/scopes/scope/users.js @@ -37,10 +37,13 @@ export default class ScopesScopeUsersRoute extends Route { */ @action async save(user) { + const { isNew } = user; try { await user.save(this.scopeAdapterOptions()); this.refresh(); - this.notify.success(this.intl.t('notify.save-success')); + this.notify.success(this.intl.t( + isNew ? 'notify.create-success' : 'notify.save-success' + )); this.transitionTo('scopes.scope.users.user', user); } catch (error) { // TODO: replace with translated strings @@ -57,8 +60,8 @@ export default class ScopesScopeUsersRoute extends Route { try { await user.destroyRecord(this.scopeAdapterOptions()); this.refresh(); + this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.users'); - this.notify.success(this.intl.t('notify.user.delete-success')); } catch (error) { // TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index e770de25c..22e522072 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -60,16 +60,9 @@ errors: server-error: We ran into a problem and could not continue. You can ask your administrator or try again later. unknown-error: Please contact your administrator or try again later. notify: - save-success: Save succeeded. - user: - create-success: User created succesfully. - delete-success: Deleted user successfully. - role: - create-success: Role created succesfully. - delete-success: Deleted role successfully. - group: - create-success: Group created succesfully. - delete-success: Deleted group successfully. + create-success: Created succesfully. + save-success: Saved succesfully. + delete-success: Deleted successfully. dev: default-org: Default Org menu-item: Menu item