@projectcaluma/ember-workflow 13.2.0 → 13.2.2
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.
|
@@ -2,10 +2,12 @@ import { inject as service } from "@ember/service";
|
|
|
2
2
|
import Component from "@glimmer/component";
|
|
3
3
|
import { queryManager } from "ember-apollo-client";
|
|
4
4
|
import { dropTask } from "ember-concurrency";
|
|
5
|
+
import { trackedFunction } from "reactiveweb/function";
|
|
5
6
|
|
|
6
7
|
import cancelWorkItem from "@projectcaluma/ember-workflow/gql/mutations/cancel-work-item.graphql";
|
|
7
8
|
import completeWorkItem from "@projectcaluma/ember-workflow/gql/mutations/complete-work-item.graphql";
|
|
8
9
|
import skipWorkItem from "@projectcaluma/ember-workflow/gql/mutations/skip-work-item.graphql";
|
|
10
|
+
import workItemStatusQuery from "@projectcaluma/ember-workflow/gql/queries/work-item-status.graphql";
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Component to render a UkButton which mutates the given work item.
|
|
@@ -36,6 +38,36 @@ export default class WorkItemButtonComponent extends Component {
|
|
|
36
38
|
completeWorkItemMutation = completeWorkItem;
|
|
37
39
|
skipWorkItemMutation = skipWorkItem;
|
|
38
40
|
|
|
41
|
+
get disabled() {
|
|
42
|
+
return (
|
|
43
|
+
this.args.disabled ||
|
|
44
|
+
this.args.loading ||
|
|
45
|
+
this.mutate.isRunning ||
|
|
46
|
+
!this.#workItemHasRequiredStatus.value
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get requiredWorkItemStatus() {
|
|
51
|
+
if (this.args.mutation === "cancel") {
|
|
52
|
+
return ["READY", "SUSPENDED"];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return ["READY"];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#workItemHasRequiredStatus = trackedFunction(this, async () => {
|
|
59
|
+
const status = await this.apollo.query(
|
|
60
|
+
{
|
|
61
|
+
query: workItemStatusQuery,
|
|
62
|
+
variables: { id: this.args.workItemId },
|
|
63
|
+
fetchPolicy: "network-only",
|
|
64
|
+
},
|
|
65
|
+
"allWorkItems.edges.0.node.status",
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return this.requiredWorkItemStatus.includes(status);
|
|
69
|
+
});
|
|
70
|
+
|
|
39
71
|
@dropTask
|
|
40
72
|
*mutate() {
|
|
41
73
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-workflow",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.2",
|
|
4
4
|
"description": "Ember addon for Caluma workflow tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -18,21 +18,22 @@
|
|
|
18
18
|
"ember-composable-helpers": "^5.0.0",
|
|
19
19
|
"ember-concurrency": "^4.0.2",
|
|
20
20
|
"ember-fetch": "^8.1.2",
|
|
21
|
-
"ember-intl": "^7.
|
|
21
|
+
"ember-intl": "^7.1.1",
|
|
22
|
+
"ember-template-imports": "^4.2.0",
|
|
22
23
|
"ember-truth-helpers": "^4.0.3",
|
|
23
24
|
"ember-uikit": "^9.1.3",
|
|
24
|
-
"graphql": "^15.
|
|
25
|
+
"graphql": "^15.10.1",
|
|
25
26
|
"reactiveweb": "^1.3.0",
|
|
26
|
-
"@projectcaluma/ember-core": "^13.2.
|
|
27
|
+
"@projectcaluma/ember-core": "^13.2.2"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@ember/optional-features": "2.2.0",
|
|
30
31
|
"@ember/test-helpers": "4.0.4",
|
|
31
32
|
"@embroider/test-setup": "4.0.0",
|
|
32
|
-
"@faker-js/faker": "9.
|
|
33
|
+
"@faker-js/faker": "9.3.0",
|
|
33
34
|
"@glimmer/tracking": "1.1.2",
|
|
34
35
|
"broccoli-asset-rev": "3.0.0",
|
|
35
|
-
"ember-cli": "
|
|
36
|
+
"ember-cli": "6.1.0",
|
|
36
37
|
"ember-cli-clean-css": "3.0.0",
|
|
37
38
|
"ember-cli-code-coverage": "3.1.0",
|
|
38
39
|
"ember-cli-dependency-checker": "3.3.3",
|
|
@@ -40,18 +41,18 @@
|
|
|
40
41
|
"ember-cli-mirage": "3.0.4",
|
|
41
42
|
"ember-cli-sri": "2.1.1",
|
|
42
43
|
"ember-cli-terser": "4.0.2",
|
|
43
|
-
"ember-load-initializers": "
|
|
44
|
-
"ember-qunit": "
|
|
45
|
-
"ember-resolver": "
|
|
46
|
-
"ember-source": "
|
|
44
|
+
"ember-load-initializers": "3.0.1",
|
|
45
|
+
"ember-qunit": "9.0.1",
|
|
46
|
+
"ember-resolver": "13.1.0",
|
|
47
|
+
"ember-source": "6.1.0",
|
|
47
48
|
"ember-source-channel-url": "3.0.0",
|
|
48
49
|
"ember-try": "3.0.0",
|
|
49
50
|
"loader.js": "4.7.0",
|
|
50
|
-
"qunit": "2.
|
|
51
|
+
"qunit": "2.23.1",
|
|
51
52
|
"qunit-dom": "3.4.0",
|
|
52
|
-
"uikit": "3.
|
|
53
|
-
"webpack": "5.
|
|
54
|
-
"@projectcaluma/ember-testing": "13.2.
|
|
53
|
+
"uikit": "3.22.0",
|
|
54
|
+
"webpack": "5.97.1",
|
|
55
|
+
"@projectcaluma/ember-testing": "13.2.2"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
58
|
"ember-source": ">= 4.0.0"
|