@projectcaluma/ember-workflow 14.7.0 → 14.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { inject as service } from "@ember/service";
2
2
  import Component from "@glimmer/component";
3
3
  import { queryManager } from "ember-apollo-client";
4
- import { dropTask } from "ember-concurrency";
4
+ import { task } from "ember-concurrency";
5
5
  import { trackedTask } from "reactiveweb/ember-concurrency";
6
6
 
7
7
  import allWorkItems from "@projectcaluma/ember-workflow/gql/queries/all-work-items.graphql";
@@ -35,15 +35,9 @@ export default class TaskButtonComponent extends Component {
35
35
  @service notification;
36
36
  @service intl;
37
37
 
38
- workItem = trackedTask(this, this.fetchWorkItem, () => [
39
- this.args.task,
40
- this.args.filters,
41
- ]);
42
-
43
- @dropTask
44
- *fetchWorkItem(task, filters) {
38
+ fetchWorkItem = task({ drop: true }, async (task, filters) => {
45
39
  try {
46
- const response = yield this.apollo.query(
40
+ const response = await this.apollo.query(
47
41
  {
48
42
  query: allWorkItems,
49
43
  fetchPolicy: "network-only",
@@ -59,5 +53,10 @@ export default class TaskButtonComponent extends Component {
59
53
  console.error(e);
60
54
  this.notification.danger(this.intl.t("caluma.task-button.error"));
61
55
  }
62
- }
56
+ });
57
+
58
+ workItem = trackedTask(this, this.fetchWorkItem, () => [
59
+ this.args.task,
60
+ this.args.filters,
61
+ ]);
63
62
  }
@@ -1,7 +1,7 @@
1
1
  import { inject as service } from "@ember/service";
2
2
  import Component from "@glimmer/component";
3
3
  import { queryManager } from "ember-apollo-client";
4
- import { dropTask } from "ember-concurrency";
4
+ import { task } from "ember-concurrency";
5
5
  import { trackedFunction } from "reactiveweb/function";
6
6
 
7
7
  import cancelWorkItem from "@projectcaluma/ember-workflow/gql/mutations/cancel-work-item.graphql";
@@ -68,22 +68,21 @@ export default class WorkItemButtonComponent extends Component {
68
68
  return this.requiredWorkItemStatus.includes(status);
69
69
  });
70
70
 
71
- @dropTask
72
- *mutate() {
71
+ mutate = task({ drop: true }, async () => {
73
72
  try {
74
73
  if (typeof this.args.beforeMutate === "function") {
75
- const proceed = yield this.args.beforeMutate();
74
+ const proceed = await this.args.beforeMutate();
76
75
 
77
76
  if (proceed === false) return;
78
77
  }
79
78
 
80
- yield this.apollo.mutate({
79
+ await this.apollo.mutate({
81
80
  mutation: this[`${this.args.mutation}WorkItemMutation`],
82
81
  variables: { id: this.args.workItemId },
83
82
  });
84
83
 
85
84
  if (typeof this.args.onSuccess === "function") {
86
- yield this.args.onSuccess();
85
+ await this.args.onSuccess();
87
86
  } else {
88
87
  this.notification.success(
89
88
  this.intl.t(`caluma.mutate-work-item.success.${this.args.mutation}`),
@@ -91,7 +90,7 @@ export default class WorkItemButtonComponent extends Component {
91
90
  }
92
91
  } catch (e) {
93
92
  if (typeof this.args.onError === "function") {
94
- yield this.args.onError(e);
93
+ await this.args.onError(e);
95
94
  } else {
96
95
  console.error(e);
97
96
  this.notification.danger(
@@ -99,5 +98,5 @@ export default class WorkItemButtonComponent extends Component {
99
98
  );
100
99
  }
101
100
  }
102
- }
101
+ });
103
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-workflow",
3
- "version": "14.7.0",
3
+ "version": "14.8.0",
4
4
  "description": "Ember addon for Caluma workflow tools.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -15,14 +15,14 @@
15
15
  "ember-cli-babel": "^8.2.0",
16
16
  "ember-cli-htmlbars": "^6.3.0",
17
17
  "ember-composable-helpers": "^5.0.0",
18
- "ember-concurrency": "^4.0.2",
18
+ "ember-concurrency": "^4.0.2 || ^5.1.0",
19
19
  "ember-intl": "^7.1.1",
20
20
  "ember-template-imports": "^4.2.0",
21
21
  "ember-truth-helpers": "^4.0.3",
22
22
  "ember-uikit": "^9.1.3",
23
23
  "graphql": "^15.10.1",
24
24
  "reactiveweb": "^1.3.0",
25
- "@projectcaluma/ember-core": "^14.7.0"
25
+ "@projectcaluma/ember-core": "^14.8.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@ember/optional-features": "2.3.0",
@@ -51,7 +51,7 @@
51
51
  "qunit-dom": "3.5.0",
52
52
  "uikit": "3.25.6",
53
53
  "webpack": "5.104.1",
54
- "@projectcaluma/ember-testing": "14.7.0"
54
+ "@projectcaluma/ember-testing": "14.8.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "ember-source": ">= 4.0.0"