install ember-fa. replaces saveOwner action with ec-task

This commit is contained in:
Seyi Adebajo 2017-11-14 01:24:43 -08:00
parent 7f5688d6d0
commit ea43bd7bb2
4 changed files with 110 additions and 17 deletions

View File

@ -3,6 +3,7 @@ import { inject } from '@ember/service';
import ComputedProperty, { filter } from '@ember/object/computed';
import { set, get, computed, getProperties } from '@ember/object';
import { assert } from '@ember/debug';
import { task, Task } from 'ember-concurrency';
import UserLookup from 'wherehows-web/services/user-lookup';
import CurrentUser from 'wherehows-web/services/current-user';
@ -134,6 +135,17 @@ export default class DatasetAuthors extends Component {
return source !== OwnerSource.Ui;
});
/**
* Invokes the external action as a dropping task
* @type {Task<Promise<Array<IOwner>>, void>}
* @memberof DatasetAuthors
*/
saveOwners: Task<Promise<Array<IOwner>>, void> = task(function*(
this: DatasetAuthors
): IterableIterator<Promise<Array<IOwner>>> {
yield get(this, 'save')(get(this, 'owners'));
}).drop();
constructor() {
super(...arguments);
const typeOfSaveAction = typeof this.save;
@ -194,14 +206,6 @@ export default class DatasetAuthors extends Component {
removeOwner: (owner: IOwner): IOwner => {
const owners = get(this, 'owners') || [];
return owners.removeObject(owner);
},
/**
* Persists the owners list by invoking the external action
*/
saveOwners: () => {
const { save } = this;
save(get(this, 'owners'));
}
};
}

View File

