dce-reactkit 3.5.14 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +350 -294
- 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 +0 -1
- package/dist/esm/index.js +350 -294
- 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 +0 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/client/initClient.tsx +20 -4
- package/src/components/AppWrapper.tsx +8 -6
- 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/cjs/index.js
CHANGED
|
@@ -83,17 +83,17 @@ var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
|
83
83
|
* @author Gabe Abrams
|
|
84
84
|
*/
|
|
85
85
|
/*------------------------------------------------------------------------*/
|
|
86
|
-
/*
|
|
86
|
+
/* ------------------------------ Component ----------------------------- */
|
|
87
87
|
/*------------------------------------------------------------------------*/
|
|
88
88
|
const ErrorBox = (props) => {
|
|
89
89
|
/*------------------------------------------------------------------------*/
|
|
90
|
-
/*
|
|
90
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
91
91
|
/*------------------------------------------------------------------------*/
|
|
92
92
|
var _a;
|
|
93
93
|
/* -------------- Props ------------- */
|
|
94
94
|
const { error, title = 'An Error Occurred', onClose, } = props;
|
|
95
95
|
/*------------------------------------------------------------------------*/
|
|
96
|
-
/*
|
|
96
|
+
/* ------------------------------- Render ------------------------------- */
|
|
97
97
|
/*------------------------------------------------------------------------*/
|
|
98
98
|
// Determine error text
|
|
99
99
|
const errorText = (typeof error === 'string'
|
|
@@ -230,11 +230,89 @@ var ModalSize;
|
|
|
230
230
|
var ModalSize$1 = ModalSize;
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
*
|
|
233
|
+
* An error with a code
|
|
234
234
|
* @author Gabe Abrams
|
|
235
235
|
*/
|
|
236
|
+
class ErrorWithCode extends Error {
|
|
237
|
+
constructor(message, code) {
|
|
238
|
+
super(message);
|
|
239
|
+
this.name = 'ErrorWithCode';
|
|
240
|
+
this.code = code;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/*----------------------------------------*/
|
|
245
|
+
/* ---- Static Variables and Getters ---- */
|
|
246
|
+
/*----------------------------------------*/
|
|
247
|
+
/* ----------- Initialized ---------- */
|
|
248
|
+
let onInitialized;
|
|
249
|
+
const initialized = new Promise((resolve) => {
|
|
250
|
+
onInitialized = resolve;
|
|
251
|
+
});
|
|
252
|
+
/* ---------- Send Request ---------- */
|
|
253
|
+
let storedSendRequest;
|
|
254
|
+
/**
|
|
255
|
+
* Get the send request function
|
|
256
|
+
* @author Gabe Abrams
|
|
257
|
+
* @returns sendRequest function
|
|
258
|
+
*/
|
|
259
|
+
const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
260
|
+
// Show timeout error if too much time passes
|
|
261
|
+
let successful = false;
|
|
262
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
263
|
+
yield waitMs(5000);
|
|
264
|
+
if (!successful) {
|
|
265
|
+
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));
|
|
266
|
+
}
|
|
267
|
+
}))();
|
|
268
|
+
// Wait for initialization
|
|
269
|
+
yield initialized;
|
|
270
|
+
successful = true;
|
|
271
|
+
// Return
|
|
272
|
+
return storedSendRequest;
|
|
273
|
+
});
|
|
274
|
+
/* ----- Session Expired Message ---- */
|
|
275
|
+
let sessionExpiredMessage;
|
|
276
|
+
/**
|
|
277
|
+
* Get the custom session expired message
|
|
278
|
+
* @author Gabe Abrams
|
|
279
|
+
* @returns session expired message
|
|
280
|
+
*/
|
|
281
|
+
const getSessionExpiredMessage = () => {
|
|
282
|
+
// Return
|
|
283
|
+
return (sessionExpiredMessage !== null && sessionExpiredMessage !== void 0 ? sessionExpiredMessage : 'Your session has expired. Please go back to Canvas and start over.');
|
|
284
|
+
};
|
|
285
|
+
/* ------------ Dark Mode ----------- */
|
|
286
|
+
let darkModeOn = false;
|
|
287
|
+
/**
|
|
288
|
+
* Get whether dark mode is enabled or not
|
|
289
|
+
* @returns true if dark mode is enabled
|
|
290
|
+
*/
|
|
291
|
+
const isDarkModeOn = () => {
|
|
292
|
+
return darkModeOn;
|
|
293
|
+
};
|
|
294
|
+
/*----------------------------------------*/
|
|
295
|
+
/* ---------------- Init ---------------- */
|
|
296
|
+
/*----------------------------------------*/
|
|
297
|
+
/**
|
|
298
|
+
* Initialize the client-side version of reactkit
|
|
299
|
+
* @author Gabe Abrams
|
|
300
|
+
* @param opts object containing all arguments
|
|
301
|
+
* @param opts.sendRequest caccl send request functions
|
|
302
|
+
* @param [opts.sessionExpiredMessage] a custom session expired message
|
|
303
|
+
*/
|
|
304
|
+
const initClient = (opts) => {
|
|
305
|
+
// Store values
|
|
306
|
+
storedSendRequest = opts.sendRequest;
|
|
307
|
+
sessionExpiredMessage = opts.sessionExpiredMessage;
|
|
308
|
+
darkModeOn = !!opts.darkModeOn;
|
|
309
|
+
// Mark as initialized
|
|
310
|
+
onInitialized(null);
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
236
314
|
/*------------------------------------------------------------------------*/
|
|
237
|
-
/*
|
|
315
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
238
316
|
/*------------------------------------------------------------------------*/
|
|
239
317
|
// Constants
|
|
240
318
|
const MS_TO_ANIMATE = 200; // Animation duration
|
|
@@ -273,51 +351,66 @@ const modalTypeToModalButtonTypes = {
|
|
|
273
351
|
ModalButtonType$1.Cancel,
|
|
274
352
|
],
|
|
275
353
|
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
354
|
+
/**
|
|
355
|
+
* Get button type styling and labels
|
|
356
|
+
* @author Gabe Abrams
|
|
357
|
+
* @returns map of button type to label and variant
|
|
358
|
+
*/
|
|
359
|
+
const getModalButtonTypeToLabelAndVariant = () => {
|
|
360
|
+
const dark = isDarkModeOn();
|
|
361
|
+
return {
|
|
362
|
+
[ModalButtonType$1.Okay]: {
|
|
363
|
+
label: 'Okay',
|
|
364
|
+
variant: (dark
|
|
365
|
+
? Variant$1.Light
|
|
366
|
+
: Variant$1.Dark),
|
|
367
|
+
},
|
|
368
|
+
[ModalButtonType$1.Cancel]: {
|
|
369
|
+
label: 'Cancel',
|
|
370
|
+
variant: Variant$1.Secondary,
|
|
371
|
+
},
|
|
372
|
+
[ModalButtonType$1.Yes]: {
|
|
373
|
+
label: 'Yes',
|
|
374
|
+
variant: (dark
|
|
375
|
+
? Variant$1.Light
|
|
376
|
+
: Variant$1.Dark),
|
|
377
|
+
},
|
|
378
|
+
[ModalButtonType$1.No]: {
|
|
379
|
+
label: 'No',
|
|
380
|
+
variant: Variant$1.Secondary,
|
|
381
|
+
},
|
|
382
|
+
[ModalButtonType$1.Abandon]: {
|
|
383
|
+
label: 'Abandon Changes',
|
|
384
|
+
variant: Variant$1.Warning,
|
|
385
|
+
},
|
|
386
|
+
[ModalButtonType$1.GoBack]: {
|
|
387
|
+
label: 'Go Back',
|
|
388
|
+
variant: Variant$1.Secondary,
|
|
389
|
+
},
|
|
390
|
+
[ModalButtonType$1.Continue]: {
|
|
391
|
+
label: 'Continue',
|
|
392
|
+
variant: (dark
|
|
393
|
+
? Variant$1.Light
|
|
394
|
+
: Variant$1.Dark),
|
|
395
|
+
},
|
|
396
|
+
[ModalButtonType$1.ImSure]: {
|
|
397
|
+
label: 'I am sure',
|
|
398
|
+
variant: Variant$1.Warning,
|
|
399
|
+
},
|
|
400
|
+
[ModalButtonType$1.Delete]: {
|
|
401
|
+
label: 'Yes, Delete',
|
|
402
|
+
variant: Variant$1.Danger,
|
|
403
|
+
},
|
|
404
|
+
[ModalButtonType$1.Confirm]: {
|
|
405
|
+
label: 'Confirm',
|
|
406
|
+
variant: (dark
|
|
407
|
+
? Variant$1.Light
|
|
408
|
+
: Variant$1.Dark),
|
|
409
|
+
},
|
|
410
|
+
};
|
|
318
411
|
};
|
|
319
412
|
/*------------------------------------------------------------------------*/
|
|
320
|
-
/*
|
|
413
|
+
/* -------------------------------- Style ------------------------------- */
|
|
321
414
|
/*------------------------------------------------------------------------*/
|
|
322
415
|
const style$b = `
|
|
323
416
|
.Modal-backdrop {
|
|
@@ -383,25 +476,23 @@ const style$b = `
|
|
|
383
476
|
}
|
|
384
477
|
`;
|
|
385
478
|
/*------------------------------------------------------------------------*/
|
|
386
|
-
/*
|
|
479
|
+
/* ------------------------------ Component ----------------------------- */
|
|
387
480
|
/*------------------------------------------------------------------------*/
|
|
388
481
|
const Modal = (props) => {
|
|
389
482
|
/*------------------------------------------------------------------------*/
|
|
390
|
-
/*
|
|
483
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
391
484
|
/*------------------------------------------------------------------------*/
|
|
392
485
|
var _a;
|
|
393
486
|
/* -------------- Props ------------- */
|
|
394
487
|
const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
|
|
395
488
|
/* -------------- State ------------- */
|
|
396
|
-
// If true, the modal is shown
|
|
397
|
-
const [visible, setVisible] = React.useState(false);
|
|
398
489
|
// True if animation is in use
|
|
399
490
|
const [animatingIn, setAnimatingIn] = React.useState(true);
|
|
400
491
|
const [animatingPop, setAnimatingPop] = React.useState(false);
|
|
401
492
|
// Keep track of whether modal is still mounted
|
|
402
493
|
const mounted = React.useRef(false);
|
|
403
494
|
/*------------------------------------------------------------------------*/
|
|
404
|
-
/*
|
|
495
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
405
496
|
/*------------------------------------------------------------------------*/
|
|
406
497
|
/**
|
|
407
498
|
* Mount
|
|
@@ -410,14 +501,12 @@ const Modal = (props) => {
|
|
|
410
501
|
React.useEffect(() => {
|
|
411
502
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
412
503
|
// Set defaults
|
|
413
|
-
setVisible(false);
|
|
414
504
|
setAnimatingIn(true);
|
|
415
505
|
setAnimatingPop(false);
|
|
416
506
|
// Wait for animation
|
|
417
507
|
yield waitMs(MS_TO_ANIMATE);
|
|
418
508
|
// Update to state after animated in
|
|
419
509
|
if (mounted.current) {
|
|
420
|
-
setVisible(true);
|
|
421
510
|
setAnimatingIn(false);
|
|
422
511
|
}
|
|
423
512
|
}))();
|
|
@@ -426,47 +515,46 @@ const Modal = (props) => {
|
|
|
426
515
|
};
|
|
427
516
|
}, []);
|
|
428
517
|
/*------------------------------------------------------------------------*/
|
|
429
|
-
/*
|
|
518
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
430
519
|
/*------------------------------------------------------------------------*/
|
|
431
520
|
/**
|
|
432
521
|
* Handles the closing of the modal
|
|
433
522
|
* @author Gabe Abrams
|
|
434
|
-
* @param
|
|
523
|
+
* @param modalButtonType the button that was clicked when closing the
|
|
435
524
|
* modal
|
|
436
525
|
*/
|
|
437
|
-
const handleClose = (
|
|
526
|
+
const handleClose = (modalButtonType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
438
527
|
// Don't close if no handler
|
|
439
528
|
if (!onClose) {
|
|
440
529
|
return;
|
|
441
530
|
}
|
|
442
|
-
onClose(
|
|
531
|
+
onClose(modalButtonType);
|
|
443
532
|
});
|
|
444
533
|
/*------------------------------------------------------------------------*/
|
|
445
|
-
/*
|
|
534
|
+
/* ------------------------------- Render ------------------------------- */
|
|
446
535
|
/*------------------------------------------------------------------------*/
|
|
447
|
-
/*----------------------------------------*/
|
|
448
|
-
/* Footer */
|
|
449
|
-
/*----------------------------------------*/
|
|
450
536
|
// Get list of buttons for this modal type
|
|
451
537
|
const ModalButtonTypes = (_a = modalTypeToModalButtonTypes[type]) !== null && _a !== void 0 ? _a : [];
|
|
538
|
+
// Get map of button type to label and variant
|
|
539
|
+
const ModalButtonTypeToLabelAndVariant = getModalButtonTypeToLabelAndVariant();
|
|
452
540
|
// Create buttons
|
|
453
|
-
const buttons = ModalButtonTypes.map((
|
|
541
|
+
const buttons = ModalButtonTypes.map((modalButtonType, i) => {
|
|
454
542
|
// Get default style
|
|
455
|
-
let { label, variant, } = ModalButtonTypeToLabelAndVariant[
|
|
543
|
+
let { label, variant, } = ModalButtonTypeToLabelAndVariant[modalButtonType];
|
|
456
544
|
// Override with customizations
|
|
457
|
-
const newLabel = props[`${
|
|
545
|
+
const newLabel = props[`${modalButtonType}Label`];
|
|
458
546
|
if (newLabel) {
|
|
459
547
|
label = newLabel;
|
|
460
548
|
}
|
|
461
|
-
const newVariant = props[`${
|
|
549
|
+
const newVariant = props[`${modalButtonType}Variant`];
|
|
462
550
|
if (newVariant) {
|
|
463
551
|
variant = newVariant;
|
|
464
552
|
}
|
|
465
553
|
// Check if this button is last
|
|
466
554
|
const last = (i === ModalButtonTypes.length - 1);
|
|
467
555
|
// Create the button
|
|
468
|
-
return (React__default["default"].createElement("button", { key:
|
|
469
|
-
handleClose(
|
|
556
|
+
return (React__default["default"].createElement("button", { key: modalButtonType, type: "button", className: `Modal-${modalButtonType}-button btn btn-${variant} ${last ? '' : 'me-1'}`, onClick: () => {
|
|
557
|
+
handleClose(modalButtonType);
|
|
470
558
|
} }, label));
|
|
471
559
|
});
|
|
472
560
|
// Put all buttons in a footer
|
|
@@ -484,7 +572,7 @@ const Modal = (props) => {
|
|
|
484
572
|
animationClass = 'Modal-animating-pop';
|
|
485
573
|
}
|
|
486
574
|
// Render the modal
|
|
487
|
-
return (React__default["default"].createElement("div", { className:
|
|
575
|
+
return (React__default["default"].createElement("div", { className: "modal show modal-dialog-scrollable modal-dialog-centered", tabIndex: -1, style: {
|
|
488
576
|
zIndex: (onTopOfOtherModals
|
|
489
577
|
? 5000000001
|
|
490
578
|
: 5000000000),
|
|
@@ -514,8 +602,22 @@ const Modal = (props) => {
|
|
|
514
602
|
React__default["default"].createElement("div", { className: `modal-dialog modal-${size} ${animationClass}`, style: {
|
|
515
603
|
zIndex: 5000000002,
|
|
516
604
|
} },
|
|
517
|
-
React__default["default"].createElement("div", { className: "modal-content"
|
|
518
|
-
|
|
605
|
+
React__default["default"].createElement("div", { className: "modal-content", style: {
|
|
606
|
+
borderColor: (isDarkModeOn()
|
|
607
|
+
? 'gray'
|
|
608
|
+
: undefined),
|
|
609
|
+
} },
|
|
610
|
+
React__default["default"].createElement("div", { className: "modal-header", style: {
|
|
611
|
+
color: (isDarkModeOn()
|
|
612
|
+
? 'white'
|
|
613
|
+
: undefined),
|
|
614
|
+
backgroundColor: (isDarkModeOn()
|
|
615
|
+
? '#444'
|
|
616
|
+
: undefined),
|
|
617
|
+
borderBottom: (isDarkModeOn()
|
|
618
|
+
? '0.1rem solid gray'
|
|
619
|
+
: undefined),
|
|
620
|
+
} },
|
|
519
621
|
React__default["default"].createElement("h5", { className: "modal-title", style: {
|
|
520
622
|
fontWeight: 'bold',
|
|
521
623
|
} }, title),
|
|
@@ -523,22 +625,27 @@ const Modal = (props) => {
|
|
|
523
625
|
// Handle close
|
|
524
626
|
handleClose(ModalButtonType$1.Cancel);
|
|
525
627
|
} }))),
|
|
526
|
-
children && (React__default["default"].createElement("div", { className: "modal-body"
|
|
527
|
-
|
|
628
|
+
children && (React__default["default"].createElement("div", { className: "modal-body", style: {
|
|
629
|
+
color: (isDarkModeOn()
|
|
630
|
+
? 'white'
|
|
631
|
+
: undefined),
|
|
632
|
+
backgroundColor: (isDarkModeOn()
|
|
633
|
+
? '#444'
|
|
634
|
+
: undefined),
|
|
635
|
+
} }, children)),
|
|
636
|
+
footer && (React__default["default"].createElement("div", { className: "modal-footer pt-1 pb-1", style: {
|
|
637
|
+
color: (isDarkModeOn()
|
|
638
|
+
? 'white'
|
|
639
|
+
: undefined),
|
|
640
|
+
backgroundColor: (isDarkModeOn()
|
|
641
|
+
? '#444'
|
|
642
|
+
: undefined),
|
|
643
|
+
borderTop: (isDarkModeOn()
|
|
644
|
+
? '0.1rem solid gray'
|
|
645
|
+
: undefined),
|
|
646
|
+
} }, footer))))));
|
|
528
647
|
};
|
|
529
648
|
|
|
530
|
-
/**
|
|
531
|
-
* An error with a code
|
|
532
|
-
* @author Gabe Abrams
|
|
533
|
-
*/
|
|
534
|
-
class ErrorWithCode extends Error {
|
|
535
|
-
constructor(message, code) {
|
|
536
|
-
super(message);
|
|
537
|
-
this.name = 'ErrorWithCode';
|
|
538
|
-
this.code = code;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
649
|
/**
|
|
543
650
|
* Path that all routes start with
|
|
544
651
|
* @author Gabe Abrams
|
|
@@ -563,65 +670,6 @@ var LogLevel;
|
|
|
563
670
|
})(LogLevel || (LogLevel = {}));
|
|
564
671
|
var LogLevel$1 = LogLevel;
|
|
565
672
|
|
|
566
|
-
/*----------------------------------------*/
|
|
567
|
-
/* ---- Static Variables and Getters ---- */
|
|
568
|
-
/*----------------------------------------*/
|
|
569
|
-
/* ----------- Initialized ---------- */
|
|
570
|
-
let onInitialized;
|
|
571
|
-
let initialized = new Promise((resolve) => {
|
|
572
|
-
onInitialized = resolve;
|
|
573
|
-
});
|
|
574
|
-
/* ---------- Send Request ---------- */
|
|
575
|
-
let storedSendRequest;
|
|
576
|
-
/**
|
|
577
|
-
* Get the send request function
|
|
578
|
-
* @author Gabe Abrams
|
|
579
|
-
* @returns sendRequest function
|
|
580
|
-
*/
|
|
581
|
-
const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
582
|
-
// Show timeout error if too much time passes
|
|
583
|
-
let successful = false;
|
|
584
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
585
|
-
yield waitMs(5000);
|
|
586
|
-
if (!successful) {
|
|
587
|
-
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));
|
|
588
|
-
}
|
|
589
|
-
}))(),
|
|
590
|
-
// Wait for initialization
|
|
591
|
-
yield initialized;
|
|
592
|
-
successful = true;
|
|
593
|
-
// Return
|
|
594
|
-
return storedSendRequest;
|
|
595
|
-
});
|
|
596
|
-
/* ----- Session Expired Message ---- */
|
|
597
|
-
let sessionExpiredMessage;
|
|
598
|
-
/**
|
|
599
|
-
* Get the custom session expired message
|
|
600
|
-
* @author Gabe Abrams
|
|
601
|
-
* @returns session expired message
|
|
602
|
-
*/
|
|
603
|
-
const getSessionExpiredMessage = () => {
|
|
604
|
-
// Return
|
|
605
|
-
return (sessionExpiredMessage !== null && sessionExpiredMessage !== void 0 ? sessionExpiredMessage : 'Your session has expired. Please go back to Canvas and start over.');
|
|
606
|
-
};
|
|
607
|
-
/*----------------------------------------*/
|
|
608
|
-
/* ---------------- Init ---------------- */
|
|
609
|
-
/*----------------------------------------*/
|
|
610
|
-
/**
|
|
611
|
-
* Initialize the client-side version of reactkit
|
|
612
|
-
* @author Gabe Abrams
|
|
613
|
-
* @param opts object containing all arguments
|
|
614
|
-
* @param opts.sendRequest caccl send request functions
|
|
615
|
-
* @param [opts.sessionExpiredMessage] a custom session expired message
|
|
616
|
-
*/
|
|
617
|
-
const initClient = (opts) => {
|
|
618
|
-
// Store values
|
|
619
|
-
storedSendRequest = opts.sendRequest;
|
|
620
|
-
sessionExpiredMessage = opts.sessionExpiredMessage;
|
|
621
|
-
// Mark as initialized
|
|
622
|
-
onInitialized(null);
|
|
623
|
-
};
|
|
624
|
-
|
|
625
673
|
// Keep track of whether or not session expiry has already been handled
|
|
626
674
|
let sessionAlreadyExpired = false;
|
|
627
675
|
/*------------------------------------------------------------------------*/
|
|
@@ -981,7 +1029,7 @@ const AppWrapper = (props) => {
|
|
|
981
1029
|
/* -------------------------------- Setup ------------------------------- */
|
|
982
1030
|
/*------------------------------------------------------------------------*/
|
|
983
1031
|
/* -------------- Props ------------- */
|
|
984
|
-
const { children,
|
|
1032
|
+
const { children, } = props;
|
|
985
1033
|
/* -------------- State ------------- */
|
|
986
1034
|
// Leave to URL
|
|
987
1035
|
const [urlToLeaveTo, setURLToLeaveToInner,] = React.useState();
|
|
@@ -1064,7 +1112,7 @@ const AppWrapper = (props) => {
|
|
|
1064
1112
|
width: '100vw',
|
|
1065
1113
|
minHeight: '100vh',
|
|
1066
1114
|
paddingTop: '2rem',
|
|
1067
|
-
backgroundColor: (
|
|
1115
|
+
backgroundColor: (isDarkModeOn()
|
|
1068
1116
|
? '#222'
|
|
1069
1117
|
: '#fff'),
|
|
1070
1118
|
} },
|
|
@@ -1077,7 +1125,7 @@ const AppWrapper = (props) => {
|
|
|
1077
1125
|
body = children;
|
|
1078
1126
|
}
|
|
1079
1127
|
/*----------------------------------------*/
|
|
1080
|
-
/*
|
|
1128
|
+
/* --------------- Main UI -------------- */
|
|
1081
1129
|
/*----------------------------------------*/
|
|
1082
1130
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1083
1131
|
React__default["default"].createElement("style", null, style$a),
|
|
@@ -1090,7 +1138,7 @@ const AppWrapper = (props) => {
|
|
|
1090
1138
|
* @author Gabe Abrams
|
|
1091
1139
|
*/
|
|
1092
1140
|
/*------------------------------------------------------------------------*/
|
|
1093
|
-
/*
|
|
1141
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1094
1142
|
/*------------------------------------------------------------------------*/
|
|
1095
1143
|
const style$9 = `
|
|
1096
1144
|
/* Container fades in */
|
|
@@ -1162,11 +1210,11 @@ const style$9 = `
|
|
|
1162
1210
|
}
|
|
1163
1211
|
`;
|
|
1164
1212
|
/*------------------------------------------------------------------------*/
|
|
1165
|
-
/*
|
|
1213
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1166
1214
|
/*------------------------------------------------------------------------*/
|
|
1167
1215
|
const LoadingSpinner = () => {
|
|
1168
1216
|
/*------------------------------------------------------------------------*/
|
|
1169
|
-
/*
|
|
1217
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1170
1218
|
/*------------------------------------------------------------------------*/
|
|
1171
1219
|
// Add all four blips to a container
|
|
1172
1220
|
return (React__default["default"].createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
@@ -1182,7 +1230,7 @@ const LoadingSpinner = () => {
|
|
|
1182
1230
|
* @author Gabe Abrams
|
|
1183
1231
|
*/
|
|
1184
1232
|
/*------------------------------------------------------------------------*/
|
|
1185
|
-
/*
|
|
1233
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1186
1234
|
/*------------------------------------------------------------------------*/
|
|
1187
1235
|
const style$8 = `
|
|
1188
1236
|
/* Tab Box */
|
|
@@ -1248,19 +1296,19 @@ const style$8 = `
|
|
|
1248
1296
|
}
|
|
1249
1297
|
`;
|
|
1250
1298
|
/*------------------------------------------------------------------------*/
|
|
1251
|
-
/*
|
|
1299
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1252
1300
|
/*------------------------------------------------------------------------*/
|
|
1253
1301
|
const TabBox = (props) => {
|
|
1254
1302
|
/*------------------------------------------------------------------------*/
|
|
1255
|
-
/*
|
|
1303
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1256
1304
|
/*------------------------------------------------------------------------*/
|
|
1257
1305
|
/* -------------- Props ------------- */
|
|
1258
1306
|
const { title, children, noBottomPadding, noBottomMargin, } = props;
|
|
1259
1307
|
/*------------------------------------------------------------------------*/
|
|
1260
|
-
/*
|
|
1308
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1261
1309
|
/*------------------------------------------------------------------------*/
|
|
1262
1310
|
/*----------------------------------------*/
|
|
1263
|
-
/*
|
|
1311
|
+
/* --------------- Main UI -------------- */
|
|
1264
1312
|
/*----------------------------------------*/
|
|
1265
1313
|
// Full UI
|
|
1266
1314
|
return (React__default["default"].createElement("div", { className: `TabBox-container ${noBottomMargin ? '' : 'mb-2'}` },
|
|
@@ -1276,19 +1324,23 @@ const TabBox = (props) => {
|
|
|
1276
1324
|
* @author Gabe Abrams
|
|
1277
1325
|
*/
|
|
1278
1326
|
/*------------------------------------------------------------------------*/
|
|
1279
|
-
/*
|
|
1327
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1280
1328
|
/*------------------------------------------------------------------------*/
|
|
1281
1329
|
const RadioButton = (props) => {
|
|
1282
1330
|
/*------------------------------------------------------------------------*/
|
|
1283
|
-
/*
|
|
1331
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1284
1332
|
/*------------------------------------------------------------------------*/
|
|
1285
1333
|
/* -------------- Props ------------- */
|
|
1286
|
-
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant =
|
|
1334
|
+
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = (isDarkModeOn()
|
|
1335
|
+
? Variant$1.Light
|
|
1336
|
+
: Variant$1.Secondary), unselectedVariant = (isDarkModeOn()
|
|
1337
|
+
? Variant$1.Secondary
|
|
1338
|
+
: Variant$1.Light), small, } = props;
|
|
1287
1339
|
/*------------------------------------------------------------------------*/
|
|
1288
|
-
/*
|
|
1340
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1289
1341
|
/*------------------------------------------------------------------------*/
|
|
1290
1342
|
/*----------------------------------------*/
|
|
1291
|
-
/*
|
|
1343
|
+
/* --------------- Main UI -------------- */
|
|
1292
1344
|
/*----------------------------------------*/
|
|
1293
1345
|
return (React__default["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: () => {
|
|
1294
1346
|
if (!selected) {
|
|
@@ -1304,19 +1356,23 @@ const RadioButton = (props) => {
|
|
|
1304
1356
|
* @author Gabe Abrams
|
|
1305
1357
|
*/
|
|
1306
1358
|
/*------------------------------------------------------------------------*/
|
|
1307
|
-
/*
|
|
1359
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1308
1360
|
/*------------------------------------------------------------------------*/
|
|
1309
1361
|
const CheckboxButton = (props) => {
|
|
1310
1362
|
/*------------------------------------------------------------------------*/
|
|
1311
|
-
/*
|
|
1363
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1312
1364
|
/*------------------------------------------------------------------------*/
|
|
1313
1365
|
/* -------------- Props ------------- */
|
|
1314
|
-
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant =
|
|
1366
|
+
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = (isDarkModeOn()
|
|
1367
|
+
? Variant$1.Light
|
|
1368
|
+
: Variant$1.Secondary), uncheckedVariant = (isDarkModeOn()
|
|
1369
|
+
? Variant$1.Secondary
|
|
1370
|
+
: Variant$1.Light), small, dashed, } = props;
|
|
1315
1371
|
/*------------------------------------------------------------------------*/
|
|
1316
|
-
/*
|
|
1372
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1317
1373
|
/*------------------------------------------------------------------------*/
|
|
1318
1374
|
/*----------------------------------------*/
|
|
1319
|
-
/*
|
|
1375
|
+
/* --------------- Main UI -------------- */
|
|
1320
1376
|
/*----------------------------------------*/
|
|
1321
1377
|
// Determine the icon
|
|
1322
1378
|
let icon;
|
|
@@ -1341,20 +1397,20 @@ const CheckboxButton = (props) => {
|
|
|
1341
1397
|
* @author Gabe Abrams
|
|
1342
1398
|
*/
|
|
1343
1399
|
/*------------------------------------------------------------------------*/
|
|
1344
|
-
/*
|
|
1400
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1345
1401
|
/*------------------------------------------------------------------------*/
|
|
1346
1402
|
const ButtonInputGroup = (props) => {
|
|
1347
1403
|
/*------------------------------------------------------------------------*/
|
|
1348
|
-
/*
|
|
1404
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1349
1405
|
/*------------------------------------------------------------------------*/
|
|
1350
1406
|
/* -------------- Props ------------- */
|
|
1351
1407
|
// Destructure all props
|
|
1352
1408
|
const { label, minLabelWidth, children, className, wrapButtonsAndAddGaps, } = props;
|
|
1353
1409
|
/*------------------------------------------------------------------------*/
|
|
1354
|
-
/*
|
|
1410
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1355
1411
|
/*------------------------------------------------------------------------*/
|
|
1356
1412
|
/*----------------------------------------*/
|
|
1357
|
-
/*
|
|
1413
|
+
/* --------------- Main UI -------------- */
|
|
1358
1414
|
/*----------------------------------------*/
|
|
1359
1415
|
return (React__default["default"].createElement("div", { className: `input-group ${className !== null && className !== void 0 ? className : ''}` },
|
|
1360
1416
|
React__default["default"].createElement("div", { className: "input-group-prepend d-flex w-100" },
|
|
@@ -1480,21 +1536,19 @@ const getTimeInfoInET = (dateOrTimestamp) => {
|
|
|
1480
1536
|
* @author Gabe Abrams
|
|
1481
1537
|
*/
|
|
1482
1538
|
/*------------------------------------------------------------------------*/
|
|
1483
|
-
/*
|
|
1539
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1484
1540
|
/*------------------------------------------------------------------------*/
|
|
1485
1541
|
const SimpleDateChooser = (props) => {
|
|
1486
1542
|
/*------------------------------------------------------------------------*/
|
|
1487
|
-
/*
|
|
1543
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1488
1544
|
/*------------------------------------------------------------------------*/
|
|
1489
|
-
var _a;
|
|
1490
1545
|
/* -------------- Props ------------- */
|
|
1491
|
-
const { ariaLabel, name,
|
|
1492
|
-
const numMonthsToShow = ((_a = props.numMonthsToShow) !== null && _a !== void 0 ? _a : 6);
|
|
1546
|
+
const { ariaLabel, name, onChange, chooseFromPast, numMonthsToShow = 6, } = props;
|
|
1493
1547
|
/*------------------------------------------------------------------------*/
|
|
1494
|
-
/*
|
|
1548
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1495
1549
|
/*------------------------------------------------------------------------*/
|
|
1496
1550
|
/*----------------------------------------*/
|
|
1497
|
-
/*
|
|
1551
|
+
/* --------------- Main UI -------------- */
|
|
1498
1552
|
/*----------------------------------------*/
|
|
1499
1553
|
// Determine the set of choices allowed
|
|
1500
1554
|
const today = getTimeInfoInET();
|
|
@@ -1549,6 +1603,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1549
1603
|
});
|
|
1550
1604
|
}
|
|
1551
1605
|
// Create choice options
|
|
1606
|
+
const { month, day, year, } = props;
|
|
1552
1607
|
const monthOptions = [];
|
|
1553
1608
|
const dayOptions = [];
|
|
1554
1609
|
choices.forEach((choice) => {
|
|
@@ -1584,7 +1639,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1584
1639
|
* @author Gabe Abrams
|
|
1585
1640
|
*/
|
|
1586
1641
|
/*------------------------------------------------------------------------*/
|
|
1587
|
-
/*
|
|
1642
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1588
1643
|
/*------------------------------------------------------------------------*/
|
|
1589
1644
|
const style$7 = `
|
|
1590
1645
|
.Drawer-container {
|
|
@@ -1602,20 +1657,20 @@ const style$7 = `
|
|
|
1602
1657
|
}
|
|
1603
1658
|
`;
|
|
1604
1659
|
/*------------------------------------------------------------------------*/
|
|
1605
|
-
/*
|
|
1660
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1606
1661
|
/*------------------------------------------------------------------------*/
|
|
1607
1662
|
const Drawer = (props) => {
|
|
1608
1663
|
/*------------------------------------------------------------------------*/
|
|
1609
|
-
/*
|
|
1664
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1610
1665
|
/*------------------------------------------------------------------------*/
|
|
1611
1666
|
/* -------------- Props ------------- */
|
|
1612
1667
|
// Destructure all props
|
|
1613
1668
|
const { customBackgroundColor, children, } = props;
|
|
1614
1669
|
/*------------------------------------------------------------------------*/
|
|
1615
|
-
/*
|
|
1670
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1616
1671
|
/*------------------------------------------------------------------------*/
|
|
1617
1672
|
/*----------------------------------------*/
|
|
1618
|
-
/*
|
|
1673
|
+
/* --------------- Main UI -------------- */
|
|
1619
1674
|
/*----------------------------------------*/
|
|
1620
1675
|
return (React__default["default"].createElement("div", { className: "Drawer-container", style: {
|
|
1621
1676
|
backgroundColor: (customBackgroundColor !== null && customBackgroundColor !== void 0 ? customBackgroundColor : undefined),
|
|
@@ -1629,7 +1684,7 @@ const Drawer = (props) => {
|
|
|
1629
1684
|
* @author Gabe Abrams
|
|
1630
1685
|
*/
|
|
1631
1686
|
/*------------------------------------------------------------------------*/
|
|
1632
|
-
/*
|
|
1687
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1633
1688
|
/*------------------------------------------------------------------------*/
|
|
1634
1689
|
const style$6 = `
|
|
1635
1690
|
.PopSuccessMark-outer-container {
|
|
@@ -1717,20 +1772,20 @@ const style$6 = `
|
|
|
1717
1772
|
}
|
|
1718
1773
|
`;
|
|
1719
1774
|
/*------------------------------------------------------------------------*/
|
|
1720
|
-
/*
|
|
1775
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1721
1776
|
/*------------------------------------------------------------------------*/
|
|
1722
1777
|
const PopSuccessMark = (props) => {
|
|
1723
1778
|
/*------------------------------------------------------------------------*/
|
|
1724
|
-
/*
|
|
1779
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1725
1780
|
/*------------------------------------------------------------------------*/
|
|
1726
1781
|
/* -------------- Props ------------- */
|
|
1727
1782
|
// Destructure all props
|
|
1728
1783
|
const { sizeRem = 3, circleVariant = 'success', checkVariant = 'white', } = props;
|
|
1729
1784
|
/*------------------------------------------------------------------------*/
|
|
1730
|
-
/*
|
|
1785
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1731
1786
|
/*------------------------------------------------------------------------*/
|
|
1732
1787
|
/*----------------------------------------*/
|
|
1733
|
-
/*
|
|
1788
|
+
/* --------------- Main UI -------------- */
|
|
1734
1789
|
/*----------------------------------------*/
|
|
1735
1790
|
return (React__default["default"].createElement("div", { className: `PopSuccessMark-outer-container bg-${circleVariant}`, style: {
|
|
1736
1791
|
width: `${sizeRem}rem`,
|
|
@@ -1750,7 +1805,7 @@ const PopSuccessMark = (props) => {
|
|
|
1750
1805
|
* @author Gabe Abrams
|
|
1751
1806
|
*/
|
|
1752
1807
|
/*------------------------------------------------------------------------*/
|
|
1753
|
-
/*
|
|
1808
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1754
1809
|
/*------------------------------------------------------------------------*/
|
|
1755
1810
|
const style$5 = `
|
|
1756
1811
|
.PopFailureMark-outer-container {
|
|
@@ -1837,20 +1892,20 @@ const style$5 = `
|
|
|
1837
1892
|
}
|
|
1838
1893
|
`;
|
|
1839
1894
|
/*------------------------------------------------------------------------*/
|
|
1840
|
-
/*
|
|
1895
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1841
1896
|
/*------------------------------------------------------------------------*/
|
|
1842
1897
|
const PopFailureMark = (props) => {
|
|
1843
1898
|
/*------------------------------------------------------------------------*/
|
|
1844
|
-
/*
|
|
1899
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1845
1900
|
/*------------------------------------------------------------------------*/
|
|
1846
1901
|
/* -------------- Props ------------- */
|
|
1847
1902
|
// Destructure all props
|
|
1848
1903
|
const { sizeRem = 3, circleVariant = 'danger', xVariant = 'white', } = props;
|
|
1849
1904
|
/*------------------------------------------------------------------------*/
|
|
1850
|
-
/*
|
|
1905
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1851
1906
|
/*------------------------------------------------------------------------*/
|
|
1852
1907
|
/*----------------------------------------*/
|
|
1853
|
-
/*
|
|
1908
|
+
/* --------------- Main UI -------------- */
|
|
1854
1909
|
/*----------------------------------------*/
|
|
1855
1910
|
return (React__default["default"].createElement("div", { className: `PopFailureMark-outer-container bg-${circleVariant}`, style: {
|
|
1856
1911
|
width: `${sizeRem}rem`,
|
|
@@ -1870,7 +1925,7 @@ const PopFailureMark = (props) => {
|
|
|
1870
1925
|
* @author Gabe Abrams
|
|
1871
1926
|
*/
|
|
1872
1927
|
/*------------------------------------------------------------------------*/
|
|
1873
|
-
/*
|
|
1928
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1874
1929
|
/*------------------------------------------------------------------------*/
|
|
1875
1930
|
const style$4 = `
|
|
1876
1931
|
.PopPendingMark-outer-container {
|
|
@@ -1926,20 +1981,20 @@ const style$4 = `
|
|
|
1926
1981
|
}
|
|
1927
1982
|
`;
|
|
1928
1983
|
/*------------------------------------------------------------------------*/
|
|
1929
|
-
/*
|
|
1984
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1930
1985
|
/*------------------------------------------------------------------------*/
|
|
1931
1986
|
const PopPendingMark = (props) => {
|
|
1932
1987
|
/*------------------------------------------------------------------------*/
|
|
1933
|
-
/*
|
|
1988
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1934
1989
|
/*------------------------------------------------------------------------*/
|
|
1935
1990
|
/* -------------- Props ------------- */
|
|
1936
1991
|
// Destructure all props
|
|
1937
1992
|
const { sizeRem = 3, circleVariant = 'warning', hourglassVariant = 'white', } = props;
|
|
1938
1993
|
/*------------------------------------------------------------------------*/
|
|
1939
|
-
/*
|
|
1994
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1940
1995
|
/*------------------------------------------------------------------------*/
|
|
1941
1996
|
/*----------------------------------------*/
|
|
1942
|
-
/*
|
|
1997
|
+
/* --------------- Main UI -------------- */
|
|
1943
1998
|
/*----------------------------------------*/
|
|
1944
1999
|
return (React__default["default"].createElement("div", { className: `PopPendingMark-outer-container bg-${circleVariant}`, style: {
|
|
1945
2000
|
width: `${sizeRem}rem`,
|
|
@@ -1989,11 +2044,11 @@ const reducer$8 = (state, action) => {
|
|
|
1989
2044
|
}
|
|
1990
2045
|
};
|
|
1991
2046
|
/*------------------------------------------------------------------------*/
|
|
1992
|
-
/*
|
|
2047
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1993
2048
|
/*------------------------------------------------------------------------*/
|
|
1994
2049
|
const CopiableBox = (props) => {
|
|
1995
2050
|
/*------------------------------------------------------------------------*/
|
|
1996
|
-
/*
|
|
2051
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1997
2052
|
/*------------------------------------------------------------------------*/
|
|
1998
2053
|
/* -------------- Props ------------- */
|
|
1999
2054
|
// Destructure all props
|
|
@@ -2008,7 +2063,7 @@ const CopiableBox = (props) => {
|
|
|
2008
2063
|
// Destructure common state
|
|
2009
2064
|
const { recentlyCopied, } = state;
|
|
2010
2065
|
/*------------------------------------------------------------------------*/
|
|
2011
|
-
/*
|
|
2066
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
2012
2067
|
/*------------------------------------------------------------------------*/
|
|
2013
2068
|
/**
|
|
2014
2069
|
* Perform a copy
|
|
@@ -2034,10 +2089,10 @@ const CopiableBox = (props) => {
|
|
|
2034
2089
|
});
|
|
2035
2090
|
});
|
|
2036
2091
|
/*------------------------------------------------------------------------*/
|
|
2037
|
-
/*
|
|
2092
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2038
2093
|
/*------------------------------------------------------------------------*/
|
|
2039
2094
|
/*----------------------------------------*/
|
|
2040
|
-
/*
|
|
2095
|
+
/* --------------- Main UI -------------- */
|
|
2041
2096
|
/*----------------------------------------*/
|
|
2042
2097
|
return (React__default["default"].createElement("div", { className: "input-group mb-2" },
|
|
2043
2098
|
(label || labelIcon) && (React__default["default"].createElement("span", { className: "input-group-text", style: {
|
|
@@ -2108,11 +2163,11 @@ const reducer$7 = (state, action) => {
|
|
|
2108
2163
|
}
|
|
2109
2164
|
};
|
|
2110
2165
|
/*------------------------------------------------------------------------*/
|
|
2111
|
-
/*
|
|
2166
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2112
2167
|
/*------------------------------------------------------------------------*/
|
|
2113
2168
|
const NestableItemList = (props) => {
|
|
2114
2169
|
/*------------------------------------------------------------------------*/
|
|
2115
|
-
/*
|
|
2170
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2116
2171
|
/*------------------------------------------------------------------------*/
|
|
2117
2172
|
/* -------------- Props ------------- */
|
|
2118
2173
|
// Destructure all props
|
|
@@ -2132,7 +2187,7 @@ const NestableItemList = (props) => {
|
|
|
2132
2187
|
// Destructure common state
|
|
2133
2188
|
const { childExpanded, } = state;
|
|
2134
2189
|
/*------------------------------------------------------------------------*/
|
|
2135
|
-
/*
|
|
2190
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
2136
2191
|
/*------------------------------------------------------------------------*/
|
|
2137
2192
|
/**
|
|
2138
2193
|
* Checks if all items in a list are checked
|
|
@@ -2207,7 +2262,7 @@ const NestableItemList = (props) => {
|
|
|
2207
2262
|
});
|
|
2208
2263
|
};
|
|
2209
2264
|
/*------------------------------------------------------------------------*/
|
|
2210
|
-
/*
|
|
2265
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2211
2266
|
/*------------------------------------------------------------------------*/
|
|
2212
2267
|
return (React__default["default"].createElement("div", null, items.map((item) => {
|
|
2213
2268
|
return (React__default["default"].createElement("div", { key: item.id },
|
|
@@ -2240,23 +2295,23 @@ const NestableItemList = (props) => {
|
|
|
2240
2295
|
* @author Yuen Ler Chow
|
|
2241
2296
|
*/
|
|
2242
2297
|
/*------------------------------------------------------------------------*/
|
|
2243
|
-
/*
|
|
2298
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2244
2299
|
/*------------------------------------------------------------------------*/
|
|
2245
2300
|
const ItemPicker = (props) => {
|
|
2246
2301
|
/*------------------------------------------------------------------------*/
|
|
2247
|
-
/*
|
|
2302
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2248
2303
|
/*------------------------------------------------------------------------*/
|
|
2249
2304
|
/* -------------- Props ------------- */
|
|
2250
2305
|
// Destructure all props
|
|
2251
2306
|
const { title, items, onChanged, noBottomMargin, } = props;
|
|
2252
2307
|
/*------------------------------------------------------------------------*/
|
|
2253
|
-
/*
|
|
2308
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
2254
2309
|
/*------------------------------------------------------------------------*/
|
|
2255
2310
|
/*------------------------------------------------------------------------*/
|
|
2256
|
-
/*
|
|
2311
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2257
2312
|
/*------------------------------------------------------------------------*/
|
|
2258
2313
|
/*----------------------------------------*/
|
|
2259
|
-
/*
|
|
2314
|
+
/* --------------- Main UI -------------- */
|
|
2260
2315
|
/*----------------------------------------*/
|
|
2261
2316
|
return (React__default["default"].createElement(TabBox, { title: title, noBottomMargin: noBottomMargin },
|
|
2262
2317
|
React__default["default"].createElement("div", { style: { overflowX: 'auto' } },
|
|
@@ -2454,20 +2509,20 @@ const genCSV = (data, columns) => {
|
|
|
2454
2509
|
* @author Gabe Abrams
|
|
2455
2510
|
*/
|
|
2456
2511
|
/*------------------------------------------------------------------------*/
|
|
2457
|
-
/*
|
|
2512
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2458
2513
|
/*------------------------------------------------------------------------*/
|
|
2459
2514
|
const CSVDownloadButton = (props) => {
|
|
2460
2515
|
/*------------------------------------------------------------------------*/
|
|
2461
|
-
/*
|
|
2516
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2462
2517
|
/*------------------------------------------------------------------------*/
|
|
2463
2518
|
/* -------------- Props ------------- */
|
|
2464
2519
|
// Destructure all props
|
|
2465
2520
|
const { filename, csv, id, className, ariaLabel, style, onClick, children, } = props;
|
|
2466
2521
|
/*------------------------------------------------------------------------*/
|
|
2467
|
-
/*
|
|
2522
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2468
2523
|
/*------------------------------------------------------------------------*/
|
|
2469
2524
|
/*----------------------------------------*/
|
|
2470
|
-
/*
|
|
2525
|
+
/* --------------- Main UI -------------- */
|
|
2471
2526
|
/*----------------------------------------*/
|
|
2472
2527
|
// Render the button
|
|
2473
2528
|
return (React__default["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
|
|
@@ -2555,26 +2610,26 @@ const reducer$6 = (state, action) => {
|
|
|
2555
2610
|
}
|
|
2556
2611
|
};
|
|
2557
2612
|
/*------------------------------------------------------------------------*/
|
|
2558
|
-
/*
|
|
2613
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2559
2614
|
/*------------------------------------------------------------------------*/
|
|
2560
2615
|
const IntelliTable = (props) => {
|
|
2561
2616
|
/*------------------------------------------------------------------------*/
|
|
2562
|
-
/*
|
|
2617
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2563
2618
|
/*------------------------------------------------------------------------*/
|
|
2564
2619
|
var _a;
|
|
2565
2620
|
/* -------------- Props ------------- */
|
|
2566
2621
|
// Destructure all props
|
|
2567
|
-
const { title, id, columns, } = props;
|
|
2622
|
+
const { title, id, columns, csvName, data = [], } = props;
|
|
2568
2623
|
// Get data, show empty row if none
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2624
|
+
if (data.length === 0) {
|
|
2625
|
+
data.push({ id: 'empty-row' });
|
|
2626
|
+
}
|
|
2572
2627
|
// Get CSV filename
|
|
2573
2628
|
let filename = `${title}.csv`;
|
|
2574
|
-
if (
|
|
2575
|
-
filename = (
|
|
2576
|
-
?
|
|
2577
|
-
: `${
|
|
2629
|
+
if (csvName) {
|
|
2630
|
+
filename = (csvName.endsWith('.csv')
|
|
2631
|
+
? csvName
|
|
2632
|
+
: `${csvName}.csv`);
|
|
2578
2633
|
}
|
|
2579
2634
|
/* -------------- State ------------- */
|
|
2580
2635
|
// Initial state
|
|
@@ -2593,10 +2648,10 @@ const IntelliTable = (props) => {
|
|
|
2593
2648
|
// Destructure common state
|
|
2594
2649
|
const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
|
|
2595
2650
|
/*------------------------------------------------------------------------*/
|
|
2596
|
-
/*
|
|
2651
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2597
2652
|
/*------------------------------------------------------------------------*/
|
|
2598
2653
|
/*----------------------------------------*/
|
|
2599
|
-
/*
|
|
2654
|
+
/* ---------------- Modal --------------- */
|
|
2600
2655
|
/*----------------------------------------*/
|
|
2601
2656
|
// Modal that may be defined
|
|
2602
2657
|
let modal;
|
|
@@ -2637,7 +2692,7 @@ const IntelliTable = (props) => {
|
|
|
2637
2692
|
} }, "Deselect All")));
|
|
2638
2693
|
}
|
|
2639
2694
|
/*----------------------------------------*/
|
|
2640
|
-
/*
|
|
2695
|
+
/* --------------- Main UI -------------- */
|
|
2641
2696
|
/*----------------------------------------*/
|
|
2642
2697
|
// Table header
|
|
2643
2698
|
const headerCells = (columns
|
|
@@ -2692,7 +2747,7 @@ const IntelliTable = (props) => {
|
|
|
2692
2747
|
const tableHeader = (React__default["default"].createElement("thead", null,
|
|
2693
2748
|
React__default["default"].createElement("tr", null, headerCells)));
|
|
2694
2749
|
// Sort data
|
|
2695
|
-
|
|
2750
|
+
const sortedData = [...data];
|
|
2696
2751
|
const paramType = (_a = columns.find((column) => {
|
|
2697
2752
|
return (column.param === sortColumnParam);
|
|
2698
2753
|
})) === null || _a === void 0 ? void 0 : _a.type;
|
|
@@ -2781,7 +2836,7 @@ const IntelliTable = (props) => {
|
|
|
2781
2836
|
});
|
|
2782
2837
|
let fullValue;
|
|
2783
2838
|
let visibleValue;
|
|
2784
|
-
let
|
|
2839
|
+
let colTitle = '';
|
|
2785
2840
|
if (column.type === ParamType$1.Boolean) {
|
|
2786
2841
|
fullValue = !!(value);
|
|
2787
2842
|
const noValue = (value === undefined
|
|
@@ -2789,9 +2844,9 @@ const IntelliTable = (props) => {
|
|
|
2789
2844
|
visibleValue = (noValue
|
|
2790
2845
|
? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
|
|
2791
2846
|
: (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: fullValue ? freeSolidSvgIcons.faCheckCircle : freeSolidSvgIcons.faXmarkCircle })));
|
|
2792
|
-
|
|
2847
|
+
colTitle = (fullValue ? 'True' : 'False');
|
|
2793
2848
|
if (noValue) {
|
|
2794
|
-
|
|
2849
|
+
colTitle = 'Empty Cell';
|
|
2795
2850
|
}
|
|
2796
2851
|
}
|
|
2797
2852
|
else if (column.type === ParamType$1.Int) {
|
|
@@ -2800,9 +2855,9 @@ const IntelliTable = (props) => {
|
|
|
2800
2855
|
visibleValue = (noValue
|
|
2801
2856
|
? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
|
|
2802
2857
|
: fullValue);
|
|
2803
|
-
|
|
2858
|
+
colTitle = String(fullValue);
|
|
2804
2859
|
if (noValue) {
|
|
2805
|
-
|
|
2860
|
+
colTitle = 'Empty Cell';
|
|
2806
2861
|
}
|
|
2807
2862
|
}
|
|
2808
2863
|
else if (column.type === ParamType$1.Float) {
|
|
@@ -2811,9 +2866,9 @@ const IntelliTable = (props) => {
|
|
|
2811
2866
|
visibleValue = (noValue
|
|
2812
2867
|
? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
|
|
2813
2868
|
: roundToNumDecimals(fullValue, 2));
|
|
2814
|
-
|
|
2869
|
+
colTitle = String(fullValue);
|
|
2815
2870
|
if (noValue) {
|
|
2816
|
-
|
|
2871
|
+
colTitle = 'Empty Cell';
|
|
2817
2872
|
}
|
|
2818
2873
|
}
|
|
2819
2874
|
else if (column.type === ParamType$1.String) {
|
|
@@ -2824,9 +2879,9 @@ const IntelliTable = (props) => {
|
|
|
2824
2879
|
visibleValue = (noValue
|
|
2825
2880
|
? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
|
|
2826
2881
|
: fullValue);
|
|
2827
|
-
|
|
2882
|
+
colTitle = `"${value}"`;
|
|
2828
2883
|
if (noValue) {
|
|
2829
|
-
|
|
2884
|
+
colTitle = 'Empty Cell';
|
|
2830
2885
|
}
|
|
2831
2886
|
}
|
|
2832
2887
|
else if (column.type === ParamType$1.JSON) {
|
|
@@ -2837,10 +2892,10 @@ const IntelliTable = (props) => {
|
|
|
2837
2892
|
visibleValue = (noValue
|
|
2838
2893
|
? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
|
|
2839
2894
|
: fullValue);
|
|
2840
|
-
|
|
2895
|
+
colTitle = 'JSON Object';
|
|
2841
2896
|
}
|
|
2842
2897
|
// Create UI
|
|
2843
|
-
return (React__default["default"].createElement("td", { key: `${datum.id}-${column.param}`, title:
|
|
2898
|
+
return (React__default["default"].createElement("td", { key: `${datum.id}-${column.param}`, title: colTitle, style: {
|
|
2844
2899
|
borderRight: '0.05rem solid #555',
|
|
2845
2900
|
borderLeft: '0.05rem solid #555',
|
|
2846
2901
|
} }, visibleValue));
|
|
@@ -2902,7 +2957,7 @@ var FilterDrawer;
|
|
|
2902
2957
|
FilterDrawer["Advanced"] = "advanced";
|
|
2903
2958
|
})(FilterDrawer || (FilterDrawer = {}));
|
|
2904
2959
|
/*------------------------------------------------------------------------*/
|
|
2905
|
-
/*
|
|
2960
|
+
/* -------------------------------- Style ------------------------------- */
|
|
2906
2961
|
/*------------------------------------------------------------------------*/
|
|
2907
2962
|
const style$3 = `
|
|
2908
2963
|
.LogReviewer-outer-container {
|
|
@@ -2988,7 +3043,7 @@ const style$3 = `
|
|
|
2988
3043
|
}
|
|
2989
3044
|
`;
|
|
2990
3045
|
/*------------------------------------------------------------------------*/
|
|
2991
|
-
/*
|
|
3046
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
2992
3047
|
/*------------------------------------------------------------------------*/
|
|
2993
3048
|
const columns = [
|
|
2994
3049
|
{
|
|
@@ -3177,7 +3232,7 @@ const columns = [
|
|
|
3177
3232
|
},
|
|
3178
3233
|
];
|
|
3179
3234
|
/*------------------------------------------------------------------------*/
|
|
3180
|
-
/*
|
|
3235
|
+
/* -------------------------- Static Functions -------------------------- */
|
|
3181
3236
|
/*------------------------------------------------------------------------*/
|
|
3182
3237
|
/**
|
|
3183
3238
|
* Turn a machine-readable name into a human-readable name
|
|
@@ -3307,11 +3362,11 @@ const reducer$5 = (state, action) => {
|
|
|
3307
3362
|
}
|
|
3308
3363
|
};
|
|
3309
3364
|
/*------------------------------------------------------------------------*/
|
|
3310
|
-
/*
|
|
3365
|
+
/* ------------------------------ Component ----------------------------- */
|
|
3311
3366
|
/*------------------------------------------------------------------------*/
|
|
3312
3367
|
const LogReviewer = (props) => {
|
|
3313
3368
|
/*------------------------------------------------------------------------*/
|
|
3314
|
-
/*
|
|
3369
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
3315
3370
|
/*------------------------------------------------------------------------*/
|
|
3316
3371
|
var _a, _b, _c, _d;
|
|
3317
3372
|
/* -------------- Props ------------- */
|
|
@@ -3431,7 +3486,7 @@ const LogReviewer = (props) => {
|
|
|
3431
3486
|
// Destructure common state
|
|
3432
3487
|
const { loading, logMap, expandedFilterDrawer, dateFilterState, contextFilterState, tagFilterState, actionErrorFilterState, advancedFilterState, } = state;
|
|
3433
3488
|
/*------------------------------------------------------------------------*/
|
|
3434
|
-
/*
|
|
3489
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
3435
3490
|
/*------------------------------------------------------------------------*/
|
|
3436
3491
|
/**
|
|
3437
3492
|
* Get the list of year/month combos that need to be loaded given a new
|
|
@@ -3444,8 +3499,7 @@ const LogReviewer = (props) => {
|
|
|
3444
3499
|
// List of year/month combos that need to be loaded
|
|
3445
3500
|
const toLoad = [];
|
|
3446
3501
|
// Loop through dates
|
|
3447
|
-
let year = newDateFilterState.startDate
|
|
3448
|
-
let month = newDateFilterState.startDate.month;
|
|
3502
|
+
let { year, month } = newDateFilterState.startDate;
|
|
3449
3503
|
while (
|
|
3450
3504
|
// Earlier year
|
|
3451
3505
|
(year < newDateFilterState.endDate.year)
|
|
@@ -3518,7 +3572,7 @@ const LogReviewer = (props) => {
|
|
|
3518
3572
|
});
|
|
3519
3573
|
});
|
|
3520
3574
|
/*------------------------------------------------------------------------*/
|
|
3521
|
-
/*
|
|
3575
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
3522
3576
|
/*------------------------------------------------------------------------*/
|
|
3523
3577
|
/**
|
|
3524
3578
|
* Mount
|
|
@@ -3529,10 +3583,10 @@ const LogReviewer = (props) => {
|
|
|
3529
3583
|
handleDateRangeUpdated(dateFilterState);
|
|
3530
3584
|
}, []);
|
|
3531
3585
|
/*------------------------------------------------------------------------*/
|
|
3532
|
-
/*
|
|
3586
|
+
/* ------------------------------- Render ------------------------------- */
|
|
3533
3587
|
/*------------------------------------------------------------------------*/
|
|
3534
3588
|
/*----------------------------------------*/
|
|
3535
|
-
/*
|
|
3589
|
+
/* --------------- Main UI -------------- */
|
|
3536
3590
|
/*----------------------------------------*/
|
|
3537
3591
|
// Body that will be filled with the contents of the panel
|
|
3538
3592
|
let body;
|
|
@@ -3544,7 +3598,7 @@ const LogReviewer = (props) => {
|
|
|
3544
3598
|
/* ------------ Review UI ----------- */
|
|
3545
3599
|
if (!loading) {
|
|
3546
3600
|
/*----------------------------------------*/
|
|
3547
|
-
/*
|
|
3601
|
+
/* --------------- Filters -------------- */
|
|
3548
3602
|
/*----------------------------------------*/
|
|
3549
3603
|
// Filter toggle
|
|
3550
3604
|
const filterToggles = (React__default["default"].createElement("div", { className: "LogReviewer-filter-toggles" },
|
|
@@ -3843,7 +3897,7 @@ const LogReviewer = (props) => {
|
|
|
3843
3897
|
React__default["default"].createElement("span", { className: "input-group-text" }, "User Canvas Id"),
|
|
3844
3898
|
React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for user canvas id", value: advancedFilterState.userId, placeholder: "e.g. 104985", onChange: (e) => {
|
|
3845
3899
|
const { value } = e.target;
|
|
3846
|
-
// Only update if value contains only numbers
|
|
3900
|
+
// Only update if value contains only numbers
|
|
3847
3901
|
if (/^\d+$/.test(value)) {
|
|
3848
3902
|
advancedFilterState.userId = ((e.target.value)
|
|
3849
3903
|
.trim());
|
|
@@ -3889,7 +3943,7 @@ const LogReviewer = (props) => {
|
|
|
3889
3943
|
React__default["default"].createElement("span", { className: "input-group-text" }, "Course Canvas Id"),
|
|
3890
3944
|
React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for course canvas id", value: advancedFilterState.courseId, placeholder: "e.g. 15948", onChange: (e) => {
|
|
3891
3945
|
const { value } = e.target;
|
|
3892
|
-
// Only update if value contains only numbers
|
|
3946
|
+
// Only update if value contains only numbers
|
|
3893
3947
|
if (/^\d+$/.test(value)) {
|
|
3894
3948
|
advancedFilterState.courseId = ((e.target.value)
|
|
3895
3949
|
.trim());
|
|
@@ -4222,7 +4276,7 @@ const LogReviewer = (props) => {
|
|
|
4222
4276
|
});
|
|
4223
4277
|
});
|
|
4224
4278
|
/*----------------------------------------*/
|
|
4225
|
-
/*
|
|
4279
|
+
/* ---------------- Data ---------------- */
|
|
4226
4280
|
/*----------------------------------------*/
|
|
4227
4281
|
// Nothing to show notice
|
|
4228
4282
|
const noLogsNotice = (logs.length === 0
|
|
@@ -41805,7 +41859,7 @@ const genRouteHandler = (opts) => {
|
|
|
41805
41859
|
// Output params
|
|
41806
41860
|
const output = {};
|
|
41807
41861
|
/*----------------------------------------*/
|
|
41808
|
-
/*
|
|
41862
|
+
/* ------------ Parse Params ------------ */
|
|
41809
41863
|
/*----------------------------------------*/
|
|
41810
41864
|
// Process items one by one
|
|
41811
41865
|
const paramList = Object.entries((_a = opts.paramTypes) !== null && _a !== void 0 ? _a : {});
|
|
@@ -41964,7 +42018,7 @@ const genRouteHandler = (opts) => {
|
|
|
41964
42018
|
}
|
|
41965
42019
|
}
|
|
41966
42020
|
/*----------------------------------------*/
|
|
41967
|
-
/*
|
|
42021
|
+
/* ------------- Launch Info ------------ */
|
|
41968
42022
|
/*----------------------------------------*/
|
|
41969
42023
|
// Get launch info
|
|
41970
42024
|
const { launched, launchInfo } = cacclGetLaunchInfo(req);
|
|
@@ -42099,7 +42153,7 @@ const genRouteHandler = (opts) => {
|
|
|
42099
42153
|
* Log an event on the server
|
|
42100
42154
|
* @author Gabe Abrams
|
|
42101
42155
|
*/
|
|
42102
|
-
const logServerEvent = (
|
|
42156
|
+
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42103
42157
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
42104
42158
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42105
42159
|
// that indicates that this is actually a client event, but we don't
|
|
@@ -42130,29 +42184,29 @@ const genRouteHandler = (opts) => {
|
|
|
42130
42184
|
hour,
|
|
42131
42185
|
minute,
|
|
42132
42186
|
timestamp,
|
|
42133
|
-
context: (typeof
|
|
42134
|
-
?
|
|
42135
|
-
: ((_d = ((_c =
|
|
42136
|
-
subcontext: ((_e =
|
|
42137
|
-
tags: ((_f =
|
|
42138
|
-
level: ((_g =
|
|
42139
|
-
metadata: ((_h =
|
|
42187
|
+
context: (typeof logOpts.context === 'string'
|
|
42188
|
+
? logOpts.context
|
|
42189
|
+
: ((_d = ((_c = logOpts.context) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInMetadata.Context.Uncategorized)),
|
|
42190
|
+
subcontext: ((_e = logOpts.subcontext) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized),
|
|
42191
|
+
tags: ((_f = logOpts.tags) !== null && _f !== void 0 ? _f : []),
|
|
42192
|
+
level: ((_g = logOpts.level) !== null && _g !== void 0 ? _g : LogLevel$1.Info),
|
|
42193
|
+
metadata: ((_h = logOpts.metadata) !== null && _h !== void 0 ? _h : {}),
|
|
42140
42194
|
};
|
|
42141
42195
|
// Type-specific info
|
|
42142
42196
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
42143
42197
|
? {
|
|
42144
42198
|
type: LogType$1.Error,
|
|
42145
|
-
errorMessage: (_j =
|
|
42146
|
-
errorCode: (_k =
|
|
42147
|
-
errorStack: (_l =
|
|
42199
|
+
errorMessage: (_j = logOpts.error.message) !== null && _j !== void 0 ? _j : 'Unknown message',
|
|
42200
|
+
errorCode: (_k = logOpts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$1.NoCode,
|
|
42201
|
+
errorStack: (_l = logOpts.error.stack) !== null && _l !== void 0 ? _l : 'No stack',
|
|
42148
42202
|
}
|
|
42149
42203
|
: {
|
|
42150
42204
|
type: LogType$1.Action,
|
|
42151
|
-
target: ((_m =
|
|
42152
|
-
action: ((_o =
|
|
42205
|
+
target: ((_m = logOpts.target) !== null && _m !== void 0 ? _m : LogBuiltInMetadata.Target.NoTarget),
|
|
42206
|
+
action: ((_o = logOpts.action) !== null && _o !== void 0 ? _o : LogAction$1.Unknown),
|
|
42153
42207
|
});
|
|
42154
42208
|
// Source-specific info
|
|
42155
|
-
const sourceSpecificInfo = (
|
|
42209
|
+
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|
|
42156
42210
|
? {
|
|
42157
42211
|
source: LogSource$1.Client,
|
|
42158
42212
|
}
|
|
@@ -42169,20 +42223,21 @@ const genRouteHandler = (opts) => {
|
|
|
42169
42223
|
// Store to the log collection
|
|
42170
42224
|
yield logCollection.insert(log);
|
|
42171
42225
|
}
|
|
42172
|
-
else {
|
|
42226
|
+
else if (log.type === LogType$1.Error) {
|
|
42173
42227
|
// Print to console
|
|
42174
|
-
|
|
42175
|
-
|
|
42176
|
-
|
|
42177
|
-
|
|
42178
|
-
|
|
42179
|
-
|
|
42228
|
+
// eslint-disable-next-line no-console
|
|
42229
|
+
console.error('dce-reactkit error log:', log);
|
|
42230
|
+
}
|
|
42231
|
+
else {
|
|
42232
|
+
// eslint-disable-next-line no-console
|
|
42233
|
+
console.log('dce-reactkit action log:', log);
|
|
42180
42234
|
}
|
|
42181
42235
|
// Return log entry
|
|
42182
42236
|
return log;
|
|
42183
42237
|
}
|
|
42184
42238
|
catch (err) {
|
|
42185
42239
|
// Print because we cannot store the error
|
|
42240
|
+
// eslint-disable-next-line no-console
|
|
42186
42241
|
console.error('Could not log the following:', opts);
|
|
42187
42242
|
// Create a dummy log to return
|
|
42188
42243
|
const dummyMainInfo = {
|
|
@@ -42258,32 +42313,32 @@ const genRouteHandler = (opts) => {
|
|
|
42258
42313
|
/**
|
|
42259
42314
|
* Render an error page
|
|
42260
42315
|
* @author Gabe Abrams
|
|
42261
|
-
* @param
|
|
42262
|
-
* @param [
|
|
42263
|
-
* @param [
|
|
42316
|
+
* @param renderOpts object containing all arguments
|
|
42317
|
+
* @param [renderOpts.title=An Error Occurred] title of the error box
|
|
42318
|
+
* @param [renderOpts.description=An unknown server error occurred. Please contact support.]
|
|
42264
42319
|
* a human-readable description of the error
|
|
42265
|
-
* @param [
|
|
42266
|
-
* @param [
|
|
42320
|
+
* @param [renderOpts.code=ReactKitErrorCode.NoCode] error code to show
|
|
42321
|
+
* @param [renderOpts.pageTitle=renderOpts.title] title of the page/tab if it differs from
|
|
42267
42322
|
* the title of the error
|
|
42268
|
-
* @param [
|
|
42323
|
+
* @param [renderOpts.status=500] http status code
|
|
42269
42324
|
*/
|
|
42270
|
-
const renderErrorPage = (
|
|
42325
|
+
const renderErrorPage = (renderOpts = {}) => {
|
|
42271
42326
|
var _a, _b;
|
|
42272
|
-
const html = genErrorPage(
|
|
42273
|
-
send(html, (_a =
|
|
42327
|
+
const html = genErrorPage(renderOpts);
|
|
42328
|
+
send(html, (_a = renderOpts.status) !== null && _a !== void 0 ? _a : 500);
|
|
42274
42329
|
// Log
|
|
42275
42330
|
logServerEvent({
|
|
42276
42331
|
context: LogBuiltInMetadata.Context.ServerRenderedErrorPage,
|
|
42277
42332
|
error: {
|
|
42278
|
-
message: `${
|
|
42279
|
-
code:
|
|
42333
|
+
message: `${renderOpts.title}: ${renderOpts.description}`,
|
|
42334
|
+
code: renderOpts.code,
|
|
42280
42335
|
},
|
|
42281
42336
|
metadata: {
|
|
42282
|
-
title:
|
|
42283
|
-
description:
|
|
42284
|
-
code:
|
|
42285
|
-
pageTitle:
|
|
42286
|
-
status: (_b =
|
|
42337
|
+
title: renderOpts.title,
|
|
42338
|
+
description: renderOpts.description,
|
|
42339
|
+
code: renderOpts.code,
|
|
42340
|
+
pageTitle: renderOpts.pageTitle,
|
|
42341
|
+
status: (_b = renderOpts.status) !== null && _b !== void 0 ? _b : 500,
|
|
42287
42342
|
},
|
|
42288
42343
|
});
|
|
42289
42344
|
};
|
|
@@ -42318,6 +42373,7 @@ const genRouteHandler = (opts) => {
|
|
|
42318
42373
|
return;
|
|
42319
42374
|
}
|
|
42320
42375
|
// Log error that was not responded with
|
|
42376
|
+
// eslint-disable-next-line no-console
|
|
42321
42377
|
console.log('Error occurred but could not be sent to client because a response was already sent:', err);
|
|
42322
42378
|
}
|
|
42323
42379
|
});
|