refactor: 💡 move notifications to separate translation file

This commit is contained in:
Randall Morey committed 2020-09-22 15:41:02 -04:00
1 parent 59870df915
commit 63a61234dd
25 files changed
+39 -38

No files matched your search

@@ -42,7 +42,7 @@ export default class AccountChangePasswordRoute extends Route {
// redirects may abort this initial transition, resulting in a
// TransitionAborted error, which we do not want to show to the user.
await this.replaceWith('index').catch(() => {});
this.notify.success(this.intl.t('notify.save-success'));
this.notify.success(this.intl.t('notifications.save-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -54,7 +54,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
);
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
} catch (error) {
//TODO: replace with translated strings
@@ -72,7 +72,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
await authMethod.destroyRecord();
await this.transitionTo('scopes.scope.auth-methods');
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
} catch (error) {
//TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -54,7 +54,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
);
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
} catch (error) {
// TODO: replace with translated strings
@@ -72,7 +72,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
await account.destroyRecord();
await this.transitionTo('scopes.scope.auth-methods.auth-method.accounts');
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
} catch (error) {
//TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -39,7 +39,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRout
await this.replaceWith(
'scopes.scope.auth-methods.auth-method.accounts.account.set-password'
);
this.notify.success(this.intl.t('notify.save-success'));
this.notify.success(this.intl.t('notifications.save-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
+2 -2
View File
@@ -50,7 +50,7 @@ export default class ScopesScopeGroupsRoute extends Route {
await group.save();
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
this.transitionTo('scopes.scope.groups.group', group);
} catch (error) {
@@ -68,7 +68,7 @@ export default class ScopesScopeGroupsRoute extends Route {
try {
await group.destroyRecord();
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
this.transitionTo('scopes.scope.groups');
} catch (error) {
//TODO: replace with translated strings
@@ -67,7 +67,7 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
try {
await group.addMembers(userIDs);
await this.replaceWith('scopes.scope.groups.group.members');
this.notify.success(this.intl.t('notify.save-success'));
this.notify.success(this.intl.t('notifications.add-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -40,7 +40,7 @@ export default class ScopesScopeGroupsGroupMembersRoute extends Route {
try {
await group.removeMember(member.id);
await this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.remove-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
+1 -1
View File
@@ -51,7 +51,7 @@ export default class ScopesScopeOrgsRoute extends Route {
await org.save();
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
this.transitionTo('scopes.scope', org);
} catch (error) {
+2 -2
View File
@@ -66,7 +66,7 @@ export default class ScopesScopeProjectsRoute extends Route {
await project.save();
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
this.transitionTo('scopes.scope.projects.project', project);
} catch (error) {
@@ -84,7 +84,7 @@ export default class ScopesScopeProjectsRoute extends Route {
try {
await project.destroyRecord();
this.refresh();
this.notify.success('notify.delete-success');
this.notify.success('notifications.delete-success');
this.transitionTo('scopes.scope.projects');
} catch (error) {
// TODO: replace with translated strings
@@ -44,7 +44,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
await hostCatalog.save();
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog',
@@ -65,7 +65,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
try {
await project.destroyRecord();
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
this.transitionTo('scopes.scope.projects.project.host-catalogs');
} catch (error) {
// TODO: replace with translated strings
@@ -53,7 +53,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
);
await this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
} catch (error) {
// TODO: replace with translated strings
@@ -69,7 +69,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
async delete(hostSet) {
try {
await hostSet.destroyRecord();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets'
);
@@ -93,7 +93,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
await this.replaceWith(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts'
);
this.notify.success(this.intl.t('notify.save-success'));
this.notify.success(this.intl.t('notifications.add-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -45,7 +45,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
adapterOptions: { scopeID, hostCatalogID },
});
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.remove-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -53,7 +53,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
);
await this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
} catch (error) {
// TODO: replace with translated strings
@@ -70,7 +70,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
try {
await host.destroyRecord();
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.hosts'
);
@@ -75,7 +75,7 @@ export default class ScopesScopeProjectsProjectSessionsRoute extends Route {
async cancelSession(session) {
try {
await session.cancelSession();
this.notify.success(this.intl.t('notify.session-canceled'));
this.notify.success(this.intl.t('notifications.canceled-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -44,7 +44,7 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
await target.save();
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
this.transitionTo('scopes.scope.projects.project.targets.target', target);
} catch (error) {
@@ -62,7 +62,7 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
try {
await target.destroyRecord();
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
this.transitionTo('scopes.scope.projects.project.targets');
} catch (error) {
// TODO: replace with translated strings
@@ -76,7 +76,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext
this.replaceWith(
'scopes.scope.projects.project.targets.target.host-sets'
);
this.notify.success(this.intl.t('notify.save-success'));
this.notify.success(this.intl.t('notifications.add-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -57,7 +57,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extend
try {
await target.removeHostSet(hostSet.id);
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.remove-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
+2 -2
View File
@@ -50,7 +50,7 @@ export default class ScopesScopeRolesRoute extends Route {
await role.save();
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
this.transitionTo('scopes.scope.roles.role', role);
} catch (error) {
@@ -68,7 +68,7 @@ export default class ScopesScopeRolesRoute extends Route {
try {
await role.destroyRecord();
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
this.transitionTo('scopes.scope.roles');
} catch (error) {
// TODO: replace with translated strings
@@ -61,7 +61,7 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
try {
await role.addPrincipals(principalIDs);
this.replaceWith('scopes.scope.roles.role.principals');
this.notify.success(this.intl.t('notify.save-success'));
this.notify.success(this.intl.t('notifications.add-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -57,7 +57,7 @@ export default class ScopesScopeRolesRoleGrantsRoute extends Route {
async save(role) {
try {
await role.saveGrants();
this.notify.success(this.intl.t('notify.save-success'));
this.notify.success(this.intl.t('notifications.save-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -65,7 +65,7 @@ export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
const role = this.modelFor('scopes.scope.roles.role');
await role.removePrincipal(principal.id);
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.remove-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
+2 -2
View File
@@ -51,7 +51,7 @@ export default class ScopesScopeUsersRoute extends Route {
await user.save();
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success')
);
this.transitionTo('scopes.scope.users.user', user);
} catch (error) {
@@ -69,7 +69,7 @@ export default class ScopesScopeUsersRoute extends Route {
try {
await user.destroyRecord();
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.notify.success(this.intl.t('notifications.delete-success'));
this.transitionTo('scopes.scope.users');
} catch (error) {
// TODO: replace with translated strings
-5
View File
@@ -191,8 +191,3 @@ form:
new_password: New Password
started: Started
status: Status
notify:
create-success: Created succesfully.
save-success: Saved succesfully.
delete-success: Deleted successfully.
session-canceled: Session canceled.
@@ -0,0 +1,6 @@
create-success: Created succesfully.
save-success: Saved succesfully.
delete-success: Deleted successfully.
add-success: Added successfully.
remove-success: Removed successfully.
canceled-success: Canceled successfully.