dce-reactkit 3.5.14 → 3.6.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.
- package/dist/cjs/index.js +388 -298
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/initClient.d.ts +7 -0
- package/dist/cjs/types/components/AppWrapper.d.ts +2 -3
- package/dist/esm/index.js +388 -298
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/client/initClient.d.ts +7 -0
- package/dist/esm/types/components/AppWrapper.d.ts +2 -3
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/client/initClient.tsx +20 -4
- package/src/components/AppWrapper.tsx +57 -13
- package/src/components/ButtonInputGroup.tsx +6 -6
- package/src/components/CSVDownloadButton.tsx +6 -6
- package/src/components/CheckboxButton.tsx +19 -8
- package/src/components/CopiableBox.tsx +8 -8
- package/src/components/Drawer.tsx +7 -7
- package/src/components/ErrorBox.tsx +5 -5
- package/src/components/IntelliTable.tsx +135 -135
- package/src/components/ItemPicker/NestableItemList.tsx +7 -7
- package/src/components/ItemPicker/index.tsx +7 -7
- package/src/components/LoadingSpinner.tsx +4 -4
- package/src/components/LogReviewer.tsx +21 -22
- package/src/components/Modal.tsx +163 -75
- package/src/components/PopFailureMark.tsx +7 -7
- package/src/components/PopPendingMark.tsx +7 -7
- package/src/components/PopSuccessMark.tsx +7 -7
- package/src/components/RadioButton.tsx +17 -8
- package/src/components/SimpleDateChooser.tsx +14 -13
- package/src/components/TabBox.tsx +7 -7
- package/src/helpers/genRouteHandler.ts +45 -41
package/dist/esm/index.js
CHANGED
|
@@ -57,17 +57,17 @@ var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
|
57
57
|
* @author Gabe Abrams
|
|
58
58
|
*/
|
|
59
59
|
/*------------------------------------------------------------------------*/
|
|
60
|
-
/*
|
|
60
|
+
/* ------------------------------ Component ----------------------------- */
|
|
61
61
|
/*------------------------------------------------------------------------*/
|
|
62
62
|
const ErrorBox = (props) => {
|
|
63
63
|
/*------------------------------------------------------------------------*/
|
|
64
|
-
/*
|
|
64
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
65
65
|
/*------------------------------------------------------------------------*/
|
|
66
66
|
var _a;
|
|
67
67
|
/* -------------- Props ------------- */
|
|
68
68
|
const { error, title = 'An Error Occurred', onClose, } = props;
|
|
69
69
|
/*------------------------------------------------------------------------*/
|
|
70
|
-
/*
|
|
70
|
+
/* ------------------------------- Render ------------------------------- */
|
|
71
71
|
/*------------------------------------------------------------------------*/
|
|
72
72
|
// Determine error text
|
|
73
73
|
const errorText = (typeof error === 'string'
|
|
@@ -204,11 +204,89 @@ var ModalSize;
|
|
|
204
204
|
var ModalSize$1 = ModalSize;
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
*
|
|
207
|
+
* An error with a code
|
|
208
208
|
* @author Gabe Abrams
|
|
209
209
|
*/
|
|
210
|
+
class ErrorWithCode extends Error {
|
|
211
|
+
constructor(message, code) {
|
|
212
|
+
super(message);
|
|
213
|
+
this.name = 'ErrorWithCode';
|
|
214
|
+
this.code = code;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/*----------------------------------------*/
|
|
219
|
+
/* ---- Static Variables and Getters ---- */
|
|
220
|
+
/*----------------------------------------*/
|
|
221
|
+
/* ----------- Initialized ---------- */
|
|
222
|
+
let onInitialized;
|
|
223
|
+
const initialized = new Promise((resolve) => {
|
|
224
|
+
onInitialized = resolve;
|
|
225
|
+
});
|
|
226
|
+
/* ---------- Send Request ---------- */
|
|
227
|
+
let storedSendRequest;
|
|
228
|
+
/**
|
|
229
|
+
* Get the send request function
|
|
230
|
+
* @author Gabe Abrams
|
|
231
|
+
* @returns sendRequest function
|
|
232
|
+
*/
|
|
233
|
+
const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
234
|
+
// Show timeout error if too much time passes
|
|
235
|
+
let successful = false;
|
|
236
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
237
|
+
yield waitMs(5000);
|
|
238
|
+
if (!successful) {
|
|
239
|
+
showFatalError(new ErrorWithCode('Could not send a request because the request needed to be sent before dce-reactkit was properly initialized. Perhaps dce-reactkit was not initialized with initClient.', ReactKitErrorCode$1.NoCACCLSendRequestFunction));
|
|
240
|
+
}
|
|
241
|
+
}))();
|
|
242
|
+
// Wait for initialization
|
|
243
|
+
yield initialized;
|
|
244
|
+
successful = true;
|
|
245
|
+
// Return
|
|
246
|
+
return storedSendRequest;
|
|
247
|
+
});
|
|
248
|
+
/* ----- Session Expired Message ---- */
|
|
249
|
+
let sessionExpiredMessage;
|
|
250
|
+
/**
|
|
251
|
+
* Get the custom session expired message
|
|
252
|
+
* @author Gabe Abrams
|
|
253
|
+
* @returns session expired message
|
|
254
|
+
*/
|
|
255
|
+
const getSessionExpiredMessage = () => {
|
|
256
|
+
// Return
|
|
257
|
+
return (sessionExpiredMessage !== null && sessionExpiredMessage !== void 0 ? sessionExpiredMessage : 'Your session has expired. Please go back to Canvas and start over.');
|
|
258
|
+
};
|
|
259
|
+
/* ------------ Dark Mode ----------- */
|
|
260
|
+
let darkModeOn = false;
|
|
261
|
+
/**
|
|
262
|
+
* Get whether dark mode is enabled or not
|
|
263
|
+
* @returns true if dark mode is enabled
|
|
264
|
+
*/
|
|
265
|
+
const isDarkModeOn = () => {
|
|
266
|
+
return darkModeOn;
|
|
267
|
+
};
|
|
268
|
+
/*----------------------------------------*/
|
|
269
|
+
/* ---------------- Init ---------------- */
|
|
270
|
+
/*----------------------------------------*/
|
|
271
|
+
/**
|
|
272
|
+
* Initialize the client-side version of reactkit
|
|
273
|
+
* @author Gabe Abrams
|
|
274
|
+
* @param opts object containing all arguments
|
|
275
|
+
* @param opts.sendRequest caccl send request functions
|
|
276
|
+
* @param [opts.sessionExpiredMessage] a custom session expired message
|
|
277
|
+
*/
|
|
278
|
+
const initClient = (opts) => {
|
|
279
|
+
// Store values
|
|
280
|
+
storedSendRequest = opts.sendRequest;
|
|
281
|
+
sessionExpiredMessage = opts.sessionExpiredMessage;
|
|
282
|
+
darkModeOn = !!opts.darkModeOn;
|
|
283
|
+
// Mark as initialized
|
|
284
|
+
onInitialized(null);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
210
288
|
/*------------------------------------------------------------------------*/
|
|
211
|
-
/*
|
|
289
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
212
290
|
/*------------------------------------------------------------------------*/
|
|
213
291
|
// Constants
|
|
214
292
|
const MS_TO_ANIMATE = 200; // Animation duration
|
|
@@ -247,51 +325,66 @@ const modalTypeToModalButtonTypes = {
|
|
|
247
325
|
ModalButtonType$1.Cancel,
|
|
248
326
|
],
|
|
249
327
|
};
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
328
|
+
/**
|
|
329
|
+
* Get button type styling and labels
|
|
330
|
+
* @author Gabe Abrams
|
|
331
|
+
* @returns map of button type to label and variant
|
|
332
|
+
*/
|
|
333
|
+
const getModalButtonTypeToLabelAndVariant = () => {
|
|
334
|
+
const dark = isDarkModeOn();
|
|
335
|
+
return {
|
|
336
|
+
[ModalButtonType$1.Okay]: {
|
|
337
|
+
label: 'Okay',
|
|
338
|
+
variant: (dark
|
|
339
|
+
? Variant$1.Light
|
|
340
|
+
: Variant$1.Dark),
|
|
341
|
+
},
|
|
342
|
+
[ModalButtonType$1.Cancel]: {
|
|
343
|
+
label: 'Cancel',
|
|
344
|
+
variant: Variant$1.Secondary,
|
|
345
|
+
},
|
|
346
|
+
[ModalButtonType$1.Yes]: {
|
|
347
|
+
label: 'Yes',
|
|
348
|
+
variant: (dark
|
|
349
|
+
? Variant$1.Light
|
|
350
|
+
: Variant$1.Dark),
|
|
351
|
+
},
|
|
352
|
+
[ModalButtonType$1.No]: {
|
|
353
|
+
label: 'No',
|
|
354
|
+
variant: Variant$1.Secondary,
|
|
355
|
+
},
|
|
356
|
+
[ModalButtonType$1.Abandon]: {
|
|
357
|
+
label: 'Abandon Changes',
|
|
358
|
+
variant: Variant$1.Warning,
|
|
359
|
+
},
|
|
360
|
+
[ModalButtonType$1.GoBack]: {
|
|
361
|
+
label: 'Go Back',
|
|
362
|
+
variant: Variant$1.Secondary,
|
|
363
|
+
},
|
|
364
|
+
[ModalButtonType$1.Continue]: {
|
|
365
|
+
label: 'Continue',
|
|
366
|
+
variant: (dark
|
|
367
|
+
? Variant$1.Light
|
|
368
|
+
: Variant$1.Dark),
|
|
369
|
+
},
|
|
370
|
+
[ModalButtonType$1.ImSure]: {
|
|
371
|
+
label: 'I am sure',
|
|
372
|
+
variant: Variant$1.Warning,
|
|
373
|
+
},
|
|
374
|
+
[ModalButtonType$1.Delete]: {
|
|
375
|
+
label: 'Yes, Delete',
|
|
376
|
+
variant: Variant$1.Danger,
|
|
377
|
+
},
|
|
378
|
+
[ModalButtonType$1.Confirm]: {
|
|
379
|
+
label: 'Confirm',
|
|
380
|
+
variant: (dark
|
|
381
|
+
? Variant$1.Light
|
|
382
|
+
: Variant$1.Dark),
|
|
383
|
+
},
|
|
384
|
+
};
|
|
292
385
|
};
|
|
293
386
|
/*------------------------------------------------------------------------*/
|
|
294
|
-
/*
|
|
387
|
+
/* -------------------------------- Style ------------------------------- */
|
|
295
388
|
/*------------------------------------------------------------------------*/
|
|
296
389
|
const style$b = `
|
|
297
390
|
.Modal-backdrop {
|
|
@@ -357,25 +450,23 @@ const style$b = `
|
|
|
357
450
|
}
|
|
358
451
|
`;
|
|
359
452
|
/*------------------------------------------------------------------------*/
|
|
360
|
-
/*
|
|
453
|
+
/* ------------------------------ Component ----------------------------- */
|
|
361
454
|
/*------------------------------------------------------------------------*/
|
|
362
455
|
const Modal = (props) => {
|
|
363
456
|
/*------------------------------------------------------------------------*/
|
|
364
|
-
/*
|
|
457
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
365
458
|
/*------------------------------------------------------------------------*/
|
|
366
459
|
var _a;
|
|
367
460
|
/* -------------- Props ------------- */
|
|
368
461
|
const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
|
|
369
462
|
/* -------------- State ------------- */
|
|
370
|
-
// If true, the modal is shown
|
|
371
|
-
const [visible, setVisible] = useState(false);
|
|
372
463
|
// True if animation is in use
|
|
373
464
|
const [animatingIn, setAnimatingIn] = useState(true);
|
|
374
465
|
const [animatingPop, setAnimatingPop] = useState(false);
|
|
375
466
|
// Keep track of whether modal is still mounted
|
|
376
467
|
const mounted = useRef(false);
|
|
377
468
|
/*------------------------------------------------------------------------*/
|
|
378
|
-
/*
|
|
469
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
379
470
|
/*------------------------------------------------------------------------*/
|
|
380
471
|
/**
|
|
381
472
|
* Mount
|
|
@@ -384,14 +475,12 @@ const Modal = (props) => {
|
|
|
384
475
|
useEffect(() => {
|
|
385
476
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
386
477
|
// Set defaults
|
|
387
|
-
setVisible(false);
|
|
388
478
|
setAnimatingIn(true);
|
|
389
479
|
setAnimatingPop(false);
|
|
390
480
|
// Wait for animation
|
|
391
481
|
yield waitMs(MS_TO_ANIMATE);
|
|
392
482
|
// Update to state after animated in
|
|
393
483
|
if (mounted.current) {
|
|
394
|
-
setVisible(true);
|
|
395
484
|
setAnimatingIn(false);
|
|
396
485
|
}
|
|
397
486
|
}))();
|
|
@@ -400,47 +489,46 @@ const Modal = (props) => {
|
|
|
400
489
|
};
|
|
401
490
|
}, []);
|
|
402
491
|
/*------------------------------------------------------------------------*/
|
|
403
|
-
/*
|
|
492
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
404
493
|
/*------------------------------------------------------------------------*/
|
|
405
494
|
/**
|
|
406
495
|
* Handles the closing of the modal
|
|
407
496
|
* @author Gabe Abrams
|
|
408
|
-
* @param
|
|
497
|
+
* @param modalButtonType the button that was clicked when closing the
|
|
409
498
|
* modal
|
|
410
499
|
*/
|
|
411
|
-
const handleClose = (
|
|
500
|
+
const handleClose = (modalButtonType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
412
501
|
// Don't close if no handler
|
|
413
502
|
if (!onClose) {
|
|
414
503
|
return;
|
|
415
504
|
}
|
|
416
|
-
onClose(
|
|
505
|
+
onClose(modalButtonType);
|
|
417
506
|
});
|
|
418
507
|
/*------------------------------------------------------------------------*/
|
|
419
|
-
/*
|
|
508
|
+
/* ------------------------------- Render ------------------------------- */
|
|
420
509
|
/*------------------------------------------------------------------------*/
|
|
421
|
-
/*----------------------------------------*/
|
|
422
|
-
/* Footer */
|
|
423
|
-
/*----------------------------------------*/
|
|
424
510
|
// Get list of buttons for this modal type
|
|
425
511
|
const ModalButtonTypes = (_a = modalTypeToModalButtonTypes[type]) !== null && _a !== void 0 ? _a : [];
|
|
512
|
+
// Get map of button type to label and variant
|
|
513
|
+
const ModalButtonTypeToLabelAndVariant = getModalButtonTypeToLabelAndVariant();
|
|
426
514
|
// Create buttons
|
|
427
|
-
const buttons = ModalButtonTypes.map((
|
|
515
|
+
const buttons = ModalButtonTypes.map((modalButtonType, i) => {
|
|
428
516
|
// Get default style
|
|
429
|
-
let { label, variant, } = ModalButtonTypeToLabelAndVariant[
|
|
517
|
+
let { label, variant, } = ModalButtonTypeToLabelAndVariant[modalButtonType];
|
|
430
518
|
// Override with customizations
|
|
431
|
-
const newLabel = props[`${
|
|
519
|
+
const newLabel = props[`${modalButtonType}Label`];
|
|
432
520
|
if (newLabel) {
|
|
433
521
|
label = newLabel;
|
|
434
522
|
}
|
|
435
|
-
const newVariant = props[`${
|
|
523
|
+
const newVariant = props[`${modalButtonType}Variant`];
|
|
436
524
|
if (newVariant) {
|
|
437
525
|
variant = newVariant;
|
|
438
526
|
}
|
|
439
527
|
// Check if this button is last
|
|
440
528
|
const last = (i === ModalButtonTypes.length - 1);
|
|
441
529
|
// Create the button
|
|
442
|
-
return (React__default.createElement("button", { key:
|
|
443
|
-
handleClose(
|
|
530
|
+
return (React__default.createElement("button", { key: modalButtonType, type: "button", className: `Modal-${modalButtonType}-button btn btn-${variant} ${last ? '' : 'me-1'}`, onClick: () => {
|
|
531
|
+
handleClose(modalButtonType);
|
|
444
532
|
} }, label));
|
|
445
533
|
});
|
|
446
534
|
// Put all buttons in a footer
|
|
@@ -458,7 +546,7 @@ const Modal = (props) => {
|
|
|
458
546
|
animationClass = 'Modal-animating-pop';
|
|
459
547
|
}
|
|
460
548
|
// Render the modal
|
|
461
|
-
return (React__default.createElement("div", { className:
|
|
549
|
+
return (React__default.createElement("div", { className: "modal show modal-dialog-scrollable modal-dialog-centered", tabIndex: -1, style: {
|
|
462
550
|
zIndex: (onTopOfOtherModals
|
|
463
551
|
? 5000000001
|
|
464
552
|
: 5000000000),
|
|
@@ -488,8 +576,22 @@ const Modal = (props) => {
|
|
|
488
576
|
React__default.createElement("div", { className: `modal-dialog modal-${size} ${animationClass}`, style: {
|
|
489
577
|
zIndex: 5000000002,
|
|
490
578
|
} },
|
|
491
|
-
React__default.createElement("div", { className: "modal-content"
|
|
492
|
-
|
|
579
|
+
React__default.createElement("div", { className: "modal-content", style: {
|
|
580
|
+
borderColor: (isDarkModeOn()
|
|
581
|
+
? 'gray'
|
|
582
|
+
: undefined),
|
|
583
|
+
} },
|
|
584
|
+
React__default.createElement("div", { className: "modal-header", style: {
|
|
585
|
+
color: (isDarkModeOn()
|
|
586
|
+
? 'white'
|
|
587
|
+
: undefined),
|
|
588
|
+
backgroundColor: (isDarkModeOn()
|
|
589
|
+
? '#444'
|
|
590
|
+
: undefined),
|
|
591
|
+
borderBottom: (isDarkModeOn()
|
|
592
|
+
? '0.1rem solid gray'
|
|
593
|
+
: undefined),
|
|
594
|
+
} },
|
|
493
595
|
React__default.createElement("h5", { className: "modal-title", style: {
|
|
494
596
|
fontWeight: 'bold',
|
|
495
597
|
} }, title),
|
|
@@ -497,22 +599,27 @@ const Modal = (props) => {
|
|
|
497
599
|
// Handle close
|
|
498
600
|
handleClose(ModalButtonType$1.Cancel);
|
|
499
601
|
} }))),
|
|
500
|
-
children && (React__default.createElement("div", { className: "modal-body"
|
|
501
|
-
|
|
602
|
+
children && (React__default.createElement("div", { className: "modal-body", style: {
|
|
603
|
+
color: (isDarkModeOn()
|
|
604
|
+
? 'white'
|
|
605
|
+
: undefined),
|
|
606
|
+
backgroundColor: (isDarkModeOn()
|
|
607
|
+
? '#444'
|
|
608
|
+
: undefined),
|
|
609
|
+
} }, children)),
|
|
610
|
+
footer && (React__default.createElement("div", { className: "modal-footer pt-1 pb-1", style: {
|
|
611
|
+
color: (isDarkModeOn()
|
|
612
|
+
? 'white'
|
|
613
|
+
: undefined),
|
|
614
|
+
backgroundColor: (isDarkModeOn()
|
|
615
|
+
? '#444'
|
|
616
|
+
: undefined),
|
|
617
|
+
borderTop: (isDarkModeOn()
|
|
618
|
+
? '0.1rem solid gray'
|
|
619
|
+
: undefined),
|
|
620
|
+
} }, footer))))));
|
|
502
621
|
};
|
|
503
622
|
|
|
504
|
-
/**
|
|
505
|
-
* An error with a code
|
|
506
|
-
* @author Gabe Abrams
|
|
507
|
-
*/
|
|
508
|
-
class ErrorWithCode extends Error {
|
|
509
|
-
constructor(message, code) {
|
|
510
|
-
super(message);
|
|
511
|
-
this.name = 'ErrorWithCode';
|
|
512
|
-
this.code = code;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
623
|
/**
|
|
517
624
|
* Path that all routes start with
|
|
518
625
|
* @author Gabe Abrams
|
|
@@ -537,65 +644,6 @@ var LogLevel;
|
|
|
537
644
|
})(LogLevel || (LogLevel = {}));
|
|
538
645
|
var LogLevel$1 = LogLevel;
|
|
539
646
|
|
|
540
|
-
/*----------------------------------------*/
|
|
541
|
-
/* ---- Static Variables and Getters ---- */
|
|
542
|
-
/*----------------------------------------*/
|
|
543
|
-
/* ----------- Initialized ---------- */
|
|
544
|
-
let onInitialized;
|
|
545
|
-
let initialized = new Promise((resolve) => {
|
|
546
|
-
onInitialized = resolve;
|
|
547
|
-
});
|
|
548
|
-
/* ---------- Send Request ---------- */
|
|
549
|
-
let storedSendRequest;
|
|
550
|
-
/**
|
|
551
|
-
* Get the send request function
|
|
552
|
-
* @author Gabe Abrams
|
|
553
|
-
* @returns sendRequest function
|
|
554
|
-
*/
|
|
555
|
-
const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
556
|
-
// Show timeout error if too much time passes
|
|
557
|
-
let successful = false;
|
|
558
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
559
|
-
yield waitMs(5000);
|
|
560
|
-
if (!successful) {
|
|
561
|
-
showFatalError(new ErrorWithCode('Could not send a request because the request needed to be sent before dce-reactkit was properly initialized. Perhaps dce-reactkit was not initialized with initClient.', ReactKitErrorCode$1.NoCACCLSendRequestFunction));
|
|
562
|
-
}
|
|
563
|
-
}))(),
|
|
564
|
-
// Wait for initialization
|
|
565
|
-
yield initialized;
|
|
566
|
-
successful = true;
|
|
567
|
-
// Return
|
|
568
|
-
return storedSendRequest;
|
|
569
|
-
});
|
|
570
|
-
/* ----- Session Expired Message ---- */
|
|
571
|
-
let sessionExpiredMessage;
|
|
572
|
-
/**
|
|
573
|
-
* Get the custom session expired message
|
|
574
|
-
* @author Gabe Abrams
|
|
575
|
-
* @returns session expired message
|
|
576
|
-
*/
|
|
577
|
-
const getSessionExpiredMessage = () => {
|
|
578
|
-
// Return
|
|
579
|
-
return (sessionExpiredMessage !== null && sessionExpiredMessage !== void 0 ? sessionExpiredMessage : 'Your session has expired. Please go back to Canvas and start over.');
|
|
580
|
-
};
|
|
581
|
-
/*----------------------------------------*/
|
|
582
|
-
/* ---------------- Init ---------------- */
|
|
583
|
-
/*----------------------------------------*/
|
|
584
|
-
/**
|
|
585
|
-
* Initialize the client-side version of reactkit
|
|
586
|
-
* @author Gabe Abrams
|
|
587
|
-
* @param opts object containing all arguments
|
|
588
|
-
* @param opts.sendRequest caccl send request functions
|
|
589
|
-
* @param [opts.sessionExpiredMessage] a custom session expired message
|
|
590
|
-
*/
|
|
591
|
-
const initClient = (opts) => {
|
|
592
|
-
// Store values
|
|
593
|
-
storedSendRequest = opts.sendRequest;
|
|
594
|
-
sessionExpiredMessage = opts.sessionExpiredMessage;
|
|
595
|
-
// Mark as initialized
|
|
596
|
-
onInitialized(null);
|
|
597
|
-
};
|
|
598
|
-
|
|
599
647
|
// Keep track of whether or not session expiry has already been handled
|
|
600
648
|
let sessionAlreadyExpired = false;
|
|
601
649
|
/*------------------------------------------------------------------------*/
|
|
@@ -754,6 +802,28 @@ const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
754
802
|
/*------------------------------------------------------------------------*/
|
|
755
803
|
/* --------------------------- Static Helpers --------------------------- */
|
|
756
804
|
/*------------------------------------------------------------------------*/
|
|
805
|
+
// Timestamp after initialization when helpers should be available
|
|
806
|
+
const timestampWhenHelpersShouldBeAvailable = Date.now() + 2000;
|
|
807
|
+
/**
|
|
808
|
+
* Wait for a little while for a helper to exist
|
|
809
|
+
* @author Gabe Abrams
|
|
810
|
+
* @param checkForHelper a function that returns true if the helper exists
|
|
811
|
+
* @returns true if the helper exists, false if the process timed out
|
|
812
|
+
*/
|
|
813
|
+
const waitForHelper = (checkForHelper) => __awaiter(void 0, void 0, void 0, function* () {
|
|
814
|
+
// Wait for helper to exist
|
|
815
|
+
while (!checkForHelper()) {
|
|
816
|
+
// Check if we should stop waiting
|
|
817
|
+
if (Date.now() > timestampWhenHelpersShouldBeAvailable) {
|
|
818
|
+
// Stop waiting
|
|
819
|
+
return false;
|
|
820
|
+
}
|
|
821
|
+
// Wait a little while
|
|
822
|
+
yield waitMs(10);
|
|
823
|
+
}
|
|
824
|
+
// Helper exists
|
|
825
|
+
return true;
|
|
826
|
+
});
|
|
757
827
|
/*----------------------------------------*/
|
|
758
828
|
/* ----------- Redirect/Leave ----------- */
|
|
759
829
|
/*----------------------------------------*/
|
|
@@ -800,6 +870,10 @@ let onAlertClosed;
|
|
|
800
870
|
* @param text the text to display in the alert
|
|
801
871
|
*/
|
|
802
872
|
const alert$1 = (title, text) => __awaiter(void 0, void 0, void 0, function* () {
|
|
873
|
+
// Wait for helper to exist
|
|
874
|
+
yield waitForHelper(() => {
|
|
875
|
+
return !!setAlertInfo;
|
|
876
|
+
});
|
|
803
877
|
// Fallback if alert not available
|
|
804
878
|
if (!setAlertInfo) {
|
|
805
879
|
// eslint-disable-next-line no-alert
|
|
@@ -841,6 +915,10 @@ let onConfirmClosed;
|
|
|
841
915
|
* @returns true if the user confirmed
|
|
842
916
|
*/
|
|
843
917
|
const confirm = (title, text, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
918
|
+
// Wait for helper to exist
|
|
919
|
+
yield waitForHelper(() => {
|
|
920
|
+
return !!setConfirmInfo;
|
|
921
|
+
});
|
|
844
922
|
// Fallback if confirm is not available
|
|
845
923
|
if (!setConfirmInfo) {
|
|
846
924
|
// eslint-disable-next-line no-alert
|
|
@@ -875,7 +953,7 @@ const fatalErrorHandlers = [];
|
|
|
875
953
|
* @param error the error to show
|
|
876
954
|
* @param [errorTitle] title of the error box
|
|
877
955
|
*/
|
|
878
|
-
const showFatalError = (error, errorTitle = 'An Error Occurred') => {
|
|
956
|
+
const showFatalError = (error, errorTitle = 'An Error Occurred') => __awaiter(void 0, void 0, void 0, function* () {
|
|
879
957
|
var _a, _b;
|
|
880
958
|
// Determine message and code
|
|
881
959
|
const message = (typeof error === 'string'
|
|
@@ -905,17 +983,21 @@ const showFatalError = (error, errorTitle = 'An Error Occurred') => {
|
|
|
905
983
|
errorTitle,
|
|
906
984
|
},
|
|
907
985
|
});
|
|
986
|
+
// Wait for helper to exist
|
|
987
|
+
yield waitForHelper(() => {
|
|
988
|
+
return (!!setFatalErrorMessage
|
|
989
|
+
&& !!setFatalErrorCode);
|
|
990
|
+
});
|
|
908
991
|
// Handle case where app hasn't loaded
|
|
909
992
|
if (!setFatalErrorMessage || !setFatalErrorCode) {
|
|
910
993
|
alert$1(errorTitle, `${message} (code: ${code}). Please contact support.`);
|
|
911
|
-
return
|
|
994
|
+
return;
|
|
912
995
|
}
|
|
913
996
|
// Use setters
|
|
914
997
|
setFatalErrorMessage(message);
|
|
915
998
|
setFatalErrorCode(code);
|
|
916
999
|
setFatalErrorTitle(errorTitle);
|
|
917
|
-
|
|
918
|
-
};
|
|
1000
|
+
});
|
|
919
1001
|
/**
|
|
920
1002
|
* Add a handler for when a fatal error occurs
|
|
921
1003
|
* @author Gabe Abrams
|
|
@@ -955,7 +1037,7 @@ const AppWrapper = (props) => {
|
|
|
955
1037
|
/* -------------------------------- Setup ------------------------------- */
|
|
956
1038
|
/*------------------------------------------------------------------------*/
|
|
957
1039
|
/* -------------- Props ------------- */
|
|
958
|
-
const { children,
|
|
1040
|
+
const { children, } = props;
|
|
959
1041
|
/* -------------- State ------------- */
|
|
960
1042
|
// Leave to URL
|
|
961
1043
|
const [urlToLeaveTo, setURLToLeaveToInner,] = useState();
|
|
@@ -1038,7 +1120,7 @@ const AppWrapper = (props) => {
|
|
|
1038
1120
|
width: '100vw',
|
|
1039
1121
|
minHeight: '100vh',
|
|
1040
1122
|
paddingTop: '2rem',
|
|
1041
|
-
backgroundColor: (
|
|
1123
|
+
backgroundColor: (isDarkModeOn()
|
|
1042
1124
|
? '#222'
|
|
1043
1125
|
: '#fff'),
|
|
1044
1126
|
} },
|
|
@@ -1051,7 +1133,7 @@ const AppWrapper = (props) => {
|
|
|
1051
1133
|
body = children;
|
|
1052
1134
|
}
|
|
1053
1135
|
/*----------------------------------------*/
|
|
1054
|
-
/*
|
|
1136
|
+
/* --------------- Main UI -------------- */
|
|
1055
1137
|
/*----------------------------------------*/
|
|
1056
1138
|
return (React__default.createElement(React__default.Fragment, null,
|
|
1057
1139
|
React__default.createElement("style", null, style$a),
|
|
@@ -1064,7 +1146,7 @@ const AppWrapper = (props) => {
|
|
|
1064
1146
|
* @author Gabe Abrams
|
|
1065
1147
|
*/
|
|
1066
1148
|
/*------------------------------------------------------------------------*/
|
|
1067
|
-
/*
|
|
1149
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1068
1150
|
/*------------------------------------------------------------------------*/
|
|
1069
1151
|
const style$9 = `
|
|
1070
1152
|
/* Container fades in */
|
|
@@ -1136,11 +1218,11 @@ const style$9 = `
|
|
|
1136
1218
|
}
|
|
1137
1219
|
`;
|
|
1138
1220
|
/*------------------------------------------------------------------------*/
|
|
1139
|
-
/*
|
|
1221
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1140
1222
|
/*------------------------------------------------------------------------*/
|
|
1141
1223
|
const LoadingSpinner = () => {
|
|
1142
1224
|
/*------------------------------------------------------------------------*/
|
|
1143
|
-
/*
|
|
1225
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1144
1226
|
/*------------------------------------------------------------------------*/
|
|
1145
1227
|
// Add all four blips to a container
|
|
1146
1228
|
return (React__default.createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
@@ -1156,7 +1238,7 @@ const LoadingSpinner = () => {
|
|
|
1156
1238
|
* @author Gabe Abrams
|
|
1157
1239
|
*/
|
|
1158
1240
|
/*------------------------------------------------------------------------*/
|
|
1159
|
-
/*
|
|
1241
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1160
1242
|
/*------------------------------------------------------------------------*/
|
|
1161
1243
|
const style$8 = `
|
|
1162
1244
|
/* Tab Box */
|
|
@@ -1222,19 +1304,19 @@ const style$8 = `
|
|
|
1222
1304
|
}
|
|
1223
1305
|
`;
|
|
1224
1306
|
/*------------------------------------------------------------------------*/
|
|
1225
|
-
/*
|
|
1307
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1226
1308
|
/*------------------------------------------------------------------------*/
|
|
1227
1309
|
const TabBox = (props) => {
|
|
1228
1310
|
/*------------------------------------------------------------------------*/
|
|
1229
|
-
/*
|
|
1311
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1230
1312
|
/*------------------------------------------------------------------------*/
|
|
1231
1313
|
/* -------------- Props ------------- */
|
|
1232
1314
|
const { title, children, noBottomPadding, noBottomMargin, } = props;
|
|
1233
1315
|
/*------------------------------------------------------------------------*/
|
|
1234
|
-
/*
|
|
1316
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1235
1317
|
/*------------------------------------------------------------------------*/
|
|
1236
1318
|
/*----------------------------------------*/
|
|
1237
|
-
/*
|
|
1319
|
+
/* --------------- Main UI -------------- */
|
|
1238
1320
|
/*----------------------------------------*/
|
|
1239
1321
|
// Full UI
|
|
1240
1322
|
return (React__default.createElement("div", { className: `TabBox-container ${noBottomMargin ? '' : 'mb-2'}` },
|
|
@@ -1250,19 +1332,23 @@ const TabBox = (props) => {
|
|
|
1250
1332
|
* @author Gabe Abrams
|
|
1251
1333
|
*/
|
|
1252
1334
|
/*------------------------------------------------------------------------*/
|
|
1253
|
-
/*
|
|
1335
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1254
1336
|
/*------------------------------------------------------------------------*/
|
|
1255
1337
|
const RadioButton = (props) => {
|
|
1256
1338
|
/*------------------------------------------------------------------------*/
|
|
1257
|
-
/*
|
|
1339
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1258
1340
|
/*------------------------------------------------------------------------*/
|
|
1259
1341
|
/* -------------- Props ------------- */
|
|
1260
|
-
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant =
|
|
1342
|
+
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = (isDarkModeOn()
|
|
1343
|
+
? Variant$1.Light
|
|
1344
|
+
: Variant$1.Secondary), unselectedVariant = (isDarkModeOn()
|
|
1345
|
+
? Variant$1.Secondary
|
|
1346
|
+
: Variant$1.Light), small, } = props;
|
|
1261
1347
|
/*------------------------------------------------------------------------*/
|
|
1262
|
-
/*
|
|
1348
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1263
1349
|
/*------------------------------------------------------------------------*/
|
|
1264
1350
|
/*----------------------------------------*/
|
|
1265
|
-
/*
|
|
1351
|
+
/* --------------- Main UI -------------- */
|
|
1266
1352
|
/*----------------------------------------*/
|
|
1267
1353
|
return (React__default.createElement("button", { type: "button", id: id, title: title, className: `btn btn-${selected ? selectedVariant : unselectedVariant}${selected ? ' selected' : ''}${small ? ' btn-sm' : ''} m-0${noMarginOnRight ? '' : ' me-1'}`, "aria-label": `${ariaLabel}${selected ? ': currently selected' : ''}`, onClick: () => {
|
|
1268
1354
|
if (!selected) {
|
|
@@ -1278,19 +1364,23 @@ const RadioButton = (props) => {
|
|
|
1278
1364
|
* @author Gabe Abrams
|
|
1279
1365
|
*/
|
|
1280
1366
|
/*------------------------------------------------------------------------*/
|
|
1281
|
-
/*
|
|
1367
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1282
1368
|
/*------------------------------------------------------------------------*/
|
|
1283
1369
|
const CheckboxButton = (props) => {
|
|
1284
1370
|
/*------------------------------------------------------------------------*/
|
|
1285
|
-
/*
|
|
1371
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1286
1372
|
/*------------------------------------------------------------------------*/
|
|
1287
1373
|
/* -------------- Props ------------- */
|
|
1288
|
-
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant =
|
|
1374
|
+
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = (isDarkModeOn()
|
|
1375
|
+
? Variant$1.Light
|
|
1376
|
+
: Variant$1.Secondary), uncheckedVariant = (isDarkModeOn()
|
|
1377
|
+
? Variant$1.Secondary
|
|
1378
|
+
: Variant$1.Light), small, dashed, } = props;
|
|
1289
1379
|
/*------------------------------------------------------------------------*/
|
|
1290
|
-
/*
|
|
1380
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1291
1381
|
/*------------------------------------------------------------------------*/
|
|
1292
1382
|
/*----------------------------------------*/
|
|
1293
|
-
/*
|
|
1383
|
+
/* --------------- Main UI -------------- */
|
|
1294
1384
|
/*----------------------------------------*/
|
|
1295
1385
|
// Determine the icon
|
|
1296
1386
|
let icon;
|
|
@@ -1315,20 +1405,20 @@ const CheckboxButton = (props) => {
|
|
|
1315
1405
|
* @author Gabe Abrams
|
|
1316
1406
|
*/
|
|
1317
1407
|
/*------------------------------------------------------------------------*/
|
|
1318
|
-
/*
|
|
1408
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1319
1409
|
/*------------------------------------------------------------------------*/
|
|
1320
1410
|
const ButtonInputGroup = (props) => {
|
|
1321
1411
|
/*------------------------------------------------------------------------*/
|
|
1322
|
-
/*
|
|
1412
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1323
1413
|
/*------------------------------------------------------------------------*/
|
|
1324
1414
|
/* -------------- Props ------------- */
|
|
1325
1415
|
// Destructure all props
|
|
1326
1416
|
const { label, minLabelWidth, children, className, wrapButtonsAndAddGaps, } = props;
|
|
1327
1417
|
/*------------------------------------------------------------------------*/
|
|
1328
|
-
/*
|
|
1418
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1329
1419
|
/*------------------------------------------------------------------------*/
|
|
1330
1420
|
/*----------------------------------------*/
|
|
1331
|
-
/*
|
|
1421
|
+
/* --------------- Main UI -------------- */
|
|
1332
1422
|
/*----------------------------------------*/
|
|
1333
1423
|
return (React__default.createElement("div", { className: `input-group ${className !== null && className !== void 0 ? className : ''}` },
|
|
1334
1424
|
React__default.createElement("div", { className: "input-group-prepend d-flex w-100" },
|
|
@@ -1454,21 +1544,19 @@ const getTimeInfoInET = (dateOrTimestamp) => {
|
|
|
1454
1544
|
* @author Gabe Abrams
|
|
1455
1545
|
*/
|
|
1456
1546
|
/*------------------------------------------------------------------------*/
|
|
1457
|
-
/*
|
|
1547
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1458
1548
|
/*------------------------------------------------------------------------*/
|
|
1459
1549
|
const SimpleDateChooser = (props) => {
|
|
1460
1550
|
/*------------------------------------------------------------------------*/
|
|
1461
|
-
/*
|
|
1551
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1462
1552
|
/*------------------------------------------------------------------------*/
|
|
1463
|
-
var _a;
|
|
1464
1553
|
/* -------------- Props ------------- */
|
|
1465
|
-
const { ariaLabel, name,
|
|
1466
|
-
const numMonthsToShow = ((_a = props.numMonthsToShow) !== null && _a !== void 0 ? _a : 6);
|
|
1554
|
+
const { ariaLabel, name, onChange, chooseFromPast, numMonthsToShow = 6, } = props;
|
|
1467
1555
|
/*------------------------------------------------------------------------*/
|
|
1468
|
-
/*
|
|
1556
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1469
1557
|
/*------------------------------------------------------------------------*/
|
|
1470
1558
|
/*----------------------------------------*/
|
|
1471
|
-
/*
|
|
1559
|
+
/* --------------- Main UI -------------- */
|
|
1472
1560
|
/*----------------------------------------*/
|
|
1473
1561
|
// Determine the set of choices allowed
|
|
1474
1562
|
const today = getTimeInfoInET();
|
|
@@ -1523,6 +1611,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1523
1611
|
});
|
|
1524
1612
|
}
|
|
1525
1613
|
// Create choice options
|
|
1614
|
+
const { month, day, year, } = props;
|
|
1526
1615
|
const monthOptions = [];
|
|
1527
1616
|
const dayOptions = [];
|
|
1528
1617
|
choices.forEach((choice) => {
|
|
@@ -1558,7 +1647,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1558
1647
|
* @author Gabe Abrams
|
|
1559
1648
|
*/
|
|
1560
1649
|
/*------------------------------------------------------------------------*/
|
|
1561
|
-
/*
|
|
1650
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1562
1651
|
/*------------------------------------------------------------------------*/
|
|
1563
1652
|
const style$7 = `
|
|
1564
1653
|
.Drawer-container {
|
|
@@ -1576,20 +1665,20 @@ const style$7 = `
|
|
|
1576
1665
|
}
|
|
1577
1666
|
`;
|
|
1578
1667
|
/*------------------------------------------------------------------------*/
|
|
1579
|
-
/*
|
|
1668
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1580
1669
|
/*------------------------------------------------------------------------*/
|
|
1581
1670
|
const Drawer = (props) => {
|
|
1582
1671
|
/*------------------------------------------------------------------------*/
|
|
1583
|
-
/*
|
|
1672
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1584
1673
|
/*------------------------------------------------------------------------*/
|
|
1585
1674
|
/* -------------- Props ------------- */
|
|
1586
1675
|
// Destructure all props
|
|
1587
1676
|
const { customBackgroundColor, children, } = props;
|
|
1588
1677
|
/*------------------------------------------------------------------------*/
|
|
1589
|
-
/*
|
|
1678
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1590
1679
|
/*------------------------------------------------------------------------*/
|
|
1591
1680
|
/*----------------------------------------*/
|
|
1592
|
-
/*
|
|
1681
|
+
/* --------------- Main UI -------------- */
|
|
1593
1682
|
/*----------------------------------------*/
|
|
1594
1683
|
return (React__default.createElement("div", { className: "Drawer-container", style: {
|
|
1595
1684
|
backgroundColor: (customBackgroundColor !== null && customBackgroundColor !== void 0 ? customBackgroundColor : undefined),
|
|
@@ -1603,7 +1692,7 @@ const Drawer = (props) => {
|
|
|
1603
1692
|
* @author Gabe Abrams
|
|
1604
1693
|
*/
|
|
1605
1694
|
/*------------------------------------------------------------------------*/
|
|
1606
|
-
/*
|
|
1695
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1607
1696
|
/*------------------------------------------------------------------------*/
|
|
1608
1697
|
const style$6 = `
|
|
1609
1698
|
.PopSuccessMark-outer-container {
|
|
@@ -1691,20 +1780,20 @@ const style$6 = `
|
|
|
1691
1780
|
}
|
|
1692
1781
|
`;
|
|
1693
1782
|
/*------------------------------------------------------------------------*/
|
|
1694
|
-
/*
|
|
1783
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1695
1784
|
/*------------------------------------------------------------------------*/
|
|
1696
1785
|
const PopSuccessMark = (props) => {
|
|
1697
1786
|
/*------------------------------------------------------------------------*/
|
|
1698
|
-
/*
|
|
1787
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1699
1788
|
/*------------------------------------------------------------------------*/
|
|
1700
1789
|
/* -------------- Props ------------- */
|
|
1701
1790
|
// Destructure all props
|
|
1702
1791
|
const { sizeRem = 3, circleVariant = 'success', checkVariant = 'white', } = props;
|
|
1703
1792
|
/*------------------------------------------------------------------------*/
|
|
1704
|
-
/*
|
|
1793
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1705
1794
|
/*------------------------------------------------------------------------*/
|
|
1706
1795
|
/*----------------------------------------*/
|
|
1707
|
-
/*
|
|
1796
|
+
/* --------------- Main UI -------------- */
|
|
1708
1797
|
/*----------------------------------------*/
|
|
1709
1798
|
return (React__default.createElement("div", { className: `PopSuccessMark-outer-container bg-${circleVariant}`, style: {
|
|
1710
1799
|
width: `${sizeRem}rem`,
|
|
@@ -1724,7 +1813,7 @@ const PopSuccessMark = (props) => {
|
|
|
1724
1813
|
* @author Gabe Abrams
|
|
1725
1814
|
*/
|
|
1726
1815
|
/*------------------------------------------------------------------------*/
|
|
1727
|
-
/*
|
|
1816
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1728
1817
|
/*------------------------------------------------------------------------*/
|
|
1729
1818
|
const style$5 = `
|
|
1730
1819
|
.PopFailureMark-outer-container {
|
|
@@ -1811,20 +1900,20 @@ const style$5 = `
|
|
|
1811
1900
|
}
|
|
1812
1901
|
`;
|
|
1813
1902
|
/*------------------------------------------------------------------------*/
|
|
1814
|
-
/*
|
|
1903
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1815
1904
|
/*------------------------------------------------------------------------*/
|
|
1816
1905
|
const PopFailureMark = (props) => {
|
|
1817
1906
|
/*------------------------------------------------------------------------*/
|
|
1818
|
-
/*
|
|
1907
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1819
1908
|
/*------------------------------------------------------------------------*/
|
|
1820
1909
|
/* -------------- Props ------------- */
|
|
1821
1910
|
// Destructure all props
|
|
1822
1911
|
const { sizeRem = 3, circleVariant = 'danger', xVariant = 'white', } = props;
|
|
1823
1912
|
/*------------------------------------------------------------------------*/
|
|
1824
|
-
/*
|
|
1913
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1825
1914
|
/*------------------------------------------------------------------------*/
|
|
1826
1915
|
/*----------------------------------------*/
|
|
1827
|
-
/*
|
|
1916
|
+
/* --------------- Main UI -------------- */
|
|
1828
1917
|
/*----------------------------------------*/
|
|
1829
1918
|
return (React__default.createElement("div", { className: `PopFailureMark-outer-container bg-${circleVariant}`, style: {
|
|
1830
1919
|
width: `${sizeRem}rem`,
|
|
@@ -1844,7 +1933,7 @@ const PopFailureMark = (props) => {
|
|
|
1844
1933
|
* @author Gabe Abrams
|
|
1845
1934
|
*/
|
|
1846
1935
|
/*------------------------------------------------------------------------*/
|
|
1847
|
-
/*
|
|
1936
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1848
1937
|
/*------------------------------------------------------------------------*/
|
|
1849
1938
|
const style$4 = `
|
|
1850
1939
|
.PopPendingMark-outer-container {
|
|
@@ -1900,20 +1989,20 @@ const style$4 = `
|
|
|
1900
1989
|
}
|
|
1901
1990
|
`;
|
|
1902
1991
|
/*------------------------------------------------------------------------*/
|
|
1903
|
-
/*
|
|
1992
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1904
1993
|
/*------------------------------------------------------------------------*/
|
|
1905
1994
|
const PopPendingMark = (props) => {
|
|
1906
1995
|
/*------------------------------------------------------------------------*/
|
|
1907
|
-
/*
|
|
1996
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1908
1997
|
/*------------------------------------------------------------------------*/
|
|
1909
1998
|
/* -------------- Props ------------- */
|
|
1910
1999
|
// Destructure all props
|
|
1911
2000
|
const { sizeRem = 3, circleVariant = 'warning', hourglassVariant = 'white', } = props;
|
|
1912
2001
|
/*------------------------------------------------------------------------*/
|
|
1913
|
-
/*
|
|
2002
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1914
2003
|
/*------------------------------------------------------------------------*/
|
|
1915
2004
|
/*----------------------------------------*/
|
|
1916
|
-
/*
|
|
2005
|
+
/* --------------- Main UI -------------- */
|
|
1917
2006
|
/*----------------------------------------*/
|
|
1918
2007
|
return (React__default.createElement("div", { className: `PopPendingMark-outer-container bg-${circleVariant}`, style: {
|
|
1919
2008
|
width: `${sizeRem}rem`,
|
|
@@ -1963,11 +2052,11 @@ const reducer$8 = (state, action) => {
|
|
|
1963
2052
|
}
|
|
1964
2053
|
};
|
|
1965
2054
|
/*------------------------------------------------------------------------*/
|
|
1966
|
-
/*
|
|
2055
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1967
2056
|
/*------------------------------------------------------------------------*/
|
|
1968
2057
|
const CopiableBox = (props) => {
|
|
1969
2058
|
/*------------------------------------------------------------------------*/
|
|
1970
|
-
/*
|
|
2059
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1971
2060
|
/*------------------------------------------------------------------------*/
|
|
1972
2061
|
/* -------------- Props ------------- */
|
|
1973
2062
|
// Destructure all props
|
|
@@ -1982,7 +2071,7 @@ const CopiableBox = (props) => {
|
|
|
1982
2071
|
// Destructure common state
|
|
1983
2072
|
const { recentlyCopied, } = state;
|
|
1984
2073
|
/*------------------------------------------------------------------------*/
|
|
1985
|
-
/*
|
|
2074
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
1986
2075
|
/*------------------------------------------------------------------------*/
|
|
1987
2076
|
/**
|
|
1988
2077
|
* Perform a copy
|
|
@@ -2008,10 +2097,10 @@ const CopiableBox = (props) => {
|
|
|
2008
2097
|
});
|
|
2009
2098
|
});
|
|
2010
2099
|
/*------------------------------------------------------------------------*/
|
|
2011
|
-
/*
|
|
2100
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2012
2101
|
/*------------------------------------------------------------------------*/
|
|
2013
2102
|
/*----------------------------------------*/
|
|
2014
|
-
/*
|
|
2103
|
+
/* --------------- Main UI -------------- */
|
|
2015
2104
|
/*----------------------------------------*/
|
|
2016
2105
|
return (React__default.createElement("div", { className: "input-group mb-2" },
|
|
2017
2106
|
(label || labelIcon) && (React__default.createElement("span", { className: "input-group-text", style: {
|
|
@@ -2082,11 +2171,11 @@ const reducer$7 = (state, action) => {
|
|
|
2082
2171
|
}
|
|
2083
2172
|
};
|
|
2084
2173
|
/*------------------------------------------------------------------------*/
|
|
2085
|
-
/*
|
|
2174
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2086
2175
|
/*------------------------------------------------------------------------*/
|
|
2087
2176
|
const NestableItemList = (props) => {
|
|
2088
2177
|
/*------------------------------------------------------------------------*/
|
|
2089
|
-
/*
|
|
2178
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2090
2179
|
/*------------------------------------------------------------------------*/
|
|
2091
2180
|
/* -------------- Props ------------- */
|
|
2092
2181
|
// Destructure all props
|
|
@@ -2106,7 +2195,7 @@ const NestableItemList = (props) => {
|
|
|
2106
2195
|
// Destructure common state
|
|
2107
2196
|
const { childExpanded, } = state;
|
|
2108
2197
|
/*------------------------------------------------------------------------*/
|
|
2109
|
-
/*
|
|
2198
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
2110
2199
|
/*------------------------------------------------------------------------*/
|
|
2111
2200
|
/**
|
|
2112
2201
|
* Checks if all items in a list are checked
|
|
@@ -2181,7 +2270,7 @@ const NestableItemList = (props) => {
|
|
|
2181
2270
|
});
|
|
2182
2271
|
};
|
|
2183
2272
|
/*------------------------------------------------------------------------*/
|
|
2184
|
-
/*
|
|
2273
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2185
2274
|
/*------------------------------------------------------------------------*/
|
|
2186
2275
|
return (React__default.createElement("div", null, items.map((item) => {
|
|
2187
2276
|
return (React__default.createElement("div", { key: item.id },
|
|
@@ -2214,23 +2303,23 @@ const NestableItemList = (props) => {
|
|
|
2214
2303
|
* @author Yuen Ler Chow
|
|
2215
2304
|
*/
|
|
2216
2305
|
/*------------------------------------------------------------------------*/
|
|
2217
|
-
/*
|
|
2306
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2218
2307
|
/*------------------------------------------------------------------------*/
|
|
2219
2308
|
const ItemPicker = (props) => {
|
|
2220
2309
|
/*------------------------------------------------------------------------*/
|
|
2221
|
-
/*
|
|
2310
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2222
2311
|
/*------------------------------------------------------------------------*/
|
|
2223
2312
|
/* -------------- Props ------------- */
|
|
2224
2313
|
// Destructure all props
|
|
2225
2314
|
const { title, items, onChanged, noBottomMargin, } = props;
|
|
2226
2315
|
/*------------------------------------------------------------------------*/
|
|
2227
|
-
/*
|
|
2316
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
2228
2317
|
/*------------------------------------------------------------------------*/
|
|
2229
2318
|
/*------------------------------------------------------------------------*/
|
|
2230
|
-
/*
|
|
2319
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2231
2320
|
/*------------------------------------------------------------------------*/
|
|
2232
2321
|
/*----------------------------------------*/
|
|
2233
|
-
/*
|
|
2322
|
+
/* --------------- Main UI -------------- */
|
|
2234
2323
|
/*----------------------------------------*/
|
|
2235
2324
|
return (React__default.createElement(TabBox, { title: title, noBottomMargin: noBottomMargin },
|
|
2236
2325
|
React__default.createElement("div", { style: { overflowX: 'auto' } },
|
|
@@ -2428,20 +2517,20 @@ const genCSV = (data, columns) => {
|
|
|
2428
2517
|
* @author Gabe Abrams
|
|
2429
2518
|
*/
|
|
2430
2519
|
/*------------------------------------------------------------------------*/
|
|
2431
|
-
/*
|
|
2520
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2432
2521
|
/*------------------------------------------------------------------------*/
|
|
2433
2522
|
const CSVDownloadButton = (props) => {
|
|
2434
2523
|
/*------------------------------------------------------------------------*/
|
|
2435
|
-
/*
|
|
2524
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2436
2525
|
/*------------------------------------------------------------------------*/
|
|
2437
2526
|
/* -------------- Props ------------- */
|
|
2438
2527
|
// Destructure all props
|
|
2439
2528
|
const { filename, csv, id, className, ariaLabel, style, onClick, children, } = props;
|
|
2440
2529
|
/*------------------------------------------------------------------------*/
|
|
2441
|
-
/*
|
|
2530
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2442
2531
|
/*------------------------------------------------------------------------*/
|
|
2443
2532
|
/*----------------------------------------*/
|
|
2444
|
-
/*
|
|
2533
|
+
/* --------------- Main UI -------------- */
|
|
2445
2534
|
/*----------------------------------------*/
|
|
2446
2535
|
// Render the button
|
|
2447
2536
|
return (React__default.createElement("a", { id: id, download: filename, href: `data:application/octet-stream,${encodeURIComponent(csv)}`, className: `CSVDownloadButton-button ${className !== null && className !== void 0 ? className : 'btn btn-secondary'}`, "aria-label": (ariaLabel
|
|
@@ -2529,26 +2618,26 @@ const reducer$6 = (state, action) => {
|
|
|
2529
2618
|
}
|
|
2530
2619
|
};
|
|
2531
2620
|
/*------------------------------------------------------------------------*/
|
|
2532
|
-
/*
|
|
2621
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2533
2622
|
/*------------------------------------------------------------------------*/
|
|
2534
2623
|
const IntelliTable = (props) => {
|
|
2535
2624
|
/*------------------------------------------------------------------------*/
|
|
2536
|
-
/*
|
|
2625
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2537
2626
|
/*------------------------------------------------------------------------*/
|
|
2538
2627
|
var _a;
|
|
2539
2628
|
/* -------------- Props ------------- */
|
|
2540
2629
|
// Destructure all props
|
|
2541
|
-
const { title, id, columns, } = props;
|
|
2630
|
+
const { title, id, columns, csvName, data = [], } = props;
|
|
2542
2631
|
// Get data, show empty row if none
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2632
|
+
if (data.length === 0) {
|
|
2633
|
+
data.push({ id: 'empty-row' });
|
|
2634
|
+
}
|
|
2546
2635
|
// Get CSV filename
|
|
2547
2636
|
let filename = `${title}.csv`;
|
|
2548
|
-
if (
|
|
2549
|
-
filename = (
|
|
2550
|
-
?
|
|
2551
|
-
: `${
|
|
2637
|
+
if (csvName) {
|
|
2638
|
+
filename = (csvName.endsWith('.csv')
|
|
2639
|
+
? csvName
|
|
2640
|
+
: `${csvName}.csv`);
|
|
2552
2641
|
}
|
|
2553
2642
|
/* -------------- State ------------- */
|
|
2554
2643
|
// Initial state
|
|
@@ -2567,10 +2656,10 @@ const IntelliTable = (props) => {
|
|
|
2567
2656
|
// Destructure common state
|
|
2568
2657
|
const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
|
|
2569
2658
|
/*------------------------------------------------------------------------*/
|
|
2570
|
-
/*
|
|
2659
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2571
2660
|
/*------------------------------------------------------------------------*/
|
|
2572
2661
|
/*----------------------------------------*/
|
|
2573
|
-
/*
|
|
2662
|
+
/* ---------------- Modal --------------- */
|
|
2574
2663
|
/*----------------------------------------*/
|
|
2575
2664
|
// Modal that may be defined
|
|
2576
2665
|
let modal;
|
|
@@ -2611,7 +2700,7 @@ const IntelliTable = (props) => {
|
|
|
2611
2700
|
} }, "Deselect All")));
|
|
2612
2701
|
}
|
|
2613
2702
|
/*----------------------------------------*/
|
|
2614
|
-
/*
|
|
2703
|
+
/* --------------- Main UI -------------- */
|
|
2615
2704
|
/*----------------------------------------*/
|
|
2616
2705
|
// Table header
|
|
2617
2706
|
const headerCells = (columns
|
|
@@ -2666,7 +2755,7 @@ const IntelliTable = (props) => {
|
|
|
2666
2755
|
const tableHeader = (React__default.createElement("thead", null,
|
|
2667
2756
|
React__default.createElement("tr", null, headerCells)));
|
|
2668
2757
|
// Sort data
|
|
2669
|
-
|
|
2758
|
+
const sortedData = [...data];
|
|
2670
2759
|
const paramType = (_a = columns.find((column) => {
|
|
2671
2760
|
return (column.param === sortColumnParam);
|
|
2672
2761
|
})) === null || _a === void 0 ? void 0 : _a.type;
|
|
@@ -2755,7 +2844,7 @@ const IntelliTable = (props) => {
|
|
|
2755
2844
|
});
|
|
2756
2845
|
let fullValue;
|
|
2757
2846
|
let visibleValue;
|
|
2758
|
-
let
|
|
2847
|
+
let colTitle = '';
|
|
2759
2848
|
if (column.type === ParamType$1.Boolean) {
|
|
2760
2849
|
fullValue = !!(value);
|
|
2761
2850
|
const noValue = (value === undefined
|
|
@@ -2763,9 +2852,9 @@ const IntelliTable = (props) => {
|
|
|
2763
2852
|
visibleValue = (noValue
|
|
2764
2853
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2765
2854
|
: (React__default.createElement(FontAwesomeIcon, { icon: fullValue ? faCheckCircle : faXmarkCircle })));
|
|
2766
|
-
|
|
2855
|
+
colTitle = (fullValue ? 'True' : 'False');
|
|
2767
2856
|
if (noValue) {
|
|
2768
|
-
|
|
2857
|
+
colTitle = 'Empty Cell';
|
|
2769
2858
|
}
|
|
2770
2859
|
}
|
|
2771
2860
|
else if (column.type === ParamType$1.Int) {
|
|
@@ -2774,9 +2863,9 @@ const IntelliTable = (props) => {
|
|
|
2774
2863
|
visibleValue = (noValue
|
|
2775
2864
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2776
2865
|
: fullValue);
|
|
2777
|
-
|
|
2866
|
+
colTitle = String(fullValue);
|
|
2778
2867
|
if (noValue) {
|
|
2779
|
-
|
|
2868
|
+
colTitle = 'Empty Cell';
|
|
2780
2869
|
}
|
|
2781
2870
|
}
|
|
2782
2871
|
else if (column.type === ParamType$1.Float) {
|
|
@@ -2785,9 +2874,9 @@ const IntelliTable = (props) => {
|
|
|
2785
2874
|
visibleValue = (noValue
|
|
2786
2875
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2787
2876
|
: roundToNumDecimals(fullValue, 2));
|
|
2788
|
-
|
|
2877
|
+
colTitle = String(fullValue);
|
|
2789
2878
|
if (noValue) {
|
|
2790
|
-
|
|
2879
|
+
colTitle = 'Empty Cell';
|
|
2791
2880
|
}
|
|
2792
2881
|
}
|
|
2793
2882
|
else if (column.type === ParamType$1.String) {
|
|
@@ -2798,9 +2887,9 @@ const IntelliTable = (props) => {
|
|
|
2798
2887
|
visibleValue = (noValue
|
|
2799
2888
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2800
2889
|
: fullValue);
|
|
2801
|
-
|
|
2890
|
+
colTitle = `"${value}"`;
|
|
2802
2891
|
if (noValue) {
|
|
2803
|
-
|
|
2892
|
+
colTitle = 'Empty Cell';
|
|
2804
2893
|
}
|
|
2805
2894
|
}
|
|
2806
2895
|
else if (column.type === ParamType$1.JSON) {
|
|
@@ -2811,10 +2900,10 @@ const IntelliTable = (props) => {
|
|
|
2811
2900
|
visibleValue = (noValue
|
|
2812
2901
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2813
2902
|
: fullValue);
|
|
2814
|
-
|
|
2903
|
+
colTitle = 'JSON Object';
|
|
2815
2904
|
}
|
|
2816
2905
|
// Create UI
|
|
2817
|
-
return (React__default.createElement("td", { key: `${datum.id}-${column.param}`, title:
|
|
2906
|
+
return (React__default.createElement("td", { key: `${datum.id}-${column.param}`, title: colTitle, style: {
|
|
2818
2907
|
borderRight: '0.05rem solid #555',
|
|
2819
2908
|
borderLeft: '0.05rem solid #555',
|
|
2820
2909
|
} }, visibleValue));
|
|
@@ -2876,7 +2965,7 @@ var FilterDrawer;
|
|
|
2876
2965
|
FilterDrawer["Advanced"] = "advanced";
|
|
2877
2966
|
})(FilterDrawer || (FilterDrawer = {}));
|
|
2878
2967
|
/*------------------------------------------------------------------------*/
|
|
2879
|
-
/*
|
|
2968
|
+
/* -------------------------------- Style ------------------------------- */
|
|
2880
2969
|
/*------------------------------------------------------------------------*/
|
|
2881
2970
|
const style$3 = `
|
|
2882
2971
|
.LogReviewer-outer-container {
|
|
@@ -2962,7 +3051,7 @@ const style$3 = `
|
|
|
2962
3051
|
}
|
|
2963
3052
|
`;
|
|
2964
3053
|
/*------------------------------------------------------------------------*/
|
|
2965
|
-
/*
|
|
3054
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
2966
3055
|
/*------------------------------------------------------------------------*/
|
|
2967
3056
|
const columns = [
|
|
2968
3057
|
{
|
|
@@ -3151,7 +3240,7 @@ const columns = [
|
|
|
3151
3240
|
},
|
|
3152
3241
|
];
|
|
3153
3242
|
/*------------------------------------------------------------------------*/
|
|
3154
|
-
/*
|
|
3243
|
+
/* -------------------------- Static Functions -------------------------- */
|
|
3155
3244
|
/*------------------------------------------------------------------------*/
|
|
3156
3245
|
/**
|
|
3157
3246
|
* Turn a machine-readable name into a human-readable name
|
|
@@ -3281,11 +3370,11 @@ const reducer$5 = (state, action) => {
|
|
|
3281
3370
|
}
|
|
3282
3371
|
};
|
|
3283
3372
|
/*------------------------------------------------------------------------*/
|
|
3284
|
-
/*
|
|
3373
|
+
/* ------------------------------ Component ----------------------------- */
|
|
3285
3374
|
/*------------------------------------------------------------------------*/
|
|
3286
3375
|
const LogReviewer = (props) => {
|
|
3287
3376
|
/*------------------------------------------------------------------------*/
|
|
3288
|
-
/*
|
|
3377
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
3289
3378
|
/*------------------------------------------------------------------------*/
|
|
3290
3379
|
var _a, _b, _c, _d;
|
|
3291
3380
|
/* -------------- Props ------------- */
|
|
@@ -3405,7 +3494,7 @@ const LogReviewer = (props) => {
|
|
|
3405
3494
|
// Destructure common state
|
|
3406
3495
|
const { loading, logMap, expandedFilterDrawer, dateFilterState, contextFilterState, tagFilterState, actionErrorFilterState, advancedFilterState, } = state;
|
|
3407
3496
|
/*------------------------------------------------------------------------*/
|
|
3408
|
-
/*
|
|
3497
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
3409
3498
|
/*------------------------------------------------------------------------*/
|
|
3410
3499
|
/**
|
|
3411
3500
|
* Get the list of year/month combos that need to be loaded given a new
|
|
@@ -3418,8 +3507,7 @@ const LogReviewer = (props) => {
|
|
|
3418
3507
|
// List of year/month combos that need to be loaded
|
|
3419
3508
|
const toLoad = [];
|
|
3420
3509
|
// Loop through dates
|
|
3421
|
-
let year = newDateFilterState.startDate
|
|
3422
|
-
let month = newDateFilterState.startDate.month;
|
|
3510
|
+
let { year, month } = newDateFilterState.startDate;
|
|
3423
3511
|
while (
|
|
3424
3512
|
// Earlier year
|
|
3425
3513
|
(year < newDateFilterState.endDate.year)
|
|
@@ -3492,7 +3580,7 @@ const LogReviewer = (props) => {
|
|
|
3492
3580
|
});
|
|
3493
3581
|
});
|
|
3494
3582
|
/*------------------------------------------------------------------------*/
|
|
3495
|
-
/*
|
|
3583
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
3496
3584
|
/*------------------------------------------------------------------------*/
|
|
3497
3585
|
/**
|
|
3498
3586
|
* Mount
|
|
@@ -3503,10 +3591,10 @@ const LogReviewer = (props) => {
|
|
|
3503
3591
|
handleDateRangeUpdated(dateFilterState);
|
|
3504
3592
|
}, []);
|
|
3505
3593
|
/*------------------------------------------------------------------------*/
|
|
3506
|
-
/*
|
|
3594
|
+
/* ------------------------------- Render ------------------------------- */
|
|
3507
3595
|
/*------------------------------------------------------------------------*/
|
|
3508
3596
|
/*----------------------------------------*/
|
|
3509
|
-
/*
|
|
3597
|
+
/* --------------- Main UI -------------- */
|
|
3510
3598
|
/*----------------------------------------*/
|
|
3511
3599
|
// Body that will be filled with the contents of the panel
|
|
3512
3600
|
let body;
|
|
@@ -3518,7 +3606,7 @@ const LogReviewer = (props) => {
|
|
|
3518
3606
|
/* ------------ Review UI ----------- */
|
|
3519
3607
|
if (!loading) {
|
|
3520
3608
|
/*----------------------------------------*/
|
|
3521
|
-
/*
|
|
3609
|
+
/* --------------- Filters -------------- */
|
|
3522
3610
|
/*----------------------------------------*/
|
|
3523
3611
|
// Filter toggle
|
|
3524
3612
|
const filterToggles = (React__default.createElement("div", { className: "LogReviewer-filter-toggles" },
|
|
@@ -3817,7 +3905,7 @@ const LogReviewer = (props) => {
|
|
|
3817
3905
|
React__default.createElement("span", { className: "input-group-text" }, "User Canvas Id"),
|
|
3818
3906
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user canvas id", value: advancedFilterState.userId, placeholder: "e.g. 104985", onChange: (e) => {
|
|
3819
3907
|
const { value } = e.target;
|
|
3820
|
-
// Only update if value contains only numbers
|
|
3908
|
+
// Only update if value contains only numbers
|
|
3821
3909
|
if (/^\d+$/.test(value)) {
|
|
3822
3910
|
advancedFilterState.userId = ((e.target.value)
|
|
3823
3911
|
.trim());
|
|
@@ -3863,7 +3951,7 @@ const LogReviewer = (props) => {
|
|
|
3863
3951
|
React__default.createElement("span", { className: "input-group-text" }, "Course Canvas Id"),
|
|
3864
3952
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for course canvas id", value: advancedFilterState.courseId, placeholder: "e.g. 15948", onChange: (e) => {
|
|
3865
3953
|
const { value } = e.target;
|
|
3866
|
-
// Only update if value contains only numbers
|
|
3954
|
+
// Only update if value contains only numbers
|
|
3867
3955
|
if (/^\d+$/.test(value)) {
|
|
3868
3956
|
advancedFilterState.courseId = ((e.target.value)
|
|
3869
3957
|
.trim());
|
|
@@ -4196,7 +4284,7 @@ const LogReviewer = (props) => {
|
|
|
4196
4284
|
});
|
|
4197
4285
|
});
|
|
4198
4286
|
/*----------------------------------------*/
|
|
4199
|
-
/*
|
|
4287
|
+
/* ---------------- Data ---------------- */
|
|
4200
4288
|
/*----------------------------------------*/
|
|
4201
4289
|
// Nothing to show notice
|
|
4202
4290
|
const noLogsNotice = (logs.length === 0
|
|
@@ -41779,7 +41867,7 @@ const genRouteHandler = (opts) => {
|
|
|
41779
41867
|
// Output params
|
|
41780
41868
|
const output = {};
|
|
41781
41869
|
/*----------------------------------------*/
|
|
41782
|
-
/*
|
|
41870
|
+
/* ------------ Parse Params ------------ */
|
|
41783
41871
|
/*----------------------------------------*/
|
|
41784
41872
|
// Process items one by one
|
|
41785
41873
|
const paramList = Object.entries((_a = opts.paramTypes) !== null && _a !== void 0 ? _a : {});
|
|
@@ -41938,7 +42026,7 @@ const genRouteHandler = (opts) => {
|
|
|
41938
42026
|
}
|
|
41939
42027
|
}
|
|
41940
42028
|
/*----------------------------------------*/
|
|
41941
|
-
/*
|
|
42029
|
+
/* ------------- Launch Info ------------ */
|
|
41942
42030
|
/*----------------------------------------*/
|
|
41943
42031
|
// Get launch info
|
|
41944
42032
|
const { launched, launchInfo } = cacclGetLaunchInfo(req);
|
|
@@ -42073,7 +42161,7 @@ const genRouteHandler = (opts) => {
|
|
|
42073
42161
|
* Log an event on the server
|
|
42074
42162
|
* @author Gabe Abrams
|
|
42075
42163
|
*/
|
|
42076
|
-
const logServerEvent = (
|
|
42164
|
+
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42077
42165
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
42078
42166
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42079
42167
|
// that indicates that this is actually a client event, but we don't
|
|
@@ -42104,29 +42192,29 @@ const genRouteHandler = (opts) => {
|
|
|
42104
42192
|
hour,
|
|
42105
42193
|
minute,
|
|
42106
42194
|
timestamp,
|
|
42107
|
-
context: (typeof
|
|
42108
|
-
?
|
|
42109
|
-
: ((_d = ((_c =
|
|
42110
|
-
subcontext: ((_e =
|
|
42111
|
-
tags: ((_f =
|
|
42112
|
-
level: ((_g =
|
|
42113
|
-
metadata: ((_h =
|
|
42195
|
+
context: (typeof logOpts.context === 'string'
|
|
42196
|
+
? logOpts.context
|
|
42197
|
+
: ((_d = ((_c = logOpts.context) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInMetadata.Context.Uncategorized)),
|
|
42198
|
+
subcontext: ((_e = logOpts.subcontext) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized),
|
|
42199
|
+
tags: ((_f = logOpts.tags) !== null && _f !== void 0 ? _f : []),
|
|
42200
|
+
level: ((_g = logOpts.level) !== null && _g !== void 0 ? _g : LogLevel$1.Info),
|
|
42201
|
+
metadata: ((_h = logOpts.metadata) !== null && _h !== void 0 ? _h : {}),
|
|
42114
42202
|
};
|
|
42115
42203
|
// Type-specific info
|
|
42116
42204
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
42117
42205
|
? {
|
|
42118
42206
|
type: LogType$1.Error,
|
|
42119
|
-
errorMessage: (_j =
|
|
42120
|
-
errorCode: (_k =
|
|
42121
|
-
errorStack: (_l =
|
|
42207
|
+
errorMessage: (_j = logOpts.error.message) !== null && _j !== void 0 ? _j : 'Unknown message',
|
|
42208
|
+
errorCode: (_k = logOpts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$1.NoCode,
|
|
42209
|
+
errorStack: (_l = logOpts.error.stack) !== null && _l !== void 0 ? _l : 'No stack',
|
|
42122
42210
|
}
|
|
42123
42211
|
: {
|
|
42124
42212
|
type: LogType$1.Action,
|
|
42125
|
-
target: ((_m =
|
|
42126
|
-
action: ((_o =
|
|
42213
|
+
target: ((_m = logOpts.target) !== null && _m !== void 0 ? _m : LogBuiltInMetadata.Target.NoTarget),
|
|
42214
|
+
action: ((_o = logOpts.action) !== null && _o !== void 0 ? _o : LogAction$1.Unknown),
|
|
42127
42215
|
});
|
|
42128
42216
|
// Source-specific info
|
|
42129
|
-
const sourceSpecificInfo = (
|
|
42217
|
+
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|
|
42130
42218
|
? {
|
|
42131
42219
|
source: LogSource$1.Client,
|
|
42132
42220
|
}
|
|
@@ -42143,20 +42231,21 @@ const genRouteHandler = (opts) => {
|
|
|
42143
42231
|
// Store to the log collection
|
|
42144
42232
|
yield logCollection.insert(log);
|
|
42145
42233
|
}
|
|
42146
|
-
else {
|
|
42234
|
+
else if (log.type === LogType$1.Error) {
|
|
42147
42235
|
// Print to console
|
|
42148
|
-
|
|
42149
|
-
|
|
42150
|
-
|
|
42151
|
-
|
|
42152
|
-
|
|
42153
|
-
|
|
42236
|
+
// eslint-disable-next-line no-console
|
|
42237
|
+
console.error('dce-reactkit error log:', log);
|
|
42238
|
+
}
|
|
42239
|
+
else {
|
|
42240
|
+
// eslint-disable-next-line no-console
|
|
42241
|
+
console.log('dce-reactkit action log:', log);
|
|
42154
42242
|
}
|
|
42155
42243
|
// Return log entry
|
|
42156
42244
|
return log;
|
|
42157
42245
|
}
|
|
42158
42246
|
catch (err) {
|
|
42159
42247
|
// Print because we cannot store the error
|
|
42248
|
+
// eslint-disable-next-line no-console
|
|
42160
42249
|
console.error('Could not log the following:', opts);
|
|
42161
42250
|
// Create a dummy log to return
|
|
42162
42251
|
const dummyMainInfo = {
|
|
@@ -42232,32 +42321,32 @@ const genRouteHandler = (opts) => {
|
|
|
42232
42321
|
/**
|
|
42233
42322
|
* Render an error page
|
|
42234
42323
|
* @author Gabe Abrams
|
|
42235
|
-
* @param
|
|
42236
|
-
* @param [
|
|
42237
|
-
* @param [
|
|
42324
|
+
* @param renderOpts object containing all arguments
|
|
42325
|
+
* @param [renderOpts.title=An Error Occurred] title of the error box
|
|
42326
|
+
* @param [renderOpts.description=An unknown server error occurred. Please contact support.]
|
|
42238
42327
|
* a human-readable description of the error
|
|
42239
|
-
* @param [
|
|
42240
|
-
* @param [
|
|
42328
|
+
* @param [renderOpts.code=ReactKitErrorCode.NoCode] error code to show
|
|
42329
|
+
* @param [renderOpts.pageTitle=renderOpts.title] title of the page/tab if it differs from
|
|
42241
42330
|
* the title of the error
|
|
42242
|
-
* @param [
|
|
42331
|
+
* @param [renderOpts.status=500] http status code
|
|
42243
42332
|
*/
|
|
42244
|
-
const renderErrorPage = (
|
|
42333
|
+
const renderErrorPage = (renderOpts = {}) => {
|
|
42245
42334
|
var _a, _b;
|
|
42246
|
-
const html = genErrorPage(
|
|
42247
|
-
send(html, (_a =
|
|
42335
|
+
const html = genErrorPage(renderOpts);
|
|
42336
|
+
send(html, (_a = renderOpts.status) !== null && _a !== void 0 ? _a : 500);
|
|
42248
42337
|
// Log
|
|
42249
42338
|
logServerEvent({
|
|
42250
42339
|
context: LogBuiltInMetadata.Context.ServerRenderedErrorPage,
|
|
42251
42340
|
error: {
|
|
42252
|
-
message: `${
|
|
42253
|
-
code:
|
|
42341
|
+
message: `${renderOpts.title}: ${renderOpts.description}`,
|
|
42342
|
+
code: renderOpts.code,
|
|
42254
42343
|
},
|
|
42255
42344
|
metadata: {
|
|
42256
|
-
title:
|
|
42257
|
-
description:
|
|
42258
|
-
code:
|
|
42259
|
-
pageTitle:
|
|
42260
|
-
status: (_b =
|
|
42345
|
+
title: renderOpts.title,
|
|
42346
|
+
description: renderOpts.description,
|
|
42347
|
+
code: renderOpts.code,
|
|
42348
|
+
pageTitle: renderOpts.pageTitle,
|
|
42349
|
+
status: (_b = renderOpts.status) !== null && _b !== void 0 ? _b : 500,
|
|
42261
42350
|
},
|
|
42262
42351
|
});
|
|
42263
42352
|
};
|
|
@@ -42292,6 +42381,7 @@ const genRouteHandler = (opts) => {
|
|
|
42292
42381
|
return;
|
|
42293
42382
|
}
|
|
42294
42383
|
// Log error that was not responded with
|
|
42384
|
+
// eslint-disable-next-line no-console
|
|
42295
42385
|
console.log('Error occurred but could not be sent to client because a response was already sent:', err);
|
|
42296
42386
|
}
|
|
42297
42387
|
});
|