@kineticdata/bundle-queue 6.0.1 → 6.0.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.
Files changed (57) hide show
  1. package/lib/App.js +1 -2
  2. package/lib/components/FormPreview.js +6 -11
  3. package/lib/components/filter_menu/FilterMenuAbstract.js +6 -11
  4. package/lib/components/filter_menu/FilterMenuModal.js +1 -2
  5. package/lib/components/filter_menu/FilterMenuToolbar.js +3 -5
  6. package/lib/components/new_item_menu/NewItemMenu.js +2 -3
  7. package/lib/components/new_item_menu/NewItemMenuContainer.js +2 -3
  8. package/lib/components/queue_item/AssignmentBadge.js +2 -3
  9. package/lib/components/queue_item/QueueItem.js +5 -9
  10. package/lib/components/queue_item/QueueItemDetails.js +5 -9
  11. package/lib/components/queue_item/ViewOriginalRequest.js +3 -5
  12. package/lib/components/queue_list/BulkAssignModal.js +2 -3
  13. package/lib/components/queue_list/BulkStatusModal.js +2 -3
  14. package/lib/components/queue_list/BulkWorkModal.js +2 -3
  15. package/lib/components/queue_list/QueueList.js +2 -3
  16. package/lib/components/queue_list/QueueListContainer.js +2 -3
  17. package/lib/components/queue_list/QueueListItem.js +3 -5
  18. package/lib/components/queue_list/QueueListPagination.js +3 -5
  19. package/lib/components/queue_list/QueueListSelection.js +3 -5
  20. package/lib/components/queue_list/QueueListSidebar.js +2 -3
  21. package/lib/components/settings/QueueSettings.js +3 -5
  22. package/lib/components/settings/Settings.js +3 -6
  23. package/lib/components/settings/Sidebar.js +3 -6
  24. package/lib/components/settings/forms/Export.js +2 -3
  25. package/lib/components/settings/forms/ExportModal.js +1 -2
  26. package/lib/components/settings/forms/FormActivity.js +3 -5
  27. package/lib/components/settings/forms/FormList.js +3 -5
  28. package/lib/components/settings/forms/FormSettings.js +4 -7
  29. package/lib/components/settings/forms/FormSubmissions.js +3 -5
  30. package/lib/components/shared/AssignmentItem.js +2 -3
  31. package/lib/components/shared/AssignmentSelector.js +2 -3
  32. package/lib/components/shared/PageTitle.js +3 -5
  33. package/lib/components/shared/StatusContent.js +4 -7
  34. package/lib/components/shared/WallyButton.js +5 -9
  35. package/lib/components/work_menu/WorkMenu.js +5 -9
  36. package/lib/index.js +3 -2
  37. package/lib/models.js +2 -3
  38. package/lib/records.js +11 -21
  39. package/lib/redux/modules/app.js +4 -7
  40. package/lib/redux/modules/filterMenu.js +5 -9
  41. package/lib/redux/modules/forms.js +5 -9
  42. package/lib/redux/modules/queue.js +4 -8
  43. package/lib/redux/modules/queueApp.js +11 -19
  44. package/lib/redux/modules/settingsForms.js +18 -33
  45. package/lib/redux/modules/settingsQueue.js +5 -9
  46. package/lib/redux/modules/workMenu.js +5 -9
  47. package/lib/redux/reducers.js +2 -3
  48. package/lib/redux/sagas/app.js +11 -15
  49. package/lib/redux/sagas/forms.js +38 -42
  50. package/lib/redux/sagas/queue.js +410 -432
  51. package/lib/redux/sagas/queueApp.js +106 -113
  52. package/lib/redux/sagas/settingsForms.js +484 -508
  53. package/lib/redux/sagas/settingsQueue.js +232 -248
  54. package/lib/redux/sagas.js +7 -9
  55. package/lib/redux/store.js +5 -9
  56. package/lib/utils.js +2 -3
  57. package/package.json +58 -57
@@ -30,12 +30,9 @@ var _marked = /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(fetchList
30
30
  _marked7 = /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(bulkWorkTask),
31
31
  _marked8 = /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(submitBulkSubmission),
32
32
  _marked9 = /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(watchQueue);
33
- var ERROR_STATUS_STRING = 'There was a problem retrieving items.';
34
- exports.ERROR_STATUS_STRING = ERROR_STATUS_STRING;
35
- 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';
36
- exports.SUBMISSION_INCLUDES = SUBMISSION_INCLUDES;
37
- var SUBMISSION_LIST_INCLUDES = ['details', 'form', 'form.kapp', 'form.attributes', 'form.fields', 'form.fields.details', 'values'];
38
- exports.SUBMISSION_LIST_INCLUDES = SUBMISSION_LIST_INCLUDES;
33
+ var ERROR_STATUS_STRING = exports.ERROR_STATUS_STRING = 'There was a problem retrieving items.';
34
+ var SUBMISSION_INCLUDES = exports.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';
35
+ var SUBMISSION_LIST_INCLUDES = exports.SUBMISSION_LIST_INCLUDES = ['details', 'form', 'form.kapp', 'form.attributes', 'form.fields', 'form.fields.details', 'values'];
39
36
  var calculateTeams = function calculateTeams(myTeams, teams) {
40
37
  return teams.isEmpty() ? myTeams.map(function (t) {
41
38
  return t.name;
@@ -43,7 +40,7 @@ var calculateTeams = function calculateTeams(myTeams, teams) {
43
40
  return t.name;
44
41
  }));
45
42
  };
46
- var buildSearch = function buildSearch(filter, appSettings, profile) {
43
+ var buildSearch = exports.buildSearch = function buildSearch(filter, appSettings, profile) {
47
44
  var searcher = (0, _react.defineKqlQuery)();
48
45
  var searcherParams = {};
49
46
 
@@ -102,497 +99,478 @@ var buildSearch = function buildSearch(filter, appSettings, profile) {
102
99
  invalidAssignment: invalidAssignment
103
100
  };
104
101
  };
105
- exports.buildSearch = buildSearch;
106
102
  function fetchListTask(action) {
107
103
  var filter, appSettings, profile, kappSlug, _yield$call, search, invalidAssignment, pageToken, limit, hasPreviousPage, _yield$call2, submissions, nextPageToken, error, count, countPageToken;
108
104
  return (0, _regeneratorRuntime2["default"])().wrap(function fetchListTask$(_context) {
109
- while (1) {
110
- switch (_context.prev = _context.next) {
111
- case 0:
112
- _context.prev = 0;
113
- _context.next = 3;
114
- return (0, _effects.select)(function (state) {
115
- return state.queue.currentFilter;
116
- });
117
- case 3:
118
- filter = _context.sent;
119
- if (!filter) {
120
- _context.next = 59;
121
- break;
122
- }
123
- _context.next = 7;
124
- return (0, _effects.select)(function (state) {
125
- return state.queueApp;
126
- });
127
- case 7:
128
- appSettings = _context.sent;
129
- _context.next = 10;
130
- return (0, _effects.select)(function (state) {
131
- return state.app.profile;
132
- });
133
- case 10:
134
- profile = _context.sent;
135
- _context.next = 13;
136
- return (0, _effects.select)(function (state) {
137
- return state.app.kappSlug;
138
- });
139
- case 13:
140
- kappSlug = _context.sent;
141
- _context.next = 16;
142
- return (0, _effects.call)(buildSearch, filter, appSettings, profile);
143
- case 16:
144
- _yield$call = _context.sent;
145
- search = _yield$call.search;
146
- invalidAssignment = _yield$call.invalidAssignment;
147
- _context.next = 21;
148
- return (0, _effects.select)(function (state) {
149
- return state.queue.pageToken;
150
- });
151
- case 21:
152
- pageToken = _context.sent;
153
- _context.next = 24;
154
- return (0, _effects.select)(function (state) {
155
- return state.queue.limit;
156
- });
157
- case 24:
158
- limit = _context.sent;
159
- _context.next = 27;
160
- return (0, _effects.select)(function (state) {
161
- return state.queue.hasPreviousPage;
162
- });
163
- case 27:
164
- hasPreviousPage = _context.sent;
165
- if (!invalidAssignment) {
166
- _context.next = 35;
167
- break;
168
- }
169
- _context.next = 31;
170
- return (0, _effects.put)(_queue.actions.setListItems(filter, []));
171
- case 31:
172
- _context.next = 33;
173
- return (0, _effects.put)(_queue.actions.fetchListSuccess({
174
- submissions: [],
175
- nextPageToken: null
176
- }));
177
- case 33:
105
+ while (1) switch (_context.prev = _context.next) {
106
+ case 0:
107
+ _context.prev = 0;
108
+ _context.next = 3;
109
+ return (0, _effects.select)(function (state) {
110
+ return state.queue.currentFilter;
111
+ });
112
+ case 3:
113
+ filter = _context.sent;
114
+ if (!filter) {
178
115
  _context.next = 59;
179
116
  break;
180
- case 35:
181
- _context.next = 37;
182
- return (0, _effects.call)(_react.searchSubmissions, {
183
- kapp: kappSlug,
184
- search: search,
185
- limit: limit,
186
- pageToken: pageToken,
187
- count: !pageToken
188
- });
189
- case 37:
190
- _yield$call2 = _context.sent;
191
- submissions = _yield$call2.submissions;
192
- nextPageToken = _yield$call2.nextPageToken;
193
- error = _yield$call2.error;
194
- count = _yield$call2.count;
195
- countPageToken = _yield$call2.countPageToken;
196
- if (!error) {
197
- _context.next = 48;
198
- break;
199
- }
200
- _context.next = 46;
201
- return (0, _effects.put)(_queue.actions.fetchListFailure(error));
202
- case 46:
203
- _context.next = 59;
117
+ }
118
+ _context.next = 7;
119
+ return (0, _effects.select)(function (state) {
120
+ return state.queueApp;
121
+ });
122
+ case 7:
123
+ appSettings = _context.sent;
124
+ _context.next = 10;
125
+ return (0, _effects.select)(function (state) {
126
+ return state.app.profile;
127
+ });
128
+ case 10:
129
+ profile = _context.sent;
130
+ _context.next = 13;
131
+ return (0, _effects.select)(function (state) {
132
+ return state.app.kappSlug;
133
+ });
134
+ case 13:
135
+ kappSlug = _context.sent;
136
+ _context.next = 16;
137
+ return (0, _effects.call)(buildSearch, filter, appSettings, profile);
138
+ case 16:
139
+ _yield$call = _context.sent;
140
+ search = _yield$call.search;
141
+ invalidAssignment = _yield$call.invalidAssignment;
142
+ _context.next = 21;
143
+ return (0, _effects.select)(function (state) {
144
+ return state.queue.pageToken;
145
+ });
146
+ case 21:
147
+ pageToken = _context.sent;
148
+ _context.next = 24;
149
+ return (0, _effects.select)(function (state) {
150
+ return state.queue.limit;
151
+ });
152
+ case 24:
153
+ limit = _context.sent;
154
+ _context.next = 27;
155
+ return (0, _effects.select)(function (state) {
156
+ return state.queue.hasPreviousPage;
157
+ });
158
+ case 27:
159
+ hasPreviousPage = _context.sent;
160
+ if (!invalidAssignment) {
161
+ _context.next = 35;
204
162
  break;
205
- case 48:
206
- if (!((!submissions || submissions.length === 0) && hasPreviousPage)) {
207
- _context.next = 53;
208
- break;
209
- }
210
- _context.next = 51;
211
- return (0, _effects.put)(_queue.actions.fetchListPrevious());
212
- case 51:
213
- _context.next = 59;
163
+ }
164
+ _context.next = 31;
165
+ return (0, _effects.put)(_queue.actions.setListItems(filter, []));
166
+ case 31:
167
+ _context.next = 33;
168
+ return (0, _effects.put)(_queue.actions.fetchListSuccess({
169
+ submissions: [],
170
+ nextPageToken: null
171
+ }));
172
+ case 33:
173
+ _context.next = 59;
174
+ break;
175
+ case 35:
176
+ _context.next = 37;
177
+ return (0, _effects.call)(_react.searchSubmissions, {
178
+ kapp: kappSlug,
179
+ search: search,
180
+ limit: limit,
181
+ pageToken: pageToken,
182
+ count: !pageToken
183
+ });
184
+ case 37:
185
+ _yield$call2 = _context.sent;
186
+ submissions = _yield$call2.submissions;
187
+ nextPageToken = _yield$call2.nextPageToken;
188
+ error = _yield$call2.error;
189
+ count = _yield$call2.count;
190
+ countPageToken = _yield$call2.countPageToken;
191
+ if (!error) {
192
+ _context.next = 48;
193
+ break;
194
+ }
195
+ _context.next = 46;
196
+ return (0, _effects.put)(_queue.actions.fetchListFailure(error));
197
+ case 46:
198
+ _context.next = 59;
199
+ break;
200
+ case 48:
201
+ if (!((!submissions || submissions.length === 0) && hasPreviousPage)) {
202
+ _context.next = 53;
214
203
  break;
215
- case 53:
216
- _context.next = 55;
217
- return (0, _effects.put)(_queue.actions.fetchListSuccess({
218
- submissions: submissions,
219
- nextPageToken: nextPageToken
220
- }));
221
- case 55:
222
- if (!(typeof count !== 'undefined')) {
223
- _context.next = 58;
224
- break;
225
- }
204
+ }
205
+ _context.next = 51;
206
+ return (0, _effects.put)(_queue.actions.fetchListPrevious());
207
+ case 51:
208
+ _context.next = 59;
209
+ break;
210
+ case 53:
211
+ _context.next = 55;
212
+ return (0, _effects.put)(_queue.actions.fetchListSuccess({
213
+ submissions: submissions,
214
+ nextPageToken: nextPageToken
215
+ }));
216
+ case 55:
217
+ if (!(typeof count !== 'undefined')) {
226
218
  _context.next = 58;
227
- return (0, _effects.put)(_queue.actions.fetchListCountSuccess({
228
- filter: filter,
229
- count: countPageToken ? "".concat(count, "+") : count
230
- }));
231
- case 58:
232
- // Call the callback if provided
233
- if (typeof action.payload === 'function') {
234
- action.payload(submissions);
235
- }
236
- case 59:
237
- _context.next = 64;
238
219
  break;
239
- case 61:
240
- _context.prev = 61;
241
- _context.t0 = _context["catch"](0);
242
- console.error('There was a problem fetching queue list items:', _context.t0);
243
- case 64:
244
- case "end":
245
- return _context.stop();
246
- }
220
+ }
221
+ _context.next = 58;
222
+ return (0, _effects.put)(_queue.actions.fetchListCountSuccess({
223
+ filter: filter,
224
+ count: countPageToken ? "".concat(count, "+") : count
225
+ }));
226
+ case 58:
227
+ // Call the callback if provided
228
+ if (typeof action.payload === 'function') {
229
+ action.payload(submissions);
230
+ }
231
+ case 59:
232
+ _context.next = 64;
233
+ break;
234
+ case 61:
235
+ _context.prev = 61;
236
+ _context.t0 = _context["catch"](0);
237
+ console.error('There was a problem fetching queue list items:', _context.t0);
238
+ case 64:
239
+ case "end":
240
+ return _context.stop();
247
241
  }
248
242
  }, _marked, null, [[0, 61]]);
249
243
  }
250
244
  function fetchListCountTask(action) {
251
245
  var filter, appSettings, profile, kappSlug, _yield$call3, search, invalidAssignment, _yield$call4, error, count, countPageToken;
252
246
  return (0, _regeneratorRuntime2["default"])().wrap(function fetchListCountTask$(_context2) {
253
- while (1) {
254
- switch (_context2.prev = _context2.next) {
255
- case 0:
256
- _context2.prev = 0;
257
- filter = action.payload;
258
- if (!filter) {
259
- _context2.next = 31;
260
- break;
261
- }
262
- _context2.next = 5;
263
- return (0, _effects.select)(function (state) {
264
- return state.queueApp;
265
- });
266
- case 5:
267
- appSettings = _context2.sent;
268
- _context2.next = 8;
269
- return (0, _effects.select)(function (state) {
270
- return state.app.profile;
271
- });
272
- case 8:
273
- profile = _context2.sent;
274
- _context2.next = 11;
275
- return (0, _effects.select)(function (state) {
276
- return state.app.kappSlug;
277
- });
278
- case 11:
279
- kappSlug = _context2.sent;
280
- _context2.next = 14;
281
- return (0, _effects.call)(buildSearch, filter, appSettings, profile);
282
- case 14:
283
- _yield$call3 = _context2.sent;
284
- search = _yield$call3.search;
285
- invalidAssignment = _yield$call3.invalidAssignment;
286
- if (!invalidAssignment) {
287
- _context2.next = 22;
288
- break;
289
- }
290
- _context2.next = 20;
291
- return (0, _effects.put)(_queue.actions.fetchListSuccess([], null));
292
- case 20:
247
+ while (1) switch (_context2.prev = _context2.next) {
248
+ case 0:
249
+ _context2.prev = 0;
250
+ filter = action.payload;
251
+ if (!filter) {
293
252
  _context2.next = 31;
294
253
  break;
295
- case 22:
296
- _context2.next = 24;
297
- return (0, _effects.call)(_react.searchSubmissions, {
298
- kapp: kappSlug,
299
- search: search,
300
- count: true,
301
- limit: 0
302
- });
303
- case 24:
304
- _yield$call4 = _context2.sent;
305
- error = _yield$call4.error;
306
- count = _yield$call4.count;
307
- countPageToken = _yield$call4.countPageToken;
308
- if (!(!error && typeof count !== 'undefined')) {
309
- _context2.next = 31;
310
- break;
311
- }
254
+ }
255
+ _context2.next = 5;
256
+ return (0, _effects.select)(function (state) {
257
+ return state.queueApp;
258
+ });
259
+ case 5:
260
+ appSettings = _context2.sent;
261
+ _context2.next = 8;
262
+ return (0, _effects.select)(function (state) {
263
+ return state.app.profile;
264
+ });
265
+ case 8:
266
+ profile = _context2.sent;
267
+ _context2.next = 11;
268
+ return (0, _effects.select)(function (state) {
269
+ return state.app.kappSlug;
270
+ });
271
+ case 11:
272
+ kappSlug = _context2.sent;
273
+ _context2.next = 14;
274
+ return (0, _effects.call)(buildSearch, filter, appSettings, profile);
275
+ case 14:
276
+ _yield$call3 = _context2.sent;
277
+ search = _yield$call3.search;
278
+ invalidAssignment = _yield$call3.invalidAssignment;
279
+ if (!invalidAssignment) {
280
+ _context2.next = 22;
281
+ break;
282
+ }
283
+ _context2.next = 20;
284
+ return (0, _effects.put)(_queue.actions.fetchListSuccess([], null));
285
+ case 20:
286
+ _context2.next = 31;
287
+ break;
288
+ case 22:
289
+ _context2.next = 24;
290
+ return (0, _effects.call)(_react.searchSubmissions, {
291
+ kapp: kappSlug,
292
+ search: search,
293
+ count: true,
294
+ limit: 0
295
+ });
296
+ case 24:
297
+ _yield$call4 = _context2.sent;
298
+ error = _yield$call4.error;
299
+ count = _yield$call4.count;
300
+ countPageToken = _yield$call4.countPageToken;
301
+ if (!(!error && typeof count !== 'undefined')) {
312
302
  _context2.next = 31;
313
- return (0, _effects.put)(_queue.actions.fetchListCountSuccess({
314
- filter: filter,
315
- count: countPageToken ? "".concat(count, "+") : count
316
- }));
317
- case 31:
318
- _context2.next = 36;
319
303
  break;
320
- case 33:
321
- _context2.prev = 33;
322
- _context2.t0 = _context2["catch"](0);
323
- console.error('There was a problem fetching queue list counts:', _context2.t0);
324
- case 36:
325
- case "end":
326
- return _context2.stop();
327
- }
304
+ }
305
+ _context2.next = 31;
306
+ return (0, _effects.put)(_queue.actions.fetchListCountSuccess({
307
+ filter: filter,
308
+ count: countPageToken ? "".concat(count, "+") : count
309
+ }));
310
+ case 31:
311
+ _context2.next = 36;
312
+ break;
313
+ case 33:
314
+ _context2.prev = 33;
315
+ _context2.t0 = _context2["catch"](0);
316
+ console.error('There was a problem fetching queue list counts:', _context2.t0);
317
+ case 36:
318
+ case "end":
319
+ return _context2.stop();
328
320
  }
329
321
  }, _marked2, null, [[0, 33]]);
330
322
  }
331
323
  function fetchCurrentItemTask(action) {
332
324
  var _yield$call5, submission, error;
333
325
  return (0, _regeneratorRuntime2["default"])().wrap(function fetchCurrentItemTask$(_context3) {
334
- while (1) {
335
- switch (_context3.prev = _context3.next) {
336
- case 0:
337
- _context3.next = 2;
338
- return (0, _effects.call)(_react.fetchSubmission, {
339
- id: action.payload,
340
- include: SUBMISSION_INCLUDES
341
- });
342
- case 2:
343
- _yield$call5 = _context3.sent;
344
- submission = _yield$call5.submission;
345
- error = _yield$call5.error;
346
- if (error) {
347
- _context3.next = 10;
348
- break;
349
- }
350
- _context3.next = 8;
351
- return (0, _effects.put)(_queue.actions.setCurrentItem(submission));
352
- case 8:
353
- _context3.next = 12;
326
+ while (1) switch (_context3.prev = _context3.next) {
327
+ case 0:
328
+ _context3.next = 2;
329
+ return (0, _effects.call)(_react.fetchSubmission, {
330
+ id: action.payload,
331
+ include: SUBMISSION_INCLUDES
332
+ });
333
+ case 2:
334
+ _yield$call5 = _context3.sent;
335
+ submission = _yield$call5.submission;
336
+ error = _yield$call5.error;
337
+ if (error) {
338
+ _context3.next = 10;
354
339
  break;
355
- case 10:
356
- _context3.next = 12;
357
- return (0, _effects.put)((0, _bundleCommon.addToastAlert)('Failed to retrieve item!'));
358
- case 12:
359
- case "end":
360
- return _context3.stop();
361
- }
340
+ }
341
+ _context3.next = 8;
342
+ return (0, _effects.put)(_queue.actions.setCurrentItem(submission));
343
+ case 8:
344
+ _context3.next = 12;
345
+ break;
346
+ case 10:
347
+ _context3.next = 12;
348
+ return (0, _effects.put)((0, _bundleCommon.addToastAlert)('Failed to retrieve item!'));
349
+ case 12:
350
+ case "end":
351
+ return _context3.stop();
362
352
  }
363
353
  }, _marked3);
364
354
  }
365
355
  function updateQueueItemTask(action) {
366
356
  var _yield$call6, submission;
367
357
  return (0, _regeneratorRuntime2["default"])().wrap(function updateQueueItemTask$(_context4) {
368
- while (1) {
369
- switch (_context4.prev = _context4.next) {
370
- case 0:
371
- _context4.next = 2;
372
- return (0, _effects.call)(_react.updateSubmission, {
373
- id: action.payload.id,
374
- values: action.payload.values,
375
- include: SUBMISSION_INCLUDES
376
- });
377
- case 2:
378
- _yield$call6 = _context4.sent;
379
- submission = _yield$call6.submission;
380
- if (!submission) {
381
- _context4.next = 8;
382
- break;
383
- }
384
- if ((0, _isFunction["default"])(action.payload.onSuccess)) {
385
- action.payload.onSuccess(submission);
386
- }
387
- _context4.next = 10;
358
+ while (1) switch (_context4.prev = _context4.next) {
359
+ case 0:
360
+ _context4.next = 2;
361
+ return (0, _effects.call)(_react.updateSubmission, {
362
+ id: action.payload.id,
363
+ values: action.payload.values,
364
+ include: SUBMISSION_INCLUDES
365
+ });
366
+ case 2:
367
+ _yield$call6 = _context4.sent;
368
+ submission = _yield$call6.submission;
369
+ if (!submission) {
370
+ _context4.next = 8;
388
371
  break;
389
- case 8:
390
- _context4.next = 10;
391
- return (0, _effects.put)((0, _bundleCommon.addToastAlert)('Failed to update item!'));
392
- case 10:
393
- case "end":
394
- return _context4.stop();
395
- }
372
+ }
373
+ if ((0, _isFunction["default"])(action.payload.onSuccess)) {
374
+ action.payload.onSuccess(submission);
375
+ }
376
+ _context4.next = 10;
377
+ break;
378
+ case 8:
379
+ _context4.next = 10;
380
+ return (0, _effects.put)((0, _bundleCommon.addToastAlert)('Failed to update item!'));
381
+ case 10:
382
+ case "end":
383
+ return _context4.stop();
396
384
  }
397
385
  }, _marked4);
398
386
  }
399
387
  function bulkAssignTask(action) {
400
388
  var submissions, assignment;
401
389
  return (0, _regeneratorRuntime2["default"])().wrap(function bulkAssignTask$(_context5) {
402
- while (1) {
403
- switch (_context5.prev = _context5.next) {
404
- case 0:
405
- _context5.next = 2;
406
- return (0, _effects.select)(function (state) {
407
- return state.queue.selectedList;
390
+ while (1) switch (_context5.prev = _context5.next) {
391
+ case 0:
392
+ _context5.next = 2;
393
+ return (0, _effects.select)(function (state) {
394
+ return state.queue.selectedList;
395
+ });
396
+ case 2:
397
+ submissions = _context5.sent;
398
+ assignment = action.payload.assignment;
399
+ if (!(!submissions || !assignment)) {
400
+ _context5.next = 6;
401
+ break;
402
+ }
403
+ return _context5.abrupt("return");
404
+ case 6:
405
+ _context5.next = 8;
406
+ return (0, _effects.all)(submissions.toList().map(function (submission, i) {
407
+ return (0, _effects.call)(updateBulkSubmission, {
408
+ id: submission.id,
409
+ values: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, submission.values), assignment),
410
+ include: SUBMISSION_LIST_INCLUDES.join(',')
408
411
  });
409
- case 2:
410
- submissions = _context5.sent;
411
- assignment = action.payload.assignment;
412
- if (!(!submissions || !assignment)) {
413
- _context5.next = 6;
414
- break;
415
- }
416
- return _context5.abrupt("return");
417
- case 6:
418
- _context5.next = 8;
419
- return (0, _effects.all)(submissions.toList().map(function (submission, i) {
420
- return (0, _effects.call)(updateBulkSubmission, {
421
- id: submission.id,
422
- values: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, submission.values), assignment),
423
- include: SUBMISSION_LIST_INCLUDES.join(',')
424
- });
425
- }).toJS());
426
- case 8:
427
- _context5.next = 10;
428
- return (0, _reduxSaga.delay)(500);
429
- case 10:
430
- _context5.next = 12;
431
- return (0, _effects.put)(_queue.actions.bulkAssignComplete());
432
- case 12:
433
- case "end":
434
- return _context5.stop();
435
- }
412
+ }).toJS());
413
+ case 8:
414
+ _context5.next = 10;
415
+ return (0, _reduxSaga.delay)(500);
416
+ case 10:
417
+ _context5.next = 12;
418
+ return (0, _effects.put)(_queue.actions.bulkAssignComplete());
419
+ case 12:
420
+ case "end":
421
+ return _context5.stop();
436
422
  }
437
423
  }, _marked5);
438
424
  }
439
425
  function updateBulkSubmission(params) {
440
426
  var _yield$call7, submission, error;
441
427
  return (0, _regeneratorRuntime2["default"])().wrap(function updateBulkSubmission$(_context6) {
442
- while (1) {
443
- switch (_context6.prev = _context6.next) {
444
- case 0:
445
- _context6.next = 2;
446
- return (0, _effects.call)(_react.updateSubmission, params);
447
- case 2:
448
- _yield$call7 = _context6.sent;
449
- submission = _yield$call7.submission;
450
- error = _yield$call7.error;
451
- if (!error) {
452
- _context6.next = 10;
453
- break;
454
- }
455
- _context6.next = 8;
456
- return (0, _effects.put)(_queue.actions.bulkStatusUpdate({
457
- status: 'error',
458
- data: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, error), {}, {
459
- submissionId: params.id
460
- })
461
- }));
462
- case 8:
463
- _context6.next = 12;
428
+ while (1) switch (_context6.prev = _context6.next) {
429
+ case 0:
430
+ _context6.next = 2;
431
+ return (0, _effects.call)(_react.updateSubmission, params);
432
+ case 2:
433
+ _yield$call7 = _context6.sent;
434
+ submission = _yield$call7.submission;
435
+ error = _yield$call7.error;
436
+ if (!error) {
437
+ _context6.next = 10;
464
438
  break;
465
- case 10:
466
- _context6.next = 12;
467
- return (0, _effects.put)(_queue.actions.bulkStatusUpdate({
468
- status: 'success',
469
- data: submission
470
- }));
471
- case 12:
472
- case "end":
473
- return _context6.stop();
474
- }
439
+ }
440
+ _context6.next = 8;
441
+ return (0, _effects.put)(_queue.actions.bulkStatusUpdate({
442
+ status: 'error',
443
+ data: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, error), {}, {
444
+ submissionId: params.id
445
+ })
446
+ }));
447
+ case 8:
448
+ _context6.next = 12;
449
+ break;
450
+ case 10:
451
+ _context6.next = 12;
452
+ return (0, _effects.put)(_queue.actions.bulkStatusUpdate({
453
+ status: 'success',
454
+ data: submission
455
+ }));
456
+ case 12:
457
+ case "end":
458
+ return _context6.stop();
475
459
  }
476
460
  }, _marked6);
477
461
  }
478
462
  function bulkWorkTask(action) {
479
463
  var submissions, profile, assignment, values;
480
464
  return (0, _regeneratorRuntime2["default"])().wrap(function bulkWorkTask$(_context7) {
481
- while (1) {
482
- switch (_context7.prev = _context7.next) {
483
- case 0:
484
- _context7.next = 2;
485
- return (0, _effects.select)(function (state) {
486
- return state.queue.selectedList;
487
- });
488
- case 2:
489
- submissions = _context7.sent;
490
- _context7.next = 5;
491
- return (0, _effects.select)(function (state) {
492
- return state.app.profile;
465
+ while (1) switch (_context7.prev = _context7.next) {
466
+ case 0:
467
+ _context7.next = 2;
468
+ return (0, _effects.select)(function (state) {
469
+ return state.queue.selectedList;
470
+ });
471
+ case 2:
472
+ submissions = _context7.sent;
473
+ _context7.next = 5;
474
+ return (0, _effects.select)(function (state) {
475
+ return state.app.profile;
476
+ });
477
+ case 5:
478
+ profile = _context7.sent;
479
+ // Override the assigned individual to be the current user in case someone
480
+ // grabbed this ticket while the bulk action was being taken
481
+ assignment = {
482
+ 'Assigned Individual': profile.username,
483
+ 'Assigned Individual Display Name': profile.displayName || profile.username
484
+ };
485
+ values = action.payload.values;
486
+ if (!(!submissions || !values)) {
487
+ _context7.next = 10;
488
+ break;
489
+ }
490
+ return _context7.abrupt("return");
491
+ case 10:
492
+ _context7.next = 12;
493
+ return (0, _effects.all)(submissions.toList().map(function (submission, i) {
494
+ return (0, _effects.call)(submitBulkSubmission, {
495
+ id: submission.id,
496
+ page: submission.currentPage,
497
+ values: (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, submission.values), assignment), values),
498
+ include: SUBMISSION_LIST_INCLUDES.join(',')
493
499
  });
494
- case 5:
495
- profile = _context7.sent;
496
- // Override the assigned individual to be the current user in case someone
497
- // grabbed this ticket while the bulk action was being taken
498
- assignment = {
499
- 'Assigned Individual': profile.username,
500
- 'Assigned Individual Display Name': profile.displayName || profile.username
501
- };
502
- values = action.payload.values;
503
- if (!(!submissions || !values)) {
504
- _context7.next = 10;
505
- break;
506
- }
507
- return _context7.abrupt("return");
508
- case 10:
509
- _context7.next = 12;
510
- return (0, _effects.all)(submissions.toList().map(function (submission, i) {
511
- return (0, _effects.call)(submitBulkSubmission, {
512
- id: submission.id,
513
- page: submission.currentPage,
514
- values: (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, submission.values), assignment), values),
515
- include: SUBMISSION_LIST_INCLUDES.join(',')
516
- });
517
- }).toJS());
518
- case 12:
519
- _context7.next = 14;
520
- return (0, _reduxSaga.delay)(500);
521
- case 14:
522
- _context7.next = 16;
523
- return (0, _effects.put)(_queue.actions.bulkWorkComplete());
524
- case 16:
525
- case "end":
526
- return _context7.stop();
527
- }
500
+ }).toJS());
501
+ case 12:
502
+ _context7.next = 14;
503
+ return (0, _reduxSaga.delay)(500);
504
+ case 14:
505
+ _context7.next = 16;
506
+ return (0, _effects.put)(_queue.actions.bulkWorkComplete());
507
+ case 16:
508
+ case "end":
509
+ return _context7.stop();
528
510
  }
529
511
  }, _marked7);
530
512
  }
531
513
  function submitBulkSubmission(params) {
532
514
  var _yield$call8, submission, error;
533
515
  return (0, _regeneratorRuntime2["default"])().wrap(function submitBulkSubmission$(_context8) {
534
- while (1) {
535
- switch (_context8.prev = _context8.next) {
536
- case 0:
537
- _context8.next = 2;
538
- return (0, _effects.call)(_react.submitSubmission, params);
539
- case 2:
540
- _yield$call8 = _context8.sent;
541
- submission = _yield$call8.submission;
542
- error = _yield$call8.error;
543
- if (!error) {
544
- _context8.next = 10;
545
- break;
546
- }
547
- _context8.next = 8;
548
- return (0, _effects.put)(_queue.actions.bulkStatusUpdate({
549
- status: 'error',
550
- data: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, error), {}, {
551
- submissionId: params.id
552
- })
553
- }));
554
- case 8:
555
- _context8.next = 12;
516
+ while (1) switch (_context8.prev = _context8.next) {
517
+ case 0:
518
+ _context8.next = 2;
519
+ return (0, _effects.call)(_react.submitSubmission, params);
520
+ case 2:
521
+ _yield$call8 = _context8.sent;
522
+ submission = _yield$call8.submission;
523
+ error = _yield$call8.error;
524
+ if (!error) {
525
+ _context8.next = 10;
556
526
  break;
557
- case 10:
558
- _context8.next = 12;
559
- return (0, _effects.put)(_queue.actions.bulkStatusUpdate({
560
- status: 'success',
561
- data: submission
562
- }));
563
- case 12:
564
- case "end":
565
- return _context8.stop();
566
- }
527
+ }
528
+ _context8.next = 8;
529
+ return (0, _effects.put)(_queue.actions.bulkStatusUpdate({
530
+ status: 'error',
531
+ data: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, error), {}, {
532
+ submissionId: params.id
533
+ })
534
+ }));
535
+ case 8:
536
+ _context8.next = 12;
537
+ break;
538
+ case 10:
539
+ _context8.next = 12;
540
+ return (0, _effects.put)(_queue.actions.bulkStatusUpdate({
541
+ status: 'success',
542
+ data: submission
543
+ }));
544
+ case 12:
545
+ case "end":
546
+ return _context8.stop();
567
547
  }
568
548
  }, _marked8);
