@plusscommunities/pluss-maintenance-web 1.1.35 → 1.1.37-beta.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/dist/index.cjs.js +177 -94
- package/dist/index.esm.js +177 -94
- package/dist/index.umd.js +177 -94
- package/package.json +1 -1
- package/src/components/AnalyticsHub.js +308 -154
package/dist/index.cjs.js
CHANGED
|
@@ -254,12 +254,12 @@ const JOBS_HIDE_SEEN = values.actionJobsHideSeen;
|
|
|
254
254
|
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; }
|
|
255
255
|
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; }
|
|
256
256
|
const {
|
|
257
|
-
Helper: Helper$
|
|
257
|
+
Helper: Helper$6,
|
|
258
258
|
Session: Session$9
|
|
259
259
|
} = PlussCore__namespace;
|
|
260
260
|
const maintenanceActions = {
|
|
261
261
|
getJobType: (site, typeId) => {
|
|
262
|
-
let url = Helper$
|
|
262
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtype');
|
|
263
263
|
return Session$9.authedFunction({
|
|
264
264
|
method: 'POST',
|
|
265
265
|
url,
|
|
@@ -270,7 +270,7 @@ const maintenanceActions = {
|
|
|
270
270
|
});
|
|
271
271
|
},
|
|
272
272
|
getJobTypes: (site, id) => {
|
|
273
|
-
let url = Helper$
|
|
273
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtypes');
|
|
274
274
|
return Session$9.authedFunction({
|
|
275
275
|
method: 'POST',
|
|
276
276
|
url,
|
|
@@ -280,7 +280,7 @@ const maintenanceActions = {
|
|
|
280
280
|
});
|
|
281
281
|
},
|
|
282
282
|
getJob: (site, id) => {
|
|
283
|
-
let url = Helper$
|
|
283
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
284
284
|
return Session$9.authedFunction({
|
|
285
285
|
method: 'POST',
|
|
286
286
|
url,
|
|
@@ -291,7 +291,7 @@ const maintenanceActions = {
|
|
|
291
291
|
});
|
|
292
292
|
},
|
|
293
293
|
getJobByJobId: (site, jobId) => {
|
|
294
|
-
let url = Helper$
|
|
294
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
295
295
|
return Session$9.authedFunction({
|
|
296
296
|
method: 'POST',
|
|
297
297
|
url,
|
|
@@ -306,7 +306,7 @@ const maintenanceActions = {
|
|
|
306
306
|
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
307
307
|
return Session$9.authedFunction({
|
|
308
308
|
method: 'POST',
|
|
309
|
-
url: Helper$
|
|
309
|
+
url: Helper$6.getUrl(values.serviceKey, 'getJobs'),
|
|
310
310
|
data: {
|
|
311
311
|
site,
|
|
312
312
|
status,
|
|
@@ -329,7 +329,7 @@ const maintenanceActions = {
|
|
|
329
329
|
}
|
|
330
330
|
return Session$9.authedFunction({
|
|
331
331
|
method: 'GET',
|
|
332
|
-
url: Helper$
|
|
332
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/requests', query)
|
|
333
333
|
});
|
|
334
334
|
},
|
|
335
335
|
getJobsRecursive: function (site, status, type, lastKey) {
|
|
@@ -347,14 +347,14 @@ const maintenanceActions = {
|
|
|
347
347
|
createJob: job => {
|
|
348
348
|
return Session$9.authedFunction({
|
|
349
349
|
method: 'POST',
|
|
350
|
-
url: Helper$
|
|
350
|
+
url: Helper$6.getUrl(values.serviceKey, 'sendMaintenance'),
|
|
351
351
|
data: _objectSpread$7({}, job)
|
|
352
352
|
});
|
|
353
353
|
},
|
|
354
354
|
editJob: (job, site) => {
|
|
355
355
|
return Session$9.authedFunction({
|
|
356
356
|
method: 'POST',
|
|
357
|
-
url: Helper$
|
|
357
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJob'),
|
|
358
358
|
data: {
|
|
359
359
|
job,
|
|
360
360
|
site
|
|
@@ -364,7 +364,7 @@ const maintenanceActions = {
|
|
|
364
364
|
deleteJob: (site, id) => {
|
|
365
365
|
return Session$9.authedFunction({
|
|
366
366
|
method: 'POST',
|
|
367
|
-
url: Helper$
|
|
367
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/remove'),
|
|
368
368
|
data: {
|
|
369
369
|
site,
|
|
370
370
|
id
|
|
@@ -374,7 +374,7 @@ const maintenanceActions = {
|
|
|
374
374
|
editJobStatus: (id, status) => {
|
|
375
375
|
return Session$9.authedFunction({
|
|
376
376
|
method: 'POST',
|
|
377
|
-
url: Helper$
|
|
377
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobStatus'),
|
|
378
378
|
data: {
|
|
379
379
|
id,
|
|
380
380
|
status
|
|
@@ -384,7 +384,7 @@ const maintenanceActions = {
|
|
|
384
384
|
editJobPriority: (id, priority) => {
|
|
385
385
|
return Session$9.authedFunction({
|
|
386
386
|
method: 'POST',
|
|
387
|
-
url: Helper$
|
|
387
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/priority'),
|
|
388
388
|
data: {
|
|
389
389
|
id,
|
|
390
390
|
priority
|
|
@@ -394,7 +394,7 @@ const maintenanceActions = {
|
|
|
394
394
|
assignJob: (jobId, userId) => {
|
|
395
395
|
return Session$9.authedFunction({
|
|
396
396
|
method: 'POST',
|
|
397
|
-
url: Helper$
|
|
397
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/assign'),
|
|
398
398
|
data: {
|
|
399
399
|
id: jobId,
|
|
400
400
|
userId
|
|
@@ -404,7 +404,7 @@ const maintenanceActions = {
|
|
|
404
404
|
getAssignees: site => {
|
|
405
405
|
return Session$9.authedFunction({
|
|
406
406
|
method: 'GET',
|
|
407
|
-
url: Helper$
|
|
407
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/assignees', {
|
|
408
408
|
site
|
|
409
409
|
})
|
|
410
410
|
});
|
|
@@ -412,7 +412,7 @@ const maintenanceActions = {
|
|
|
412
412
|
addNote: (jobId, note, attachments, images) => {
|
|
413
413
|
return Session$9.authedFunction({
|
|
414
414
|
method: 'POST',
|
|
415
|
-
url: Helper$
|
|
415
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
416
416
|
data: {
|
|
417
417
|
id: jobId,
|
|
418
418
|
note,
|
|
@@ -425,7 +425,7 @@ const maintenanceActions = {
|
|
|
425
425
|
editNote: (jobId, noteId, note, attachments, images) => {
|
|
426
426
|
return Session$9.authedFunction({
|
|
427
427
|
method: 'POST',
|
|
428
|
-
url: Helper$
|
|
428
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
429
429
|
data: {
|
|
430
430
|
id: jobId,
|
|
431
431
|
note,
|
|
@@ -439,7 +439,7 @@ const maintenanceActions = {
|
|
|
439
439
|
deleteNote: (jobId, noteId) => {
|
|
440
440
|
return Session$9.authedFunction({
|
|
441
441
|
method: 'POST',
|
|
442
|
-
url: Helper$
|
|
442
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
443
443
|
data: {
|
|
444
444
|
id: jobId,
|
|
445
445
|
noteId,
|
|
@@ -459,7 +459,7 @@ const maintenanceActions = {
|
|
|
459
459
|
};
|
|
460
460
|
return Session$9.authedFunction({
|
|
461
461
|
method: 'POST',
|
|
462
|
-
url: Helper$
|
|
462
|
+
url: Helper$6.getUrl(values.serviceKey, 'createJobType'),
|
|
463
463
|
data
|
|
464
464
|
});
|
|
465
465
|
},
|
|
@@ -477,14 +477,14 @@ const maintenanceActions = {
|
|
|
477
477
|
if (hasCustomFields && customFields) data.customFields = customFields;
|
|
478
478
|
return Session$9.authedFunction({
|
|
479
479
|
method: 'POST',
|
|
480
|
-
url: Helper$
|
|
480
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobType'),
|
|
481
481
|
data
|
|
482
482
|
});
|
|
483
483
|
},
|
|
484
484
|
deleteJobType: (site, id) => {
|
|
485
485
|
return Session$9.authedFunction({
|
|
486
486
|
method: 'POST',
|
|
487
|
-
url: Helper$
|
|
487
|
+
url: Helper$6.getUrl(values.serviceKey, 'deleteJobType'),
|
|
488
488
|
data: {
|
|
489
489
|
site,
|
|
490
490
|
id
|
|
@@ -494,7 +494,7 @@ const maintenanceActions = {
|
|
|
494
494
|
getExternalSync: jobId => {
|
|
495
495
|
return Session$9.authedFunction({
|
|
496
496
|
method: 'GET',
|
|
497
|
-
url: Helper$
|
|
497
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/externalsync', {
|
|
498
498
|
id: jobId
|
|
499
499
|
})
|
|
500
500
|
});
|
|
@@ -502,7 +502,7 @@ const maintenanceActions = {
|
|
|
502
502
|
retrySync: jobId => {
|
|
503
503
|
return Session$9.authedFunction({
|
|
504
504
|
method: 'POST',
|
|
505
|
-
url: Helper$
|
|
505
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/retrysync'),
|
|
506
506
|
data: {
|
|
507
507
|
id: jobId
|
|
508
508
|
}
|
|
@@ -511,7 +511,7 @@ const maintenanceActions = {
|
|
|
511
511
|
};
|
|
512
512
|
|
|
513
513
|
const {
|
|
514
|
-
Helper: Helper$
|
|
514
|
+
Helper: Helper$5,
|
|
515
515
|
Session: Session$8
|
|
516
516
|
} = PlussCore__namespace;
|
|
517
517
|
const reactionActions = {
|
|
@@ -529,7 +529,7 @@ const reactionActions = {
|
|
|
529
529
|
}
|
|
530
530
|
return Session$8.authedFunction({
|
|
531
531
|
method: 'POST',
|
|
532
|
-
url: Helper$
|
|
532
|
+
url: Helper$5.getUrl('reactions', 'comments/add'),
|
|
533
533
|
data
|
|
534
534
|
});
|
|
535
535
|
},
|
|
@@ -552,7 +552,7 @@ const reactionActions = {
|
|
|
552
552
|
}
|
|
553
553
|
return Session$8.authedFunction({
|
|
554
554
|
method: 'GET',
|
|
555
|
-
url: Helper$
|
|
555
|
+
url: Helper$5.getUrl('reactions', 'comments/get', query)
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
558
|
};
|
|
@@ -586,7 +586,7 @@ var jobStatusOptions = [
|
|
|
586
586
|
];
|
|
587
587
|
|
|
588
588
|
const {
|
|
589
|
-
Helper: Helper$
|
|
589
|
+
Helper: Helper$4
|
|
590
590
|
} = PlussCore__namespace;
|
|
591
591
|
const jobsUpdate = (site, isdashboard) => {
|
|
592
592
|
return dispatch => {
|
|
@@ -594,7 +594,7 @@ const jobsUpdate = (site, isdashboard) => {
|
|
|
594
594
|
type: JOBS_LOADING
|
|
595
595
|
});
|
|
596
596
|
maintenanceActions.getJobsRecursive(site).then(res => {
|
|
597
|
-
const currentSite = Helper$
|
|
597
|
+
const currentSite = Helper$4.readStorageWithCookie('site');
|
|
598
598
|
if (!___default["default"].isEmpty(res) && res[0].site === currentSite) {
|
|
599
599
|
dispatch({
|
|
600
600
|
type: JOBS_LOADED,
|
|
@@ -2731,7 +2731,7 @@ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
2731
2731
|
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; }
|
|
2732
2732
|
const {
|
|
2733
2733
|
Apis: Apis$1,
|
|
2734
|
-
Helper: Helper$
|
|
2734
|
+
Helper: Helper$3,
|
|
2735
2735
|
Session: Session$3,
|
|
2736
2736
|
Colours: Colours$1,
|
|
2737
2737
|
Components: Components$3
|
|
@@ -3133,7 +3133,7 @@ class Job extends React.Component {
|
|
|
3133
3133
|
}
|
|
3134
3134
|
});
|
|
3135
3135
|
this.state = {
|
|
3136
|
-
jobId: Helper$
|
|
3136
|
+
jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
|
|
3137
3137
|
job: null,
|
|
3138
3138
|
showingSelector: false,
|
|
3139
3139
|
updating: false,
|
|
@@ -3336,7 +3336,7 @@ class Job extends React.Component {
|
|
|
3336
3336
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3337
3337
|
className: "imageGrid_image",
|
|
3338
3338
|
style: {
|
|
3339
|
-
backgroundImage: "url('".concat(Helper$
|
|
3339
|
+
backgroundImage: "url('".concat(Helper$3.get1400(image), "')"),
|
|
3340
3340
|
width: size,
|
|
3341
3341
|
height: size
|
|
3342
3342
|
}
|
|
@@ -3551,7 +3551,7 @@ class Job extends React.Component {
|
|
|
3551
3551
|
}]
|
|
3552
3552
|
})), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
3553
3553
|
className: "maintenanceNote_text"
|
|
3554
|
-
}, Helper$
|
|
3554
|
+
}, 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));
|
|
3555
3555
|
}
|
|
3556
3556
|
renderAssignment() {
|
|
3557
3557
|
const {
|
|
@@ -3985,7 +3985,7 @@ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
3985
3985
|
const {
|
|
3986
3986
|
Actions,
|
|
3987
3987
|
Components: Components$2,
|
|
3988
|
-
Helper: Helper$
|
|
3988
|
+
Helper: Helper$2,
|
|
3989
3989
|
Session: Session$2,
|
|
3990
3990
|
Colours,
|
|
3991
3991
|
Apis
|
|
@@ -4343,7 +4343,7 @@ class AddJob extends React.Component {
|
|
|
4343
4343
|
if (___default["default"].isNil(answer) || ___default["default"].isEmpty(answer)) return true;
|
|
4344
4344
|
switch (type) {
|
|
4345
4345
|
case "email":
|
|
4346
|
-
return Helper$
|
|
4346
|
+
return Helper$2.isEmail(answer);
|
|
4347
4347
|
case "date":
|
|
4348
4348
|
return moment__default["default"](answer, "YYYY-MM-DD", true).isValid();
|
|
4349
4349
|
case "time":
|
|
@@ -4364,7 +4364,7 @@ class AddJob extends React.Component {
|
|
|
4364
4364
|
this.customImageInputs = {};
|
|
4365
4365
|
this.customDocumentInputs = {};
|
|
4366
4366
|
this.state = {
|
|
4367
|
-
jobId: Helper$
|
|
4367
|
+
jobId: Helper$2.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
|
|
4368
4368
|
job: null,
|
|
4369
4369
|
showingSelector: false,
|
|
4370
4370
|
updating: false,
|
|
@@ -4716,7 +4716,7 @@ class AddJob extends React.Component {
|
|
|
4716
4716
|
return /*#__PURE__*/React__default["default"].createElement("p", {
|
|
4717
4717
|
className: "visitorSignIn_text-staticText",
|
|
4718
4718
|
key: fieldId
|
|
4719
|
-
}, Helper$
|
|
4719
|
+
}, Helper$2.toParagraphed(field.label, {
|
|
4720
4720
|
marginTop: 10
|
|
4721
4721
|
}));
|
|
4722
4722
|
case "date":
|
|
@@ -4971,7 +4971,7 @@ const mapStateToProps$2 = state => {
|
|
|
4971
4971
|
return {
|
|
4972
4972
|
auth,
|
|
4973
4973
|
strings: state.strings && state.strings.config || {},
|
|
4974
|
-
optionOnlyForResidents: Helper$
|
|
4974
|
+
optionOnlyForResidents: Helper$2.getSiteSettingFromState(state, values.optionOnlyForResidents)
|
|
4975
4975
|
};
|
|
4976
4976
|
};
|
|
4977
4977
|
var AddJob$1 = reactRedux.connect(mapStateToProps$2, {
|
|
@@ -4983,7 +4983,7 @@ var AddJob$1 = reactRedux.connect(mapStateToProps$2, {
|
|
|
4983
4983
|
const {
|
|
4984
4984
|
Components: Components$1,
|
|
4985
4985
|
Session: Session$1,
|
|
4986
|
-
Helper
|
|
4986
|
+
Helper: Helper$1
|
|
4987
4987
|
} = PlussCore__namespace;
|
|
4988
4988
|
const DEFAULT_FIELD = {
|
|
4989
4989
|
type: 'text',
|
|
@@ -5026,7 +5026,7 @@ class AddJobType extends React.Component {
|
|
|
5026
5026
|
const {
|
|
5027
5027
|
jobTypeEmail
|
|
5028
5028
|
} = this.state;
|
|
5029
|
-
return !___default["default"].isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
|
|
5029
|
+
return !___default["default"].isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
|
|
5030
5030
|
});
|
|
5031
5031
|
_defineProperty__default["default"](this, "isJobTypeValid", () => {
|
|
5032
5032
|
const {
|
|
@@ -5228,7 +5228,7 @@ class AddJobType extends React.Component {
|
|
|
5228
5228
|
}];
|
|
5229
5229
|
this.state = {
|
|
5230
5230
|
loading: false,
|
|
5231
|
-
jobTypeId: Helper.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5231
|
+
jobTypeId: Helper$1.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5232
5232
|
jobTypeName: '',
|
|
5233
5233
|
jobTypeEmail: '',
|
|
5234
5234
|
jobTypeDescription: '',
|
|
@@ -5796,7 +5796,8 @@ var AddJobType$1 = reactRedux.connect(mapStateToProps$1, {
|
|
|
5796
5796
|
const {
|
|
5797
5797
|
Analytics: Analytics$1,
|
|
5798
5798
|
Session,
|
|
5799
|
-
Components
|
|
5799
|
+
Components,
|
|
5800
|
+
Helper
|
|
5800
5801
|
} = PlussCore__namespace;
|
|
5801
5802
|
const getInitialState = () => ({
|
|
5802
5803
|
requests: 0,
|
|
@@ -5816,10 +5817,20 @@ const AnalyticsHub = _ref => {
|
|
|
5816
5817
|
auth,
|
|
5817
5818
|
prevText,
|
|
5818
5819
|
dayCount,
|
|
5819
|
-
strings
|
|
5820
|
+
strings,
|
|
5821
|
+
userType,
|
|
5822
|
+
userCategory,
|
|
5823
|
+
selectedSites
|
|
5820
5824
|
} = _ref;
|
|
5821
5825
|
const [analyticsData, setAnalyticsData] = React.useState(getInitialState());
|
|
5822
5826
|
const [isExportOpen, setIsExportOpen] = React.useState(false);
|
|
5827
|
+
const [comparisonData, setComparisonData] = React.useState({
|
|
5828
|
+
requests: [],
|
|
5829
|
+
completedRequests: [],
|
|
5830
|
+
comments: [],
|
|
5831
|
+
isLoading: true
|
|
5832
|
+
});
|
|
5833
|
+
const comparisonMode = selectedSites && selectedSites.length > 1;
|
|
5823
5834
|
const hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
|
|
5824
5835
|
if (!hasAccess) {
|
|
5825
5836
|
return null;
|
|
@@ -5831,50 +5842,92 @@ const AnalyticsHub = _ref => {
|
|
|
5831
5842
|
return strings.sideNav[key];
|
|
5832
5843
|
})();
|
|
5833
5844
|
const exportColumns = [{
|
|
5834
|
-
label:
|
|
5835
|
-
key:
|
|
5845
|
+
label: "Select All",
|
|
5846
|
+
key: ""
|
|
5836
5847
|
}, {
|
|
5837
|
-
label:
|
|
5838
|
-
key:
|
|
5848
|
+
label: "Start Date",
|
|
5849
|
+
key: "startDate"
|
|
5839
5850
|
}, {
|
|
5840
|
-
label:
|
|
5841
|
-
key:
|
|
5851
|
+
label: "End Date",
|
|
5852
|
+
key: "endDate"
|
|
5842
5853
|
}, {
|
|
5843
5854
|
label: "".concat(values.textSingularName, "s"),
|
|
5844
|
-
key:
|
|
5855
|
+
key: "requests"
|
|
5845
5856
|
}, {
|
|
5846
5857
|
label: "Completed ".concat(values.textSingularName, "s"),
|
|
5847
|
-
key:
|
|
5858
|
+
key: "completedRequests"
|
|
5848
5859
|
}, {
|
|
5849
|
-
label:
|
|
5850
|
-
key:
|
|
5860
|
+
label: "Comments",
|
|
5861
|
+
key: "comments"
|
|
5851
5862
|
}];
|
|
5852
5863
|
React.useEffect(() => {
|
|
5853
5864
|
getData();
|
|
5854
|
-
}, [startTime, endTime]);
|
|
5865
|
+
}, [startTime, endTime, userType, userCategory, selectedSites]);
|
|
5855
5866
|
const getData = async () => {
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5867
|
+
if (comparisonMode) {
|
|
5868
|
+
setComparisonData({
|
|
5869
|
+
requests: [],
|
|
5870
|
+
completedRequests: [],
|
|
5871
|
+
comments: [],
|
|
5872
|
+
isLoading: true
|
|
5873
|
+
});
|
|
5874
|
+
const multiSiteResultsObj = await Analytics$1.fetchMultiSiteData(selectedSites, async site => {
|
|
5875
|
+
const {
|
|
5876
|
+
data
|
|
5877
|
+
} = await analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5878
|
+
userType,
|
|
5879
|
+
userCategory
|
|
5880
|
+
});
|
|
5881
|
+
return data;
|
|
5882
|
+
});
|
|
5883
|
+
const multiSiteResults = Object.entries(multiSiteResultsObj).map(_ref2 => {
|
|
5884
|
+
let [site, data] = _ref2;
|
|
5885
|
+
return {
|
|
5886
|
+
site,
|
|
5887
|
+
data
|
|
5888
|
+
};
|
|
5889
|
+
});
|
|
5890
|
+
const roles = auth.user.Roles;
|
|
5891
|
+
const buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
|
|
5892
|
+
name: Helper.getSiteNameFromRoles(result.site, roles),
|
|
5893
|
+
value: Analytics$1.countActivities(result.data, activityKey, countType)
|
|
5894
|
+
}));
|
|
5895
|
+
setComparisonData({
|
|
5896
|
+
requests: buildComparison("Request", "total"),
|
|
5897
|
+
completedRequests: buildComparison("RequestCompleted", "unique"),
|
|
5898
|
+
comments: buildComparison("Comment", "total"),
|
|
5899
|
+
isLoading: false
|
|
5900
|
+
});
|
|
5901
|
+
} else {
|
|
5902
|
+
setAnalyticsData(getInitialState());
|
|
5903
|
+
const site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
|
|
5904
|
+
const timeDifference = endTime - startTime;
|
|
5905
|
+
const [currentStatsResponse, prevStatsResponse] = await Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5906
|
+
userType,
|
|
5907
|
+
userCategory
|
|
5908
|
+
}), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
|
|
5909
|
+
userType,
|
|
5910
|
+
userCategory
|
|
5911
|
+
})]);
|
|
5912
|
+
const data = {
|
|
5913
|
+
requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
|
|
5914
|
+
prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
|
|
5915
|
+
completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
|
|
5916
|
+
prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
|
|
5917
|
+
comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
|
|
5918
|
+
prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
|
|
5919
|
+
isLoading: false
|
|
5920
|
+
};
|
|
5921
|
+
setAnalyticsData(data);
|
|
5922
|
+
}
|
|
5870
5923
|
};
|
|
5871
5924
|
const isReadyToOpenCSV = () => {
|
|
5872
|
-
return !analyticsData.isLoading;
|
|
5925
|
+
return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
|
|
5873
5926
|
};
|
|
5874
5927
|
const getExportSource = () => {
|
|
5875
5928
|
return [{
|
|
5876
|
-
startDate: moment__default["default"](startTime + 1).format(
|
|
5877
|
-
endDate: moment__default["default"](endTime).format(
|
|
5929
|
+
startDate: moment__default["default"](startTime + 1).format("D-MM-YYYY"),
|
|
5930
|
+
endDate: moment__default["default"](endTime).format("D-MM-YYYY"),
|
|
5878
5931
|
requests: analyticsData.requests,
|
|
5879
5932
|
completedRequests: analyticsData.completedRequests,
|
|
5880
5933
|
comments: analyticsData.comments
|
|
@@ -5910,31 +5963,61 @@ const AnalyticsHub = _ref => {
|
|
|
5910
5963
|
leftIcon: "file-code-o"
|
|
5911
5964
|
}, "Export CSV")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5912
5965
|
className: "analyticsSection dashboardSection_content"
|
|
5913
|
-
},
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5966
|
+
}, (() => {
|
|
5967
|
+
const chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
|
|
5968
|
+
if (comparisonMode) {
|
|
5969
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5970
|
+
style: {
|
|
5971
|
+
display: "flex",
|
|
5972
|
+
flexDirection: "column",
|
|
5973
|
+
gap: 16
|
|
5974
|
+
}
|
|
5975
|
+
}, /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5976
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5977
|
+
data: comparisonData.requests,
|
|
5978
|
+
prevText: prevText,
|
|
5979
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5980
|
+
isLoading: comparisonData.isLoading
|
|
5981
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5982
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
5983
|
+
data: comparisonData.completedRequests,
|
|
5984
|
+
prevText: prevText,
|
|
5985
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5986
|
+
isLoading: comparisonData.isLoading
|
|
5987
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5988
|
+
title: "".concat(featureTitle, " Comments"),
|
|
5989
|
+
data: comparisonData.comments,
|
|
5990
|
+
prevText: prevText,
|
|
5991
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5992
|
+
isLoading: comparisonData.isLoading
|
|
5993
|
+
}));
|
|
5994
|
+
}
|
|
5995
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
5996
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5997
|
+
icon: freeSolidSvgIcons.faWrench,
|
|
5998
|
+
value: analyticsData.requests,
|
|
5999
|
+
previousValue: analyticsData.prevRequests,
|
|
6000
|
+
prevText: prevText,
|
|
6001
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
6002
|
+
isLoading: analyticsData.isLoading
|
|
6003
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
6004
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
6005
|
+
icon: freeSolidSvgIcons.faCircleCheck,
|
|
6006
|
+
value: analyticsData.completedRequests,
|
|
6007
|
+
previousValue: analyticsData.prevCompletedRequests,
|
|
6008
|
+
prevText: prevText,
|
|
6009
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
6010
|
+
isLoading: analyticsData.isLoading
|
|
6011
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
6012
|
+
title: "".concat(featureTitle, " Comments"),
|
|
6013
|
+
icon: freeSolidSvgIcons.faComment,
|
|
6014
|
+
value: analyticsData.comments,
|
|
6015
|
+
previousValue: analyticsData.prevComments,
|
|
6016
|
+
prevText: prevText,
|
|
6017
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
6018
|
+
isLoading: analyticsData.isLoading
|
|
6019
|
+
}));
|
|
6020
|
+
})()));
|
|
5938
6021
|
};
|
|
5939
6022
|
const mapStateToProps = state => {
|
|
5940
6023
|
const {
|