@plusscommunities/pluss-maintenance-web-forms 1.1.36 → 1.1.37-beta.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/dist/index.cjs.js +217 -106
- package/dist/index.esm.js +217 -106
- package/dist/index.umd.js +217 -106
- package/package.json +1 -1
- package/src/components/AnalyticsHub.js +331 -154
- package/src/feature.config.js +0 -1
- package/src/values.config.a.js +0 -6
- package/src/values.config.default.js +0 -6
- package/src/values.config.forms.js +0 -6
- package/src/values.config.js +0 -6
package/dist/index.umd.js
CHANGED
|
@@ -101,13 +101,7 @@
|
|
|
101
101
|
hasHelpButton: true,
|
|
102
102
|
helpGuideURL: 'https://www.plusscommunities.com/forms-feature',
|
|
103
103
|
stringConfigJobStatus: 'maintenanceJobStatusForms',
|
|
104
|
-
stringConfigHideSeen: 'maintenanceDisableSeenForms'
|
|
105
|
-
// Comment subscription notification preference
|
|
106
|
-
notificationPreference: {
|
|
107
|
-
key: 'maintenancerequestFormsComments',
|
|
108
|
-
label: 'Forms comments',
|
|
109
|
-
permission: 'maintenanceTrackingForms'
|
|
110
|
-
}
|
|
104
|
+
stringConfigHideSeen: 'maintenanceDisableSeenForms'
|
|
111
105
|
};
|
|
112
106
|
|
|
113
107
|
// import * as PlussCore from '../../pluss-core/src';
|
|
@@ -230,8 +224,7 @@
|
|
|
230
224
|
init: environment => {
|
|
231
225
|
FeatureConfig.env = environment;
|
|
232
226
|
PlussCore__namespace.Config.init(environment);
|
|
233
|
-
}
|
|
234
|
-
notificationPreference: values.notificationPreference
|
|
227
|
+
}
|
|
235
228
|
};
|
|
236
229
|
|
|
237
230
|
const JOBS_LOADED = values.actionJobsLoaded;
|
|
@@ -244,12 +237,12 @@
|
|
|
244
237
|
function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
245
238
|
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
246
239
|
const {
|
|
247
|
-
Helper: Helper$
|
|
240
|
+
Helper: Helper$6,
|
|
248
241
|
Session: Session$9
|
|
249
242
|
} = PlussCore__namespace;
|
|
250
243
|
const maintenanceActions = {
|
|
251
244
|
getJobType: (site, typeId) => {
|
|
252
|
-
let url = Helper$
|
|
245
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtype');
|
|
253
246
|
return Session$9.authedFunction({
|
|
254
247
|
method: 'POST',
|
|
255
248
|
url,
|
|
@@ -260,7 +253,7 @@
|
|
|
260
253
|
});
|
|
261
254
|
},
|
|
262
255
|
getJobTypes: (site, id) => {
|
|
263
|
-
let url = Helper$
|
|
256
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtypes');
|
|
264
257
|
return Session$9.authedFunction({
|
|
265
258
|
method: 'POST',
|
|
266
259
|
url,
|
|
@@ -270,7 +263,7 @@
|
|
|
270
263
|
});
|
|
271
264
|
},
|
|
272
265
|
getJob: (site, id) => {
|
|
273
|
-
let url = Helper$
|
|
266
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
274
267
|
return Session$9.authedFunction({
|
|
275
268
|
method: 'POST',
|
|
276
269
|
url,
|
|
@@ -281,7 +274,7 @@
|
|
|
281
274
|
});
|
|
282
275
|
},
|
|
283
276
|
getJobByJobId: (site, jobId) => {
|
|
284
|
-
let url = Helper$
|
|
277
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
285
278
|
return Session$9.authedFunction({
|
|
286
279
|
method: 'POST',
|
|
287
280
|
url,
|
|
@@ -296,7 +289,7 @@
|
|
|
296
289
|
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
297
290
|
return Session$9.authedFunction({
|
|
298
291
|
method: 'POST',
|
|
299
|
-
url: Helper$
|
|
292
|
+
url: Helper$6.getUrl(values.serviceKey, 'getJobs'),
|
|
300
293
|
data: {
|
|
301
294
|
site,
|
|
302
295
|
status,
|
|
@@ -319,7 +312,7 @@
|
|
|
319
312
|
}
|
|
320
313
|
return Session$9.authedFunction({
|
|
321
314
|
method: 'GET',
|
|
322
|
-
url: Helper$
|
|
315
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/requests', query)
|
|
323
316
|
});
|
|
324
317
|
},
|
|
325
318
|
getJobsRecursive: function (site, status, type, lastKey) {
|
|
@@ -337,14 +330,14 @@
|
|
|
337
330
|
createJob: job => {
|
|
338
331
|
return Session$9.authedFunction({
|
|
339
332
|
method: 'POST',
|
|
340
|
-
url: Helper$
|
|
333
|
+
url: Helper$6.getUrl(values.serviceKey, 'sendMaintenance'),
|
|
341
334
|
data: _objectSpread$7({}, job)
|
|
342
335
|
});
|
|
343
336
|
},
|
|
344
337
|
editJob: (job, site) => {
|
|
345
338
|
return Session$9.authedFunction({
|
|
346
339
|
method: 'POST',
|
|
347
|
-
url: Helper$
|
|
340
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJob'),
|
|
348
341
|
data: {
|
|
349
342
|
job,
|
|
350
343
|
site
|
|
@@ -354,7 +347,7 @@
|
|
|
354
347
|
deleteJob: (site, id) => {
|
|
355
348
|
return Session$9.authedFunction({
|
|
356
349
|
method: 'POST',
|
|
357
|
-
url: Helper$
|
|
350
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/remove'),
|
|
358
351
|
data: {
|
|
359
352
|
site,
|
|
360
353
|
id
|
|
@@ -364,7 +357,7 @@
|
|
|
364
357
|
editJobStatus: (id, status) => {
|
|
365
358
|
return Session$9.authedFunction({
|
|
366
359
|
method: 'POST',
|
|
367
|
-
url: Helper$
|
|
360
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobStatus'),
|
|
368
361
|
data: {
|
|
369
362
|
id,
|
|
370
363
|
status
|
|
@@ -374,7 +367,7 @@
|
|
|
374
367
|
editJobPriority: (id, priority) => {
|
|
375
368
|
return Session$9.authedFunction({
|
|
376
369
|
method: 'POST',
|
|
377
|
-
url: Helper$
|
|
370
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/priority'),
|
|
378
371
|
data: {
|
|
379
372
|
id,
|
|
380
373
|
priority
|
|
@@ -384,7 +377,7 @@
|
|
|
384
377
|
assignJob: (jobId, userId) => {
|
|
385
378
|
return Session$9.authedFunction({
|
|
386
379
|
method: 'POST',
|
|
387
|
-
url: Helper$
|
|
380
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/assign'),
|
|
388
381
|
data: {
|
|
389
382
|
id: jobId,
|
|
390
383
|
userId
|
|
@@ -394,7 +387,7 @@
|
|
|
394
387
|
getAssignees: site => {
|
|
395
388
|
return Session$9.authedFunction({
|
|
396
389
|
method: 'GET',
|
|
397
|
-
url: Helper$
|
|
390
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/assignees', {
|
|
398
391
|
site
|
|
399
392
|
})
|
|
400
393
|
});
|
|
@@ -402,7 +395,7 @@
|
|
|
402
395
|
addNote: (jobId, note, attachments, images) => {
|
|
403
396
|
return Session$9.authedFunction({
|
|
404
397
|
method: 'POST',
|
|
405
|
-
url: Helper$
|
|
398
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
406
399
|
data: {
|
|
407
400
|
id: jobId,
|
|
408
401
|
note,
|
|
@@ -415,7 +408,7 @@
|
|
|
415
408
|
editNote: (jobId, noteId, note, attachments, images) => {
|
|
416
409
|
return Session$9.authedFunction({
|
|
417
410
|
method: 'POST',
|
|
418
|
-
url: Helper$
|
|
411
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
419
412
|
data: {
|
|
420
413
|
id: jobId,
|
|
421
414
|
note,
|
|
@@ -429,7 +422,7 @@
|
|
|
429
422
|
deleteNote: (jobId, noteId) => {
|
|
430
423
|
return Session$9.authedFunction({
|
|
431
424
|
method: 'POST',
|
|
432
|
-
url: Helper$
|
|
425
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
433
426
|
data: {
|
|
434
427
|
id: jobId,
|
|
435
428
|
noteId,
|
|
@@ -449,7 +442,7 @@
|
|
|
449
442
|
};
|
|
450
443
|
return Session$9.authedFunction({
|
|
451
444
|
method: 'POST',
|
|
452
|
-
url: Helper$
|
|
445
|
+
url: Helper$6.getUrl(values.serviceKey, 'createJobType'),
|
|
453
446
|
data
|
|
454
447
|
});
|
|
455
448
|
},
|
|
@@ -467,14 +460,14 @@
|
|
|
467
460
|
if (hasCustomFields && customFields) data.customFields = customFields;
|
|
468
461
|
return Session$9.authedFunction({
|
|
469
462
|
method: 'POST',
|
|
470
|
-
url: Helper$
|
|
463
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobType'),
|
|
471
464
|
data
|
|
472
465
|
});
|
|
473
466
|
},
|
|
474
467
|
deleteJobType: (site, id) => {
|
|
475
468
|
return Session$9.authedFunction({
|
|
476
469
|
method: 'POST',
|
|
477
|
-
url: Helper$
|
|
470
|
+
url: Helper$6.getUrl(values.serviceKey, 'deleteJobType'),
|
|
478
471
|
data: {
|
|
479
472
|
site,
|
|
480
473
|
id
|
|
@@ -484,7 +477,7 @@
|
|
|
484
477
|
getExternalSync: jobId => {
|
|
485
478
|
return Session$9.authedFunction({
|
|
486
479
|
method: 'GET',
|
|
487
|
-
url: Helper$
|
|
480
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/externalsync', {
|
|
488
481
|
id: jobId
|
|
489
482
|
})
|
|
490
483
|
});
|
|
@@ -492,7 +485,7 @@
|
|
|
492
485
|
retrySync: jobId => {
|
|
493
486
|
return Session$9.authedFunction({
|
|
494
487
|
method: 'POST',
|
|
495
|
-
url: Helper$
|
|
488
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/retrysync'),
|
|
496
489
|
data: {
|
|
497
490
|
id: jobId
|
|
498
491
|
}
|
|
@@ -501,7 +494,7 @@
|
|
|
501
494
|
};
|
|
502
495
|
|
|
503
496
|
const {
|
|
504
|
-
Helper: Helper$
|
|
497
|
+
Helper: Helper$5,
|
|
505
498
|
Session: Session$8
|
|
506
499
|
} = PlussCore__namespace;
|
|
507
500
|
const reactionActions = {
|
|
@@ -519,7 +512,7 @@
|
|
|
519
512
|
}
|
|
520
513
|
return Session$8.authedFunction({
|
|
521
514
|
method: 'POST',
|
|
522
|
-
url: Helper$
|
|
515
|
+
url: Helper$5.getUrl('reactions', 'comments/add'),
|
|
523
516
|
data
|
|
524
517
|
});
|
|
525
518
|
},
|
|
@@ -542,7 +535,7 @@
|
|
|
542
535
|
}
|
|
543
536
|
return Session$8.authedFunction({
|
|
544
537
|
method: 'GET',
|
|
545
|
-
url: Helper$
|
|
538
|
+
url: Helper$5.getUrl('reactions', 'comments/get', query)
|
|
546
539
|
});
|
|
547
540
|
}
|
|
548
541
|
};
|
|
@@ -576,7 +569,7 @@
|
|
|
576
569
|
];
|
|
577
570
|
|
|
578
571
|
const {
|
|
579
|
-
Helper: Helper$
|
|
572
|
+
Helper: Helper$4
|
|
580
573
|
} = PlussCore__namespace;
|
|
581
574
|
const jobsUpdate = (site, isdashboard) => {
|
|
582
575
|
return dispatch => {
|
|
@@ -584,7 +577,7 @@
|
|
|
584
577
|
type: JOBS_LOADING
|
|
585
578
|
});
|
|
586
579
|
maintenanceActions.getJobsRecursive(site).then(res => {
|
|
587
|
-
const currentSite = Helper$
|
|
580
|
+
const currentSite = Helper$4.readStorageWithCookie('site');
|
|
588
581
|
if (!___default["default"].isEmpty(res) && res[0].site === currentSite) {
|
|
589
582
|
dispatch({
|
|
590
583
|
type: JOBS_LOADED,
|
|
@@ -2721,7 +2714,7 @@
|
|
|
2721
2714
|
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2722
2715
|
const {
|
|
2723
2716
|
Apis: Apis$1,
|
|
2724
|
-
Helper: Helper$
|
|
2717
|
+
Helper: Helper$3,
|
|
2725
2718
|
Session: Session$3,
|
|
2726
2719
|
Colours: Colours$1,
|
|
2727
2720
|
Components: Components$3
|
|
@@ -3123,7 +3116,7 @@
|
|
|
3123
3116
|
}
|
|
3124
3117
|
});
|
|
3125
3118
|
this.state = {
|
|
3126
|
-
jobId: Helper$
|
|
3119
|
+
jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
|
|
3127
3120
|
job: null,
|
|
3128
3121
|
showingSelector: false,
|
|
3129
3122
|
updating: false,
|
|
@@ -3326,7 +3319,7 @@
|
|
|
3326
3319
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3327
3320
|
className: "imageGrid_image",
|
|
3328
3321
|
style: {
|
|
3329
|
-
backgroundImage: "url('".concat(Helper$
|
|
3322
|
+
backgroundImage: "url('".concat(Helper$3.get1400(image), "')"),
|
|
3330
3323
|
width: size,
|
|
3331
3324
|
height: size
|
|
3332
3325
|
}
|
|
@@ -3541,7 +3534,7 @@
|
|
|
3541
3534
|
}]
|
|
3542
3535
|
})), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
3543
3536
|
className: "maintenanceNote_text"
|
|
3544
|
-
}, Helper$
|
|
3537
|
+
}, Helper$3.toParagraphed(note.Note)), note.Attachments.map((a, i) => this.renderAttachment(a, i)), note.Images && note.Images.length > 0 ? this.renderImageGrid(note.Images, IMAGE_SIZE_NOTE) : null));
|
|
3545
3538
|
}
|
|
3546
3539
|
renderAssignment() {
|
|
3547
3540
|
const {
|
|
@@ -3975,7 +3968,7 @@
|
|
|
3975
3968
|
const {
|
|
3976
3969
|
Actions,
|
|
3977
3970
|
Components: Components$2,
|
|
3978
|
-
Helper: Helper$
|
|
3971
|
+
Helper: Helper$2,
|
|
3979
3972
|
Session: Session$2,
|
|
3980
3973
|
Colours,
|
|
3981
3974
|
Apis
|
|
@@ -4333,7 +4326,7 @@
|
|
|
4333
4326
|
if (___default["default"].isNil(answer) || ___default["default"].isEmpty(answer)) return true;
|
|
4334
4327
|
switch (type) {
|
|
4335
4328
|
case "email":
|
|
4336
|
-
return Helper$
|
|
4329
|
+
return Helper$2.isEmail(answer);
|
|
4337
4330
|
case "date":
|
|
4338
4331
|
return moment__default["default"](answer, "YYYY-MM-DD", true).isValid();
|
|
4339
4332
|
case "time":
|
|
@@ -4354,7 +4347,7 @@
|
|
|
4354
4347
|
this.customImageInputs = {};
|
|
4355
4348
|
this.customDocumentInputs = {};
|
|
4356
4349
|
this.state = {
|
|
4357
|
-
jobId: Helper$
|
|
4350
|
+
jobId: Helper$2.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
|
|
4358
4351
|
job: null,
|
|
4359
4352
|
showingSelector: false,
|
|
4360
4353
|
updating: false,
|
|
@@ -4706,7 +4699,7 @@
|
|
|
4706
4699
|
return /*#__PURE__*/React__default["default"].createElement("p", {
|
|
4707
4700
|
className: "visitorSignIn_text-staticText",
|
|
4708
4701
|
key: fieldId
|
|
4709
|
-
}, Helper$
|
|
4702
|
+
}, Helper$2.toParagraphed(field.label, {
|
|
4710
4703
|
marginTop: 10
|
|
4711
4704
|
}));
|
|
4712
4705
|
case "date":
|
|
@@ -4961,7 +4954,7 @@
|
|
|
4961
4954
|
return {
|
|
4962
4955
|
auth,
|
|
4963
4956
|
strings: state.strings && state.strings.config || {},
|
|
4964
|
-
optionOnlyForResidents: Helper$
|
|
4957
|
+
optionOnlyForResidents: Helper$2.getSiteSettingFromState(state, values.optionOnlyForResidents)
|
|
4965
4958
|
};
|
|
4966
4959
|
};
|
|
4967
4960
|
var AddJob$1 = reactRedux.connect(mapStateToProps$2, {
|
|
@@ -4973,7 +4966,7 @@
|
|
|
4973
4966
|
const {
|
|
4974
4967
|
Components: Components$1,
|
|
4975
4968
|
Session: Session$1,
|
|
4976
|
-
Helper
|
|
4969
|
+
Helper: Helper$1
|
|
4977
4970
|
} = PlussCore__namespace;
|
|
4978
4971
|
const DEFAULT_FIELD = {
|
|
4979
4972
|
type: 'text',
|
|
@@ -5016,7 +5009,7 @@
|
|
|
5016
5009
|
const {
|
|
5017
5010
|
jobTypeEmail
|
|
5018
5011
|
} = this.state;
|
|
5019
|
-
return !___default["default"].isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
|
|
5012
|
+
return !___default["default"].isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
|
|
5020
5013
|
});
|
|
5021
5014
|
_defineProperty__default["default"](this, "isJobTypeValid", () => {
|
|
5022
5015
|
const {
|
|
@@ -5218,7 +5211,7 @@
|
|
|
5218
5211
|
}];
|
|
5219
5212
|
this.state = {
|
|
5220
5213
|
loading: false,
|
|
5221
|
-
jobTypeId: Helper.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5214
|
+
jobTypeId: Helper$1.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5222
5215
|
jobTypeName: '',
|
|
5223
5216
|
jobTypeEmail: '',
|
|
5224
5217
|
jobTypeDescription: '',
|
|
@@ -5770,7 +5763,8 @@
|
|
|
5770
5763
|
const {
|
|
5771
5764
|
Analytics: Analytics$1,
|
|
5772
5765
|
Session,
|
|
5773
|
-
Components
|
|
5766
|
+
Components,
|
|
5767
|
+
Helper
|
|
5774
5768
|
} = PlussCore__namespace;
|
|
5775
5769
|
const getInitialState = () => ({
|
|
5776
5770
|
requests: 0,
|
|
@@ -5790,10 +5784,21 @@
|
|
|
5790
5784
|
auth,
|
|
5791
5785
|
prevText,
|
|
5792
5786
|
dayCount,
|
|
5793
|
-
strings
|
|
5787
|
+
strings,
|
|
5788
|
+
userType,
|
|
5789
|
+
userCategory,
|
|
5790
|
+
selectedSites
|
|
5794
5791
|
} = _ref;
|
|
5795
5792
|
const [analyticsData, setAnalyticsData] = React.useState(getInitialState());
|
|
5796
5793
|
const [isExportOpen, setIsExportOpen] = React.useState(false);
|
|
5794
|
+
const [failedSites, setFailedSites] = React.useState([]);
|
|
5795
|
+
const [comparisonData, setComparisonData] = React.useState({
|
|
5796
|
+
requests: [],
|
|
5797
|
+
completedRequests: [],
|
|
5798
|
+
comments: [],
|
|
5799
|
+
isLoading: true
|
|
5800
|
+
});
|
|
5801
|
+
const comparisonMode = selectedSites && selectedSites.length > 1;
|
|
5797
5802
|
const hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
|
|
5798
5803
|
if (!hasAccess) {
|
|
5799
5804
|
return null;
|
|
@@ -5805,50 +5810,120 @@
|
|
|
5805
5810
|
return strings.sideNav[key];
|
|
5806
5811
|
})();
|
|
5807
5812
|
const exportColumns = [{
|
|
5808
|
-
label:
|
|
5809
|
-
key:
|
|
5810
|
-
}, {
|
|
5811
|
-
label:
|
|
5812
|
-
key:
|
|
5813
|
+
label: "Select All",
|
|
5814
|
+
key: ""
|
|
5815
|
+
}, ...(comparisonMode ? [{
|
|
5816
|
+
label: "Site",
|
|
5817
|
+
key: "site"
|
|
5818
|
+
}] : []), {
|
|
5819
|
+
label: "Start Date",
|
|
5820
|
+
key: "startDate"
|
|
5813
5821
|
}, {
|
|
5814
|
-
label:
|
|
5815
|
-
key:
|
|
5822
|
+
label: "End Date",
|
|
5823
|
+
key: "endDate"
|
|
5816
5824
|
}, {
|
|
5817
5825
|
label: "".concat(values.textSingularName, "s"),
|
|
5818
|
-
key:
|
|
5826
|
+
key: "requests"
|
|
5819
5827
|
}, {
|
|
5820
5828
|
label: "Completed ".concat(values.textSingularName, "s"),
|
|
5821
|
-
key:
|
|
5829
|
+
key: "completedRequests"
|
|
5822
5830
|
}, {
|
|
5823
|
-
label:
|
|
5824
|
-
key:
|
|
5831
|
+
label: "Comments",
|
|
5832
|
+
key: "comments"
|
|
5825
5833
|
}];
|
|
5826
5834
|
React.useEffect(() => {
|
|
5827
5835
|
getData();
|
|
5828
|
-
}, [startTime, endTime]);
|
|
5836
|
+
}, [startTime, endTime, userType, userCategory, selectedSites]);
|
|
5829
5837
|
const getData = async () => {
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5838
|
+
if (comparisonMode) {
|
|
5839
|
+
setComparisonData({
|
|
5840
|
+
requests: [],
|
|
5841
|
+
completedRequests: [],
|
|
5842
|
+
comments: [],
|
|
5843
|
+
isLoading: true
|
|
5844
|
+
});
|
|
5845
|
+
const multiSiteResultsObj = await Analytics$1.fetchMultiSiteData(selectedSites, async site => {
|
|
5846
|
+
const {
|
|
5847
|
+
data
|
|
5848
|
+
} = await analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5849
|
+
userType,
|
|
5850
|
+
userCategory
|
|
5851
|
+
});
|
|
5852
|
+
return data;
|
|
5853
|
+
});
|
|
5854
|
+
const roles = auth.user.Roles;
|
|
5855
|
+
const failed = Object.entries(multiSiteResultsObj).filter(_ref2 => {
|
|
5856
|
+
let [, data] = _ref2;
|
|
5857
|
+
return data === null;
|
|
5858
|
+
}).map(_ref3 => {
|
|
5859
|
+
let [site] = _ref3;
|
|
5860
|
+
return Helper.getSiteNameFromRoles(site, roles);
|
|
5861
|
+
});
|
|
5862
|
+
setFailedSites(failed);
|
|
5863
|
+
const multiSiteResults = Object.entries(multiSiteResultsObj).filter(_ref4 => {
|
|
5864
|
+
let [, data] = _ref4;
|
|
5865
|
+
return data !== null;
|
|
5866
|
+
}).map(_ref5 => {
|
|
5867
|
+
let [site, data] = _ref5;
|
|
5868
|
+
return {
|
|
5869
|
+
site,
|
|
5870
|
+
data
|
|
5871
|
+
};
|
|
5872
|
+
});
|
|
5873
|
+
const buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
|
|
5874
|
+
name: Helper.getSiteNameFromRoles(result.site, roles),
|
|
5875
|
+
value: Analytics$1.countActivities(result.data, activityKey, countType)
|
|
5876
|
+
}));
|
|
5877
|
+
setComparisonData({
|
|
5878
|
+
requests: buildComparison("Request", "total"),
|
|
5879
|
+
completedRequests: buildComparison("RequestCompleted", "unique"),
|
|
5880
|
+
comments: buildComparison("Comment", "total"),
|
|
5881
|
+
isLoading: false
|
|
5882
|
+
});
|
|
5883
|
+
} else {
|
|
5884
|
+
setAnalyticsData(getInitialState());
|
|
5885
|
+
const site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
|
|
5886
|
+
const timeDifference = endTime - startTime;
|
|
5887
|
+
const [currentStatsResponse, prevStatsResponse] = await Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5888
|
+
userType,
|
|
5889
|
+
userCategory
|
|
5890
|
+
}), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
|
|
5891
|
+
userType,
|
|
5892
|
+
userCategory
|
|
5893
|
+
})]);
|
|
5894
|
+
const data = {
|
|
5895
|
+
requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
|
|
5896
|
+
prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
|
|
5897
|
+
completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
|
|
5898
|
+
prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
|
|
5899
|
+
comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
|
|
5900
|
+
prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
|
|
5901
|
+
isLoading: false
|
|
5902
|
+
};
|
|
5903
|
+
setAnalyticsData(data);
|
|
5904
|
+
}
|
|
5844
5905
|
};
|
|
5845
5906
|
const isReadyToOpenCSV = () => {
|
|
5846
|
-
return !analyticsData.isLoading;
|
|
5907
|
+
return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
|
|
5847
5908
|
};
|
|
5848
5909
|
const getExportSource = () => {
|
|
5910
|
+
if (comparisonMode) {
|
|
5911
|
+
const sites = comparisonData.requests || [];
|
|
5912
|
+
return sites.map((site, i) => {
|
|
5913
|
+
var _comparisonData$compl, _comparisonData$comme;
|
|
5914
|
+
return {
|
|
5915
|
+
site: site.name,
|
|
5916
|
+
startDate: moment__default["default"](startTime + 1).format("D-MM-YYYY"),
|
|
5917
|
+
endDate: moment__default["default"](endTime).format("D-MM-YYYY"),
|
|
5918
|
+
requests: site.value,
|
|
5919
|
+
completedRequests: ((_comparisonData$compl = comparisonData.completedRequests[i]) === null || _comparisonData$compl === void 0 ? void 0 : _comparisonData$compl.value) || 0,
|
|
5920
|
+
comments: ((_comparisonData$comme = comparisonData.comments[i]) === null || _comparisonData$comme === void 0 ? void 0 : _comparisonData$comme.value) || 0
|
|
5921
|
+
};
|
|
5922
|
+
});
|
|
5923
|
+
}
|
|
5849
5924
|
return [{
|
|
5850
|
-
startDate: moment__default["default"](startTime + 1).format(
|
|
5851
|
-
endDate: moment__default["default"](endTime).format(
|
|
5925
|
+
startDate: moment__default["default"](startTime + 1).format("D-MM-YYYY"),
|
|
5926
|
+
endDate: moment__default["default"](endTime).format("D-MM-YYYY"),
|
|
5852
5927
|
requests: analyticsData.requests,
|
|
5853
5928
|
completedRequests: analyticsData.completedRequests,
|
|
5854
5929
|
comments: analyticsData.comments
|
|
@@ -5859,13 +5934,14 @@
|
|
|
5859
5934
|
return null;
|
|
5860
5935
|
}
|
|
5861
5936
|
const source = getExportSource();
|
|
5937
|
+
const filterSuffix = [userType, userCategory].filter(Boolean).map(f => f.toLowerCase().replace(/\s+/g, '-')).join('_');
|
|
5862
5938
|
return /*#__PURE__*/React__default["default"].createElement(Components.ExportCsvPopup, {
|
|
5863
5939
|
onClose: () => {
|
|
5864
5940
|
setIsExportOpen(false);
|
|
5865
5941
|
},
|
|
5866
5942
|
columns: exportColumns,
|
|
5867
5943
|
source: source,
|
|
5868
|
-
filename: "".concat(values.analyticsKey, "
|
|
5944
|
+
filename: "".concat(values.analyticsKey, "analytics").concat(comparisonMode ? '_comparison' : '').concat(filterSuffix ? "_".concat(filterSuffix) : '', "_").concat(source[0].startDate, "_").concat(source[0].endDate, ".csv")
|
|
5869
5945
|
});
|
|
5870
5946
|
};
|
|
5871
5947
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -5882,33 +5958,68 @@
|
|
|
5882
5958
|
},
|
|
5883
5959
|
isActive: isReadyToOpenCSV(),
|
|
5884
5960
|
leftIcon: "file-code-o"
|
|
5885
|
-
}, "Export CSV")), /*#__PURE__*/React__default["default"].createElement(
|
|
5961
|
+
}, "Export CSV")), failedSites.length > 0 && /*#__PURE__*/React__default["default"].createElement(Components.Text, {
|
|
5962
|
+
type: "help",
|
|
5963
|
+
style: {
|
|
5964
|
+
color: '#c02743'
|
|
5965
|
+
}
|
|
5966
|
+
}, "Data unavailable for: ", failedSites.join(', ')), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5886
5967
|
className: "analyticsSection dashboardSection_content"
|
|
5887
|
-
},
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5968
|
+
}, (() => {
|
|
5969
|
+
const chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
|
|
5970
|
+
if (comparisonMode) {
|
|
5971
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5972
|
+
style: {
|
|
5973
|
+
display: "flex",
|
|
5974
|
+
flexDirection: "column",
|
|
5975
|
+
gap: 16
|
|
5976
|
+
}
|
|
5977
|
+
}, /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5978
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5979
|
+
data: comparisonData.requests,
|
|
5980
|
+
prevText: prevText,
|
|
5981
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5982
|
+
isLoading: comparisonData.isLoading
|
|
5983
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5984
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
5985
|
+
data: comparisonData.completedRequests,
|
|
5986
|
+
prevText: prevText,
|
|
5987
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5988
|
+
isLoading: comparisonData.isLoading
|
|
5989
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5990
|
+
title: "".concat(featureTitle, " Comments"),
|
|
5991
|
+
data: comparisonData.comments,
|
|
5992
|
+
prevText: prevText,
|
|
5993
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5994
|
+
isLoading: comparisonData.isLoading
|
|
5995
|
+
}));
|
|
5996
|
+
}
|
|
5997
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
5998
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5999
|
+
icon: freeSolidSvgIcons.faWrench,
|
|
6000
|
+
value: analyticsData.requests,
|
|
6001
|
+
previousValue: analyticsData.prevRequests,
|
|
6002
|
+
prevText: prevText,
|
|
6003
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
6004
|
+
isLoading: analyticsData.isLoading
|
|
6005
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
6006
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
6007
|
+
icon: freeSolidSvgIcons.faCircleCheck,
|
|
6008
|
+
value: analyticsData.completedRequests,
|
|
6009
|
+
previousValue: analyticsData.prevCompletedRequests,
|
|
6010
|
+
prevText: prevText,
|
|
6011
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
6012
|
+
isLoading: analyticsData.isLoading
|
|
6013
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
6014
|
+
title: "".concat(featureTitle, " Comments"),
|
|
6015
|
+
icon: freeSolidSvgIcons.faComment,
|
|
6016
|
+
value: analyticsData.comments,
|
|
6017
|
+
previousValue: analyticsData.prevComments,
|
|
6018
|
+
prevText: prevText,
|
|
6019
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
6020
|
+
isLoading: analyticsData.isLoading
|
|
6021
|
+
}));
|
|
6022
|
+
})()));
|
|
5912
6023
|
};
|
|
5913
6024
|
const mapStateToProps = state => {
|
|
5914
6025
|
const {
|
package/package.json
CHANGED