569
549
  }
570
550
  function watchQueue() {
571
551
  return (0, _regeneratorRuntime2["default"])().wrap(function watchQueue$(_context9) {
572
- while (1) {
573
- switch (_context9.prev = _context9.next) {
574
- case 0:
575
- _context9.next = 2;
576
- return (0, _effects.takeLatest)([_queue.types.FETCH_LIST_REQUEST, _queue.types.FETCH_LIST_PREVIOUS, _queue.types.FETCH_LIST_NEXT, _queue.types.FETCH_LIST_RESET, _queue.types.UPDATE_LIST_LIMIT], fetchListTask);
577
- case 2:
578
- _context9.next = 4;
579
- return (0, _effects.takeEvery)(_queue.types.FETCH_LIST_COUNT_REQUEST, fetchListCountTask);
580
- case 4:
581
- _context9.next = 6;
582
- return (0, _effects.takeEvery)(_queue.types.FETCH_CURRENT_ITEM, fetchCurrentItemTask);
583
- case 6:
584
- _context9.next = 8;
585
- return (0, _effects.takeEvery)(_queue.types.UPDATE_QUEUE_ITEM, updateQueueItemTask);
586
- case 8:
587
- _context9.next = 10;
588
- return (0, _effects.takeEvery)(_queue.types.BULK_ASSIGN_REQUEST, bulkAssignTask);
589
- case 10:
590
- _context9.next = 12;
591
- return (0, _effects.takeEvery)(_queue.types.BULK_WORK_REQUEST, bulkWorkTask);
592
- case 12:
593
- case "end":
594
- return _context9.stop();
595
- }
552
+ while (1) switch (_context9.prev = _context9.next) {
553
+ case 0:
554
+ _context9.next = 2;
555
+ return (0, _effects.takeLatest)([_queue.types.FETCH_LIST_REQUEST, _queue.types.FETCH_LIST_PREVIOUS, _queue.types.FETCH_LIST_NEXT, _queue.types.FETCH_LIST_RESET, _queue.types.UPDATE_LIST_LIMIT], fetchListTask);
556
+ case 2:
557
+ _context9.next = 4;
558
+ return (0, _effects.takeEvery)(_queue.types.FETCH_LIST_COUNT_REQUEST, fetchListCountTask);
559
+ case 4:
560
+ _context9.next = 6;
561
+ return (0, _effects.takeEvery)(_queue.types.FETCH_CURRENT_ITEM, fetchCurrentItemTask);
562
+ case 6:
563
+ _context9.next = 8;
564
+ return (0, _effects.takeEvery)(_queue.types.UPDATE_QUEUE_ITEM, updateQueueItemTask);
565
+ case 8:
566
+ _context9.next = 10;
567
+ return (0, _effects.takeEvery)(_queue.types.BULK_ASSIGN_REQUEST, bulkAssignTask);
568
+ case 10:
569
+ _context9.next = 12;
570
+ return (0, _effects.takeEvery)(_queue.types.BULK_WORK_REQUEST, bulkWorkTask);
571
+ case 12:
572
+ case "end":
573
+ return _context9.stop();
596
574
  }
597
575
  }, _marked9);
598
576
  }