@ -146,8 +146,15 @@
<button
class="nacho-button nacho-button--large-inverse action-bar__item dataset-authors-save"
disabled={{requiredMinNotConfirmed}}
{{action "saveOwners"}}>
Save
onclick={{perform saveOwners}}>
{{#if saveOwners.isIdle}}
Save
{{else}}
Saving...
{{fa-icon "circle-o-notch" spin=true}}
{{/if}}
</button>
</div>

View File

@ -52,6 +52,7 @@
"ember-decorators": "^1.3.1",
"ember-export-application-global": "^2.0.0",
"ember-fetch": "^3.4.3",
"ember-font-awesome": "^4.0.0-alpha.14",
"ember-load-initializers": "^1.0.0",
"ember-math-helpers": "^2.3.0",
"ember-metrics": "^0.12.1",

View File

@ -12,6 +12,16 @@
"@glimmer/wire-format" "^0.25.3"
simple-html-tokenizer "^0.3.0"
"@glimmer/compiler@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.27.0.tgz#b24042752a53171d5cb3d9a95a29dfc0f314ed2c"
dependencies:
"@glimmer/interfaces" "^0.27.0"
"@glimmer/syntax" "^0.27.0"
"@glimmer/util" "^0.27.0"
"@glimmer/wire-format" "^0.27.0"
simple-html-tokenizer "^0.3.0"
"@glimmer/di@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@glimmer/di/-/di-0.2.0.tgz#73bfd4a6ee4148a80bf092e8a5d29bcac9d4ce7e"
@ -22,6 +32,12 @@
dependencies:
"@glimmer/wire-format" "^0.25.3"
"@glimmer/interfaces@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.27.0.tgz#473cda3c8cca636989fb310b4ffdb8f14ffae5c9"
dependencies:
"@glimmer/wire-format" "^0.27.0"
"@glimmer/node@^0.25.3":
version "0.25.3"
resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.25.3.tgz#301828e8455be141d5384b01980ed9be02984059"
@ -75,16 +91,35 @@
handlebars "^4.0.6"
simple-html-tokenizer "^0.3.0"
"@glimmer/syntax@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.27.0.tgz#e53133727cf465a8787a07c7ea660a91689ebdc2"
dependencies:
"@glimmer/interfaces" "^0.27.0"
"@glimmer/util" "^0.27.0"
handlebars "^4.0.6"
simple-html-tokenizer "^0.3.0"
"@glimmer/util@^0.25.3":
version "0.25.3"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.25.3.tgz#7cedf72947137b519658c8be34d0d5965cebe3a1"
"@glimmer/util@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.27.0.tgz#e6e26779b4b7ced899ec376c7b949d0f16f92383"
"@glimmer/wire-format@^0.25.3":
version "0.25.3"
resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.25.3.tgz#046692b3a26a30a498712266cd0bdb47d7710f37"
dependencies:
"@glimmer/util" "^0.25.3"
"@glimmer/wire-format@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.27.0.tgz#1d1729814da57b99f2dbbe718f71456259484b11"
dependencies:
"@glimmer/util" "^0.27.0"
"@types/ember-testing-helpers@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@types/ember-testing-helpers/-/ember-testing-helpers-0.0.3.tgz#1a6cfc484b63d19ddd822c87e4dd710597db17d9"
@ -1486,7 +1521,7 @@ broccoli-filter@^0.1.11:
symlink-or-copy "^1.0.1"
walk-sync "^0.1.3"
broccoli-filter@^1.2.2, broccoli-filter@^1.2.3:
broccoli-filter@^1.2.2, broccoli-filter@^1.2.3, broccoli-filter@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/broccoli-filter/-/broccoli-filter-1.2.4.tgz#409afb94b9a3a6da9fac8134e91e205f40cc7330"
dependencies:
@ -1868,6 +1903,14 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0:
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"
chalk@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba"
dependencies:
ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"
charm@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/charm/-/charm-1.0.2.tgz#8add367153a6d9a581331052c4090991da995e35"
@ -2432,6 +2475,13 @@ ember-ajax@^3.0.0:
dependencies:
ember-cli-babel "^6.0.0"
ember-ast-helpers@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/ember-ast-helpers/-/ember-ast-helpers-0.3.1.tgz#7740080aea8c29356ff88311fae04b3bc7498aeb"
dependencies:
"@glimmer/compiler" "^0.27.0"
"@glimmer/syntax" "^0.27.0"
ember-aupac-typeahead@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ember-aupac-typeahead/-/ember-aupac-typeahead-2.1.2.tgz#53cf7636d299f4811dcd59dbf4cbf2803cbb56b5"
@ -2546,7 +2596,7 @@ ember-cli-htmlbars@^1.0.10, ember-cli-htmlbars@^1.1.0, ember-cli-htmlbars@^1.1.1
json-stable-stringify "^1.0.0"
strip-bom "^2.0.0"
ember-cli-htmlbars@^2.0.1, ember-cli-htmlbars@^2.0.3:
ember-cli-htmlbars@^2.0.1, ember-cli-htmlbars@^2.0.2, ember-cli-htmlbars@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-2.0.3.tgz#e116e1500dba12f29c94b05b9ec90f52cb8bb042"
dependencies:
@ -2964,6 +3014,21 @@ ember-factory-for-polyfill@^1.1.0:
node-fetch "^2.0.0-alpha.9"
whatwg-fetch "^2.0.3"
ember-font-awesome@^4.0.0-alpha.14:
version "4.0.0-alpha.14"
resolved "https://registry.yarnpkg.com/ember-font-awesome/-/ember-font-awesome-4.0.0-alpha.14.tgz#f2f2fb12ff78b59a6a31939b45d1504900f3e73b"
dependencies:
broccoli-filter "^1.2.4"
broccoli-funnel "^1.2.0"
chalk "^1.1.3"
ember-ast-helpers "0.3.1"
ember-cli-babel "^6.3.0"
ember-cli-htmlbars "^2.0.2"
font-awesome "^4.7.0"
fs-readdir-recursive "^1.0.0"
postcss "^6.0.9"
sync-disk-cache "^1.3.2"
ember-get-config@0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/ember-get-config/-/ember-get-config-0.2.1.tgz#a1325cceefcb4534c78fc6ccb2be87a3feda6817"
@ -3858,6 +3923,10 @@ flat-cache@^1.2.1:
graceful-fs "^4.1.2"
write "^0.2.1"
font-awesome@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133"
for-in@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
@ -3956,6 +4025,10 @@ fs-readdir-recursive@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-0.1.2.tgz#315b4fb8c1ca5b8c47defef319d073dad3568059"
fs-readdir-recursive@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27"
fs-tree-diff@^0.5.2, fs-tree-diff@^0.5.3, fs-tree-diff@^0.5.4, fs-tree-diff@^0.5.6:
version "0.5.7"
resolved "https://registry.yarnpkg.com/fs-tree-diff/-/fs-tree-diff-0.5.7.tgz#315e2b098d5fe7f622880ac965b1b051868ac871"
@ -6078,6 +6151,14 @@ portfinder@^1.0.7:
debug "^2.2.0"
mkdirp "0.5.x"
postcss@^6.0.9:
version "6.0.14"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.14.tgz#5534c72114739e75d0afcf017db853099f562885"
dependencies:
chalk "^2.3.0"
source-map "^0.6.1"
supports-color "^4.4.0"
prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
@ -6864,16 +6945,16 @@ source-map@^0.5.0, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
source-map@~0.1.x:
version "0.1.43"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
dependencies:
amdefine ">=0.0.4"
source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
sourcemap-validator@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/sourcemap-validator/-/sourcemap-validator-1.0.6.tgz#abd2f1ecdae6a3c46c2c96c5f256705b2147c9c0"
@ -7070,7 +7151,7 @@ supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
supports-color@^4.0.0:
supports-color@^4.0.0, supports-color@^4.4.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b"
dependencies: