refactor: 💡 port confirmation service and components into core
This commit is contained in:
26 files changed
+59
-17
No files matched your search
+31
-1
@@ -31,10 +31,40 @@ See monorepo README for installation instructions.
|
||||
To use internationalization features, install `ember-intl` into your project:
|
||||
`ember install ember-intl`.
|
||||
|
||||
## Usage within a project
|
||||
## I18n
|
||||
|
||||
To access translations within a template, see `ember-intl` docs.
|
||||
|
||||
## Confirmations
|
||||
|
||||
This addon exposes a service to request confirmations and the component
|
||||
used to expose them to users. A decorator is exposed for convenience.
|
||||
|
||||
To guard an action on a confirmation, decorate it with `@confirm`. In this
|
||||
example, the confirmation looks up the translation under a
|
||||
`questions.delete-confirm` key.
|
||||
|
||||
```js
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
|
||||
export default class ExampleRoute extends Route {
|
||||
@confirm('questions.delete-confirm')
|
||||
async myAction() {
|
||||
// do something
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In the application template, interate over confirmations, yielding the
|
||||
confirmation instance as well as accept and deny functions which, when called,
|
||||
update the confirmation status.
|
||||
|
||||
```html
|
||||
<PendingConfirmations as |confirmation accept deny|>
|
||||
{{!-- your confirmation dialog component here --}}
|
||||
</PendingConfirmations
|
||||
```
|
||||
|
||||
## Yarn Commands
|
||||
|
||||
List of available project commands. `yarn run <command-name>`
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,9 +1,9 @@
|
||||
import Service from '@ember/service';
|
||||
import { filterBy } from '@ember/object/computed';
|
||||
import { A } from '@ember/array';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { defer, resolve } from 'rsvp';
|
||||
import { filterBy } from '@ember/object/computed';
|
||||
import config from '../config/environment';
|
||||
import config from 'ember-get-config';
|
||||
|
||||
/**
|
||||
* A simple service that emits Confirmation instances and
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'core/components/pending-confirmations';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'core/decorators/confirm';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'core/services/confirm';
|
||||
@@ -43,6 +43,7 @@
|
||||
"ember-cli-uglify": "^3.0.0",
|
||||
"ember-disable-prototype-extensions": "^1.1.3",
|
||||
"ember-export-application-global": "^2.0.1",
|
||||
"ember-get-config": "^0.3.0",
|
||||
"ember-intl": "^5.5.0",
|
||||
"ember-load-initializers": "^2.1.1",
|
||||
"ember-maybe-import-regenerator": "^0.1.6",
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -3,7 +3,7 @@ import { inject as service } from '@ember/service';
|
||||
import { A } from '@ember/array';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeRoute extends Route {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { action } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeGroupsRoute extends Route {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { action } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { hash, all } from 'rsvp';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeGroupsGroupMembersRoute extends Route {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeHostCatalogsRoute extends Route {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Route {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { hash, all } from 'rsvp';
|
||||
import { action } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../../../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import {
|
||||
notifySuccess,
|
||||
notifyError,
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeRolesRoute extends Route {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { all, hash } from 'rsvp';
|
||||
import { action } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeTargetsRoute extends Route {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { all, hash } from 'rsvp';
|
||||
import { action } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeTargetsTargetHostSetsRoute extends Route {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import loading from 'ember-loading/decorator';
|
||||
import { confirm } from '../../../decorators/confirm';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from '../../../decorators/notify';
|
||||
|
||||
export default class ScopesScopeUsersRoute extends Route {
|
||||
|
||||
@@ -8905,6 +8905,14 @@ ember-get-config@0.2.4, ember-get-config@^0.2.2, ember-get-config@^0.2.4:
|
||||
broccoli-file-creator "^1.1.1"
|
||||
ember-cli-babel "^6.3.0"
|
||||
|
||||
ember-get-config@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/ember-get-config/-/ember-get-config-0.3.0.tgz#a73a1a87b48d9dde4c66a0e52ed5260b8a48cfbd"
|
||||
integrity sha512-0e2pKzwW5lBZ4oJnvu9qHOht4sP1MWz/m3hyz8kpSoMdrlZVf62LDKZ6qfKgy8drcv5YhCMYE6QV7MhnqlrzEQ==
|
||||
dependencies:
|
||||
broccoli-file-creator "^1.1.1"
|
||||
ember-cli-babel "^7.0.0"
|
||||
|
||||
"ember-getowner-polyfill@^1.1.0 || ^2.0.0", ember-getowner-polyfill@^2.0.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/ember-getowner-polyfill/-/ember-getowner-polyfill-2.2.0.tgz#38e7dccbcac69d5ec694000329ec0b2be651d2b2"
|
||||
|
||||
Reference in new issue
Block a user