dce-reactkit 3.5.13 → 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 +355 -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 +0 -1
- package/dist/cjs/types/helpers/makeLinksClickable.d.ts +4 -2
- package/dist/esm/index.js +355 -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 +0 -1
- package/dist/esm/types/helpers/makeLinksClickable.d.ts +4 -2
- package/dist/index.d.ts +5 -3
- 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/src/helpers/makeLinksClickable.tsx +6 -4
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
|
/*------------------------------------------------------------------------*/
|
|
@@ -955,7 +1003,7 @@ const AppWrapper = (props) => {
|
|
|
955
1003
|
/* -------------------------------- Setup ------------------------------- */
|
|
956
1004
|
/*------------------------------------------------------------------------*/
|
|
957
1005
|
/* -------------- Props ------------- */
|
|
958
|
-
const { children,
|
|
1006
|
+
const { children, } = props;
|
|
959
1007
|
/* -------------- State ------------- */
|
|
960
1008
|
// Leave to URL
|
|
961
1009
|
const [urlToLeaveTo, setURLToLeaveToInner,] = useState();
|
|
@@ -1038,7 +1086,7 @@ const AppWrapper = (props) => {
|
|
|
1038
1086
|
width: '100vw',
|
|
1039
1087
|
minHeight: '100vh',
|
|
1040
1088
|
paddingTop: '2rem',
|
|
1041
|
-
backgroundColor: (
|
|
1089
|
+
backgroundColor: (isDarkModeOn()
|
|
1042
1090
|
? '#222'
|
|
1043
1091
|
: '#fff'),
|
|
1044
1092
|
} },
|
|
@@ -1051,7 +1099,7 @@ const AppWrapper = (props) => {
|
|
|
1051
1099
|
body = children;
|
|
1052
1100
|
}
|
|
1053
1101
|
/*----------------------------------------*/
|
|
1054
|
-
/*
|
|
1102
|
+
/* --------------- Main UI -------------- */
|
|
1055
1103
|
/*----------------------------------------*/
|
|
1056
1104
|
return (React__default.createElement(React__default.Fragment, null,
|
|
1057
1105
|
React__default.createElement("style", null, style$a),
|
|
@@ -1064,7 +1112,7 @@ const AppWrapper = (props) => {
|
|
|
1064
1112
|
* @author Gabe Abrams
|
|
1065
1113
|
*/
|
|
1066
1114
|
/*------------------------------------------------------------------------*/
|
|
1067
|
-
/*
|
|
1115
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1068
1116
|
/*------------------------------------------------------------------------*/
|
|
1069
1117
|
const style$9 = `
|
|
1070
1118
|
/* Container fades in */
|
|
@@ -1136,11 +1184,11 @@ const style$9 = `
|
|
|
1136
1184
|
}
|
|
1137
1185
|
`;
|
|
1138
1186
|
/*------------------------------------------------------------------------*/
|
|
1139
|
-
/*
|
|
1187
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1140
1188
|
/*------------------------------------------------------------------------*/
|
|
1141
1189
|
const LoadingSpinner = () => {
|
|
1142
1190
|
/*------------------------------------------------------------------------*/
|
|
1143
|
-
/*
|
|
1191
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1144
1192
|
/*------------------------------------------------------------------------*/
|
|
1145
1193
|
// Add all four blips to a container
|
|
1146
1194
|
return (React__default.createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
@@ -1156,7 +1204,7 @@ const LoadingSpinner = () => {
|
|
|
1156
1204
|
* @author Gabe Abrams
|
|
1157
1205
|
*/
|
|
1158
1206
|
/*------------------------------------------------------------------------*/
|
|
1159
|
-
/*
|
|
1207
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1160
1208
|
/*------------------------------------------------------------------------*/
|
|
1161
1209
|
const style$8 = `
|
|
1162
1210
|
/* Tab Box */
|
|
@@ -1222,19 +1270,19 @@ const style$8 = `
|
|
|
1222
1270
|
}
|
|
1223
1271
|
`;
|
|
1224
1272
|
/*------------------------------------------------------------------------*/
|
|
1225
|
-
/*
|
|
1273
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1226
1274
|
/*------------------------------------------------------------------------*/
|
|
1227
1275
|
const TabBox = (props) => {
|
|
1228
1276
|
/*------------------------------------------------------------------------*/
|
|
1229
|
-
/*
|
|
1277
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1230
1278
|
/*------------------------------------------------------------------------*/
|
|
1231
1279
|
/* -------------- Props ------------- */
|
|
1232
1280
|
const { title, children, noBottomPadding, noBottomMargin, } = props;
|
|
1233
1281
|
/*------------------------------------------------------------------------*/
|
|
1234
|
-
/*
|
|
1282
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1235
1283
|
/*------------------------------------------------------------------------*/
|
|
1236
1284
|
/*----------------------------------------*/
|
|
1237
|
-
/*
|
|
1285
|
+
/* --------------- Main UI -------------- */
|
|
1238
1286
|
/*----------------------------------------*/
|
|
1239
1287
|
// Full UI
|
|
1240
1288
|
return (React__default.createElement("div", { className: `TabBox-container ${noBottomMargin ? '' : 'mb-2'}` },
|
|
@@ -1250,19 +1298,23 @@ const TabBox = (props) => {
|
|
|
1250
1298
|
* @author Gabe Abrams
|
|
1251
1299
|
*/
|
|
1252
1300
|
/*------------------------------------------------------------------------*/
|
|
1253
|
-
/*
|
|
1301
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1254
1302
|
/*------------------------------------------------------------------------*/
|
|
1255
1303
|
const RadioButton = (props) => {
|
|
1256
1304
|
/*------------------------------------------------------------------------*/
|
|
1257
|
-
/*
|
|
1305
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1258
1306
|
/*------------------------------------------------------------------------*/
|
|
1259
1307
|
/* -------------- Props ------------- */
|
|
1260
|
-
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant =
|
|
1308
|
+
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = (isDarkModeOn()
|
|
1309
|
+
? Variant$1.Light
|
|
1310
|
+
: Variant$1.Secondary), unselectedVariant = (isDarkModeOn()
|
|
1311
|
+
? Variant$1.Secondary
|
|
1312
|
+
: Variant$1.Light), small, } = props;
|
|
1261
1313
|
/*------------------------------------------------------------------------*/
|
|
1262
|
-
/*
|
|
1314
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1263
1315
|
/*------------------------------------------------------------------------*/
|
|
1264
1316
|
/*----------------------------------------*/
|
|
1265
|
-
/*
|
|
1317
|
+
/* --------------- Main UI -------------- */
|
|
1266
1318
|
/*----------------------------------------*/
|
|
1267
1319
|
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
1320
|
if (!selected) {
|
|
@@ -1278,19 +1330,23 @@ const RadioButton = (props) => {
|
|
|
1278
1330
|
* @author Gabe Abrams
|
|
1279
1331
|
*/
|
|
1280
1332
|
/*------------------------------------------------------------------------*/
|
|
1281
|
-
/*
|
|
1333
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1282
1334
|
/*------------------------------------------------------------------------*/
|
|
1283
1335
|
const CheckboxButton = (props) => {
|
|
1284
1336
|
/*------------------------------------------------------------------------*/
|
|
1285
|
-
/*
|
|
1337
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1286
1338
|
/*------------------------------------------------------------------------*/
|
|
1287
1339
|
/* -------------- Props ------------- */
|
|
1288
|
-
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant =
|
|
1340
|
+
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = (isDarkModeOn()
|
|
1341
|
+
? Variant$1.Light
|
|
1342
|
+
: Variant$1.Secondary), uncheckedVariant = (isDarkModeOn()
|
|
1343
|
+
? Variant$1.Secondary
|
|
1344
|
+
: Variant$1.Light), small, dashed, } = props;
|
|
1289
1345
|
/*------------------------------------------------------------------------*/
|
|
1290
|
-
/*
|
|
1346
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1291
1347
|
/*------------------------------------------------------------------------*/
|
|
1292
1348
|
/*----------------------------------------*/
|
|
1293
|
-
/*
|
|
1349
|
+
/* --------------- Main UI -------------- */
|
|
1294
1350
|
/*----------------------------------------*/
|
|
1295
1351
|
// Determine the icon
|
|
1296
1352
|
let icon;
|
|
@@ -1315,20 +1371,20 @@ const CheckboxButton = (props) => {
|
|
|
1315
1371
|
* @author Gabe Abrams
|
|
1316
1372
|
*/
|
|
1317
1373
|
/*------------------------------------------------------------------------*/
|
|
1318
|
-
/*
|
|
1374
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1319
1375
|
/*------------------------------------------------------------------------*/
|
|
1320
1376
|
const ButtonInputGroup = (props) => {
|
|
1321
1377
|
/*------------------------------------------------------------------------*/
|
|
1322
|
-
/*
|
|
1378
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1323
1379
|
/*------------------------------------------------------------------------*/
|
|
1324
1380
|
/* -------------- Props ------------- */
|
|
1325
1381
|
// Destructure all props
|
|
1326
1382
|
const { label, minLabelWidth, children, className, wrapButtonsAndAddGaps, } = props;
|
|
1327
1383
|
/*------------------------------------------------------------------------*/
|
|
1328
|
-
/*
|
|
1384
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1329
1385
|
/*------------------------------------------------------------------------*/
|
|
1330
1386
|
/*----------------------------------------*/
|
|
1331
|
-
/*
|
|
1387
|
+
/* --------------- Main UI -------------- */
|
|
1332
1388
|
/*----------------------------------------*/
|
|
1333
1389
|
return (React__default.createElement("div", { className: `input-group ${className !== null && className !== void 0 ? className : ''}` },
|
|
1334
1390
|
React__default.createElement("div", { className: "input-group-prepend d-flex w-100" },
|
|
@@ -1454,21 +1510,19 @@ const getTimeInfoInET = (dateOrTimestamp) => {
|
|
|
1454
1510
|
* @author Gabe Abrams
|
|
1455
1511
|
*/
|
|
1456
1512
|
/*------------------------------------------------------------------------*/
|
|
1457
|
-
/*
|
|
1513
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1458
1514
|
/*------------------------------------------------------------------------*/
|
|
1459
1515
|
const SimpleDateChooser = (props) => {
|
|
1460
1516
|
/*------------------------------------------------------------------------*/
|
|
1461
|
-
/*
|
|
1517
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1462
1518
|
/*------------------------------------------------------------------------*/
|
|
1463
|
-
var _a;
|
|
1464
1519
|
/* -------------- Props ------------- */
|
|
1465
|
-
const { ariaLabel, name,
|
|
1466
|
-
const numMonthsToShow = ((_a = props.numMonthsToShow) !== null && _a !== void 0 ? _a : 6);
|
|
1520
|
+
const { ariaLabel, name, onChange, chooseFromPast, numMonthsToShow = 6, } = props;
|
|
1467
1521
|
/*------------------------------------------------------------------------*/
|
|
1468
|
-
/*
|
|
1522
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1469
1523
|
/*------------------------------------------------------------------------*/
|
|
1470
1524
|
/*----------------------------------------*/
|
|
1471
|
-
/*
|
|
1525
|
+
/* --------------- Main UI -------------- */
|
|
1472
1526
|
/*----------------------------------------*/
|
|
1473
1527
|
// Determine the set of choices allowed
|
|
1474
1528
|
const today = getTimeInfoInET();
|
|
@@ -1523,6 +1577,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1523
1577
|
});
|
|
1524
1578
|
}
|
|
1525
1579
|
// Create choice options
|
|
1580
|
+
const { month, day, year, } = props;
|
|
1526
1581
|
const monthOptions = [];
|
|
1527
1582
|
const dayOptions = [];
|
|
1528
1583
|
choices.forEach((choice) => {
|
|
@@ -1558,7 +1613,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1558
1613
|
* @author Gabe Abrams
|
|
1559
1614
|
*/
|
|
1560
1615
|
/*------------------------------------------------------------------------*/
|
|
1561
|
-
/*
|
|
1616
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1562
1617
|
/*------------------------------------------------------------------------*/
|
|
1563
1618
|
const style$7 = `
|
|
1564
1619
|
.Drawer-container {
|
|
@@ -1576,20 +1631,20 @@ const style$7 = `
|
|
|
1576
1631
|
}
|
|
1577
1632
|
`;
|
|
1578
1633
|
/*------------------------------------------------------------------------*/
|
|
1579
|
-
/*
|
|
1634
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1580
1635
|
/*------------------------------------------------------------------------*/
|
|
1581
1636
|
const Drawer = (props) => {
|
|
1582
1637
|
/*------------------------------------------------------------------------*/
|
|
1583
|
-
/*
|
|
1638
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1584
1639
|
/*------------------------------------------------------------------------*/
|
|
1585
1640
|
/* -------------- Props ------------- */
|
|
1586
1641
|
// Destructure all props
|
|
1587
1642
|
const { customBackgroundColor, children, } = props;
|
|
1588
1643
|
/*------------------------------------------------------------------------*/
|
|
1589
|
-
/*
|
|
1644
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1590
1645
|
/*------------------------------------------------------------------------*/
|
|
1591
1646
|
/*----------------------------------------*/
|
|
1592
|
-
/*
|
|
1647
|
+
/* --------------- Main UI -------------- */
|
|
1593
1648
|
/*----------------------------------------*/
|
|
1594
1649
|
return (React__default.createElement("div", { className: "Drawer-container", style: {
|
|
1595
1650
|
backgroundColor: (customBackgroundColor !== null && customBackgroundColor !== void 0 ? customBackgroundColor : undefined),
|
|
@@ -1603,7 +1658,7 @@ const Drawer = (props) => {
|
|
|
1603
1658
|
* @author Gabe Abrams
|
|
1604
1659
|
*/
|
|
1605
1660
|
/*------------------------------------------------------------------------*/
|
|
1606
|
-
/*
|
|
1661
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1607
1662
|
/*------------------------------------------------------------------------*/
|
|
1608
1663
|
const style$6 = `
|
|
1609
1664
|
.PopSuccessMark-outer-container {
|
|
@@ -1691,20 +1746,20 @@ const style$6 = `
|
|
|
1691
1746
|
}
|
|
1692
1747
|
`;
|
|
1693
1748
|
/*------------------------------------------------------------------------*/
|
|
1694
|
-
/*
|
|
1749
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1695
1750
|
/*------------------------------------------------------------------------*/
|
|
1696
1751
|
const PopSuccessMark = (props) => {
|
|
1697
1752
|
/*------------------------------------------------------------------------*/
|
|
1698
|
-
/*
|
|
1753
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1699
1754
|
/*------------------------------------------------------------------------*/
|
|
1700
1755
|
/* -------------- Props ------------- */
|
|
1701
1756
|
// Destructure all props
|
|
1702
1757
|
const { sizeRem = 3, circleVariant = 'success', checkVariant = 'white', } = props;
|
|
1703
1758
|
/*------------------------------------------------------------------------*/
|
|
1704
|
-
/*
|
|
1759
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1705
1760
|
/*------------------------------------------------------------------------*/
|
|
1706
1761
|
/*----------------------------------------*/
|
|
1707
|
-
/*
|
|
1762
|
+
/* --------------- Main UI -------------- */
|
|
1708
1763
|
/*----------------------------------------*/
|
|
1709
1764
|
return (React__default.createElement("div", { className: `PopSuccessMark-outer-container bg-${circleVariant}`, style: {
|
|
1710
1765
|
width: `${sizeRem}rem`,
|
|
@@ -1724,7 +1779,7 @@ const PopSuccessMark = (props) => {
|
|
|
1724
1779
|
* @author Gabe Abrams
|
|
1725
1780
|
*/
|
|
1726
1781
|
/*------------------------------------------------------------------------*/
|
|
1727
|
-
/*
|
|
1782
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1728
1783
|
/*------------------------------------------------------------------------*/
|
|
1729
1784
|
const style$5 = `
|
|
1730
1785
|
.PopFailureMark-outer-container {
|
|
@@ -1811,20 +1866,20 @@ const style$5 = `
|
|
|
1811
1866
|
}
|
|
1812
1867
|
`;
|
|
1813
1868
|
/*------------------------------------------------------------------------*/
|
|
1814
|
-
/*
|
|
1869
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1815
1870
|
/*------------------------------------------------------------------------*/
|
|
1816
1871
|
const PopFailureMark = (props) => {
|
|
1817
1872
|
/*------------------------------------------------------------------------*/
|
|
1818
|
-
/*
|
|
1873
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1819
1874
|
/*------------------------------------------------------------------------*/
|
|
1820
1875
|
/* -------------- Props ------------- */
|
|
1821
1876
|
// Destructure all props
|
|
1822
1877
|
const { sizeRem = 3, circleVariant = 'danger', xVariant = 'white', } = props;
|
|
1823
1878
|
/*------------------------------------------------------------------------*/
|
|
1824
|
-
/*
|
|
1879
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1825
1880
|
/*------------------------------------------------------------------------*/
|
|
1826
1881
|
/*----------------------------------------*/
|
|
1827
|
-
/*
|
|
1882
|
+
/* --------------- Main UI -------------- */
|
|
1828
1883
|
/*----------------------------------------*/
|
|
1829
1884
|
return (React__default.createElement("div", { className: `PopFailureMark-outer-container bg-${circleVariant}`, style: {
|
|
1830
1885
|
width: `${sizeRem}rem`,
|
|
@@ -1844,7 +1899,7 @@ const PopFailureMark = (props) => {
|
|
|
1844
1899
|
* @author Gabe Abrams
|
|
1845
1900
|
*/
|
|
1846
1901
|
/*------------------------------------------------------------------------*/
|
|
1847
|
-
/*
|
|
1902
|
+
/* -------------------------------- Style ------------------------------- */
|
|
1848
1903
|
/*------------------------------------------------------------------------*/
|
|
1849
1904
|
const style$4 = `
|
|
1850
1905
|
.PopPendingMark-outer-container {
|
|
@@ -1900,20 +1955,20 @@ const style$4 = `
|
|
|
1900
1955
|
}
|
|
1901
1956
|
`;
|
|
1902
1957
|
/*------------------------------------------------------------------------*/
|
|
1903
|
-
/*
|
|
1958
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1904
1959
|
/*------------------------------------------------------------------------*/
|
|
1905
1960
|
const PopPendingMark = (props) => {
|
|
1906
1961
|
/*------------------------------------------------------------------------*/
|
|
1907
|
-
/*
|
|
1962
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1908
1963
|
/*------------------------------------------------------------------------*/
|
|
1909
1964
|
/* -------------- Props ------------- */
|
|
1910
1965
|
// Destructure all props
|
|
1911
1966
|
const { sizeRem = 3, circleVariant = 'warning', hourglassVariant = 'white', } = props;
|
|
1912
1967
|
/*------------------------------------------------------------------------*/
|
|
1913
|
-
/*
|
|
1968
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1914
1969
|
/*------------------------------------------------------------------------*/
|
|
1915
1970
|
/*----------------------------------------*/
|
|
1916
|
-
/*
|
|
1971
|
+
/* --------------- Main UI -------------- */
|
|
1917
1972
|
/*----------------------------------------*/
|
|
1918
1973
|
return (React__default.createElement("div", { className: `PopPendingMark-outer-container bg-${circleVariant}`, style: {
|
|
1919
1974
|
width: `${sizeRem}rem`,
|
|
@@ -1963,11 +2018,11 @@ const reducer$8 = (state, action) => {
|
|
|
1963
2018
|
}
|
|
1964
2019
|
};
|
|
1965
2020
|
/*------------------------------------------------------------------------*/
|
|
1966
|
-
/*
|
|
2021
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1967
2022
|
/*------------------------------------------------------------------------*/
|
|
1968
2023
|
const CopiableBox = (props) => {
|
|
1969
2024
|
/*------------------------------------------------------------------------*/
|
|
1970
|
-
/*
|
|
2025
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1971
2026
|
/*------------------------------------------------------------------------*/
|
|
1972
2027
|
/* -------------- Props ------------- */
|
|
1973
2028
|
// Destructure all props
|
|
@@ -1982,7 +2037,7 @@ const CopiableBox = (props) => {
|
|
|
1982
2037
|
// Destructure common state
|
|
1983
2038
|
const { recentlyCopied, } = state;
|
|
1984
2039
|
/*------------------------------------------------------------------------*/
|
|
1985
|
-
/*
|
|
2040
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
1986
2041
|
/*------------------------------------------------------------------------*/
|
|
1987
2042
|
/**
|
|
1988
2043
|
* Perform a copy
|
|
@@ -2008,10 +2063,10 @@ const CopiableBox = (props) => {
|
|
|
2008
2063
|
});
|
|
2009
2064
|
});
|
|
2010
2065
|
/*------------------------------------------------------------------------*/
|
|
2011
|
-
/*
|
|
2066
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2012
2067
|
/*------------------------------------------------------------------------*/
|
|
2013
2068
|
/*----------------------------------------*/
|
|
2014
|
-
/*
|
|
2069
|
+
/* --------------- Main UI -------------- */
|
|
2015
2070
|
/*----------------------------------------*/
|
|
2016
2071
|
return (React__default.createElement("div", { className: "input-group mb-2" },
|
|
2017
2072
|
(label || labelIcon) && (React__default.createElement("span", { className: "input-group-text", style: {
|
|
@@ -2082,11 +2137,11 @@ const reducer$7 = (state, action) => {
|
|
|
2082
2137
|
}
|
|
2083
2138
|
};
|
|
2084
2139
|
/*------------------------------------------------------------------------*/
|
|
2085
|
-
/*
|
|
2140
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2086
2141
|
/*------------------------------------------------------------------------*/
|
|
2087
2142
|
const NestableItemList = (props) => {
|
|
2088
2143
|
/*------------------------------------------------------------------------*/
|
|
2089
|
-
/*
|
|
2144
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2090
2145
|
/*------------------------------------------------------------------------*/
|
|
2091
2146
|
/* -------------- Props ------------- */
|
|
2092
2147
|
// Destructure all props
|
|
@@ -2106,7 +2161,7 @@ const NestableItemList = (props) => {
|
|
|
2106
2161
|
// Destructure common state
|
|
2107
2162
|
const { childExpanded, } = state;
|
|
2108
2163
|
/*------------------------------------------------------------------------*/
|
|
2109
|
-
/*
|
|
2164
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
2110
2165
|
/*------------------------------------------------------------------------*/
|
|
2111
2166
|
/**
|
|
2112
2167
|
* Checks if all items in a list are checked
|
|
@@ -2181,7 +2236,7 @@ const NestableItemList = (props) => {
|
|
|
2181
2236
|
});
|
|
2182
2237
|
};
|
|
2183
2238
|
/*------------------------------------------------------------------------*/
|
|
2184
|
-
/*
|
|
2239
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2185
2240
|
/*------------------------------------------------------------------------*/
|
|
2186
2241
|
return (React__default.createElement("div", null, items.map((item) => {
|
|
2187
2242
|
return (React__default.createElement("div", { key: item.id },
|
|
@@ -2214,23 +2269,23 @@ const NestableItemList = (props) => {
|
|
|
2214
2269
|
* @author Yuen Ler Chow
|
|
2215
2270
|
*/
|
|
2216
2271
|
/*------------------------------------------------------------------------*/
|
|
2217
|
-
/*
|
|
2272
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2218
2273
|
/*------------------------------------------------------------------------*/
|
|
2219
2274
|
const ItemPicker = (props) => {
|
|
2220
2275
|
/*------------------------------------------------------------------------*/
|
|
2221
|
-
/*
|
|
2276
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2222
2277
|
/*------------------------------------------------------------------------*/
|
|
2223
2278
|
/* -------------- Props ------------- */
|
|
2224
2279
|
// Destructure all props
|
|
2225
2280
|
const { title, items, onChanged, noBottomMargin, } = props;
|
|
2226
2281
|
/*------------------------------------------------------------------------*/
|
|
2227
|
-
/*
|
|
2282
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
2228
2283
|
/*------------------------------------------------------------------------*/
|
|
2229
2284
|
/*------------------------------------------------------------------------*/
|
|
2230
|
-
/*
|
|
2285
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2231
2286
|
/*------------------------------------------------------------------------*/
|
|
2232
2287
|
/*----------------------------------------*/
|
|
2233
|
-
/*
|
|
2288
|
+
/* --------------- Main UI -------------- */
|
|
2234
2289
|
/*----------------------------------------*/
|
|
2235
2290
|
return (React__default.createElement(TabBox, { title: title, noBottomMargin: noBottomMargin },
|
|
2236
2291
|
React__default.createElement("div", { style: { overflowX: 'auto' } },
|
|
@@ -2428,20 +2483,20 @@ const genCSV = (data, columns) => {
|
|
|
2428
2483
|
* @author Gabe Abrams
|
|
2429
2484
|
*/
|
|
2430
2485
|
/*------------------------------------------------------------------------*/
|
|
2431
|
-
/*
|
|
2486
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2432
2487
|
/*------------------------------------------------------------------------*/
|
|
2433
2488
|
const CSVDownloadButton = (props) => {
|
|
2434
2489
|
/*------------------------------------------------------------------------*/
|
|
2435
|
-
/*
|
|
2490
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2436
2491
|
/*------------------------------------------------------------------------*/
|
|
2437
2492
|
/* -------------- Props ------------- */
|
|
2438
2493
|
// Destructure all props
|
|
2439
2494
|
const { filename, csv, id, className, ariaLabel, style, onClick, children, } = props;
|
|
2440
2495
|
/*------------------------------------------------------------------------*/
|
|
2441
|
-
/*
|
|
2496
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2442
2497
|
/*------------------------------------------------------------------------*/
|
|
2443
2498
|
/*----------------------------------------*/
|
|
2444
|
-
/*
|
|
2499
|
+
/* --------------- Main UI -------------- */
|
|
2445
2500
|
/*----------------------------------------*/
|
|
2446
2501
|
// Render the button
|
|
2447
2502
|
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 +2584,26 @@ const reducer$6 = (state, action) => {
|
|
|
2529
2584
|
}
|
|
2530
2585
|
};
|
|
2531
2586
|
/*------------------------------------------------------------------------*/
|
|
2532
|
-
/*
|
|
2587
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2533
2588
|
/*------------------------------------------------------------------------*/
|
|
2534
2589
|
const IntelliTable = (props) => {
|
|
2535
2590
|
/*------------------------------------------------------------------------*/
|
|
2536
|
-
/*
|
|
2591
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2537
2592
|
/*------------------------------------------------------------------------*/
|
|
2538
2593
|
var _a;
|
|
2539
2594
|
/* -------------- Props ------------- */
|
|
2540
2595
|
// Destructure all props
|
|
2541
|
-
const { title, id, columns, } = props;
|
|
2596
|
+
const { title, id, columns, csvName, data = [], } = props;
|
|
2542
2597
|
// Get data, show empty row if none
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2598
|
+
if (data.length === 0) {
|
|
2599
|
+
data.push({ id: 'empty-row' });
|
|
2600
|
+
}
|
|
2546
2601
|
// Get CSV filename
|
|
2547
2602
|
let filename = `${title}.csv`;
|
|
2548
|
-
if (
|
|
2549
|
-
filename = (
|
|
2550
|
-
?
|
|
2551
|
-
: `${
|
|
2603
|
+
if (csvName) {
|
|
2604
|
+
filename = (csvName.endsWith('.csv')
|
|
2605
|
+
? csvName
|
|
2606
|
+
: `${csvName}.csv`);
|
|
2552
2607
|
}
|
|
2553
2608
|
/* -------------- State ------------- */
|
|
2554
2609
|
// Initial state
|
|
@@ -2567,10 +2622,10 @@ const IntelliTable = (props) => {
|
|
|
2567
2622
|
// Destructure common state
|
|
2568
2623
|
const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
|
|
2569
2624
|
/*------------------------------------------------------------------------*/
|
|
2570
|
-
/*
|
|
2625
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2571
2626
|
/*------------------------------------------------------------------------*/
|
|
2572
2627
|
/*----------------------------------------*/
|
|
2573
|
-
/*
|
|
2628
|
+
/* ---------------- Modal --------------- */
|
|
2574
2629
|
/*----------------------------------------*/
|
|
2575
2630
|
// Modal that may be defined
|
|
2576
2631
|
let modal;
|
|
@@ -2611,7 +2666,7 @@ const IntelliTable = (props) => {
|
|
|
2611
2666
|
} }, "Deselect All")));
|
|
2612
2667
|
}
|
|
2613
2668
|
/*----------------------------------------*/
|
|
2614
|
-
/*
|
|
2669
|
+
/* --------------- Main UI -------------- */
|
|
2615
2670
|
/*----------------------------------------*/
|
|
2616
2671
|
// Table header
|
|
2617
2672
|
const headerCells = (columns
|
|
@@ -2666,7 +2721,7 @@ const IntelliTable = (props) => {
|
|
|
2666
2721
|
const tableHeader = (React__default.createElement("thead", null,
|
|
2667
2722
|
React__default.createElement("tr", null, headerCells)));
|
|
2668
2723
|
// Sort data
|
|
2669
|
-
|
|
2724
|
+
const sortedData = [...data];
|
|
2670
2725
|
const paramType = (_a = columns.find((column) => {
|
|
2671
2726
|
return (column.param === sortColumnParam);
|
|
2672
2727
|
})) === null || _a === void 0 ? void 0 : _a.type;
|
|
@@ -2755,7 +2810,7 @@ const IntelliTable = (props) => {
|
|
|
2755
2810
|
});
|
|
2756
2811
|
let fullValue;
|
|
2757
2812
|
let visibleValue;
|
|
2758
|
-
let
|
|
2813
|
+
let colTitle = '';
|
|
2759
2814
|
if (column.type === ParamType$1.Boolean) {
|
|
2760
2815
|
fullValue = !!(value);
|
|
2761
2816
|
const noValue = (value === undefined
|
|
@@ -2763,9 +2818,9 @@ const IntelliTable = (props) => {
|
|
|
2763
2818
|
visibleValue = (noValue
|
|
2764
2819
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2765
2820
|
: (React__default.createElement(FontAwesomeIcon, { icon: fullValue ? faCheckCircle : faXmarkCircle })));
|
|
2766
|
-
|
|
2821
|
+
colTitle = (fullValue ? 'True' : 'False');
|
|
2767
2822
|
if (noValue) {
|
|
2768
|
-
|
|
2823
|
+
colTitle = 'Empty Cell';
|
|
2769
2824
|
}
|
|
2770
2825
|
}
|
|
2771
2826
|
else if (column.type === ParamType$1.Int) {
|
|
@@ -2774,9 +2829,9 @@ const IntelliTable = (props) => {
|
|
|
2774
2829
|
visibleValue = (noValue
|
|
2775
2830
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2776
2831
|
: fullValue);
|
|
2777
|
-
|
|
2832
|
+
colTitle = String(fullValue);
|
|
2778
2833
|
if (noValue) {
|
|
2779
|
-
|
|
2834
|
+
colTitle = 'Empty Cell';
|
|
2780
2835
|
}
|
|
2781
2836
|
}
|
|
2782
2837
|
else if (column.type === ParamType$1.Float) {
|
|
@@ -2785,9 +2840,9 @@ const IntelliTable = (props) => {
|
|
|
2785
2840
|
visibleValue = (noValue
|
|
2786
2841
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2787
2842
|
: roundToNumDecimals(fullValue, 2));
|
|
2788
|
-
|
|
2843
|
+
colTitle = String(fullValue);
|
|
2789
2844
|
if (noValue) {
|
|
2790
|
-
|
|
2845
|
+
colTitle = 'Empty Cell';
|
|
2791
2846
|
}
|
|
2792
2847
|
}
|
|
2793
2848
|
else if (column.type === ParamType$1.String) {
|
|
@@ -2798,9 +2853,9 @@ const IntelliTable = (props) => {
|
|
|
2798
2853
|
visibleValue = (noValue
|
|
2799
2854
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2800
2855
|
: fullValue);
|
|
2801
|
-
|
|
2856
|
+
colTitle = `"${value}"`;
|
|
2802
2857
|
if (noValue) {
|
|
2803
|
-
|
|
2858
|
+
colTitle = 'Empty Cell';
|
|
2804
2859
|
}
|
|
2805
2860
|
}
|
|
2806
2861
|
else if (column.type === ParamType$1.JSON) {
|
|
@@ -2811,10 +2866,10 @@ const IntelliTable = (props) => {
|
|
|
2811
2866
|
visibleValue = (noValue
|
|
2812
2867
|
? (React__default.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2813
2868
|
: fullValue);
|
|
2814
|
-
|
|
2869
|
+
colTitle = 'JSON Object';
|
|
2815
2870
|
}
|
|
2816
2871
|
// Create UI
|
|
2817
|
-
return (React__default.createElement("td", { key: `${datum.id}-${column.param}`, title:
|
|
2872
|
+
return (React__default.createElement("td", { key: `${datum.id}-${column.param}`, title: colTitle, style: {
|
|
2818
2873
|
borderRight: '0.05rem solid #555',
|
|
2819
2874
|
borderLeft: '0.05rem solid #555',
|
|
2820
2875
|
} }, visibleValue));
|
|
@@ -2876,7 +2931,7 @@ var FilterDrawer;
|
|
|
2876
2931
|
FilterDrawer["Advanced"] = "advanced";
|
|
2877
2932
|
})(FilterDrawer || (FilterDrawer = {}));
|
|
2878
2933
|
/*------------------------------------------------------------------------*/
|
|
2879
|
-
/*
|
|
2934
|
+
/* -------------------------------- Style ------------------------------- */
|
|
2880
2935
|
/*------------------------------------------------------------------------*/
|
|
2881
2936
|
const style$3 = `
|
|
2882
2937
|
.LogReviewer-outer-container {
|
|
@@ -2962,7 +3017,7 @@ const style$3 = `
|
|
|
2962
3017
|
}
|
|
2963
3018
|
`;
|
|
2964
3019
|
/*------------------------------------------------------------------------*/
|
|
2965
|
-
/*
|
|
3020
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
2966
3021
|
/*------------------------------------------------------------------------*/
|
|
2967
3022
|
const columns = [
|
|
2968
3023
|
{
|
|
@@ -3151,7 +3206,7 @@ const columns = [
|
|
|
3151
3206
|
},
|
|
3152
3207
|
];
|
|
3153
3208
|
/*------------------------------------------------------------------------*/
|
|
3154
|
-
/*
|
|
3209
|
+
/* -------------------------- Static Functions -------------------------- */
|
|
3155
3210
|
/*------------------------------------------------------------------------*/
|
|
3156
3211
|
/**
|
|
3157
3212
|
* Turn a machine-readable name into a human-readable name
|
|
@@ -3281,11 +3336,11 @@ const reducer$5 = (state, action) => {
|
|
|
3281
3336
|
}
|
|
3282
3337
|
};
|
|
3283
3338
|
/*------------------------------------------------------------------------*/
|
|
3284
|
-
/*
|
|
3339
|
+
/* ------------------------------ Component ----------------------------- */
|
|
3285
3340
|
/*------------------------------------------------------------------------*/
|
|
3286
3341
|
const LogReviewer = (props) => {
|
|
3287
3342
|
/*------------------------------------------------------------------------*/
|
|
3288
|
-
/*
|
|
3343
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
3289
3344
|
/*------------------------------------------------------------------------*/
|
|
3290
3345
|
var _a, _b, _c, _d;
|
|
3291
3346
|
/* -------------- Props ------------- */
|
|
@@ -3405,7 +3460,7 @@ const LogReviewer = (props) => {
|
|
|
3405
3460
|
// Destructure common state
|
|
3406
3461
|
const { loading, logMap, expandedFilterDrawer, dateFilterState, contextFilterState, tagFilterState, actionErrorFilterState, advancedFilterState, } = state;
|
|
3407
3462
|
/*------------------------------------------------------------------------*/
|
|
3408
|
-
/*
|
|
3463
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
3409
3464
|
/*------------------------------------------------------------------------*/
|
|
3410
3465
|
/**
|
|
3411
3466
|
* Get the list of year/month combos that need to be loaded given a new
|
|
@@ -3418,8 +3473,7 @@ const LogReviewer = (props) => {
|
|
|
3418
3473
|
// List of year/month combos that need to be loaded
|
|
3419
3474
|
const toLoad = [];
|
|
3420
3475
|
// Loop through dates
|
|
3421
|
-
let year = newDateFilterState.startDate
|
|
3422
|
-
let month = newDateFilterState.startDate.month;
|
|
3476
|
+
let { year, month } = newDateFilterState.startDate;
|
|
3423
3477
|
while (
|
|
3424
3478
|
// Earlier year
|
|
3425
3479
|
(year < newDateFilterState.endDate.year)
|
|
@@ -3492,7 +3546,7 @@ const LogReviewer = (props) => {
|
|
|
3492
3546
|
});
|
|
3493
3547
|
});
|
|
3494
3548
|
/*------------------------------------------------------------------------*/
|
|
3495
|
-
/*
|
|
3549
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
3496
3550
|
/*------------------------------------------------------------------------*/
|
|
3497
3551
|
/**
|
|
3498
3552
|
* Mount
|
|
@@ -3503,10 +3557,10 @@ const LogReviewer = (props) => {
|
|
|
3503
3557
|
handleDateRangeUpdated(dateFilterState);
|
|
3504
3558
|
}, []);
|
|
3505
3559
|
/*------------------------------------------------------------------------*/
|
|
3506
|
-
/*
|
|
3560
|
+
/* ------------------------------- Render ------------------------------- */
|
|
3507
3561
|
/*------------------------------------------------------------------------*/
|
|
3508
3562
|
/*----------------------------------------*/
|
|
3509
|
-
/*
|
|
3563
|
+
/* --------------- Main UI -------------- */
|
|
3510
3564
|
/*----------------------------------------*/
|
|
3511
3565
|
// Body that will be filled with the contents of the panel
|
|
3512
3566
|
let body;
|
|
@@ -3518,7 +3572,7 @@ const LogReviewer = (props) => {
|
|
|
3518
3572
|
/* ------------ Review UI ----------- */
|
|
3519
3573
|
if (!loading) {
|
|
3520
3574
|
/*----------------------------------------*/
|
|
3521
|
-
/*
|
|
3575
|
+
/* --------------- Filters -------------- */
|
|
3522
3576
|
/*----------------------------------------*/
|
|
3523
3577
|
// Filter toggle
|
|
3524
3578
|
const filterToggles = (React__default.createElement("div", { className: "LogReviewer-filter-toggles" },
|
|
@@ -3817,7 +3871,7 @@ const LogReviewer = (props) => {
|
|
|
3817
3871
|
React__default.createElement("span", { className: "input-group-text" }, "User Canvas Id"),
|
|
3818
3872
|
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
3873
|
const { value } = e.target;
|
|
3820
|
-
// Only update if value contains only numbers
|
|
3874
|
+
// Only update if value contains only numbers
|
|
3821
3875
|
if (/^\d+$/.test(value)) {
|
|
3822
3876
|
advancedFilterState.userId = ((e.target.value)
|
|
3823
3877
|
.trim());
|
|
@@ -3863,7 +3917,7 @@ const LogReviewer = (props) => {
|
|
|
3863
3917
|
React__default.createElement("span", { className: "input-group-text" }, "Course Canvas Id"),
|
|
3864
3918
|
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
3919
|
const { value } = e.target;
|
|
3866
|
-
// Only update if value contains only numbers
|
|
3920
|
+
// Only update if value contains only numbers
|
|
3867
3921
|
if (/^\d+$/.test(value)) {
|
|
3868
3922
|
advancedFilterState.courseId = ((e.target.value)
|
|
3869
3923
|
.trim());
|
|
@@ -4196,7 +4250,7 @@ const LogReviewer = (props) => {
|
|
|
4196
4250
|
});
|
|
4197
4251
|
});
|
|
4198
4252
|
/*----------------------------------------*/
|
|
4199
|
-
/*
|
|
4253
|
+
/* ---------------- Data ---------------- */
|
|
4200
4254
|
/*----------------------------------------*/
|
|
4201
4255
|
// Nothing to show notice
|
|
4202
4256
|
const noLogsNotice = (logs.length === 0
|
|
@@ -41779,7 +41833,7 @@ const genRouteHandler = (opts) => {
|
|
|
41779
41833
|
// Output params
|
|
41780
41834
|
const output = {};
|
|
41781
41835
|
/*----------------------------------------*/
|
|
41782
|
-
/*
|
|
41836
|
+
/* ------------ Parse Params ------------ */
|
|
41783
41837
|
/*----------------------------------------*/
|
|
41784
41838
|
// Process items one by one
|
|
41785
41839
|
const paramList = Object.entries((_a = opts.paramTypes) !== null && _a !== void 0 ? _a : {});
|
|
@@ -41938,7 +41992,7 @@ const genRouteHandler = (opts) => {
|
|
|
41938
41992
|
}
|
|
41939
41993
|
}
|
|
41940
41994
|
/*----------------------------------------*/
|
|
41941
|
-
/*
|
|
41995
|
+
/* ------------- Launch Info ------------ */
|
|
41942
41996
|
/*----------------------------------------*/
|
|
41943
41997
|
// Get launch info
|
|
41944
41998
|
const { launched, launchInfo } = cacclGetLaunchInfo(req);
|
|
@@ -42073,7 +42127,7 @@ const genRouteHandler = (opts) => {
|
|
|
42073
42127
|
* Log an event on the server
|
|
42074
42128
|
* @author Gabe Abrams
|
|
42075
42129
|
*/
|
|
42076
|
-
const logServerEvent = (
|
|
42130
|
+
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42077
42131
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
42078
42132
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42079
42133
|
// that indicates that this is actually a client event, but we don't
|
|
@@ -42104,29 +42158,29 @@ const genRouteHandler = (opts) => {
|
|
|
42104
42158
|
hour,
|
|
42105
42159
|
minute,
|
|
42106
42160
|
timestamp,
|
|
42107
|
-
context: (typeof
|
|
42108
|
-
?
|
|
42109
|
-
: ((_d = ((_c =
|
|
42110
|
-
subcontext: ((_e =
|
|
42111
|
-
tags: ((_f =
|
|
42112
|
-
level: ((_g =
|
|
42113
|
-
metadata: ((_h =
|
|
42161
|
+
context: (typeof logOpts.context === 'string'
|
|
42162
|
+
? logOpts.context
|
|
42163
|
+
: ((_d = ((_c = logOpts.context) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInMetadata.Context.Uncategorized)),
|
|
42164
|
+
subcontext: ((_e = logOpts.subcontext) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized),
|
|
42165
|
+
tags: ((_f = logOpts.tags) !== null && _f !== void 0 ? _f : []),
|
|
42166
|
+
level: ((_g = logOpts.level) !== null && _g !== void 0 ? _g : LogLevel$1.Info),
|
|
42167
|
+
metadata: ((_h = logOpts.metadata) !== null && _h !== void 0 ? _h : {}),
|
|
42114
42168
|
};
|
|
42115
42169
|
// Type-specific info
|
|
42116
42170
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
42117
42171
|
? {
|
|
42118
42172
|
type: LogType$1.Error,
|
|
42119
|
-
errorMessage: (_j =
|
|
42120
|
-
errorCode: (_k =
|
|
42121
|
-
errorStack: (_l =
|
|
42173
|
+
errorMessage: (_j = logOpts.error.message) !== null && _j !== void 0 ? _j : 'Unknown message',
|
|
42174
|
+
errorCode: (_k = logOpts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$1.NoCode,
|
|
42175
|
+
errorStack: (_l = logOpts.error.stack) !== null && _l !== void 0 ? _l : 'No stack',
|
|
42122
42176
|
}
|
|
42123
42177
|
: {
|
|
42124
42178
|
type: LogType$1.Action,
|
|
42125
|
-
target: ((_m =
|
|
42126
|
-
action: ((_o =
|
|
42179
|
+
target: ((_m = logOpts.target) !== null && _m !== void 0 ? _m : LogBuiltInMetadata.Target.NoTarget),
|
|
42180
|
+
action: ((_o = logOpts.action) !== null && _o !== void 0 ? _o : LogAction$1.Unknown),
|
|
42127
42181
|
});
|
|
42128
42182
|
// Source-specific info
|
|
42129
|
-
const sourceSpecificInfo = (
|
|
42183
|
+
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|
|
42130
42184
|
? {
|
|
42131
42185
|
source: LogSource$1.Client,
|
|
42132
42186
|
}
|
|
@@ -42143,20 +42197,21 @@ const genRouteHandler = (opts) => {
|
|
|
42143
42197
|
// Store to the log collection
|
|
42144
42198
|
yield logCollection.insert(log);
|
|
42145
42199
|
}
|
|
42146
|
-
else {
|
|
42200
|
+
else if (log.type === LogType$1.Error) {
|
|
42147
42201
|
// Print to console
|
|
42148
|
-
|
|
42149
|
-
|
|
42150
|
-
|
|
42151
|
-
|
|
42152
|
-
|
|
42153
|
-
|
|
42202
|
+
// eslint-disable-next-line no-console
|
|
42203
|
+
console.error('dce-reactkit error log:', log);
|
|
42204
|
+
}
|
|
42205
|
+
else {
|
|
42206
|
+
// eslint-disable-next-line no-console
|
|
42207
|
+
console.log('dce-reactkit action log:', log);
|
|
42154
42208
|
}
|
|
42155
42209
|
// Return log entry
|
|
42156
42210
|
return log;
|
|
42157
42211
|
}
|
|
42158
42212
|
catch (err) {
|
|
42159
42213
|
// Print because we cannot store the error
|
|
42214
|
+
// eslint-disable-next-line no-console
|
|
42160
42215
|
console.error('Could not log the following:', opts);
|
|
42161
42216
|
// Create a dummy log to return
|
|
42162
42217
|
const dummyMainInfo = {
|
|
@@ -42232,32 +42287,32 @@ const genRouteHandler = (opts) => {
|
|
|
42232
42287
|
/**
|
|
42233
42288
|
* Render an error page
|
|
42234
42289
|
* @author Gabe Abrams
|
|
42235
|
-
* @param
|
|
42236
|
-
* @param [
|
|
42237
|
-
* @param [
|
|
42290
|
+
* @param renderOpts object containing all arguments
|
|
42291
|
+
* @param [renderOpts.title=An Error Occurred] title of the error box
|
|
42292
|
+
* @param [renderOpts.description=An unknown server error occurred. Please contact support.]
|
|
42238
42293
|
* a human-readable description of the error
|
|
42239
|
-
* @param [
|
|
42240
|
-
* @param [
|
|
42294
|
+
* @param [renderOpts.code=ReactKitErrorCode.NoCode] error code to show
|
|
42295
|
+
* @param [renderOpts.pageTitle=renderOpts.title] title of the page/tab if it differs from
|
|
42241
42296
|
* the title of the error
|
|
42242
|
-
* @param [
|
|
42297
|
+
* @param [renderOpts.status=500] http status code
|
|
42243
42298
|
*/
|
|
42244
|
-
const renderErrorPage = (
|
|
42299
|
+
const renderErrorPage = (renderOpts = {}) => {
|
|
42245
42300
|
var _a, _b;
|
|
42246
|
-
const html = genErrorPage(
|
|
42247
|
-
send(html, (_a =
|
|
42301
|
+
const html = genErrorPage(renderOpts);
|
|
42302
|
+
send(html, (_a = renderOpts.status) !== null && _a !== void 0 ? _a : 500);
|
|
42248
42303
|
// Log
|
|
42249
42304
|
logServerEvent({
|
|
42250
42305
|
context: LogBuiltInMetadata.Context.ServerRenderedErrorPage,
|
|
42251
42306
|
error: {
|
|
42252
|
-
message: `${
|
|
42253
|
-
code:
|
|
42307
|
+
message: `${renderOpts.title}: ${renderOpts.description}`,
|
|
42308
|
+
code: renderOpts.code,
|
|
42254
42309
|
},
|
|
42255
42310
|
metadata: {
|
|
42256
|
-
title:
|
|
42257
|
-
description:
|
|
42258
|
-
code:
|
|
42259
|
-
pageTitle:
|
|
42260
|
-
status: (_b =
|
|
42311
|
+
title: renderOpts.title,
|
|
42312
|
+
description: renderOpts.description,
|
|
42313
|
+
code: renderOpts.code,
|
|
42314
|
+
pageTitle: renderOpts.pageTitle,
|
|
42315
|
+
status: (_b = renderOpts.status) !== null && _b !== void 0 ? _b : 500,
|
|
42261
42316
|
},
|
|
42262
42317
|
});
|
|
42263
42318
|
};
|
|
@@ -42292,6 +42347,7 @@ const genRouteHandler = (opts) => {
|
|
|
42292
42347
|
return;
|
|
42293
42348
|
}
|
|
42294
42349
|
// Log error that was not responded with
|
|
42350
|
+
// eslint-disable-next-line no-console
|
|
42295
42351
|
console.log('Error occurred but could not be sent to client because a response was already sent:', err);
|
|
42296
42352
|
}
|
|
42297
42353
|
});
|
|
@@ -42916,8 +42972,9 @@ const urlRegex = /(https?:\/\/)?([a-z0-9-]+\.)+[a-z0-9]{2,6}(:[0-9]{1,5})?(\/\S*
|
|
|
42916
42972
|
* @param text the text to process
|
|
42917
42973
|
* @param [opts] options to customize behavior
|
|
42918
42974
|
* @param [opts.newTab] if true, links will open in a new tab
|
|
42919
|
-
* @param [opts.preventPropagation] if true, clicks to link will prevent
|
|
42920
|
-
*
|
|
42975
|
+
* @param [opts.preventPropagation] if true, clicks to link will prevent
|
|
42976
|
+
* propagation
|
|
42977
|
+
* @param [opts.inheritColor] if true, inherit text color for links
|
|
42921
42978
|
* @returns the processed text
|
|
42922
42979
|
*/
|
|
42923
42980
|
const makeLinksClickable = (text, opts) => {
|
|
@@ -42944,10 +43001,10 @@ const makeLinksClickable = (text, opts) => {
|
|
|
42944
43001
|
// Add the link
|
|
42945
43002
|
elements.push(React__default.createElement("a", { key: nextKey += 1, href: link, target: newTab ? '_blank' : undefined, rel: newTab ? 'noopener noreferrer' : undefined, style: {
|
|
42946
43003
|
textDecoration: 'underline',
|
|
43004
|
+
color: (opts === null || opts === void 0 ? void 0 : opts.inheritColor) ? 'inherit' : undefined,
|
|
42947
43005
|
}, onClick: (e) => {
|
|
42948
|
-
// Prevent
|
|
43006
|
+
// Prevent propagation if requested
|
|
42949
43007
|
if (opts === null || opts === void 0 ? void 0 : opts.preventPropagation) {
|
|
42950
|
-
e.preventDefault();
|
|
42951
43008
|
e.stopPropagation();
|
|
42952
43009
|
}
|
|
42953
43010
|
} }, link));
|