@kineticdata/bundle-queue 5.0.16 → 5.1.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.
- package/assets/styles/_assignments.scss +5 -1
- package/assets/styles/_queue_item_details.scss +23 -37
- package/assets/styles/_queue_list.scss +179 -90
- package/assets/styles/_status.scss +6 -17
- package/assets/styles/_submissions.scss +60 -9
- package/assets/styles/_temp.scss +4 -0
- package/lib/App.js +71 -72
- package/lib/components/FormPreview.js +62 -0
- package/lib/components/filter_menu/FilterMenuAbstract.js +112 -70
- package/lib/components/filter_menu/FilterMenuModal.js +316 -0
- package/lib/components/filter_menu/FilterMenuToolbar.js +309 -0
- package/lib/components/new_item_menu/NewItemMenu.js +15 -4
- package/lib/components/new_item_menu/NewItemMenuContainer.js +5 -12
- package/lib/components/queue_item/QueueItem.js +118 -39
- package/lib/components/queue_item/QueueItemDetails.js +179 -132
- package/lib/components/queue_list/BulkAssignModal.js +93 -0
- package/lib/components/queue_list/BulkStatusModal.js +169 -0
- package/lib/components/queue_list/BulkWorkModal.js +74 -0
- package/lib/components/queue_list/QueueList.js +52 -107
- package/lib/components/queue_list/QueueListContainer.js +35 -131
- package/lib/components/queue_list/QueueListItem.js +113 -24
- package/lib/components/queue_list/QueueListPagination.js +105 -14
- package/lib/components/queue_list/QueueListSelection.js +251 -0
- package/lib/components/queue_list/QueueListSidebar.js +114 -0
- package/lib/components/settings/QueueSettings.js +19 -26
- package/lib/components/settings/Settings.js +29 -46
- package/lib/components/settings/forms/FormActivity.js +29 -40
- package/lib/components/settings/forms/FormList.js +19 -37
- package/lib/components/settings/forms/FormSettings.js +33 -48
- package/lib/components/settings/forms/FormSubmissions.js +30 -47
- package/lib/components/shared/PageTitle.js +10 -3
- package/lib/components/shared/StatusContent.js +29 -28
- package/lib/components/work_menu/WorkMenu.js +4 -5
- package/lib/index.js +3 -0
- package/lib/records.js +5 -4
- package/lib/redux/modules/filterMenu.js +13 -11
- package/lib/redux/modules/queue.js +193 -89
- package/lib/redux/modules/queueApp.js +8 -2
- package/lib/redux/sagas/queue.js +518 -179
- package/lib/utils.js +0 -14
- package/package.json +4 -5
package/lib/redux/sagas/queue.js
CHANGED
|
@@ -1,66 +1,26 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
3
|
|
|
3
4
|
var _marked = /*#__PURE__*/_regeneratorRuntime.mark(fetchListTask),
|
|
4
|
-
_marked2 = /*#__PURE__*/_regeneratorRuntime.mark(
|
|
5
|
-
_marked3 = /*#__PURE__*/_regeneratorRuntime.mark(
|
|
6
|
-
_marked4 = /*#__PURE__*/_regeneratorRuntime.mark(
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
_marked2 = /*#__PURE__*/_regeneratorRuntime.mark(fetchListCountTask),
|
|
6
|
+
_marked3 = /*#__PURE__*/_regeneratorRuntime.mark(fetchCurrentItemTask),
|
|
7
|
+
_marked4 = /*#__PURE__*/_regeneratorRuntime.mark(updateQueueItemTask),
|
|
8
|
+
_marked5 = /*#__PURE__*/_regeneratorRuntime.mark(bulkAssignTask),
|
|
9
|
+
_marked6 = /*#__PURE__*/_regeneratorRuntime.mark(updateBulkSubmission),
|
|
10
|
+
_marked7 = /*#__PURE__*/_regeneratorRuntime.mark(bulkWorkTask),
|
|
11
|
+
_marked8 = /*#__PURE__*/_regeneratorRuntime.mark(submitBulkSubmission),
|
|
12
|
+
_marked9 = /*#__PURE__*/_regeneratorRuntime.mark(watchQueue);
|
|
13
|
+
|
|
14
|
+
import { delay } from 'redux-saga';
|
|
15
|
+
import { all, select, call, put, takeEvery, takeLatest } from 'redux-saga/effects';
|
|
9
16
|
import moment from 'moment';
|
|
10
|
-
import {
|
|
17
|
+
import { defineKqlQuery, searchSubmissions, fetchSubmission, updateSubmission, submitSubmission } from '@kineticdata/react';
|
|
11
18
|
import isFunction from 'is-function';
|
|
12
19
|
import { addToastAlert } from '@kineticdata/bundle-common';
|
|
13
20
|
import { types, actions } from '../modules/queue';
|
|
14
21
|
export var ERROR_STATUS_STRING = 'There was a problem retrieving items.';
|
|
15
|
-
export var TOO_MANY_STATUS_STRING = 'Your filter matches too many items. Try a more specific filter.';
|
|
16
22
|
export var SUBMISSION_INCLUDES = 'details,values,attributes,form,form.kapp,children,children.details,children.form,children.form.kapp,children.values,form.attributes,parent,parent.details,parent.values,parent.form,parent.form.kapp';
|
|
17
|
-
export var
|
|
18
|
-
return state.queueApp;
|
|
19
|
-
};
|
|
20
|
-
export var getCurrentItem = function getCurrentItem(state) {
|
|
21
|
-
return state.queue.currentItem;
|
|
22
|
-
};
|
|
23
|
-
export var getProfile = function getProfile(state) {
|
|
24
|
-
return state.app.profile;
|
|
25
|
-
};
|
|
26
|
-
export var getKappSlug = function getKappSlug(state) {
|
|
27
|
-
return state.app.kappSlug;
|
|
28
|
-
};
|
|
29
|
-
/* eslint-disable no-param-reassign */
|
|
30
|
-
|
|
31
|
-
export var prepareStatusFilter = function prepareStatusFilter(searcher, filter) {
|
|
32
|
-
// There is at least one status add the criteria.
|
|
33
|
-
if (filter.status.size > 0) {
|
|
34
|
-
if (filter.status.size === 1) {
|
|
35
|
-
searcher.eq('values[Status]', filter.status.first());
|
|
36
|
-
} else {
|
|
37
|
-
searcher["in"]('values[Status]', filter.status.toJS());
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
export var prepareDateRangeFilter = function prepareDateRangeFilter(searcher, filter, now) {
|
|
42
|
-
if (filter.dateRange.custom) {
|
|
43
|
-
searcher.sortBy(filter.dateRange.timeline === 'completedAt' ? 'closedAt' : filter.dateRange.timeline);
|
|
44
|
-
searcher.startDate(moment(filter.dateRange.start).toDate());
|
|
45
|
-
searcher.endDate(moment(filter.dateRange.end).add(1, 'day').toDate());
|
|
46
|
-
} else if (filter.dateRange.preset !== '') {
|
|
47
|
-
// Compute the number of days specified in the preset date range, just use
|
|
48
|
-
// regex to get the number. If the string does not match the pattern log a
|
|
49
|
-
// warning and default to 7.
|
|
50
|
-
var match = filter.dateRange.preset.match(/^(\d+)days$/);
|
|
51
|
-
var numberOfDays = match ? parseInt(match[1], 10) : 7;
|
|
52
|
-
|
|
53
|
-
if (!match) {
|
|
54
|
-
window.console.warn("Invalid date range filter preset: ".concat(filter.dateRange.preset));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
searcher.sortBy(filter.dateRange.timeline === 'completedAt' ? 'closedAt' : filter.dateRange.timeline);
|
|
58
|
-
searcher.startDate(now.clone().startOf('day').subtract(numberOfDays, 'days').toDate());
|
|
59
|
-
searcher.endDate(now.toDate());
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return searcher;
|
|
63
|
-
};
|
|
23
|
+
export var SUBMISSION_LIST_INCLUDES = ['details', 'form', 'form.kapp', 'form.attributes', 'form.fields', 'form.fields.details', 'values'];
|
|
64
24
|
|
|
65
25
|
var calculateTeams = function calculateTeams(myTeams, teams) {
|
|
66
26
|
return teams.isEmpty() ? myTeams.map(function (t) {
|
|
@@ -71,229 +31,392 @@ var calculateTeams = function calculateTeams(myTeams, teams) {
|
|
|
71
31
|
};
|
|
72
32
|
|
|
73
33
|
export var buildSearch = function buildSearch(filter, appSettings, profile) {
|
|
74
|
-
var searcher =
|
|
75
|
-
|
|
76
|
-
prepareStatusFilter(searcher, filter); // Make sure there is a valid assignment in the searcher
|
|
34
|
+
var searcher = defineKqlQuery();
|
|
35
|
+
var searcherParams = {}; // Make sure there is a valid assignment in the searcher
|
|
77
36
|
|
|
78
37
|
var invalidAssignment = true;
|
|
79
38
|
|
|
80
39
|
if (filter.createdByMe) {
|
|
81
|
-
searcher.
|
|
40
|
+
searcher.equals('createdBy', 'username');
|
|
41
|
+
searcherParams.username = profile.username;
|
|
82
42
|
invalidAssignment = false;
|
|
83
43
|
}
|
|
84
44
|
|
|
85
45
|
if (filter.assignments === 'mine') {
|
|
86
|
-
searcher.
|
|
46
|
+
searcher.equals('values[Assigned Individual]', 'username');
|
|
47
|
+
searcherParams.username = profile.username;
|
|
87
48
|
invalidAssignment = false;
|
|
88
49
|
} else if (filter.assignments === 'unassigned' && (appSettings.myTeams.size > 0 || filter.createdByMe)) {
|
|
89
|
-
searcher.
|
|
50
|
+
searcher.equals('values[Assigned Individual]', 'null', true);
|
|
51
|
+
searcherParams["null"] = null;
|
|
90
52
|
}
|
|
91
53
|
|
|
92
54
|
if (appSettings.myTeams.size > 0 && (filter.teams.size > 0 || filter.assignments !== 'mine' && !filter.createdByMe)) {
|
|
93
|
-
searcher["in"]('values[Assigned Team]',
|
|
55
|
+
searcher["in"]('values[Assigned Team]', 'teams');
|
|
56
|
+
searcherParams.teams = calculateTeams(appSettings.myTeams, filter.teams).toJS();
|
|
94
57
|
invalidAssignment = false;
|
|
95
58
|
}
|
|
96
59
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
};
|
|
102
|
-
export var getSubmissionDate = function getSubmissionDate(submission, key) {
|
|
103
|
-
if (['createdAt', 'updatedAt', 'closedAt'].includes(key)) {
|
|
104
|
-
return submission[key];
|
|
105
|
-
} else {
|
|
106
|
-
return submission.values[key];
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
export var sortSubmissions = function sortSubmissions(submissions, filter) {
|
|
110
|
-
return submissions.sort(function (s1, s2) {
|
|
111
|
-
var s1Date = getSubmissionDate(s1, filter.sortBy);
|
|
112
|
-
var s2Date = getSubmissionDate(s2, filter.sortBy);
|
|
113
|
-
var beforeIndex = -1;
|
|
114
|
-
var afterIndex = 1;
|
|
115
|
-
|
|
116
|
-
if (s1Date && s2Date) {
|
|
117
|
-
if (moment(s1Date).isBefore(s2Date)) {
|
|
118
|
-
return beforeIndex;
|
|
119
|
-
} else if (moment(s1Date).isAfter(s2Date)) {
|
|
120
|
-
return afterIndex;
|
|
121
|
-
}
|
|
122
|
-
} else if (s1Date && !s2Date) {
|
|
123
|
-
return afterIndex;
|
|
124
|
-
} else if (!s1Date && s2Date) {
|
|
125
|
-
return beforeIndex;
|
|
60
|
+
if (filter.status.size > 0) {
|
|
61
|
+
if (filter.status.size === 1) {
|
|
62
|
+
searcher.equals('values[Status]', 'status');
|
|
63
|
+
searcherParams.status = filter.status.first();
|
|
126
64
|
} else {
|
|
127
|
-
|
|
128
|
-
|
|
65
|
+
searcher["in"]('values[Status]', 'status');
|
|
66
|
+
searcherParams.status = filter.status.toJS();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
129
69
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
70
|
+
if (filter.dateRange.custom) {
|
|
71
|
+
searcher.between(filter.dateRange.timeline === 'completedAt' ? 'closedAt' : filter.dateRange.timeline, 'start', 'end');
|
|
72
|
+
searcherParams.start = moment(filter.dateRange.start).toISOString();
|
|
73
|
+
searcherParams.end = moment(filter.dateRange.end).add(1, 'day').toISOString();
|
|
74
|
+
} else if (filter.dateRange.preset !== '') {
|
|
75
|
+
// Compute the number of days specified in the preset date range, just use
|
|
76
|
+
// regex to get the number. If the string does not match the pattern log a
|
|
77
|
+
// warning and default to 7.
|
|
78
|
+
var match = filter.dateRange.preset.match(/^(\d+)days$/);
|
|
79
|
+
var numberOfDays = match ? parseInt(match[1], 10) : 7;
|
|
80
|
+
|
|
81
|
+
if (!match) {
|
|
82
|
+
window.console.warn("Invalid date range filter preset: ".concat(filter.dateRange.preset));
|
|
135
83
|
}
|
|
136
84
|
|
|
137
|
-
|
|
138
|
-
|
|
85
|
+
searcher.greaterThan(filter.dateRange.timeline === 'completedAt' ? 'closedAt' : filter.dateRange.timeline, 'start');
|
|
86
|
+
searcherParams.start = moment().startOf('day').subtract(numberOfDays, 'days').toISOString();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
search: {
|
|
91
|
+
q: searcher.end()(searcherParams),
|
|
92
|
+
orderBy: filter.sortBy,
|
|
93
|
+
direction: filter.sortDirection,
|
|
94
|
+
include: SUBMISSION_LIST_INCLUDES
|
|
95
|
+
},
|
|
96
|
+
invalidAssignment: invalidAssignment
|
|
97
|
+
};
|
|
139
98
|
};
|
|
140
99
|
export function fetchListTask(action) {
|
|
141
|
-
var filter, appSettings, profile, kappSlug, _yield$call, search, invalidAssignment, _yield$call2, submissions, nextPageToken, error,
|
|
100
|
+
var filter, appSettings, profile, kappSlug, _yield$call, search, invalidAssignment, pageToken, limit, hasPreviousPage, _yield$call2, submissions, nextPageToken, error, count, countPageToken;
|
|
142
101
|
|
|
143
102
|
return _regeneratorRuntime.wrap(function fetchListTask$(_context) {
|
|
144
103
|
while (1) {
|
|
145
104
|
switch (_context.prev = _context.next) {
|
|
146
105
|
case 0:
|
|
147
|
-
|
|
106
|
+
_context.prev = 0;
|
|
107
|
+
_context.next = 3;
|
|
108
|
+
return select(function (state) {
|
|
109
|
+
return state.queue.currentFilter;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
case 3:
|
|
113
|
+
filter = _context.sent;
|
|
148
114
|
|
|
149
115
|
if (!filter) {
|
|
150
|
-
_context.next =
|
|
116
|
+
_context.next = 59;
|
|
151
117
|
break;
|
|
152
118
|
}
|
|
153
119
|
|
|
154
|
-
_context.next = 4;
|
|
155
|
-
return select(getAppSettings);
|
|
156
|
-
|
|
157
|
-
case 4:
|
|
158
|
-
appSettings = _context.sent;
|
|
159
120
|
_context.next = 7;
|
|
160
|
-
return select(
|
|
121
|
+
return select(function (state) {
|
|
122
|
+
return state.queueApp;
|
|
123
|
+
});
|
|
161
124
|
|
|
162
125
|
case 7:
|
|
163
|
-
|
|
126
|
+
appSettings = _context.sent;
|
|
164
127
|
_context.next = 10;
|
|
165
|
-
return select(
|
|
128
|
+
return select(function (state) {
|
|
129
|
+
return state.app.profile;
|
|
130
|
+
});
|
|
166
131
|
|
|
167
132
|
case 10:
|
|
168
|
-
|
|
133
|
+
profile = _context.sent;
|
|
169
134
|
_context.next = 13;
|
|
170
|
-
return
|
|
135
|
+
return select(function (state) {
|
|
136
|
+
return state.app.kappSlug;
|
|
137
|
+
});
|
|
171
138
|
|
|
172
139
|
case 13:
|
|
140
|
+
kappSlug = _context.sent;
|
|
141
|
+
_context.next = 16;
|
|
142
|
+
return call(buildSearch, filter, appSettings, profile);
|
|
143
|
+
|
|
144
|
+
case 16:
|
|
173
145
|
_yield$call = _context.sent;
|
|
174
146
|
search = _yield$call.search;
|
|
175
147
|
invalidAssignment = _yield$call.invalidAssignment;
|
|
148
|
+
_context.next = 21;
|
|
149
|
+
return select(function (state) {
|
|
150
|
+
return state.queue.pageToken;
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
case 21:
|
|
154
|
+
pageToken = _context.sent;
|
|
155
|
+
_context.next = 24;
|
|
156
|
+
return select(function (state) {
|
|
157
|
+
return state.queue.limit;
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
case 24:
|
|
161
|
+
limit = _context.sent;
|
|
162
|
+
_context.next = 27;
|
|
163
|
+
return select(function (state) {
|
|
164
|
+
return state.queue.hasPreviousPage;
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
case 27:
|
|
168
|
+
hasPreviousPage = _context.sent;
|
|
176
169
|
|
|
177
170
|
if (!invalidAssignment) {
|
|
178
|
-
_context.next =
|
|
171
|
+
_context.next = 35;
|
|
179
172
|
break;
|
|
180
173
|
}
|
|
181
174
|
|
|
182
|
-
_context.next =
|
|
175
|
+
_context.next = 31;
|
|
183
176
|
return put(actions.setListItems(filter, []));
|
|
184
177
|
|
|
185
|
-
case
|
|
186
|
-
_context.next =
|
|
178
|
+
case 31:
|
|
179
|
+
_context.next = 33;
|
|
180
|
+
return put(actions.fetchListSuccess({
|
|
181
|
+
submissions: [],
|
|
182
|
+
nextPageToken: null
|
|
183
|
+
}));
|
|
184
|
+
|
|
185
|
+
case 33:
|
|
186
|
+
_context.next = 59;
|
|
187
187
|
break;
|
|
188
188
|
|
|
189
|
-
case
|
|
190
|
-
_context.next =
|
|
189
|
+
case 35:
|
|
190
|
+
_context.next = 37;
|
|
191
191
|
return call(searchSubmissions, {
|
|
192
192
|
kapp: kappSlug,
|
|
193
193
|
search: search,
|
|
194
|
-
limit:
|
|
194
|
+
limit: limit,
|
|
195
|
+
pageToken: pageToken,
|
|
196
|
+
count: !pageToken
|
|
195
197
|
});
|
|
196
198
|
|
|
197
|
-
case
|
|
199
|
+
case 37:
|
|
198
200
|
_yield$call2 = _context.sent;
|
|
199
201
|
submissions = _yield$call2.submissions;
|
|
200
202
|
nextPageToken = _yield$call2.nextPageToken;
|
|
201
203
|
error = _yield$call2.error;
|
|
204
|
+
count = _yield$call2.count;
|
|
205
|
+
countPageToken = _yield$call2.countPageToken;
|
|
202
206
|
|
|
203
207
|
if (!error) {
|
|
204
|
-
_context.next =
|
|
208
|
+
_context.next = 48;
|
|
205
209
|
break;
|
|
206
210
|
}
|
|
207
211
|
|
|
208
|
-
_context.next =
|
|
209
|
-
return put(actions.
|
|
210
|
-
|
|
211
|
-
case 30:
|
|
212
|
-
_context.next = 32;
|
|
213
|
-
return put(addToastAlert('Failed to retrieve items!'));
|
|
212
|
+
_context.next = 46;
|
|
213
|
+
return put(actions.fetchListFailure(error));
|
|
214
214
|
|
|
215
|
-
case
|
|
216
|
-
_context.next =
|
|
215
|
+
case 46:
|
|
216
|
+
_context.next = 59;
|
|
217
217
|
break;
|
|
218
218
|
|
|
219
|
-
case
|
|
220
|
-
if (!
|
|
221
|
-
_context.next =
|
|
219
|
+
case 48:
|
|
220
|
+
if (!((!submissions || submissions.length === 0) && hasPreviousPage)) {
|
|
221
|
+
_context.next = 53;
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
_context.next =
|
|
226
|
-
return put(actions.
|
|
225
|
+
_context.next = 51;
|
|
226
|
+
return put(actions.fetchListPrevious());
|
|
227
227
|
|
|
228
|
-
case
|
|
229
|
-
_context.next =
|
|
228
|
+
case 51:
|
|
229
|
+
_context.next = 59;
|
|
230
230
|
break;
|
|
231
231
|
|
|
232
|
-
case
|
|
233
|
-
_context.next =
|
|
234
|
-
return
|
|
232
|
+
case 53:
|
|
233
|
+
_context.next = 55;
|
|
234
|
+
return put(actions.fetchListSuccess({
|
|
235
|
+
submissions: submissions,
|
|
236
|
+
nextPageToken: nextPageToken
|
|
237
|
+
}));
|
|
238
|
+
|
|
239
|
+
case 55:
|
|
240
|
+
if (!(typeof count !== 'undefined')) {
|
|
241
|
+
_context.next = 58;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
_context.next = 58;
|
|
246
|
+
return put(actions.fetchListCountSuccess({
|
|
247
|
+
filter: filter,
|
|
248
|
+
count: countPageToken ? "".concat(count, "+") : count
|
|
249
|
+
}));
|
|
235
250
|
|
|
236
|
-
case
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
251
|
+
case 58:
|
|
252
|
+
// Call the callback if provided
|
|
253
|
+
if (typeof action.payload === 'function') {
|
|
254
|
+
action.payload(submissions);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
case 59:
|
|
258
|
+
_context.next = 64;
|
|
259
|
+
break;
|
|
260
|
+
|
|
261
|
+
case 61:
|
|
262
|
+
_context.prev = 61;
|
|
263
|
+
_context.t0 = _context["catch"](0);
|
|
264
|
+
console.error('There was a problem fetching queue list items:', _context.t0);
|
|
240
265
|
|
|
241
|
-
case
|
|
266
|
+
case 64:
|
|
242
267
|
case "end":
|
|
243
268
|
return _context.stop();
|
|
244
269
|
}
|
|
245
270
|
}
|
|
246
|
-
}, _marked);
|
|
271
|
+
}, _marked, null, [[0, 61]]);
|
|
247
272
|
}
|
|
248
|
-
export function
|
|
249
|
-
var _yield$call3,
|
|
273
|
+
export function fetchListCountTask(action) {
|
|
274
|
+
var filter, appSettings, profile, kappSlug, _yield$call3, search, invalidAssignment, _yield$call4, error, count, countPageToken;
|
|
250
275
|
|
|
251
|
-
return _regeneratorRuntime.wrap(function
|
|
276
|
+
return _regeneratorRuntime.wrap(function fetchListCountTask$(_context2) {
|
|
252
277
|
while (1) {
|
|
253
278
|
switch (_context2.prev = _context2.next) {
|
|
254
279
|
case 0:
|
|
255
|
-
_context2.
|
|
280
|
+
_context2.prev = 0;
|
|
281
|
+
filter = action.payload;
|
|
282
|
+
|
|
283
|
+
if (!filter) {
|
|
284
|
+
_context2.next = 31;
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
_context2.next = 5;
|
|
289
|
+
return select(function (state) {
|
|
290
|
+
return state.queueApp;
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
case 5:
|
|
294
|
+
appSettings = _context2.sent;
|
|
295
|
+
_context2.next = 8;
|
|
296
|
+
return select(function (state) {
|
|
297
|
+
return state.app.profile;
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
case 8:
|
|
301
|
+
profile = _context2.sent;
|
|
302
|
+
_context2.next = 11;
|
|
303
|
+
return select(function (state) {
|
|
304
|
+
return state.app.kappSlug;
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
case 11:
|
|
308
|
+
kappSlug = _context2.sent;
|
|
309
|
+
_context2.next = 14;
|
|
310
|
+
return call(buildSearch, filter, appSettings, profile);
|
|
311
|
+
|
|
312
|
+
case 14:
|
|
313
|
+
_yield$call3 = _context2.sent;
|
|
314
|
+
search = _yield$call3.search;
|
|
315
|
+
invalidAssignment = _yield$call3.invalidAssignment;
|
|
316
|
+
|
|
317
|
+
if (!invalidAssignment) {
|
|
318
|
+
_context2.next = 22;
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
_context2.next = 20;
|
|
323
|
+
return put(actions.fetchListSuccess([], null));
|
|
324
|
+
|
|
325
|
+
case 20:
|
|
326
|
+
_context2.next = 31;
|
|
327
|
+
break;
|
|
328
|
+
|
|
329
|
+
case 22:
|
|
330
|
+
_context2.next = 24;
|
|
331
|
+
return call(searchSubmissions, {
|
|
332
|
+
kapp: kappSlug,
|
|
333
|
+
search: search,
|
|
334
|
+
count: true,
|
|
335
|
+
limit: 0
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
case 24:
|
|
339
|
+
_yield$call4 = _context2.sent;
|
|
340
|
+
error = _yield$call4.error;
|
|
341
|
+
count = _yield$call4.count;
|
|
342
|
+
countPageToken = _yield$call4.countPageToken;
|
|
343
|
+
|
|
344
|
+
if (!(!error && typeof count !== 'undefined')) {
|
|
345
|
+
_context2.next = 31;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
_context2.next = 31;
|
|
350
|
+
return put(actions.fetchListCountSuccess({
|
|
351
|
+
filter: filter,
|
|
352
|
+
count: countPageToken ? "".concat(count, "+") : count
|
|
353
|
+
}));
|
|
354
|
+
|
|
355
|
+
case 31:
|
|
356
|
+
_context2.next = 36;
|
|
357
|
+
break;
|
|
358
|
+
|
|
359
|
+
case 33:
|
|
360
|
+
_context2.prev = 33;
|
|
361
|
+
_context2.t0 = _context2["catch"](0);
|
|
362
|
+
console.error('There was a problem fetching queue list counts:', _context2.t0);
|
|
363
|
+
|
|
364
|
+
case 36:
|
|
365
|
+
case "end":
|
|
366
|
+
return _context2.stop();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}, _marked2, null, [[0, 33]]);
|
|
370
|
+
}
|
|
371
|
+
export function fetchCurrentItemTask(action) {
|
|
372
|
+
var _yield$call5, submission, error;
|
|
373
|
+
|
|
374
|
+
return _regeneratorRuntime.wrap(function fetchCurrentItemTask$(_context3) {
|
|
375
|
+
while (1) {
|
|
376
|
+
switch (_context3.prev = _context3.next) {
|
|
377
|
+
case 0:
|
|
378
|
+
_context3.next = 2;
|
|
256
379
|
return call(fetchSubmission, {
|
|
257
380
|
id: action.payload,
|
|
258
381
|
include: SUBMISSION_INCLUDES
|
|
259
382
|
});
|
|
260
383
|
|
|
261
384
|
case 2:
|
|
262
|
-
_yield$
|
|
263
|
-
submission = _yield$
|
|
264
|
-
error = _yield$
|
|
385
|
+
_yield$call5 = _context3.sent;
|
|
386
|
+
submission = _yield$call5.submission;
|
|
387
|
+
error = _yield$call5.error;
|
|
265
388
|
|
|
266
389
|
if (error) {
|
|
267
|
-
|
|
390
|
+
_context3.next = 10;
|
|
268
391
|
break;
|
|
269
392
|
}
|
|
270
393
|
|
|
271
|
-
|
|
394
|
+
_context3.next = 8;
|
|
272
395
|
return put(actions.setCurrentItem(submission));
|
|
273
396
|
|
|
274
397
|
case 8:
|
|
275
|
-
|
|
398
|
+
_context3.next = 12;
|
|
276
399
|
break;
|
|
277
400
|
|
|
278
401
|
case 10:
|
|
279
|
-
|
|
402
|
+
_context3.next = 12;
|
|
280
403
|
return put(addToastAlert('Failed to retrieve item!'));
|
|
281
404
|
|
|
282
405
|
case 12:
|
|
283
406
|
case "end":
|
|
284
|
-
return
|
|
407
|
+
return _context3.stop();
|
|
285
408
|
}
|
|
286
409
|
}
|
|
287
|
-
},
|
|
410
|
+
}, _marked3);
|
|
288
411
|
}
|
|
289
412
|
export function updateQueueItemTask(action) {
|
|
290
|
-
var _yield$
|
|
413
|
+
var _yield$call6, submission;
|
|
291
414
|
|
|
292
|
-
return _regeneratorRuntime.wrap(function updateQueueItemTask$(
|
|
415
|
+
return _regeneratorRuntime.wrap(function updateQueueItemTask$(_context4) {
|
|
293
416
|
while (1) {
|
|
294
|
-
switch (
|
|
417
|
+
switch (_context4.prev = _context4.next) {
|
|
295
418
|
case 0:
|
|
296
|
-
|
|
419
|
+
_context4.next = 2;
|
|
297
420
|
return call(updateSubmission, {
|
|
298
421
|
id: action.payload.id,
|
|
299
422
|
values: action.payload.values,
|
|
@@ -301,11 +424,11 @@ export function updateQueueItemTask(action) {
|
|
|
301
424
|
});
|
|
302
425
|
|
|
303
426
|
case 2:
|
|
304
|
-
_yield$
|
|
305
|
-
submission = _yield$
|
|
427
|
+
_yield$call6 = _context4.sent;
|
|
428
|
+
submission = _yield$call6.submission;
|
|
306
429
|
|
|
307
430
|
if (!submission) {
|
|
308
|
-
|
|
431
|
+
_context4.next = 8;
|
|
309
432
|
break;
|
|
310
433
|
}
|
|
311
434
|
|
|
@@ -313,40 +436,256 @@ export function updateQueueItemTask(action) {
|
|
|
313
436
|
action.payload.onSuccess(submission);
|
|
314
437
|
}
|
|
315
438
|
|
|
316
|
-
|
|
439
|
+
_context4.next = 10;
|
|
317
440
|
break;
|
|
318
441
|
|
|
319
442
|
case 8:
|
|
320
|
-
|
|
443
|
+
_context4.next = 10;
|
|
321
444
|
return put(addToastAlert('Failed to update item!'));
|
|
322
445
|
|
|
323
446
|
case 10:
|
|
324
447
|
case "end":
|
|
325
|
-
return
|
|
448
|
+
return _context4.stop();
|
|
326
449
|
}
|
|
327
450
|
}
|
|
328
|
-
},
|
|
451
|
+
}, _marked4);
|
|
452
|
+
}
|
|
453
|
+
export function bulkAssignTask(action) {
|
|
454
|
+
var submissions, assignment;
|
|
455
|
+
return _regeneratorRuntime.wrap(function bulkAssignTask$(_context5) {
|
|
456
|
+
while (1) {
|
|
457
|
+
switch (_context5.prev = _context5.next) {
|
|
458
|
+
case 0:
|
|
459
|
+
_context5.next = 2;
|
|
460
|
+
return select(function (state) {
|
|
461
|
+
return state.queue.selectedList;
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
case 2:
|
|
465
|
+
submissions = _context5.sent;
|
|
466
|
+
assignment = action.payload.assignment;
|
|
467
|
+
|
|
468
|
+
if (!(!submissions || !assignment)) {
|
|
469
|
+
_context5.next = 6;
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return _context5.abrupt("return");
|
|
474
|
+
|
|
475
|
+
case 6:
|
|
476
|
+
_context5.next = 8;
|
|
477
|
+
return all(submissions.toList().map(function (submission, i) {
|
|
478
|
+
return call(updateBulkSubmission, {
|
|
479
|
+
id: submission.id,
|
|
480
|
+
values: _objectSpread(_objectSpread({}, submission.values), assignment),
|
|
481
|
+
include: SUBMISSION_LIST_INCLUDES.join(',')
|
|
482
|
+
});
|
|
483
|
+
}).toJS());
|
|
484
|
+
|
|
485
|
+
case 8:
|
|
486
|
+
_context5.next = 10;
|
|
487
|
+
return delay(500);
|
|
488
|
+
|
|
489
|
+
case 10:
|
|
490
|
+
_context5.next = 12;
|
|
491
|
+
return put(actions.bulkAssignComplete());
|
|
492
|
+
|
|
493
|
+
case 12:
|
|
494
|
+
case "end":
|
|
495
|
+
return _context5.stop();
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}, _marked5);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
function updateBulkSubmission(params) {
|
|
502
|
+
var _yield$call7, submission, error;
|
|
503
|
+
|
|
504
|
+
return _regeneratorRuntime.wrap(function updateBulkSubmission$(_context6) {
|
|
505
|
+
while (1) {
|
|
506
|
+
switch (_context6.prev = _context6.next) {
|
|
507
|
+
case 0:
|
|
508
|
+
_context6.next = 2;
|
|
509
|
+
return call(updateSubmission, params);
|
|
510
|
+
|
|
511
|
+
case 2:
|
|
512
|
+
_yield$call7 = _context6.sent;
|
|
513
|
+
submission = _yield$call7.submission;
|
|
514
|
+
error = _yield$call7.error;
|
|
515
|
+
|
|
516
|
+
if (!error) {
|
|
517
|
+
_context6.next = 10;
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
_context6.next = 8;
|
|
522
|
+
return put(actions.bulkStatusUpdate({
|
|
523
|
+
status: 'error',
|
|
524
|
+
data: _objectSpread(_objectSpread({}, error), {}, {
|
|
525
|
+
submissionId: params.id
|
|
526
|
+
})
|
|
527
|
+
}));
|
|
528
|
+
|
|
529
|
+
case 8:
|
|
530
|
+
_context6.next = 12;
|
|
531
|
+
break;
|
|
532
|
+
|
|
533
|
+
case 10:
|
|
534
|
+
_context6.next = 12;
|
|
535
|
+
return put(actions.bulkStatusUpdate({
|
|
536
|
+
status: 'success',
|
|
537
|
+
data: submission
|
|
538
|
+
}));
|
|
539
|
+
|
|
540
|
+
case 12:
|
|
541
|
+
case "end":
|
|
542
|
+
return _context6.stop();
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}, _marked6);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export function bulkWorkTask(action) {
|
|
549
|
+
var submissions, profile, assignment, values;
|
|
550
|
+
return _regeneratorRuntime.wrap(function bulkWorkTask$(_context7) {
|
|
551
|
+
while (1) {
|
|
552
|
+
switch (_context7.prev = _context7.next) {
|
|
553
|
+
case 0:
|
|
554
|
+
_context7.next = 2;
|
|
555
|
+
return select(function (state) {
|
|
556
|
+
return state.queue.selectedList;
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
case 2:
|
|
560
|
+
submissions = _context7.sent;
|
|
561
|
+
_context7.next = 5;
|
|
562
|
+
return select(function (state) {
|
|
563
|
+
return state.app.profile;
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
case 5:
|
|
567
|
+
profile = _context7.sent;
|
|
568
|
+
// Override the assigned individual to be the current user in case someone
|
|
569
|
+
// grabbed this ticket while the bulk action was being taken
|
|
570
|
+
assignment = {
|
|
571
|
+
'Assigned Individual': profile.username,
|
|
572
|
+
'Assigned Individual Display Name': profile.displayName || profile.username
|
|
573
|
+
};
|
|
574
|
+
values = action.payload.values;
|
|
575
|
+
|
|
576
|
+
if (!(!submissions || !values)) {
|
|
577
|
+
_context7.next = 10;
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
return _context7.abrupt("return");
|
|
582
|
+
|
|
583
|
+
case 10:
|
|
584
|
+
_context7.next = 12;
|
|
585
|
+
return all(submissions.toList().map(function (submission, i) {
|
|
586
|
+
return call(submitBulkSubmission, {
|
|
587
|
+
id: submission.id,
|
|
588
|
+
page: submission.currentPage,
|
|
589
|
+
values: _objectSpread(_objectSpread(_objectSpread({}, submission.values), assignment), values),
|
|
590
|
+
include: SUBMISSION_LIST_INCLUDES.join(',')
|
|
591
|
+
});
|
|
592
|
+
}).toJS());
|
|
593
|
+
|
|
594
|
+
case 12:
|
|
595
|
+
_context7.next = 14;
|
|
596
|
+
return delay(500);
|
|
597
|
+
|
|
598
|
+
case 14:
|
|
599
|
+
_context7.next = 16;
|
|
600
|
+
return put(actions.bulkWorkComplete());
|
|
601
|
+
|
|
602
|
+
case 16:
|
|
603
|
+
case "end":
|
|
604
|
+
return _context7.stop();
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}, _marked7);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function submitBulkSubmission(params) {
|
|
611
|
+
var _yield$call8, submission, error;
|
|
612
|
+
|
|
613
|
+
return _regeneratorRuntime.wrap(function submitBulkSubmission$(_context8) {
|
|
614
|
+
while (1) {
|
|
615
|
+
switch (_context8.prev = _context8.next) {
|
|
616
|
+
case 0:
|
|
617
|
+
_context8.next = 2;
|
|
618
|
+
return call(submitSubmission, params);
|
|
619
|
+
|
|
620
|
+
case 2:
|
|
621
|
+
_yield$call8 = _context8.sent;
|
|
622
|
+
submission = _yield$call8.submission;
|
|
623
|
+
error = _yield$call8.error;
|
|
624
|
+
|
|
625
|
+
if (!error) {
|
|
626
|
+
_context8.next = 10;
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
_context8.next = 8;
|
|
631
|
+
return put(actions.bulkStatusUpdate({
|
|
632
|
+
status: 'error',
|
|
633
|
+
data: _objectSpread(_objectSpread({}, error), {}, {
|
|
634
|
+
submissionId: params.id
|
|
635
|
+
})
|
|
636
|
+
}));
|
|
637
|
+
|
|
638
|
+
case 8:
|
|
639
|
+
_context8.next = 12;
|
|
640
|
+
break;
|
|
641
|
+
|
|
642
|
+
case 10:
|
|
643
|
+
_context8.next = 12;
|
|
644
|
+
return put(actions.bulkStatusUpdate({
|
|
645
|
+
status: 'success',
|
|
646
|
+
data: submission
|
|
647
|
+
}));
|
|
648
|
+
|
|
649
|
+
case 12:
|
|
650
|
+
case "end":
|
|
651
|
+
return _context8.stop();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}, _marked8);
|
|
329
655
|
}
|
|
656
|
+
|
|
330
657
|
export function watchQueue() {
|
|
331
|
-
return _regeneratorRuntime.wrap(function watchQueue$(
|
|
658
|
+
return _regeneratorRuntime.wrap(function watchQueue$(_context9) {
|
|
332
659
|
while (1) {
|
|
333
|
-
switch (
|
|
660
|
+
switch (_context9.prev = _context9.next) {
|
|
334
661
|
case 0:
|
|
335
|
-
|
|
336
|
-
return
|
|
662
|
+
_context9.next = 2;
|
|
663
|
+
return takeLatest([types.FETCH_LIST_REQUEST, types.FETCH_LIST_PREVIOUS, types.FETCH_LIST_NEXT, types.FETCH_LIST_RESET, types.UPDATE_LIST_LIMIT], fetchListTask);
|
|
337
664
|
|
|
338
665
|
case 2:
|
|
339
|
-
|
|
340
|
-
return takeEvery(types.
|
|
666
|
+
_context9.next = 4;
|
|
667
|
+
return takeEvery(types.FETCH_LIST_COUNT_REQUEST, fetchListCountTask);
|
|
341
668
|
|
|
342
669
|
case 4:
|
|
343
|
-
|
|
344
|
-
return takeEvery(types.
|
|
670
|
+
_context9.next = 6;
|
|
671
|
+
return takeEvery(types.FETCH_CURRENT_ITEM, fetchCurrentItemTask);
|
|
345
672
|
|
|
346
673
|
case 6:
|
|
674
|
+
_context9.next = 8;
|
|
675
|
+
return takeEvery(types.UPDATE_QUEUE_ITEM, updateQueueItemTask);
|
|
676
|
+
|
|
677
|
+
case 8:
|
|
678
|
+
_context9.next = 10;
|
|
679
|
+
return takeEvery(types.BULK_ASSIGN_REQUEST, bulkAssignTask);
|
|
680
|
+
|
|
681
|
+
case 10:
|
|
682
|
+
_context9.next = 12;
|
|
683
|
+
return takeEvery(types.BULK_WORK_REQUEST, bulkWorkTask);
|
|
684
|
+
|
|
685
|
+
case 12:
|
|
347
686
|
case "end":
|
|
348
|
-
return
|
|
687
|
+
return _context9.stop();
|
|
349
688
|
}
|
|
350
689
|
}
|
|
351
|
-
},
|
|
690
|
+
}, _marked9);
|
|
352
691
|
}
|