Merge pull request #386 from hashicorp/refactor-notify-decorator
Refactor notify decorator
This commit is contained in:
28 files changed
+44
-25
No files matched your search
@@ -35,6 +35,24 @@ To use internationalization features, install `ember-intl` into your project:
|
|||||||
|
|
||||||
To access translations within a template, see `ember-intl` docs.
|
To access translations within a template, see `ember-intl` docs.
|
||||||
|
|
||||||
|
## Notifications
|
||||||
|
|
||||||
|
To use in-app notifications, first install `ember-notify` in your app. Then use
|
||||||
|
the notificaiton decorators to notify the user when a function or action
|
||||||
|
succeeds or fails. For example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
|
export default class ExampleRoute extends Route {
|
||||||
|
@notifyError(({ message }) => message, { catch: true })
|
||||||
|
@notifySuccess('notifications.delete-success')
|
||||||
|
async myAction() {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Confirmations
|
## Confirmations
|
||||||
|
|
||||||
This addon exposes a service to request confirmations and the component
|
This addon exposes a service to request confirmations and the component
|
||||||
|
|||||||
File renamed without changes.
@@ -0,0 +1 @@
|
|||||||
|
export { default } from 'core/decorators/notify';
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import { notifySuccess, notifyError } from '../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The change password flow is associated only with password-type auth methods.
|
* The change password flow is associated only with password-type auth methods.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { A } from '@ember/array';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeRoute extends Route {
|
export default class ScopesScopeRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeAuthMethodsRoute extends Route {
|
export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { action } from '@ember/object';
|
|||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route {
|
export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import loading from 'ember-loading/decorator';
|
|||||||
import {
|
import {
|
||||||
notifySuccess,
|
notifySuccess,
|
||||||
notifyError,
|
notifyError,
|
||||||
} from '../../../../../../../decorators/notify';
|
} from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRoute extends Route {
|
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeGroupsRoute extends Route {
|
export default class ScopesScopeGroupsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import { hash } from 'rsvp';
|
import { hash } from 'rsvp';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
|
export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { hash, all } from 'rsvp';
|
import { hash, all } from 'rsvp';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeGroupsGroupMembersRoute extends Route {
|
export default class ScopesScopeGroupsGroupMembersRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeHostCatalogsRoute extends Route {
|
export default class ScopesScopeHostCatalogsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Route {
|
export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import loading from 'ember-loading/decorator';
|
|||||||
import {
|
import {
|
||||||
notifySuccess,
|
notifySuccess,
|
||||||
notifyError,
|
notifyError,
|
||||||
} from '../../../../../../../decorators/notify';
|
} from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsRoute extends Route {
|
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import loading from 'ember-loading/decorator';
|
|||||||
import {
|
import {
|
||||||
notifySuccess,
|
notifySuccess,
|
||||||
notifyError,
|
notifyError,
|
||||||
} from '../../../../../../../decorators/notify';
|
} from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndAddHostRoute extends Route {
|
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndAddHostRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ import { confirm } from 'core/decorators/confirm';
|
|||||||
import {
|
import {
|
||||||
notifySuccess,
|
notifySuccess,
|
||||||
notifyError,
|
notifyError,
|
||||||
} from '../../../../../../../decorators/notify';
|
} from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route {
|
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route {
|
export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeRolesRoute extends Route {
|
export default class ScopesScopeRolesRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import { hash } from 'rsvp';
|
import { hash } from 'rsvp';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
|
export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
|||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeRolesRoleGrantsRoute extends Route {
|
export default class ScopesScopeRolesRoleGrantsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { action } from '@ember/object';
|
|||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
|
export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { action } from '@ember/object';
|
|||||||
import { all, hash } from 'rsvp';
|
import { all, hash } from 'rsvp';
|
||||||
import { task, timeout } from 'ember-concurrency';
|
import { task, timeout } from 'ember-concurrency';
|
||||||
import { A } from '@ember/array';
|
import { A } from '@ember/array';
|
||||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
import config from '../../../config/environment';
|
import config from '../../../config/environment';
|
||||||
|
|
||||||
const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds;
|
const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeTargetsRoute extends Route {
|
export default class ScopesScopeTargetsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import { all } from 'rsvp';
|
import { all } from 'rsvp';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route {
|
export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { action } from '@ember/object';
|
|||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeTargetsTargetHostSetsRoute extends Route {
|
export default class ScopesScopeTargetsTargetHostSetsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { confirm } from 'core/decorators/confirm';
|
import { confirm } from 'core/decorators/confirm';
|
||||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeUsersRoute extends Route {
|
export default class ScopesScopeUsersRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { action } from '@ember/object';
|
|||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { hash, all } from 'rsvp';
|
import { hash, all } from 'rsvp';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeUsersUserAccountsRoute extends Route {
|
export default class ScopesScopeUsersUserAccountsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
|||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import { all } from 'rsvp';
|
import { all } from 'rsvp';
|
||||||
import loading from 'ember-loading/decorator';
|
import loading from 'ember-loading/decorator';
|
||||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class ScopesScopeUsersUserAddAccountsRoute extends Route {
|
export default class ScopesScopeUsersUserAddAccountsRoute extends Route {
|
||||||
// =services
|
// =services
|
||||||
|
|||||||
Reference in new issue
Block a user