@projectcaluma/ember-distribution 14.7.0 → 14.7.1
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/addon/components/cd-inquiry-answer-form.js +35 -34
- package/addon/components/cd-inquiry-dialog/inquiry-part.js +14 -17
- package/addon/components/cd-inquiry-dialog.js +15 -17
- package/addon/components/cd-inquiry-edit-form.js +11 -13
- package/addon/components/cd-inquiry-new-form/bulk-edit.js +5 -6
- package/addon/components/cd-inquiry-new-form/select.js +16 -18
- package/addon/components/cd-navigation/controls.js +16 -19
- package/addon/services/distribution.js +18 -22
- package/package.json +6 -6
|
@@ -3,7 +3,7 @@ import { inject as service } from "@ember/service";
|
|
|
3
3
|
import Component from "@glimmer/component";
|
|
4
4
|
import { tracked } from "@glimmer/tracking";
|
|
5
5
|
import { queryManager } from "ember-apollo-client";
|
|
6
|
-
import {
|
|
6
|
+
import { task } from "ember-concurrency";
|
|
7
7
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
8
8
|
|
|
9
9
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
|
@@ -26,10 +26,6 @@ export default class CdInquiryAnswerFormComponent extends Component {
|
|
|
26
26
|
@inquiryAnswerStatus({ inquiryProperty: "inquiry" }) answerStatus;
|
|
27
27
|
@tracked isExpanded = !this.config.ui.small;
|
|
28
28
|
|
|
29
|
-
_inquiry = trackedTask(this, this.fetchInquiryAnswer, () => [
|
|
30
|
-
this.args.inquiry,
|
|
31
|
-
]);
|
|
32
|
-
|
|
33
29
|
get inquiry() {
|
|
34
30
|
return this._inquiry.value?.[0]?.node;
|
|
35
31
|
}
|
|
@@ -68,9 +64,8 @@ export default class CdInquiryAnswerFormComponent extends Component {
|
|
|
68
64
|
this.isExpanded = !this.isExpanded;
|
|
69
65
|
}
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return yield this.apollo.watchQuery(
|
|
67
|
+
fetchInquiryAnswer = task({ drop: true }, async (inquiry) => {
|
|
68
|
+
return await this.apollo.watchQuery(
|
|
74
69
|
{
|
|
75
70
|
query: inquiryAnswerQuery,
|
|
76
71
|
variables: {
|
|
@@ -82,33 +77,39 @@ export default class CdInquiryAnswerFormComponent extends Component {
|
|
|
82
77
|
},
|
|
83
78
|
"allWorkItems.edges",
|
|
84
79
|
);
|
|
85
|
-
}
|
|
80
|
+
});
|
|
86
81
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (typeof validate === "function" && !(yield validate())) return;
|
|
82
|
+
_inquiry = trackedTask(this, this.fetchInquiryAnswer, () => [
|
|
83
|
+
this.args.inquiry,
|
|
84
|
+
]);
|
|
91
85
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
buttonTasks: Object.keys(this.config.inquiry.answer.buttons),
|
|
98
|
-
checkTask: this.config.controls.checkTask,
|
|
99
|
-
createTask: this.config.controls.createTask,
|
|
100
|
-
inquiryTask: this.config.inquiry.task,
|
|
101
|
-
currentGroup: String(this.calumaOptions.currentGroupId),
|
|
102
|
-
answerInfoQuestions: this.config.inquiry.answer.infoQuestions,
|
|
103
|
-
willCompleteInquiry,
|
|
104
|
-
},
|
|
105
|
-
});
|
|
86
|
+
completeWorkItem = task(
|
|
87
|
+
{ drop: true },
|
|
88
|
+
async (workItem, willCompleteInquiry, validate = () => true) => {
|
|
89
|
+
try {
|
|
90
|
+
if (typeof validate === "function" && !(await validate())) return;
|
|
106
91
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
92
|
+
await this.apollo.mutate({
|
|
93
|
+
mutation: completeInquiryWorkItemMutation,
|
|
94
|
+
variables: {
|
|
95
|
+
workItem,
|
|
96
|
+
statusQuestion: this.config.inquiry.answer.statusQuestion,
|
|
97
|
+
buttonTasks: Object.keys(this.config.inquiry.answer.buttons),
|
|
98
|
+
checkTask: this.config.controls.checkTask,
|
|
99
|
+
createTask: this.config.controls.createTask,
|
|
100
|
+
inquiryTask: this.config.inquiry.task,
|
|
101
|
+
currentGroup: String(this.calumaOptions.currentGroupId),
|
|
102
|
+
answerInfoQuestions: this.config.inquiry.answer.infoQuestions,
|
|
103
|
+
willCompleteInquiry,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
await this.router.transitionTo("inquiry.index");
|
|
108
|
+
} catch {
|
|
109
|
+
this.notification.danger(
|
|
110
|
+
this.intl.t("caluma.distribution.answer.complete-error"),
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
);
|
|
114
115
|
}
|
|
@@ -2,7 +2,7 @@ import { inject as service } from "@ember/service";
|
|
|
2
2
|
import { isEmpty } from "@ember/utils";
|
|
3
3
|
import Component from "@glimmer/component";
|
|
4
4
|
import { queryManager } from "ember-apollo-client";
|
|
5
|
-
import {
|
|
5
|
+
import { task } from "ember-concurrency";
|
|
6
6
|
import { confirm } from "ember-uikit";
|
|
7
7
|
import { DateTime } from "luxon";
|
|
8
8
|
|
|
@@ -81,17 +81,16 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
|
|
|
81
81
|
: null;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
*withdraw(e) {
|
|
84
|
+
withdraw = task({ drop: true }, async (e) => {
|
|
86
85
|
e.preventDefault();
|
|
87
86
|
|
|
88
87
|
/* istanbul ignore next */
|
|
89
|
-
if (!(
|
|
88
|
+
if (!(await confirm(this.intl.t("caluma.distribution.withdraw.confirm")))) {
|
|
90
89
|
return;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
try {
|
|
94
|
-
|
|
93
|
+
await this.apollo.mutate({
|
|
95
94
|
mutation: withdrawInquiryMutation,
|
|
96
95
|
variables: {
|
|
97
96
|
workItem: decodeId(this.args.inquiry.id),
|
|
@@ -102,15 +101,14 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
|
|
|
102
101
|
this.intl.t("caluma.distribution.withdraw.error"),
|
|
103
102
|
);
|
|
104
103
|
}
|
|
105
|
-
}
|
|
104
|
+
});
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
*reopen(e) {
|
|
106
|
+
reopen = task({ drop: true }, async (e) => {
|
|
109
107
|
e.preventDefault();
|
|
110
108
|
|
|
111
109
|
/* istanbul ignore next */
|
|
112
110
|
if (
|
|
113
|
-
!(
|
|
111
|
+
!(await confirm(
|
|
114
112
|
this.intl.t("caluma.distribution.reopen-inquiry.confirm"),
|
|
115
113
|
))
|
|
116
114
|
) {
|
|
@@ -118,7 +116,7 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
|
|
|
118
116
|
}
|
|
119
117
|
|
|
120
118
|
try {
|
|
121
|
-
|
|
119
|
+
await this.apollo.mutate({
|
|
122
120
|
mutation: reopenInquiryMutation,
|
|
123
121
|
variables: {
|
|
124
122
|
workItem: decodeId(this.args.inquiry.id),
|
|
@@ -131,18 +129,17 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
|
|
|
131
129
|
this.intl.t("caluma.distribution.reopen-inquiry.error"),
|
|
132
130
|
);
|
|
133
131
|
}
|
|
134
|
-
}
|
|
132
|
+
});
|
|
135
133
|
|
|
136
|
-
|
|
137
|
-
*sendReminder(e) {
|
|
134
|
+
sendReminder = task({ drop: true }, async (e) => {
|
|
138
135
|
e.preventDefault();
|
|
139
136
|
|
|
140
|
-
if (!(
|
|
137
|
+
if (!(await confirm(this.intl.t("caluma.distribution.reminder.confirm")))) {
|
|
141
138
|
return;
|
|
142
139
|
}
|
|
143
140
|
|
|
144
141
|
try {
|
|
145
|
-
|
|
142
|
+
await this.calumaOptions.sendReminderDistributionInquiry(
|
|
146
143
|
decodeId(this.args.inquiry.id),
|
|
147
144
|
);
|
|
148
145
|
|
|
@@ -150,7 +147,7 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
|
|
|
150
147
|
this.intl.t("caluma.distribution.reminder.success"),
|
|
151
148
|
);
|
|
152
149
|
|
|
153
|
-
|
|
150
|
+
await this.apollo.mutate({
|
|
154
151
|
mutation: updateInquiryMetaMutation,
|
|
155
152
|
variables: {
|
|
156
153
|
inquiry: decodeId(this.args.inquiry.id),
|
|
@@ -168,5 +165,5 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
|
|
|
168
165
|
this.intl.t("caluma.distribution.reminder.error"),
|
|
169
166
|
);
|
|
170
167
|
}
|
|
171
|
-
}
|
|
168
|
+
});
|
|
172
169
|
}
|
|
@@ -2,7 +2,7 @@ import { next } from "@ember/runloop";
|
|
|
2
2
|
import { inject as service } from "@ember/service";
|
|
3
3
|
import Component from "@glimmer/component";
|
|
4
4
|
import { queryManager, getObservable } from "ember-apollo-client";
|
|
5
|
-
import {
|
|
5
|
+
import { task } from "ember-concurrency";
|
|
6
6
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
7
7
|
|
|
8
8
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
|
@@ -33,16 +33,8 @@ export default class CdInquiryDialogComponent extends Component {
|
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
this.
|
|
38
|
-
this.args.to,
|
|
39
|
-
this.distribution.caseId,
|
|
40
|
-
this.config,
|
|
41
|
-
]);
|
|
42
|
-
|
|
43
|
-
@dropTask
|
|
44
|
-
*fetchDialog(from, to, caseId, config) {
|
|
45
|
-
const response = yield this.apollo.watchQuery({
|
|
36
|
+
fetchDialog = task({ drop: true }, async (from, to, caseId, config) => {
|
|
37
|
+
const response = await this.apollo.watchQuery({
|
|
46
38
|
query: inquiryDialogQuery,
|
|
47
39
|
fetchPolicy: "cache-and-network",
|
|
48
40
|
variables: {
|
|
@@ -77,18 +69,24 @@ export default class CdInquiryDialogComponent extends Component {
|
|
|
77
69
|
});
|
|
78
70
|
|
|
79
71
|
return response;
|
|
80
|
-
}
|
|
72
|
+
});
|
|
81
73
|
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
_inquiries = trackedTask(this, this.fetchDialog, () => [
|
|
75
|
+
this.args.from,
|
|
76
|
+
this.args.to,
|
|
77
|
+
this.distribution.caseId,
|
|
78
|
+
this.config,
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
createInquiry = task({ drop: true }, async (e) => {
|
|
84
82
|
e.preventDefault();
|
|
85
83
|
|
|
86
|
-
|
|
84
|
+
await this.distribution.createInquiry.perform([this.args.to]);
|
|
87
85
|
|
|
88
|
-
|
|
86
|
+
await getObservable(this._inquiries.value).refetch();
|
|
89
87
|
|
|
90
88
|
next(this, "transitionToLatestInquiry");
|
|
91
|
-
}
|
|
89
|
+
});
|
|
92
90
|
|
|
93
91
|
transitionToLatestInquiry() {
|
|
94
92
|
this.router.transitionTo(
|
|
@@ -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 {
|
|
4
|
+
import { task } from "ember-concurrency";
|
|
5
5
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
6
6
|
|
|
7
7
|
import config from "@projectcaluma/ember-distribution/config";
|
|
@@ -18,40 +18,38 @@ export default class CdInquiryEditFormComponent extends Component {
|
|
|
18
18
|
|
|
19
19
|
@queryManager apollo;
|
|
20
20
|
|
|
21
|
-
_inquiry = trackedTask(this, this.fetchInquiry, () => [this.args.inquiry]);
|
|
22
|
-
|
|
23
21
|
get inquiry() {
|
|
24
22
|
return this._inquiry.value?.[0]?.node;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return yield this.apollo.watchQuery(
|
|
25
|
+
fetchInquiry = task({ drop: true }, async (inquiry) => {
|
|
26
|
+
return await this.apollo.watchQuery(
|
|
30
27
|
{
|
|
31
28
|
query: inquiryEditQuery,
|
|
32
29
|
variables: { inquiry },
|
|
33
30
|
},
|
|
34
31
|
"allWorkItems.edges",
|
|
35
32
|
);
|
|
36
|
-
}
|
|
33
|
+
});
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
_inquiry = trackedTask(this, this.fetchInquiry, () => [this.args.inquiry]);
|
|
36
|
+
|
|
37
|
+
send = task({ drop: true }, async (validate) => {
|
|
40
38
|
try {
|
|
41
|
-
if (!(
|
|
39
|
+
if (!(await validate()) || this.distribution.sendAllInquiries.isRunning) {
|
|
42
40
|
return;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
await this.apollo.mutate({
|
|
46
44
|
mutation: resumeWorkItemMutation,
|
|
47
45
|
variables: { workItem: this.args.inquiry },
|
|
48
46
|
});
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
await this.router.transitionTo("inquiry.index");
|
|
51
49
|
} catch {
|
|
52
50
|
this.notification.danger(
|
|
53
51
|
this.intl.t("caluma.distribution.edit.send-error"),
|
|
54
52
|
);
|
|
55
53
|
}
|
|
56
|
-
}
|
|
54
|
+
});
|
|
57
55
|
}
|
|
@@ -5,7 +5,7 @@ import { next } from "@ember/runloop";
|
|
|
5
5
|
import { inject as service } from "@ember/service";
|
|
6
6
|
import Component from "@glimmer/component";
|
|
7
7
|
import { queryManager } from "ember-apollo-client";
|
|
8
|
-
import {
|
|
8
|
+
import { task } from "ember-concurrency";
|
|
9
9
|
import { trackedFunction } from "reactiveweb/function";
|
|
10
10
|
|
|
11
11
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
|
@@ -90,18 +90,17 @@ export default class CdInquiryNewFormBulkEditComponent extends Component {
|
|
|
90
90
|
this.answers[field.question.slug] = value;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
*submit(validate, e) {
|
|
93
|
+
submit = task({ drop: true }, async (validate, e) => {
|
|
95
94
|
e.preventDefault();
|
|
96
95
|
|
|
97
|
-
if (!this.args.selectedGroups.length || !(
|
|
96
|
+
if (!this.args.selectedGroups.length || !(await validate())) return;
|
|
98
97
|
|
|
99
|
-
|
|
98
|
+
await this.distribution.createInquiry.perform(this.args.selectedGroups, {
|
|
100
99
|
answers: this.answers,
|
|
101
100
|
});
|
|
102
101
|
|
|
103
102
|
next(this, "transitionToFirstInquiryOfGroup", this.args.selectedGroups[0]);
|
|
104
|
-
}
|
|
103
|
+
});
|
|
105
104
|
|
|
106
105
|
transitionToFirstInquiryOfGroup(group) {
|
|
107
106
|
const firstCreated = this.distribution.navigation.value.controlling.edges
|
|
@@ -2,7 +2,7 @@ import { action } from "@ember/object";
|
|
|
2
2
|
import { inject as service } from "@ember/service";
|
|
3
3
|
import { macroCondition, isTesting } from "@embroider/macros";
|
|
4
4
|
import Component from "@glimmer/component";
|
|
5
|
-
import { timeout,
|
|
5
|
+
import { timeout, task } from "ember-concurrency";
|
|
6
6
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
7
7
|
|
|
8
8
|
import config from "@projectcaluma/ember-distribution/config";
|
|
@@ -37,14 +37,6 @@ export default class CdInquiryNewFormSelectComponent extends Component {
|
|
|
37
37
|
}));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
groups = trackedTask(this, this.fetchGroups, () => [
|
|
41
|
-
// if we want to show all services we need to fetch all groups
|
|
42
|
-
this.showAllServices
|
|
43
|
-
? Object.keys(this.config.new.types)
|
|
44
|
-
: this.args.selectedTypes,
|
|
45
|
-
this.args.search,
|
|
46
|
-
]);
|
|
47
|
-
|
|
48
40
|
@action
|
|
49
41
|
updateSelectedTypes(type, e) {
|
|
50
42
|
e.preventDefault();
|
|
@@ -59,26 +51,24 @@ export default class CdInquiryNewFormSelectComponent extends Component {
|
|
|
59
51
|
);
|
|
60
52
|
}
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
*updateSearch(e) {
|
|
54
|
+
updateSearch = task({ restartable: true }, async (e) => {
|
|
64
55
|
e.preventDefault();
|
|
65
56
|
|
|
66
57
|
/* istanbul ignore next */
|
|
67
58
|
if (macroCondition(isTesting())) {
|
|
68
59
|
// no timeout
|
|
69
60
|
} else {
|
|
70
|
-
|
|
61
|
+
await timeout(500);
|
|
71
62
|
}
|
|
72
63
|
|
|
73
64
|
this.args.onChangeSearch(e.target.value);
|
|
74
|
-
}
|
|
65
|
+
});
|
|
75
66
|
|
|
76
|
-
|
|
77
|
-
*fetchGroups(types, search) {
|
|
67
|
+
fetchGroups = task({ restartable: true }, async (types, search) => {
|
|
78
68
|
// https://github.com/ember-cli/eslint-plugin-ember/issues/1413
|
|
79
|
-
|
|
69
|
+
await Promise.resolve();
|
|
80
70
|
|
|
81
|
-
const typedGroups =
|
|
71
|
+
const typedGroups = await this.calumaOptions.fetchTypedGroups(
|
|
82
72
|
types,
|
|
83
73
|
search,
|
|
84
74
|
);
|
|
@@ -93,5 +83,13 @@ export default class CdInquiryNewFormSelectComponent extends Component {
|
|
|
93
83
|
}));
|
|
94
84
|
})
|
|
95
85
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
96
|
-
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
groups = trackedTask(this, this.fetchGroups, () => [
|
|
89
|
+
// if we want to show all services we need to fetch all groups
|
|
90
|
+
this.showAllServices
|
|
91
|
+
? Object.keys(this.config.new.types)
|
|
92
|
+
: this.args.selectedTypes,
|
|
93
|
+
this.args.search,
|
|
94
|
+
]);
|
|
97
95
|
}
|
|
@@ -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 {
|
|
4
|
+
import { task } from "ember-concurrency";
|
|
5
5
|
import { confirm } from "ember-uikit";
|
|
6
6
|
|
|
7
7
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
|
@@ -19,13 +19,12 @@ export default class CdNavigationControlsComponent extends Component {
|
|
|
19
19
|
@queryManager apollo;
|
|
20
20
|
@config config;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
*completeDistribution() {
|
|
22
|
+
completeDistribution = task({ drop: true }, async () => {
|
|
24
23
|
try {
|
|
25
24
|
let confirmText = this.intl.t("caluma.distribution.skip-confirm");
|
|
26
25
|
|
|
27
26
|
if (this.distribution.hasInquiries) {
|
|
28
|
-
const incompleteInquiries =
|
|
27
|
+
const incompleteInquiries = await this.apollo.query(
|
|
29
28
|
{
|
|
30
29
|
query: incompleteInquiriesQuery,
|
|
31
30
|
variables: {
|
|
@@ -44,35 +43,34 @@ export default class CdNavigationControlsComponent extends Component {
|
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
if (!(
|
|
46
|
+
if (!(await confirm(confirmText))) {
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
const completeDistributionWorkItem =
|
|
52
51
|
this.distribution.controls.value.complete.edges?.[0]?.node.id;
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
await this.apollo.mutate({
|
|
55
54
|
mutation: completeWorkItemMutation,
|
|
56
55
|
variables: {
|
|
57
56
|
workItem: completeDistributionWorkItem,
|
|
58
57
|
},
|
|
59
58
|
});
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
await this.config.hooks.postCompleteDistribution?.();
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
await this.distribution.refetch();
|
|
64
63
|
this.router.transitionTo("index");
|
|
65
64
|
} catch {
|
|
66
65
|
this.notification.danger(
|
|
67
66
|
this.intl.t("caluma.distribution.complete-error"),
|
|
68
67
|
);
|
|
69
68
|
}
|
|
70
|
-
}
|
|
69
|
+
});
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
*reopenDistribution() {
|
|
71
|
+
reopenDistribution = task({ drop: true }, async () => {
|
|
74
72
|
try {
|
|
75
|
-
if (!(
|
|
73
|
+
if (!(await confirm(this.intl.t("caluma.distribution.reopen-confirm")))) {
|
|
76
74
|
return;
|
|
77
75
|
}
|
|
78
76
|
|
|
@@ -80,23 +78,22 @@ export default class CdNavigationControlsComponent extends Component {
|
|
|
80
78
|
this.distribution.controls.value?.case.edges[0]?.node.parentWorkItem.id,
|
|
81
79
|
);
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
await this.apollo.mutate({
|
|
84
82
|
mutation: reopenDistributionMutation,
|
|
85
83
|
variables: {
|
|
86
84
|
workItem: distributionWorkItemId,
|
|
87
85
|
},
|
|
88
86
|
});
|
|
89
87
|
|
|
90
|
-
|
|
88
|
+
await this.distribution.refetchControls();
|
|
91
89
|
} catch {
|
|
92
90
|
this.notification.danger(this.intl.t("caluma.distribution.reopen-error"));
|
|
93
91
|
}
|
|
94
|
-
}
|
|
92
|
+
});
|
|
95
93
|
|
|
96
|
-
|
|
97
|
-
*checkInquiries() {
|
|
94
|
+
checkInquiries = task({ drop: true }, async () => {
|
|
98
95
|
try {
|
|
99
|
-
|
|
96
|
+
await this.apollo.mutate({
|
|
100
97
|
mutation: completeWorkItemMutation,
|
|
101
98
|
variables: {
|
|
102
99
|
workItem: decodeId(
|
|
@@ -109,5 +106,5 @@ export default class CdNavigationControlsComponent extends Component {
|
|
|
109
106
|
this.intl.t("caluma.distribution.check-inquiries-error"),
|
|
110
107
|
);
|
|
111
108
|
}
|
|
112
|
-
}
|
|
109
|
+
});
|
|
113
110
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Service, { inject as service } from "@ember/service";
|
|
2
2
|
import { tracked } from "@glimmer/tracking";
|
|
3
3
|
import { queryManager, getObservable } from "ember-apollo-client";
|
|
4
|
-
import {
|
|
4
|
+
import { task } from "ember-concurrency";
|
|
5
5
|
import { confirm } from "ember-uikit";
|
|
6
6
|
import { gql } from "graphql-tag";
|
|
7
7
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
@@ -35,9 +35,6 @@ export default class DistributionService extends Service {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
controls = trackedTask(this, this.fetchControls, () => [this.caseId]);
|
|
39
|
-
navigation = trackedTask(this, this.fetchNavigation, () => [this.caseId]);
|
|
40
|
-
|
|
41
38
|
async refetch() {
|
|
42
39
|
await this.refetchControls();
|
|
43
40
|
await this.refetchNavigation();
|
|
@@ -51,9 +48,8 @@ export default class DistributionService extends Service {
|
|
|
51
48
|
await getObservable(this.controls.value)?.refetch();
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return yield this.apollo.watchQuery({
|
|
51
|
+
fetchControls = task({ drop: true }, async (caseId) => {
|
|
52
|
+
return await this.apollo.watchQuery({
|
|
57
53
|
query: controlsQuery,
|
|
58
54
|
variables: {
|
|
59
55
|
caseId,
|
|
@@ -64,11 +60,10 @@ export default class DistributionService extends Service {
|
|
|
64
60
|
checkTask: this.config.controls.checkTask,
|
|
65
61
|
},
|
|
66
62
|
});
|
|
67
|
-
}
|
|
63
|
+
});
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const response = yield this.apollo.watchQuery({
|
|
65
|
+
fetchNavigation = task({ drop: true }, async (caseId) => {
|
|
66
|
+
const response = await this.apollo.watchQuery({
|
|
72
67
|
query: navigationQuery,
|
|
73
68
|
variables: {
|
|
74
69
|
caseId,
|
|
@@ -101,16 +96,18 @@ export default class DistributionService extends Service {
|
|
|
101
96
|
});
|
|
102
97
|
|
|
103
98
|
return response;
|
|
104
|
-
}
|
|
99
|
+
});
|
|
105
100
|
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
controls = trackedTask(this, this.fetchControls, () => [this.caseId]);
|
|
102
|
+
navigation = trackedTask(this, this.fetchNavigation, () => [this.caseId]);
|
|
103
|
+
|
|
104
|
+
createInquiry = task({ drop: true }, async (groups, context = {}) => {
|
|
108
105
|
try {
|
|
109
106
|
// get create inquiry work item to complete
|
|
110
107
|
const createId = decodeId(this.controls.value?.create.edges[0].node.id);
|
|
111
108
|
|
|
112
109
|
// create new inquiries
|
|
113
|
-
|
|
110
|
+
await this.apollo.mutate({
|
|
114
111
|
mutation: createInquiryMutation,
|
|
115
112
|
variables: {
|
|
116
113
|
id: createId,
|
|
@@ -122,13 +119,13 @@ export default class DistributionService extends Service {
|
|
|
122
119
|
});
|
|
123
120
|
|
|
124
121
|
// refetch navigation and controls data
|
|
125
|
-
|
|
122
|
+
await this.refetch();
|
|
126
123
|
} catch {
|
|
127
124
|
this.notification.danger(
|
|
128
125
|
this.intl.t("caluma.distribution.new.error", { count: groups.length }),
|
|
129
126
|
);
|
|
130
127
|
}
|
|
131
|
-
}
|
|
128
|
+
});
|
|
132
129
|
|
|
133
130
|
@cached
|
|
134
131
|
get inquiries() {
|
|
@@ -175,15 +172,14 @@ export default class DistributionService extends Service {
|
|
|
175
172
|
);
|
|
176
173
|
}
|
|
177
174
|
|
|
178
|
-
|
|
179
|
-
*sendAllInquiries() {
|
|
175
|
+
sendAllInquiries = task({ drop: true }, async () => {
|
|
180
176
|
const ids = this.controls.value.send.edges
|
|
181
177
|
.filter((edge) => edge.node.status === "SUSPENDED")
|
|
182
178
|
.map((edge) => decodeId(edge.node.id));
|
|
183
179
|
|
|
184
180
|
if (
|
|
185
181
|
ids.length &&
|
|
186
|
-
!(
|
|
182
|
+
!(await confirm(
|
|
187
183
|
this.intl.t("caluma.distribution.send-confirm", { count: ids.length }),
|
|
188
184
|
))
|
|
189
185
|
) {
|
|
@@ -204,9 +200,9 @@ export default class DistributionService extends Service {
|
|
|
204
200
|
|
|
205
201
|
const mutation = gql`mutation SendInquiries {${mutations.join("\n")}}`;
|
|
206
202
|
|
|
207
|
-
|
|
203
|
+
await this.apollo.mutate({ mutation });
|
|
208
204
|
} catch {
|
|
209
205
|
this.notification.danger(this.intl.t("caluma.distribution.send-error"));
|
|
210
206
|
}
|
|
211
|
-
}
|
|
207
|
+
});
|
|
212
208
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-distribution",
|
|
3
|
-
"version": "14.7.
|
|
3
|
+
"version": "14.7.1",
|
|
4
4
|
"description": "Ember engine for the Caluma distribution module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"ember-can": "^7.0.0",
|
|
19
19
|
"ember-cli-babel": "^8.2.0",
|
|
20
20
|
"ember-cli-htmlbars": "^6.3.0",
|
|
21
|
-
"ember-concurrency": "^4.0.2",
|
|
21
|
+
"ember-concurrency": "^4.0.2 || ^5.1.0",
|
|
22
22
|
"ember-engines-router-service": "^0.6.0",
|
|
23
23
|
"ember-flatpickr": "^8.0.1",
|
|
24
24
|
"ember-intl": "^7.1.1",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"luxon": "^3.5.0",
|
|
36
36
|
"reactiveweb": "^1.3.0",
|
|
37
37
|
"tracked-toolbox": "^2.0.0",
|
|
38
|
-
"@projectcaluma/ember-
|
|
39
|
-
"@projectcaluma/ember-
|
|
40
|
-
"@projectcaluma/ember-
|
|
38
|
+
"@projectcaluma/ember-form": "^14.7.1",
|
|
39
|
+
"@projectcaluma/ember-workflow": "^14.7.1",
|
|
40
|
+
"@projectcaluma/ember-core": "^14.7.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@ember/optional-features": "2.3.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"sass": "1.97.3",
|
|
69
69
|
"uikit": "3.25.6",
|
|
70
70
|
"webpack": "5.104.1",
|
|
71
|
-
"@projectcaluma/ember-testing": "14.7.
|
|
71
|
+
"@projectcaluma/ember-testing": "14.7.1"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"ember-engines": "^0.11.0",
|