@projectcaluma/ember-workflow 11.0.0-beta.2 → 11.0.0-beta.3

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [@projectcaluma/ember-workflow-v11.0.0-beta.3](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-workflow-v11.0.0-beta.2...@projectcaluma/ember-workflow-v11.0.0-beta.3) (2022-02-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **task-button:** remove wrapping div around task button ([50746ec](https://github.com/projectcaluma/ember-caluma/commit/50746ecda69f46f9d72631778fb4fa37f123159c))
7
+ * **work-item-button:** update status of work item in cache after mutation ([d8c1e2a](https://github.com/projectcaluma/ember-caluma/commit/d8c1e2a4db8cf3d3bb5891be705782c6e39c8e60))
8
+
1
9
  # [@projectcaluma/ember-workflow-v11.0.0-beta.2](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-workflow-v11.0.0-beta.1...@projectcaluma/ember-workflow-v11.0.0-beta.2) (2022-01-24)
2
10
 
3
11
 
@@ -1,28 +1,26 @@
1
- <div {{did-insert (perform this.fetchWorkItem)}}>
2
- {{#if this.workItem}}
3
- <WorkItemButton
4
- ...attributes
5
- @mutation={{@mutation}}
6
- @label={{@label}}
7
- @workItemId={{this.workItem.id}}
8
- @type={{@type}}
9
- @disabled={{@disabled}}
10
- @active={{@active}}
11
- @loading={{@loading}}
12
- @color={{@color}}
13
- @size={{@size}}
14
- @title={{@title}}
15
- @onSuccess={{@onSuccess}}
16
- @onError={{@onError}}
17
- @beforeMutate={{@beforeMutate}}
18
- >
19
- {{#if (has-block)}}
20
- {{yield}}
21
- {{else if @label}}
22
- {{@label}}
23
- {{else}}
24
- {{t (concat "caluma.mutate-work-item." @mutation)}}
25
- {{/if}}
26
- </WorkItemButton>
27
- {{/if}}
28
- </div>
1
+ {{#if this.workItem.value}}
2
+ <WorkItemButton
3
+ ...attributes
4
+ @mutation={{@mutation}}
5
+ @label={{@label}}
6
+ @workItemId={{decode-id this.workItem.value.id}}
7
+ @type={{@type}}
8
+ @disabled={{@disabled}}
9
+ @active={{@active}}
10
+ @loading={{@loading}}
11
+ @color={{@color}}
12
+ @size={{@size}}
13
+ @title={{@title}}
14
+ @onSuccess={{@onSuccess}}
15
+ @onError={{@onError}}
16
+ @beforeMutate={{@beforeMutate}}
17
+ >
18
+ {{#if (has-block)}}
19
+ {{yield}}
20
+ {{else if @label}}
21
+ {{@label}}
22
+ {{else}}
23
+ {{t (concat "caluma.mutate-work-item." @mutation)}}
24
+ {{/if}}
25
+ </WorkItemButton>
26
+ {{/if}}
@@ -1,7 +1,8 @@
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 { lastValue, dropTask } from "ember-concurrency";
4
+ import { dropTask } from "ember-concurrency";
5
+ import { useTask } from "ember-resources";
5
6
 
6
7
  import allWorkItems from "@projectcaluma/ember-workflow/gql/queries/all-work-items.graphql";
7
8
 
@@ -34,20 +35,19 @@ export default class TaskButtonComponent extends Component {
34
35
  @service notification;
35
36
  @service intl;
36
37
 
37
- @lastValue("fetchWorkItem") workItem;
38
+ workItem = useTask(this, this.fetchWorkItem, () => [
39
+ this.args.task,
40
+ this.args.filters,
41
+ ]);
38
42
 
39
43
  @dropTask
40
- *fetchWorkItem() {
44
+ *fetchWorkItem(task, filters) {
41
45
  try {
42
46
  const response = yield this.apollo.query(
43
47
  {
44
48
  query: allWorkItems,
45
49
  variables: {
46
- filter: [
47
- { task: this.args.task },
48
- { status: "READY" },
49
- ...(this.args.filters || []),
50
- ],
50
+ filter: [{ task }, { status: "READY" }, ...(filters ?? [])],
51
51
  },
52
52
  },
53
53
  "allWorkItems.edges"
@@ -1,5 +1,8 @@
1
1
  mutation CancelWorkItem($id: ID!) {
2
2
  cancelWorkItem(input: { id: $id }) {
3
- clientMutationId
3
+ workItem {
4
+ id
5
+ status
6
+ }
4
7
  }
5
8
  }
@@ -1,5 +1,8 @@
1
1
  mutation CompleteWorkItem($id: ID!) {
2
2
  completeWorkItem(input: { id: $id }) {
3
- clientMutationId
3
+ workItem {
4
+ id
5
+ status
6
+ }
4
7
  }
5
8
  }
@@ -1,5 +1,8 @@
1
1
  mutation SkipWorkItem($id: ID!) {
2
2
  skipWorkItem(input: { id: $id }) {
3
- clientMutationId
3
+ workItem {
4
+ id
5
+ status
6
+ }
4
7
  }
5
8
  }
@@ -1,5 +1,5 @@
1
1
  query AllWorkItems($filter: [WorkItemFilterSetType]!) {
2
- allWorkItems(filter: $filter) {
2
+ allWorkItems(filter: $filter, first: 1) {
3
3
  edges {
4
4
  node {
5
5
  id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-workflow",
3
- "version": "11.0.0-beta.2",
3
+ "version": "11.0.0-beta.3",
4
4
  "description": "Ember addon for Caluma workflow tools.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -24,8 +24,9 @@
24
24
  "ember-cli-htmlbars": "^6.0.1",
25
25
  "ember-composable-helpers": "^5.0.0",
26
26
  "ember-fetch": "^8.1.1",
27
+ "ember-resources": "^4.2.0",
27
28
  "ember-truth-helpers": "^3.0.0",
28
- "ember-uikit": "^5.0.0-beta.3",
29
+ "ember-uikit": "^5.0.0-beta.9",
29
30
  "graphql": "^15.8.0",
30
31
  "moment": "^2.29.1"
31
32
  },
@@ -33,7 +34,7 @@
33
34
  "@ember/optional-features": "2.0.0",
34
35
  "@ember/test-helpers": "2.6.0",
35
36
  "@embroider/test-setup": "1.0.0",
36
- "@faker-js/faker": "6.0.0-alpha.3",
37
+ "@faker-js/faker": "6.0.0-alpha.5",
37
38
  "@projectcaluma/ember-testing": "10.2.0-beta.2",
38
39
  "broccoli-asset-rev": "3.0.0",
39
40
  "ember-cli": "3.28.5",
@@ -56,7 +57,7 @@
56
57
  "npm-run-all": "4.1.5",
57
58
  "qunit": "2.17.2",
58
59
  "qunit-dom": "2.0.0",
59
- "webpack": "5.67.0"
60
+ "webpack": "5.68.0"
60
61
  },
61
62
  "engines": {
62
63
  "node": "12.* || 14.* || >= 16"