@projectcaluma/ember-distribution 11.0.2 → 11.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,11 @@
47
47
  <UkButton
48
48
  @type="submit"
49
49
  @color="primary"
50
- @disabled={{or (not isValid) this.send.isRunning}}
50
+ @disabled={{or
51
+ (not isValid)
52
+ this.send.isRunning
53
+ this.distribution.sendAllInquiries.isRunning
54
+ }}
51
55
  @onClick={{perform this.send validate}}
52
56
  @loading={{this.send.isRunning}}
53
57
  >{{t "caluma.distribution.edit.send"}}</UkButton>
@@ -9,6 +9,7 @@ import resumeWorkItemMutation from "@projectcaluma/ember-distribution/gql/mutati
9
9
  import inquiryEditQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-edit.graphql";
10
10
 
11
11
  export default class CdInquiryEditFormComponent extends Component {
12
+ @service distribution;
12
13
  @service notification;
13
14
  @service router;
14
15
  @service intl;
@@ -37,7 +38,9 @@ export default class CdInquiryEditFormComponent extends Component {
37
38
  @dropTask
38
39
  *send(validate) {
39
40
  try {
40
- if (!(yield validate())) return;
41
+ if (!(yield validate()) || this.distribution.sendAllInquiries.isRunning) {
42
+ return;
43
+ }
41
44
 
42
45
  yield this.apollo.mutate({
43
46
  mutation: resumeWorkItemMutation,
@@ -43,9 +43,9 @@
43
43
  class="uk-icon-button uk-button-primary"
44
44
  {{uk-tooltip (t "caluma.distribution.send")}}
45
45
  data-test-send-pending-inquiries
46
- {{on "click" (perform this.sendInquiries)}}
46
+ {{on "click" (perform this.distribution.sendAllInquiries)}}
47
47
  >
48
- {{#if this.sendInquiries.isRunning}}
48
+ {{#if this.distribution.sendAllInquiries.isRunning}}
49
49
  <UkSpinner @ratio={{0.6}} />
50
50
  {{else}}
51
51
  <UkIcon @icon="comment" />
@@ -3,7 +3,6 @@ import Component from "@glimmer/component";
3
3
  import { queryManager } from "ember-apollo-client";
4
4
  import { dropTask } from "ember-concurrency";
5
5
  import { confirm } from "ember-uikit";
6
- import { gql } from "graphql-tag";
7
6
 
8
7
  import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
9
8
  import config from "@projectcaluma/ember-distribution/config";
@@ -94,41 +93,6 @@ export default class CdNavigationControlsComponent extends Component {
94
93
  }
95
94
  }
96
95
 
97
- @dropTask
98
- *sendInquiries() {
99
- const ids = this.distribution.controls.value.send.edges
100
- .filter((edge) => edge.node.status === "SUSPENDED")
101
- .map((edge) => decodeId(edge.node.id));
102
-
103
- if (
104
- ids.length &&
105
- !(yield confirm(
106
- this.intl.t("caluma.distribution.send-confirm", { count: ids.length })
107
- ))
108
- ) {
109
- return;
110
- }
111
-
112
- try {
113
- const mutations = ids.map(
114
- (id, index) => `
115
- sendInquiry${index}: resumeWorkItem(input: { id: "${id}" }) {
116
- workItem {
117
- id
118
- status
119
- }
120
- }
121
- `
122
- );
123
-
124
- const mutation = gql`mutation SendInquiries {${mutations.join("\n")}}`;
125
-
126
- yield this.apollo.mutate({ mutation });
127
- } catch (e) {
128
- this.notification.danger(this.intl.t("caluma.distribution.send-error"));
129
- }
130
- }
131
-
132
96
  @dropTask
133
97
  *checkInquiries() {
134
98
  try {
@@ -3,6 +3,8 @@ import { tracked } from "@glimmer/tracking";
3
3
  import { queryManager, getObservable } from "ember-apollo-client";
4
4
  import { dropTask } from "ember-concurrency";
5
5
  import { trackedTask } from "ember-resources/util/ember-concurrency";
6
+ import { confirm } from "ember-uikit";
7
+ import { gql } from "graphql-tag";
6
8
  import { cached } from "tracked-toolbox";
7
9
 
8
10
  import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
@@ -172,4 +174,39 @@ export default class DistributionService extends Service {
172
174
  {}
173
175
  );
174
176
  }
177
+
178
+ @dropTask
179
+ *sendAllInquiries() {
180
+ const ids = this.controls.value.send.edges
181
+ .filter((edge) => edge.node.status === "SUSPENDED")
182
+ .map((edge) => decodeId(edge.node.id));
183
+
184
+ if (
185
+ ids.length &&
186
+ !(yield confirm(
187
+ this.intl.t("caluma.distribution.send-confirm", { count: ids.length })
188
+ ))
189
+ ) {
190
+ return;
191
+ }
192
+
193
+ try {
194
+ const mutations = ids.map(
195
+ (id, index) => `
196
+ sendInquiry${index}: resumeWorkItem(input: { id: "${id}" }) {
197
+ workItem {
198
+ id
199
+ status
200
+ }
201
+ }
202
+ `
203
+ );
204
+
205
+ const mutation = gql`mutation SendInquiries {${mutations.join("\n")}}`;
206
+
207
+ yield this.apollo.mutate({ mutation });
208
+ } catch (e) {
209
+ this.notification.danger(this.intl.t("caluma.distribution.send-error"));
210
+ }
211
+ }
175
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-distribution",
3
- "version": "11.0.2",
3
+ "version": "11.0.3",
4
4
  "description": "Ember engine for the Caluma distribution module.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -24,11 +24,11 @@
24
24
  "@embroider/macros": "^1.10.0",
25
25
  "@glimmer/component": "^1.1.2",
26
26
  "@glimmer/tracking": "^1.1.2",
27
- "@projectcaluma/ember-core": "^11.0.2",
28
- "@projectcaluma/ember-form": "^11.0.2",
29
- "@projectcaluma/ember-workflow": "^11.0.2",
27
+ "@projectcaluma/ember-core": "^11.0.3",
28
+ "@projectcaluma/ember-form": "^11.0.3",
29
+ "@projectcaluma/ember-workflow": "^11.0.3",
30
30
  "ember-apollo-client": "~4.0.2",
31
- "ember-auto-import": "^2.6.0",
31
+ "ember-auto-import": "^2.6.1",
32
32
  "ember-can": "^4.2.0",
33
33
  "ember-cli-babel": "^7.26.11",
34
34
  "ember-cli-htmlbars": "^6.2.0",
@@ -52,7 +52,7 @@
52
52
  "@ember/test-helpers": "2.7.0",
53
53
  "@embroider/test-setup": "2.1.1",
54
54
  "@faker-js/faker": "7.6.0",
55
- "@projectcaluma/ember-testing": "11.0.2",
55
+ "@projectcaluma/ember-testing": "11.0.3",
56
56
  "broccoli-asset-rev": "3.0.0",
57
57
  "concurrently": "7.6.0",
58
58
  "ember-cli": "4.9.2",
@@ -74,7 +74,7 @@
74
74
  "miragejs": "0.1.47",
75
75
  "qunit": "2.19.4",
76
76
  "qunit-dom": "2.0.0",
77
- "sass": "1.58.2",
77
+ "sass": "1.58.3",
78
78
  "webpack": "5.75.0"
79
79
  },
80
80
  "engines": {