dce-reactkit 3.4.0-beta.2 → 3.4.0-beta.4
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 +608 -1570
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +1 -0
- package/dist/esm/index.js +595 -1557
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/DBEntryManagerPanel/AddOrEditDBEntry/index.tsx +9 -10
- package/src/components/DBEntryManagerPanel/helpers/generateEndpointPath.ts +1 -1
- package/src/components/DBEntryManagerPanel/index.tsx +2 -2
- package/src/helpers/addDBEditorEndpoints.ts +5 -2
package/dist/esm/index.js
CHANGED
|
@@ -19,7 +19,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
19
19
|
PERFORMANCE OF THIS SOFTWARE.
|
|
20
20
|
***************************************************************************** */
|
|
21
21
|
|
|
22
|
-
function __awaiter
|
|
22
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
23
23
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
24
24
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
25
25
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -34,7 +34,7 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
|
|
|
34
34
|
* List of error codes built into the react kit
|
|
35
35
|
* @author Gabe Abrams
|
|
36
36
|
*/
|
|
37
|
-
var ReactKitErrorCode
|
|
37
|
+
var ReactKitErrorCode;
|
|
38
38
|
(function (ReactKitErrorCode) {
|
|
39
39
|
ReactKitErrorCode["NoResponse"] = "DRK1";
|
|
40
40
|
ReactKitErrorCode["NoCode"] = "DRK2";
|
|
@@ -49,8 +49,8 @@ var ReactKitErrorCode$2;
|
|
|
49
49
|
ReactKitErrorCode["NotAllowedToReviewLogs"] = "DRK11";
|
|
50
50
|
ReactKitErrorCode["ThemeCheckedBeforeReactKitReady"] = "DRK12";
|
|
51
51
|
ReactKitErrorCode["SessionExpiredMessageGottenBeforeReactKitReady"] = "DRK13";
|
|
52
|
-
})(ReactKitErrorCode
|
|
53
|
-
var ReactKitErrorCode$
|
|
52
|
+
})(ReactKitErrorCode || (ReactKitErrorCode = {}));
|
|
53
|
+
var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Displays an error
|
|
@@ -90,7 +90,7 @@ const ErrorBox = (props) => {
|
|
|
90
90
|
} },
|
|
91
91
|
"code:",
|
|
92
92
|
' ',
|
|
93
|
-
String((_a = error.code) !== null && _a !== void 0 ? _a : ReactKitErrorCode$
|
|
93
|
+
String((_a = error.code) !== null && _a !== void 0 ? _a : ReactKitErrorCode$1.NoCode).toUpperCase())));
|
|
94
94
|
}
|
|
95
95
|
// Main UI
|
|
96
96
|
return (React__default.createElement("div", { className: "alert alert-danger text-center", style: {
|
|
@@ -111,7 +111,7 @@ const ErrorBox = (props) => {
|
|
|
111
111
|
* Types of buttons in the modal
|
|
112
112
|
* @author Gabe Abrams
|
|
113
113
|
*/
|
|
114
|
-
var ModalButtonType
|
|
114
|
+
var ModalButtonType;
|
|
115
115
|
(function (ModalButtonType) {
|
|
116
116
|
ModalButtonType["Okay"] = "okay";
|
|
117
117
|
ModalButtonType["Cancel"] = "cancel";
|
|
@@ -123,14 +123,14 @@ var ModalButtonType$2;
|
|
|
123
123
|
ModalButtonType["ImSure"] = "imSure";
|
|
124
124
|
ModalButtonType["Delete"] = "delete";
|
|
125
125
|
ModalButtonType["Confirm"] = "confirm";
|
|
126
|
-
})(ModalButtonType
|
|
127
|
-
var ModalButtonType$
|
|
126
|
+
})(ModalButtonType || (ModalButtonType = {}));
|
|
127
|
+
var ModalButtonType$1 = ModalButtonType;
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Types of modals
|
|
131
131
|
* @author Gabe Abrams
|
|
132
132
|
*/
|
|
133
|
-
var ModalType
|
|
133
|
+
var ModalType;
|
|
134
134
|
(function (ModalType) {
|
|
135
135
|
ModalType["Okay"] = "okay";
|
|
136
136
|
ModalType["OkayCancel"] = "okay-cancel";
|
|
@@ -141,8 +141,8 @@ var ModalType$2;
|
|
|
141
141
|
ModalType["DeleteCancel"] = "delete-cancel";
|
|
142
142
|
ModalType["ConfirmCancel"] = "confirm-cancel";
|
|
143
143
|
ModalType["NoButtons"] = "-";
|
|
144
|
-
})(ModalType
|
|
145
|
-
var ModalType$
|
|
144
|
+
})(ModalType || (ModalType = {}));
|
|
145
|
+
var ModalType$1 = ModalType;
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* Built-in metadata for logs
|
|
@@ -167,7 +167,7 @@ const LogBuiltInMetadata = {
|
|
|
167
167
|
* @author Gabe Abrams
|
|
168
168
|
* @param ms number of ms to wait
|
|
169
169
|
*/
|
|
170
|
-
const waitMs = (ms = 0) => __awaiter
|
|
170
|
+
const waitMs = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
|
171
171
|
return new Promise((resolve) => {
|
|
172
172
|
setTimeout(resolve, ms);
|
|
173
173
|
});
|
|
@@ -177,7 +177,7 @@ const waitMs = (ms = 0) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
|
177
177
|
* Bootstrap variants
|
|
178
178
|
* @author Gabe Abrams
|
|
179
179
|
*/
|
|
180
|
-
var Variant
|
|
180
|
+
var Variant;
|
|
181
181
|
(function (Variant) {
|
|
182
182
|
Variant["Primary"] = "primary";
|
|
183
183
|
Variant["Secondary"] = "secondary";
|
|
@@ -187,21 +187,21 @@ var Variant$2;
|
|
|
187
187
|
Variant["Danger"] = "danger";
|
|
188
188
|
Variant["Light"] = "light";
|
|
189
189
|
Variant["Dark"] = "dark";
|
|
190
|
-
})(Variant
|
|
191
|
-
var Variant$
|
|
190
|
+
})(Variant || (Variant = {}));
|
|
191
|
+
var Variant$1 = Variant;
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
194
|
* Modal sizes
|
|
195
195
|
* @author Gabe Abrams
|
|
196
196
|
*/
|
|
197
|
-
var ModalSize
|
|
197
|
+
var ModalSize;
|
|
198
198
|
(function (ModalSize) {
|
|
199
199
|
ModalSize["Small"] = "sm";
|
|
200
200
|
ModalSize["Medium"] = "md";
|
|
201
201
|
ModalSize["Large"] = "lg";
|
|
202
202
|
ModalSize["ExtraLarge"] = "xl";
|
|
203
|
-
})(ModalSize
|
|
204
|
-
var ModalSize$
|
|
203
|
+
})(ModalSize || (ModalSize = {}));
|
|
204
|
+
var ModalSize$1 = ModalSize;
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
207
|
* A generic popup modal
|
|
@@ -214,86 +214,86 @@ var ModalSize$2 = ModalSize$1;
|
|
|
214
214
|
const MS_TO_ANIMATE = 200; // Animation duration
|
|
215
215
|
// Modal type to list of buttons
|
|
216
216
|
const modalTypeToModalButtonTypes = {
|
|
217
|
-
[ModalType$
|
|
218
|
-
ModalButtonType$
|
|
217
|
+
[ModalType$1.Okay]: [
|
|
218
|
+
ModalButtonType$1.Okay,
|
|
219
219
|
],
|
|
220
|
-
[ModalType$
|
|
221
|
-
ModalButtonType$
|
|
222
|
-
ModalButtonType$
|
|
220
|
+
[ModalType$1.OkayCancel]: [
|
|
221
|
+
ModalButtonType$1.Okay,
|
|
222
|
+
ModalButtonType$1.Cancel,
|
|
223
223
|
],
|
|
224
|
-
[ModalType$
|
|
225
|
-
ModalButtonType$
|
|
226
|
-
ModalButtonType$
|
|
224
|
+
[ModalType$1.YesNo]: [
|
|
225
|
+
ModalButtonType$1.Yes,
|
|
226
|
+
ModalButtonType$1.No,
|
|
227
227
|
],
|
|
228
|
-
[ModalType$
|
|
229
|
-
ModalButtonType$
|
|
230
|
-
ModalButtonType$
|
|
231
|
-
ModalButtonType$
|
|
228
|
+
[ModalType$1.YesNoCancel]: [
|
|
229
|
+
ModalButtonType$1.Yes,
|
|
230
|
+
ModalButtonType$1.No,
|
|
231
|
+
ModalButtonType$1.Cancel,
|
|
232
232
|
],
|
|
233
|
-
[ModalType$
|
|
234
|
-
ModalButtonType$
|
|
235
|
-
ModalButtonType$
|
|
233
|
+
[ModalType$1.AbandonGoBack]: [
|
|
234
|
+
ModalButtonType$1.Abandon,
|
|
235
|
+
ModalButtonType$1.GoBack,
|
|
236
236
|
],
|
|
237
|
-
[ModalType$
|
|
238
|
-
ModalButtonType$
|
|
239
|
-
ModalButtonType$
|
|
237
|
+
[ModalType$1.ImSureCancel]: [
|
|
238
|
+
ModalButtonType$1.ImSure,
|
|
239
|
+
ModalButtonType$1.Cancel,
|
|
240
240
|
],
|
|
241
|
-
[ModalType$
|
|
242
|
-
ModalButtonType$
|
|
243
|
-
ModalButtonType$
|
|
241
|
+
[ModalType$1.DeleteCancel]: [
|
|
242
|
+
ModalButtonType$1.Delete,
|
|
243
|
+
ModalButtonType$1.Cancel,
|
|
244
244
|
],
|
|
245
|
-
[ModalType$
|
|
246
|
-
ModalButtonType$
|
|
247
|
-
ModalButtonType$
|
|
245
|
+
[ModalType$1.ConfirmCancel]: [
|
|
246
|
+
ModalButtonType$1.Confirm,
|
|
247
|
+
ModalButtonType$1.Cancel,
|
|
248
248
|
],
|
|
249
249
|
};
|
|
250
250
|
// Button type styling and labels
|
|
251
251
|
const ModalButtonTypeToLabelAndVariant = {
|
|
252
|
-
[ModalButtonType$
|
|
252
|
+
[ModalButtonType$1.Okay]: {
|
|
253
253
|
label: 'Okay',
|
|
254
|
-
variant: Variant$
|
|
254
|
+
variant: Variant$1.Dark,
|
|
255
255
|
},
|
|
256
|
-
[ModalButtonType$
|
|
256
|
+
[ModalButtonType$1.Cancel]: {
|
|
257
257
|
label: 'Cancel',
|
|
258
|
-
variant: Variant$
|
|
258
|
+
variant: Variant$1.Secondary,
|
|
259
259
|
},
|
|
260
|
-
[ModalButtonType$
|
|
260
|
+
[ModalButtonType$1.Yes]: {
|
|
261
261
|
label: 'Yes',
|
|
262
|
-
variant: Variant$
|
|
262
|
+
variant: Variant$1.Dark,
|
|
263
263
|
},
|
|
264
|
-
[ModalButtonType$
|
|
264
|
+
[ModalButtonType$1.No]: {
|
|
265
265
|
label: 'No',
|
|
266
|
-
variant: Variant$
|
|
266
|
+
variant: Variant$1.Secondary,
|
|
267
267
|
},
|
|
268
|
-
[ModalButtonType$
|
|
268
|
+
[ModalButtonType$1.Abandon]: {
|
|
269
269
|
label: 'Abandon Changes',
|
|
270
|
-
variant: Variant$
|
|
270
|
+
variant: Variant$1.Warning,
|
|
271
271
|
},
|
|
272
|
-
[ModalButtonType$
|
|
272
|
+
[ModalButtonType$1.GoBack]: {
|
|
273
273
|
label: 'Go Back',
|
|
274
|
-
variant: Variant$
|
|
274
|
+
variant: Variant$1.Secondary,
|
|
275
275
|
},
|
|
276
|
-
[ModalButtonType$
|
|
276
|
+
[ModalButtonType$1.Continue]: {
|
|
277
277
|
label: 'Continue',
|
|
278
|
-
variant: Variant$
|
|
278
|
+
variant: Variant$1.Dark,
|
|
279
279
|
},
|
|
280
|
-
[ModalButtonType$
|
|
280
|
+
[ModalButtonType$1.ImSure]: {
|
|
281
281
|
label: 'I am sure',
|
|
282
|
-
variant: Variant$
|
|
282
|
+
variant: Variant$1.Warning,
|
|
283
283
|
},
|
|
284
|
-
[ModalButtonType$
|
|
284
|
+
[ModalButtonType$1.Delete]: {
|
|
285
285
|
label: 'Yes, Delete',
|
|
286
|
-
variant: Variant$
|
|
286
|
+
variant: Variant$1.Danger,
|
|
287
287
|
},
|
|
288
|
-
[ModalButtonType$
|
|
288
|
+
[ModalButtonType$1.Confirm]: {
|
|
289
289
|
label: 'Confirm',
|
|
290
|
-
variant: Variant$
|
|
290
|
+
variant: Variant$1.Dark,
|
|
291
291
|
},
|
|
292
292
|
};
|
|
293
293
|
/*------------------------------------------------------------------------*/
|
|
294
294
|
/* Style */
|
|
295
295
|
/*------------------------------------------------------------------------*/
|
|
296
|
-
const style$
|
|
296
|
+
const style$8 = `
|
|
297
297
|
.Modal-backdrop {
|
|
298
298
|
position: fixed;
|
|
299
299
|
top: 0;
|
|
@@ -365,7 +365,7 @@ const Modal = (props) => {
|
|
|
365
365
|
/*------------------------------------------------------------------------*/
|
|
366
366
|
var _a;
|
|
367
367
|
/* -------------- Props ------------- */
|
|
368
|
-
const { type = ModalType$
|
|
368
|
+
const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
|
|
369
369
|
/* -------------- State ------------- */
|
|
370
370
|
// If true, the modal is shown
|
|
371
371
|
const [visible, setVisible] = useState(false);
|
|
@@ -382,7 +382,7 @@ const Modal = (props) => {
|
|
|
382
382
|
* @author Gabe Abrams
|
|
383
383
|
*/
|
|
384
384
|
useEffect(() => {
|
|
385
|
-
(() => __awaiter
|
|
385
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
386
386
|
// Set defaults
|
|
387
387
|
setVisible(false);
|
|
388
388
|
setAnimatingIn(true);
|
|
@@ -408,7 +408,7 @@ const Modal = (props) => {
|
|
|
408
408
|
* @param ModalButtonType the button that was clicked when closing the
|
|
409
409
|
* modal
|
|
410
410
|
*/
|
|
411
|
-
const handleClose = (ModalButtonType) => __awaiter
|
|
411
|
+
const handleClose = (ModalButtonType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
412
412
|
// Don't close if no handler
|
|
413
413
|
if (!onClose) {
|
|
414
414
|
return;
|
|
@@ -467,10 +467,10 @@ const Modal = (props) => {
|
|
|
467
467
|
left: 0,
|
|
468
468
|
right: 0,
|
|
469
469
|
} },
|
|
470
|
-
React__default.createElement("style", null, style$
|
|
470
|
+
React__default.createElement("style", null, style$8),
|
|
471
471
|
React__default.createElement("div", { className: `Modal-backdrop ${backdropAnimationClass}`, style: {
|
|
472
472
|
zIndex: 5000000003,
|
|
473
|
-
}, onClick: () => __awaiter
|
|
473
|
+
}, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
474
474
|
// Skip if exit via backdrop not allowed
|
|
475
475
|
if (dontAllowBackdropExit || !onClose) {
|
|
476
476
|
// Show pop animation
|
|
@@ -483,7 +483,7 @@ const Modal = (props) => {
|
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
485
|
// Handle close
|
|
486
|
-
handleClose(ModalButtonType$
|
|
486
|
+
handleClose(ModalButtonType$1.Cancel);
|
|
487
487
|
}) }),
|
|
488
488
|
React__default.createElement("div", { className: `modal-dialog modal-${size} ${animationClass}`, style: {
|
|
489
489
|
zIndex: 5000000002,
|
|
@@ -495,7 +495,7 @@ const Modal = (props) => {
|
|
|
495
495
|
} }, title),
|
|
496
496
|
onClose && (React__default.createElement("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: () => {
|
|
497
497
|
// Handle close
|
|
498
|
-
handleClose(ModalButtonType$
|
|
498
|
+
handleClose(ModalButtonType$1.Cancel);
|
|
499
499
|
} }))),
|
|
500
500
|
children && (React__default.createElement("div", { className: "modal-body" }, children)),
|
|
501
501
|
footer && (React__default.createElement("div", { className: "modal-footer pt-1 pb-1" }, footer))))));
|
|
@@ -505,7 +505,7 @@ const Modal = (props) => {
|
|
|
505
505
|
* An error with a code
|
|
506
506
|
* @author Gabe Abrams
|
|
507
507
|
*/
|
|
508
|
-
class ErrorWithCode
|
|
508
|
+
class ErrorWithCode extends Error {
|
|
509
509
|
constructor(message, code) {
|
|
510
510
|
super(message);
|
|
511
511
|
this.name = 'ErrorWithCode';
|
|
@@ -552,10 +552,10 @@ let storedSendRequest;
|
|
|
552
552
|
* @author Gabe Abrams
|
|
553
553
|
* @returns sendRequest function
|
|
554
554
|
*/
|
|
555
|
-
const getSendRequest = () => __awaiter
|
|
555
|
+
const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
556
556
|
// Track timeout
|
|
557
557
|
let timedOut = false;
|
|
558
|
-
(() => __awaiter
|
|
558
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
559
559
|
yield waitMs(5000);
|
|
560
560
|
timedOut = true;
|
|
561
561
|
}))(),
|
|
@@ -563,7 +563,7 @@ const getSendRequest = () => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
|
563
563
|
yield initialized;
|
|
564
564
|
// Error if no send request function
|
|
565
565
|
if (timedOut) {
|
|
566
|
-
showFatalError
|
|
566
|
+
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));
|
|
567
567
|
// Return dummy function that never resolves
|
|
568
568
|
return (() => {
|
|
569
569
|
return new Promise(() => { });
|
|
@@ -602,12 +602,12 @@ const initClient = (opts) => {
|
|
|
602
602
|
};
|
|
603
603
|
|
|
604
604
|
// Keep track of whether or not session expiry has already been handled
|
|
605
|
-
let sessionAlreadyExpired
|
|
605
|
+
let sessionAlreadyExpired = false;
|
|
606
606
|
/*------------------------------------------------------------------------*/
|
|
607
607
|
/* Stub Logic */
|
|
608
608
|
/*------------------------------------------------------------------------*/
|
|
609
609
|
// Stored stub responses
|
|
610
|
-
const stubResponses
|
|
610
|
+
const stubResponses = {};
|
|
611
611
|
/**
|
|
612
612
|
* Add a stub response
|
|
613
613
|
* @author Gabe Abrams
|
|
@@ -623,12 +623,12 @@ const _setStubResponse = (opts) => {
|
|
|
623
623
|
const { path, body, } = opts;
|
|
624
624
|
const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET').toUpperCase();
|
|
625
625
|
const errorMessage = ((_b = opts.errorMessage) !== null && _b !== void 0 ? _b : 'An unknown error has occurred.');
|
|
626
|
-
const errorCode = ((_c = opts.errorCode) !== null && _c !== void 0 ? _c : ReactKitErrorCode$
|
|
626
|
+
const errorCode = ((_c = opts.errorCode) !== null && _c !== void 0 ? _c : ReactKitErrorCode$1.NoCode);
|
|
627
627
|
// Store to stub responses
|
|
628
|
-
if (!stubResponses
|
|
629
|
-
stubResponses
|
|
628
|
+
if (!stubResponses[method]) {
|
|
629
|
+
stubResponses[method] = {};
|
|
630
630
|
}
|
|
631
|
-
stubResponses
|
|
631
|
+
stubResponses[method][path] = ((opts.errorMessage || opts.errorCode)
|
|
632
632
|
? {
|
|
633
633
|
success: false,
|
|
634
634
|
errorMessage,
|
|
@@ -651,15 +651,15 @@ const _setStubResponse = (opts) => {
|
|
|
651
651
|
* @param [opts.params] - query/body parameters to include
|
|
652
652
|
* @returns response from server
|
|
653
653
|
*/
|
|
654
|
-
const visitServerEndpoint
|
|
654
|
+
const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
655
655
|
var _a, _b, _c;
|
|
656
656
|
const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET');
|
|
657
657
|
// Handle stubs
|
|
658
|
-
const stubResponse = (_b = stubResponses
|
|
658
|
+
const stubResponse = (_b = stubResponses[method]) === null || _b === void 0 ? void 0 : _b[opts.path];
|
|
659
659
|
if (stubResponse) {
|
|
660
660
|
// Remove from list
|
|
661
661
|
try {
|
|
662
|
-
stubResponses
|
|
662
|
+
stubResponses[method][opts.path] = undefined;
|
|
663
663
|
}
|
|
664
664
|
catch (err) {
|
|
665
665
|
// Ignore
|
|
@@ -669,7 +669,7 @@ const visitServerEndpoint$1 = (opts) => __awaiter$1(void 0, void 0, void 0, func
|
|
|
669
669
|
return stubResponse.body;
|
|
670
670
|
}
|
|
671
671
|
// Error
|
|
672
|
-
throw new ErrorWithCode
|
|
672
|
+
throw new ErrorWithCode(stubResponse.errorMessage, stubResponse.errorCode);
|
|
673
673
|
}
|
|
674
674
|
// Send the request
|
|
675
675
|
const sendRequest = yield getSendRequest();
|
|
@@ -680,19 +680,19 @@ const visitServerEndpoint$1 = (opts) => __awaiter$1(void 0, void 0, void 0, func
|
|
|
680
680
|
});
|
|
681
681
|
// Check for failure
|
|
682
682
|
if (!response || !response.body) {
|
|
683
|
-
throw new ErrorWithCode
|
|
683
|
+
throw new ErrorWithCode('We didn\'t get a response from the server. Please check your internet connection.', ReactKitErrorCode$1.NoResponse);
|
|
684
684
|
}
|
|
685
685
|
if (!response.body.success) {
|
|
686
686
|
// Session expired
|
|
687
|
-
if (response.body.code === ReactKitErrorCode$
|
|
687
|
+
if (response.body.code === ReactKitErrorCode$1.SessionExpired) {
|
|
688
688
|
// Skip notice if session was already expired
|
|
689
|
-
if (sessionAlreadyExpired
|
|
689
|
+
if (sessionAlreadyExpired) {
|
|
690
690
|
// Never return (browser is already reloading)
|
|
691
691
|
yield new Promise(() => {
|
|
692
692
|
// Promise that never returns
|
|
693
693
|
});
|
|
694
694
|
}
|
|
695
|
-
sessionAlreadyExpired
|
|
695
|
+
sessionAlreadyExpired = true;
|
|
696
696
|
// Show session expiration message
|
|
697
697
|
{
|
|
698
698
|
// Fallback to alert
|
|
@@ -705,9 +705,9 @@ const visitServerEndpoint$1 = (opts) => __awaiter$1(void 0, void 0, void 0, func
|
|
|
705
705
|
});
|
|
706
706
|
}
|
|
707
707
|
// Other errors
|
|
708
|
-
throw new ErrorWithCode
|
|
708
|
+
throw new ErrorWithCode((response.body.message
|
|
709
709
|
|| 'An unknown error occurred. Please contact an admin.'), (response.body.code
|
|
710
|
-
|| ReactKitErrorCode$
|
|
710
|
+
|| ReactKitErrorCode$1.NoCode));
|
|
711
711
|
}
|
|
712
712
|
// Success! Extract the body
|
|
713
713
|
const { body } = response.body;
|
|
@@ -719,9 +719,9 @@ const visitServerEndpoint$1 = (opts) => __awaiter$1(void 0, void 0, void 0, func
|
|
|
719
719
|
* Log a user action on the client (cannot be used on the server)
|
|
720
720
|
* @author Gabe Abrams
|
|
721
721
|
*/
|
|
722
|
-
const logClientEvent = (opts) => __awaiter
|
|
722
|
+
const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
723
723
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
724
|
-
return visitServerEndpoint
|
|
724
|
+
return visitServerEndpoint({
|
|
725
725
|
path: LOG_ROUTE_PATH,
|
|
726
726
|
method: 'POST',
|
|
727
727
|
params: {
|
|
@@ -771,7 +771,7 @@ let onAlertClosed;
|
|
|
771
771
|
* @param title the title text to display at the top of the alert
|
|
772
772
|
* @param text the text to display in the alert
|
|
773
773
|
*/
|
|
774
|
-
const alert$
|
|
774
|
+
const alert$1 = (title, text) => __awaiter(void 0, void 0, void 0, function* () {
|
|
775
775
|
// Fallback if alert not available
|
|
776
776
|
if (!setAlertInfo) {
|
|
777
777
|
window.alert(`${title}\n\n${text}`);
|
|
@@ -811,7 +811,7 @@ let onConfirmClosed;
|
|
|
811
811
|
* button
|
|
812
812
|
* @returns true if the user confirmed
|
|
813
813
|
*/
|
|
814
|
-
const confirm = (title, text, opts) => __awaiter
|
|
814
|
+
const confirm = (title, text, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
815
815
|
// Fallback if confirm is not available
|
|
816
816
|
if (!setConfirmInfo) {
|
|
817
817
|
return window.confirm(`${title}\n\n${text}`);
|
|
@@ -843,15 +843,15 @@ let setFatalErrorTitle;
|
|
|
843
843
|
* @param error the error to show
|
|
844
844
|
* @param [errorTitle] title of the error box
|
|
845
845
|
*/
|
|
846
|
-
const showFatalError
|
|
846
|
+
const showFatalError = (error, errorTitle = 'An Error Occurred') => {
|
|
847
847
|
var _a, _b;
|
|
848
848
|
// Determine message and code
|
|
849
849
|
const message = (typeof error === 'string'
|
|
850
850
|
? error.trim()
|
|
851
851
|
: String((_a = error.message) !== null && _a !== void 0 ? _a : 'An unknown error occurred.'));
|
|
852
852
|
const code = (typeof error === 'string'
|
|
853
|
-
? ReactKitErrorCode$
|
|
854
|
-
: String((_b = error.code) !== null && _b !== void 0 ? _b : ReactKitErrorCode$
|
|
853
|
+
? ReactKitErrorCode$1.NoCode
|
|
854
|
+
: String((_b = error.code) !== null && _b !== void 0 ? _b : ReactKitErrorCode$1.NoCode));
|
|
855
855
|
// Add log
|
|
856
856
|
logClientEvent({
|
|
857
857
|
context: LogBuiltInMetadata.Context.ClientFatalError,
|
|
@@ -866,7 +866,7 @@ const showFatalError$1 = (error, errorTitle = 'An Error Occurred') => {
|
|
|
866
866
|
});
|
|
867
867
|
// Handle case where app hasn't loaded
|
|
868
868
|
if (!setFatalErrorMessage || !setFatalErrorCode) {
|
|
869
|
-
alert$
|
|
869
|
+
alert$1(errorTitle, `${message} (code: ${code}). Please contact support.`);
|
|
870
870
|
return undefined;
|
|
871
871
|
}
|
|
872
872
|
// Use setters
|
|
@@ -910,7 +910,7 @@ const AppWrapper = (props) => {
|
|
|
910
910
|
let modal;
|
|
911
911
|
/* -------------- Alert ------------- */
|
|
912
912
|
if (alertInfo) {
|
|
913
|
-
modal = (React__default.createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$
|
|
913
|
+
modal = (React__default.createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
|
|
914
914
|
// Alert closed
|
|
915
915
|
setAlertInfo(undefined);
|
|
916
916
|
if (onAlertClosed) {
|
|
@@ -920,10 +920,10 @@ const AppWrapper = (props) => {
|
|
|
920
920
|
}
|
|
921
921
|
/* ------------- Confirm ------------ */
|
|
922
922
|
if (confirmInfo) {
|
|
923
|
-
modal = (React__default.createElement(Modal, { key: `confirm-${confirmInfo.title}-${confirmInfo.text}`, title: confirmInfo.title, type: ModalType$
|
|
923
|
+
modal = (React__default.createElement(Modal, { key: `confirm-${confirmInfo.title}-${confirmInfo.text}`, title: confirmInfo.title, type: ModalType$1.OkayCancel, okayLabel: confirmInfo.opts.confirmButtonText, okayVariant: confirmInfo.opts.confirmButtonVariant, cancelLabel: confirmInfo.opts.cancelButtonText, cancelVariant: confirmInfo.opts.cancelButtonVariant, onClose: (buttonType) => {
|
|
924
924
|
setConfirmInfo(undefined);
|
|
925
925
|
if (onConfirmClosed) {
|
|
926
|
-
onConfirmClosed(buttonType === ModalButtonType$
|
|
926
|
+
onConfirmClosed(buttonType === ModalButtonType$1.Okay);
|
|
927
927
|
}
|
|
928
928
|
}, dontAllowBackdropExit: true }, confirmInfo.text));
|
|
929
929
|
}
|
|
@@ -936,8 +936,8 @@ const AppWrapper = (props) => {
|
|
|
936
936
|
if (fatalErrorMessage || fatalErrorCode || sessionHasExpired) {
|
|
937
937
|
// Re-encapsulate in an error
|
|
938
938
|
const error = (sessionHasExpired
|
|
939
|
-
? new ErrorWithCode
|
|
940
|
-
: new ErrorWithCode
|
|
939
|
+
? new ErrorWithCode(getSessionExpiredMessage(), ReactKitErrorCode$1.SessionExpired)
|
|
940
|
+
: new ErrorWithCode((fatalErrorMessage !== null && fatalErrorMessage !== void 0 ? fatalErrorMessage : 'An unknown error has occurred. Please contact support.'), (fatalErrorCode !== null && fatalErrorCode !== void 0 ? fatalErrorCode : ReactKitErrorCode$1.NoCode)));
|
|
941
941
|
// Build error screen
|
|
942
942
|
body = (React__default.createElement("div", { style: {
|
|
943
943
|
display: 'block',
|
|
@@ -971,7 +971,7 @@ const AppWrapper = (props) => {
|
|
|
971
971
|
/*------------------------------------------------------------------------*/
|
|
972
972
|
/* Style */
|
|
973
973
|
/*------------------------------------------------------------------------*/
|
|
974
|
-
const style$
|
|
974
|
+
const style$7 = `
|
|
975
975
|
/* Container fades in */
|
|
976
976
|
.LoadingSpinner-container {
|
|
977
977
|
animation-name: LoadingSpinner-container-fade-in;
|
|
@@ -1043,13 +1043,13 @@ const style$8 = `
|
|
|
1043
1043
|
/*------------------------------------------------------------------------*/
|
|
1044
1044
|
/* Component */
|
|
1045
1045
|
/*------------------------------------------------------------------------*/
|
|
1046
|
-
const LoadingSpinner
|
|
1046
|
+
const LoadingSpinner = () => {
|
|
1047
1047
|
/*------------------------------------------------------------------------*/
|
|
1048
1048
|
/* Render */
|
|
1049
1049
|
/*------------------------------------------------------------------------*/
|
|
1050
1050
|
// Add all four blips to a container
|
|
1051
1051
|
return (React__default.createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
1052
|
-
React__default.createElement("style", null, style$
|
|
1052
|
+
React__default.createElement("style", null, style$7),
|
|
1053
1053
|
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-1 me-1" }),
|
|
1054
1054
|
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-2 me-1" }),
|
|
1055
1055
|
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-3 me-1" }),
|
|
@@ -1063,7 +1063,7 @@ const LoadingSpinner$1 = () => {
|
|
|
1063
1063
|
/*------------------------------------------------------------------------*/
|
|
1064
1064
|
/* Style */
|
|
1065
1065
|
/*------------------------------------------------------------------------*/
|
|
1066
|
-
const style$
|
|
1066
|
+
const style$6 = `
|
|
1067
1067
|
/* Tab Box */
|
|
1068
1068
|
.TabBox-box {
|
|
1069
1069
|
/* Light Border */
|
|
@@ -1143,7 +1143,7 @@ const TabBox = (props) => {
|
|
|
1143
1143
|
/*----------------------------------------*/
|
|
1144
1144
|
// Full UI
|
|
1145
1145
|
return (React__default.createElement("div", { className: `TabBox-container ${noBottomMargin ? '' : 'mb-2'}` },
|
|
1146
|
-
React__default.createElement("style", null, style$
|
|
1146
|
+
React__default.createElement("style", null, style$6),
|
|
1147
1147
|
React__default.createElement("div", { className: "TabBox-title-container" },
|
|
1148
1148
|
React__default.createElement("div", { className: "TabBox-title" }, title)),
|
|
1149
1149
|
React__default.createElement("div", { className: `TabBox-box ps-2 pt-2 pe-2 ${noBottomPadding ? '' : 'pb-2'}` },
|
|
@@ -1157,12 +1157,12 @@ const TabBox = (props) => {
|
|
|
1157
1157
|
/*------------------------------------------------------------------------*/
|
|
1158
1158
|
/* Component */
|
|
1159
1159
|
/*------------------------------------------------------------------------*/
|
|
1160
|
-
const RadioButton
|
|
1160
|
+
const RadioButton = (props) => {
|
|
1161
1161
|
/*------------------------------------------------------------------------*/
|
|
1162
1162
|
/* Setup */
|
|
1163
1163
|
/*------------------------------------------------------------------------*/
|
|
1164
1164
|
/* -------------- Props ------------- */
|
|
1165
|
-
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = Variant$
|
|
1165
|
+
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = Variant$1.Secondary, unselectedVariant = Variant$1.Light, small, } = props;
|
|
1166
1166
|
/*------------------------------------------------------------------------*/
|
|
1167
1167
|
/* Render */
|
|
1168
1168
|
/*------------------------------------------------------------------------*/
|
|
@@ -1185,12 +1185,12 @@ const RadioButton$1 = (props) => {
|
|
|
1185
1185
|
/*------------------------------------------------------------------------*/
|
|
1186
1186
|
/* Component */
|
|
1187
1187
|
/*------------------------------------------------------------------------*/
|
|
1188
|
-
const CheckboxButton
|
|
1188
|
+
const CheckboxButton = (props) => {
|
|
1189
1189
|
/*------------------------------------------------------------------------*/
|
|
1190
1190
|
/* Setup */
|
|
1191
1191
|
/*------------------------------------------------------------------------*/
|
|
1192
1192
|
/* -------------- Props ------------- */
|
|
1193
|
-
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = Variant$
|
|
1193
|
+
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = Variant$1.Secondary, uncheckedVariant = Variant$1.Light, small, dashed, } = props;
|
|
1194
1194
|
/*------------------------------------------------------------------------*/
|
|
1195
1195
|
/* Render */
|
|
1196
1196
|
/*------------------------------------------------------------------------*/
|
|
@@ -1222,7 +1222,7 @@ const CheckboxButton$1 = (props) => {
|
|
|
1222
1222
|
/*------------------------------------------------------------------------*/
|
|
1223
1223
|
/* Component */
|
|
1224
1224
|
/*------------------------------------------------------------------------*/
|
|
1225
|
-
const ButtonInputGroup
|
|
1225
|
+
const ButtonInputGroup = (props) => {
|
|
1226
1226
|
/*------------------------------------------------------------------------*/
|
|
1227
1227
|
/* Setup */
|
|
1228
1228
|
/*------------------------------------------------------------------------*/
|
|
@@ -1464,7 +1464,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1464
1464
|
/*------------------------------------------------------------------------*/
|
|
1465
1465
|
/* Style */
|
|
1466
1466
|
/*------------------------------------------------------------------------*/
|
|
1467
|
-
const style$
|
|
1467
|
+
const style$5 = `
|
|
1468
1468
|
.Drawer-container {
|
|
1469
1469
|
margin-left: 1rem;
|
|
1470
1470
|
margin-right: 1rem;
|
|
@@ -1498,7 +1498,7 @@ const Drawer = (props) => {
|
|
|
1498
1498
|
return (React__default.createElement("div", { className: "Drawer-container", style: {
|
|
1499
1499
|
backgroundColor: (customBackgroundColor !== null && customBackgroundColor !== void 0 ? customBackgroundColor : undefined),
|
|
1500
1500
|
} },
|
|
1501
|
-
React__default.createElement("style", null, style$
|
|
1501
|
+
React__default.createElement("style", null, style$5),
|
|
1502
1502
|
children));
|
|
1503
1503
|
};
|
|
1504
1504
|
|
|
@@ -1836,13 +1836,13 @@ const PopPendingMark = (props) => {
|
|
|
1836
1836
|
*/
|
|
1837
1837
|
/* ------------- Actions ------------ */
|
|
1838
1838
|
// Types of actions
|
|
1839
|
-
var ActionType$
|
|
1839
|
+
var ActionType$6;
|
|
1840
1840
|
(function (ActionType) {
|
|
1841
1841
|
// Indicate that the text was recently copied
|
|
1842
1842
|
ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
|
|
1843
1843
|
// Clear the status
|
|
1844
1844
|
ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
|
|
1845
|
-
})(ActionType$
|
|
1845
|
+
})(ActionType$6 || (ActionType$6 = {}));
|
|
1846
1846
|
/**
|
|
1847
1847
|
* Reducer that executes actions
|
|
1848
1848
|
* @author Gabe Abrams
|
|
@@ -1851,12 +1851,12 @@ var ActionType$7;
|
|
|
1851
1851
|
*/
|
|
1852
1852
|
const reducer$6 = (state, action) => {
|
|
1853
1853
|
switch (action.type) {
|
|
1854
|
-
case ActionType$
|
|
1854
|
+
case ActionType$6.IndicateRecentlyCopied: {
|
|
1855
1855
|
return {
|
|
1856
1856
|
recentlyCopied: true,
|
|
1857
1857
|
};
|
|
1858
1858
|
}
|
|
1859
|
-
case ActionType$
|
|
1859
|
+
case ActionType$6.ClearRecentlyCopiedStatus: {
|
|
1860
1860
|
return {
|
|
1861
1861
|
recentlyCopied: false,
|
|
1862
1862
|
};
|
|
@@ -1892,23 +1892,23 @@ const CopiableBox = (props) => {
|
|
|
1892
1892
|
* Perform a copy
|
|
1893
1893
|
* @author Gabe Abrams
|
|
1894
1894
|
*/
|
|
1895
|
-
const performCopy = () => __awaiter
|
|
1895
|
+
const performCopy = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1896
1896
|
// Write to clipboard
|
|
1897
1897
|
try {
|
|
1898
1898
|
yield navigator.clipboard.writeText(text);
|
|
1899
1899
|
}
|
|
1900
1900
|
catch (err) {
|
|
1901
|
-
return alert$
|
|
1901
|
+
return alert$1('Unable to copy', 'Oops! We couldn\'t copy that to the clipboard. Please copy the text manually.');
|
|
1902
1902
|
}
|
|
1903
1903
|
// Show copied notice
|
|
1904
1904
|
dispatch({
|
|
1905
|
-
type: ActionType$
|
|
1905
|
+
type: ActionType$6.IndicateRecentlyCopied,
|
|
1906
1906
|
});
|
|
1907
1907
|
// Wait a moment
|
|
1908
1908
|
yield waitMs(4000);
|
|
1909
1909
|
// Hide copied notice
|
|
1910
1910
|
dispatch({
|
|
1911
|
-
type: ActionType$
|
|
1911
|
+
type: ActionType$6.ClearRecentlyCopiedStatus,
|
|
1912
1912
|
});
|
|
1913
1913
|
});
|
|
1914
1914
|
/*------------------------------------------------------------------------*/
|
|
@@ -1964,11 +1964,11 @@ const CopiableBox = (props) => {
|
|
|
1964
1964
|
*/
|
|
1965
1965
|
/* ------------- Actions ------------ */
|
|
1966
1966
|
// Types of actions
|
|
1967
|
-
var ActionType$
|
|
1967
|
+
var ActionType$5;
|
|
1968
1968
|
(function (ActionType) {
|
|
1969
1969
|
// Toggle whether a child are being shown
|
|
1970
1970
|
ActionType["ToggleChild"] = "toggle-child";
|
|
1971
|
-
})(ActionType$
|
|
1971
|
+
})(ActionType$5 || (ActionType$5 = {}));
|
|
1972
1972
|
/**
|
|
1973
1973
|
* Reducer that executes actions
|
|
1974
1974
|
* @author Gabe Abrams
|
|
@@ -1977,7 +1977,7 @@ var ActionType$6;
|
|
|
1977
1977
|
*/
|
|
1978
1978
|
const reducer$5 = (state, action) => {
|
|
1979
1979
|
switch (action.type) {
|
|
1980
|
-
case ActionType$
|
|
1980
|
+
case ActionType$5.ToggleChild: {
|
|
1981
1981
|
return Object.assign(Object.assign({}, state), { childExpanded: Object.assign(Object.assign({}, state.childExpanded), { [String(action.id)]: !state.childExpanded[String(action.id)] }) });
|
|
1982
1982
|
}
|
|
1983
1983
|
default: {
|
|
@@ -2096,14 +2096,14 @@ const NestableItemList = (props) => {
|
|
|
2096
2096
|
backgroundColor: 'transparent',
|
|
2097
2097
|
}, type: "button", onClick: () => {
|
|
2098
2098
|
dispatch({
|
|
2099
|
-
type: ActionType$
|
|
2099
|
+
type: ActionType$5.ToggleChild,
|
|
2100
2100
|
id: item.id,
|
|
2101
2101
|
});
|
|
2102
2102
|
}, "aria-label": `${childExpanded[item.id] ? 'Hide' : 'Show'} items in ${item.name}` },
|
|
2103
2103
|
React__default.createElement(FontAwesomeIcon, { icon: childExpanded[item.id] ? faChevronDown : faChevronRight })))),
|
|
2104
|
-
React__default.createElement(CheckboxButton
|
|
2104
|
+
React__default.createElement(CheckboxButton, { className: `NestableItemList-CheckboxButton-${item.id}`, text: item.name, checked: item.isGroup ? allChecked(item.children) : item.checked, dashed: item.isGroup ? !noneChecked(item.children) : false, onChanged: (checked) => {
|
|
2105
2105
|
onChanged(changeChecked(item.id, checked, items));
|
|
2106
|
-
}, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$
|
|
2106
|
+
}, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$1.Light }),
|
|
2107
2107
|
(item.isGroup && childExpanded[item.id]) && (React__default.createElement("div", { className: "NestableItemList-children-container", style: {
|
|
2108
2108
|
paddingLeft: '2.2rem',
|
|
2109
2109
|
} },
|
|
@@ -2241,7 +2241,7 @@ var LogAction$1 = LogAction;
|
|
|
2241
2241
|
* Server-side API param types
|
|
2242
2242
|
* @author Gabe Abrams
|
|
2243
2243
|
*/
|
|
2244
|
-
var ParamType
|
|
2244
|
+
var ParamType;
|
|
2245
2245
|
(function (ParamType) {
|
|
2246
2246
|
ParamType["Boolean"] = "boolean";
|
|
2247
2247
|
ParamType["BooleanOptional"] = "boolean-optional";
|
|
@@ -2253,8 +2253,8 @@ var ParamType$2;
|
|
|
2253
2253
|
ParamType["JSONOptional"] = "json-optional";
|
|
2254
2254
|
ParamType["String"] = "string";
|
|
2255
2255
|
ParamType["StringOptional"] = "string-optional";
|
|
2256
|
-
})(ParamType
|
|
2257
|
-
var ParamType$
|
|
2256
|
+
})(ParamType || (ParamType = {}));
|
|
2257
|
+
var ParamType$1 = ParamType;
|
|
2258
2258
|
|
|
2259
2259
|
/**
|
|
2260
2260
|
* Round a number to a certain number of decimals
|
|
@@ -2371,7 +2371,7 @@ var SortType;
|
|
|
2371
2371
|
})(SortType || (SortType = {}));
|
|
2372
2372
|
/* ------------- Actions ------------ */
|
|
2373
2373
|
// Types of actions
|
|
2374
|
-
var ActionType$
|
|
2374
|
+
var ActionType$4;
|
|
2375
2375
|
(function (ActionType) {
|
|
2376
2376
|
// Toggle sort column param
|
|
2377
2377
|
ActionType["ToggleSortColumn"] = "toggle-sort-column";
|
|
@@ -2383,7 +2383,7 @@ var ActionType$5;
|
|
|
2383
2383
|
ActionType["ShowAllColumns"] = "show-all-columns";
|
|
2384
2384
|
// Hide all columns
|
|
2385
2385
|
ActionType["HideAllColumns"] = "hide-all-columns";
|
|
2386
|
-
})(ActionType$
|
|
2386
|
+
})(ActionType$4 || (ActionType$4 = {}));
|
|
2387
2387
|
/**
|
|
2388
2388
|
* Reducer that executes actions
|
|
2389
2389
|
* @author Gabe Abrams
|
|
@@ -2392,7 +2392,7 @@ var ActionType$5;
|
|
|
2392
2392
|
*/
|
|
2393
2393
|
const reducer$4 = (state, action) => {
|
|
2394
2394
|
switch (action.type) {
|
|
2395
|
-
case ActionType$
|
|
2395
|
+
case ActionType$4.ToggleSortColumn: {
|
|
2396
2396
|
if (action.param !== state.sortColumnParam) {
|
|
2397
2397
|
// Different column param
|
|
2398
2398
|
return Object.assign(Object.assign({}, state), { sortColumnParam: action.param, sortType: SortType.Ascending });
|
|
@@ -2404,22 +2404,22 @@ const reducer$4 = (state, action) => {
|
|
|
2404
2404
|
// Stop sorting by column
|
|
2405
2405
|
return Object.assign(Object.assign({}, state), { sortColumnParam: undefined, sortType: SortType.Ascending });
|
|
2406
2406
|
}
|
|
2407
|
-
case ActionType$
|
|
2407
|
+
case ActionType$4.UpdateColumnVisibility: {
|
|
2408
2408
|
const { columnVisibilityMap } = state;
|
|
2409
2409
|
columnVisibilityMap[action.param] = action.visible;
|
|
2410
2410
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2411
2411
|
}
|
|
2412
|
-
case ActionType$
|
|
2412
|
+
case ActionType$4.ToggleColVisCusModalVisibility: {
|
|
2413
2413
|
return Object.assign(Object.assign({}, state), { columnVisibilityCustomizationModalVisible: !state.columnVisibilityCustomizationModalVisible });
|
|
2414
2414
|
}
|
|
2415
|
-
case ActionType$
|
|
2415
|
+
case ActionType$4.ShowAllColumns: {
|
|
2416
2416
|
const { columnVisibilityMap } = state;
|
|
2417
2417
|
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2418
2418
|
columnVisibilityMap[param] = true;
|
|
2419
2419
|
});
|
|
2420
2420
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2421
2421
|
}
|
|
2422
|
-
case ActionType$
|
|
2422
|
+
case ActionType$4.HideAllColumns: {
|
|
2423
2423
|
const { columnVisibilityMap } = state;
|
|
2424
2424
|
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2425
2425
|
columnVisibilityMap[param] = false;
|
|
@@ -2480,36 +2480,36 @@ const IntelliTable = (props) => {
|
|
|
2480
2480
|
/* ------- Col Vis Customization Modal ------ */
|
|
2481
2481
|
if (columnVisibilityCustomizationModalVisible) {
|
|
2482
2482
|
// Create modal
|
|
2483
|
-
modal = (React__default.createElement(Modal, { type: ModalType$
|
|
2483
|
+
modal = (React__default.createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
|
|
2484
2484
|
const noColumnsSelected = (Object.values(columnVisibilityMap)
|
|
2485
2485
|
.every((isSelected) => {
|
|
2486
2486
|
return !isSelected;
|
|
2487
2487
|
}));
|
|
2488
2488
|
if (noColumnsSelected) {
|
|
2489
|
-
return alert$
|
|
2489
|
+
return alert$1('Choose at least one column', 'To continue, you have to choose at least one column to show');
|
|
2490
2490
|
}
|
|
2491
2491
|
dispatch({
|
|
2492
|
-
type: ActionType$
|
|
2492
|
+
type: ActionType$4.ToggleColVisCusModalVisibility,
|
|
2493
2493
|
});
|
|
2494
|
-
}, okayVariant: Variant$
|
|
2494
|
+
}, okayVariant: Variant$1.Light },
|
|
2495
2495
|
columns.map((column) => {
|
|
2496
|
-
return (React__default.createElement(CheckboxButton
|
|
2496
|
+
return (React__default.createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
|
|
2497
2497
|
dispatch({
|
|
2498
|
-
type: ActionType$
|
|
2498
|
+
type: ActionType$4.UpdateColumnVisibility,
|
|
2499
2499
|
param: column.param,
|
|
2500
2500
|
visible: checked,
|
|
2501
2501
|
});
|
|
2502
|
-
}, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$
|
|
2502
|
+
}, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.Secondary }));
|
|
2503
2503
|
}),
|
|
2504
2504
|
React__default.createElement("div", { className: "mt-3" }, "Or you can:"),
|
|
2505
2505
|
React__default.createElement("button", { type: "button", id: `IntelliTable-${id}-select-all-columns`, className: "btn btn-secondary me-2", "aria-label": `show all columns in the ${title} table`, onClick: () => {
|
|
2506
2506
|
dispatch({
|
|
2507
|
-
type: ActionType$
|
|
2507
|
+
type: ActionType$4.ShowAllColumns,
|
|
2508
2508
|
});
|
|
2509
2509
|
} }, "Select All"),
|
|
2510
2510
|
React__default.createElement("button", { type: "button", id: `IntelliTable-${id}-select-none-columns`, className: "btn btn-secondary", "aria-label": `hide all columns in the ${title} table`, onClick: () => {
|
|
2511
2511
|
dispatch({
|
|
2512
|
-
type: ActionType$
|
|
2512
|
+
type: ActionType$4.HideAllColumns,
|
|
2513
2513
|
});
|
|
2514
2514
|
} }, "Deselect All")));
|
|
2515
2515
|
}
|
|
@@ -2560,7 +2560,7 @@ const IntelliTable = (props) => {
|
|
|
2560
2560
|
React__default.createElement("div", null,
|
|
2561
2561
|
React__default.createElement("button", { type: "button", id: `IntelliTable-${id}-sort-by-${column.param}-button`, className: `btn btn-${sortingByThisColumn ? 'light' : 'secondary'} btn-sm ms-1 ps-1 pe-1 pt-0 pb-0`, "aria-label": sortButtonAriaLabel, onClick: () => {
|
|
2562
2562
|
dispatch({
|
|
2563
|
-
type: ActionType$
|
|
2563
|
+
type: ActionType$4.ToggleSortColumn,
|
|
2564
2564
|
param: column.param,
|
|
2565
2565
|
});
|
|
2566
2566
|
} },
|
|
@@ -2600,7 +2600,7 @@ const IntelliTable = (props) => {
|
|
|
2600
2600
|
}
|
|
2601
2601
|
// Sort differently based on the data type
|
|
2602
2602
|
// > Boolean
|
|
2603
|
-
if (paramType === ParamType$
|
|
2603
|
+
if (paramType === ParamType$1.Boolean) {
|
|
2604
2604
|
if (aVal && !bVal) {
|
|
2605
2605
|
return (descending ? -1 : 1);
|
|
2606
2606
|
}
|
|
@@ -2610,14 +2610,14 @@ const IntelliTable = (props) => {
|
|
|
2610
2610
|
return tiebreaker;
|
|
2611
2611
|
}
|
|
2612
2612
|
// > Number
|
|
2613
|
-
if (paramType === ParamType$
|
|
2614
|
-
|| paramType === ParamType$
|
|
2613
|
+
if (paramType === ParamType$1.Int
|
|
2614
|
+
|| paramType === ParamType$1.Float) {
|
|
2615
2615
|
return (descending
|
|
2616
2616
|
? (bVal - aVal)
|
|
2617
2617
|
: (aVal - bVal));
|
|
2618
2618
|
}
|
|
2619
2619
|
// > String
|
|
2620
|
-
if (paramType === ParamType$
|
|
2620
|
+
if (paramType === ParamType$1.String) {
|
|
2621
2621
|
if (aVal < bVal) {
|
|
2622
2622
|
return (descending ? 1 : -1);
|
|
2623
2623
|
}
|
|
@@ -2627,7 +2627,7 @@ const IntelliTable = (props) => {
|
|
|
2627
2627
|
return tiebreaker;
|
|
2628
2628
|
}
|
|
2629
2629
|
// > JSON
|
|
2630
|
-
if (paramType === ParamType$
|
|
2630
|
+
if (paramType === ParamType$1.JSON) {
|
|
2631
2631
|
const aSize = (Array.isArray(aVal)
|
|
2632
2632
|
? aVal.length
|
|
2633
2633
|
: Object.keys(aVal).length);
|
|
@@ -2659,7 +2659,7 @@ const IntelliTable = (props) => {
|
|
|
2659
2659
|
let fullValue;
|
|
2660
2660
|
let visibleValue;
|
|
2661
2661
|
let title = '';
|
|
2662
|
-
if (column.type === ParamType$
|
|
2662
|
+
if (column.type === ParamType$1.Boolean) {
|
|
2663
2663
|
fullValue = !!(value);
|
|
2664
2664
|
const noValue = (value === undefined
|
|
2665
2665
|
|| value === null);
|
|
@@ -2671,7 +2671,7 @@ const IntelliTable = (props) => {
|
|
|
2671
2671
|
title = 'Empty Cell';
|
|
2672
2672
|
}
|
|
2673
2673
|
}
|
|
2674
|
-
else if (column.type === ParamType$
|
|
2674
|
+
else if (column.type === ParamType$1.Int) {
|
|
2675
2675
|
fullValue = Number.parseInt(value, 10);
|
|
2676
2676
|
const noValue = Number.isNaN(fullValue);
|
|
2677
2677
|
visibleValue = (noValue
|
|
@@ -2682,7 +2682,7 @@ const IntelliTable = (props) => {
|
|
|
2682
2682
|
title = 'Empty Cell';
|
|
2683
2683
|
}
|
|
2684
2684
|
}
|
|
2685
|
-
else if (column.type === ParamType$
|
|
2685
|
+
else if (column.type === ParamType$1.Float) {
|
|
2686
2686
|
fullValue = Number.parseFloat(value);
|
|
2687
2687
|
const noValue = Number.isNaN(fullValue);
|
|
2688
2688
|
visibleValue = (noValue
|
|
@@ -2693,7 +2693,7 @@ const IntelliTable = (props) => {
|
|
|
2693
2693
|
title = 'Empty Cell';
|
|
2694
2694
|
}
|
|
2695
2695
|
}
|
|
2696
|
-
else if (column.type === ParamType$
|
|
2696
|
+
else if (column.type === ParamType$1.String) {
|
|
2697
2697
|
fullValue = String(value).trim();
|
|
2698
2698
|
const noValue = (value === undefined
|
|
2699
2699
|
|| value === null
|
|
@@ -2706,7 +2706,7 @@ const IntelliTable = (props) => {
|
|
|
2706
2706
|
title = 'Empty Cell';
|
|
2707
2707
|
}
|
|
2708
2708
|
}
|
|
2709
|
-
else if (column.type === ParamType$
|
|
2709
|
+
else if (column.type === ParamType$1.JSON) {
|
|
2710
2710
|
fullValue = JSON.stringify(value);
|
|
2711
2711
|
const noValue = (Array.isArray(value)
|
|
2712
2712
|
? (!value || value.length === 0)
|
|
@@ -2749,7 +2749,7 @@ const IntelliTable = (props) => {
|
|
|
2749
2749
|
React__default.createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
|
|
2750
2750
|
React__default.createElement("button", { type: "button", className: "btn btn-secondary ms-2", "aria-label": `show panel for customizing which columns show in table ${title}`, id: `IntelliTable-${id}-show-column-customization-modal`, onClick: () => {
|
|
2751
2751
|
dispatch({
|
|
2752
|
-
type: ActionType$
|
|
2752
|
+
type: ActionType$4.ToggleColVisCusModalVisibility,
|
|
2753
2753
|
});
|
|
2754
2754
|
} },
|
|
2755
2755
|
"Show/Hide Cols",
|
|
@@ -2871,185 +2871,185 @@ const columns = [
|
|
|
2871
2871
|
{
|
|
2872
2872
|
title: 'First Name',
|
|
2873
2873
|
param: 'userFirstName',
|
|
2874
|
-
type: ParamType$
|
|
2874
|
+
type: ParamType$1.String,
|
|
2875
2875
|
},
|
|
2876
2876
|
{
|
|
2877
2877
|
title: 'Last Name',
|
|
2878
2878
|
param: 'userLastName',
|
|
2879
|
-
type: ParamType$
|
|
2879
|
+
type: ParamType$1.String,
|
|
2880
2880
|
},
|
|
2881
2881
|
{
|
|
2882
2882
|
title: 'Email',
|
|
2883
2883
|
param: 'userEmail',
|
|
2884
|
-
type: ParamType$
|
|
2884
|
+
type: ParamType$1.String,
|
|
2885
2885
|
},
|
|
2886
2886
|
{
|
|
2887
2887
|
title: 'Canvas Id',
|
|
2888
2888
|
param: 'userId',
|
|
2889
|
-
type: ParamType$
|
|
2889
|
+
type: ParamType$1.Int,
|
|
2890
2890
|
},
|
|
2891
2891
|
{
|
|
2892
2892
|
title: 'Student?',
|
|
2893
2893
|
param: 'isLearner',
|
|
2894
|
-
type: ParamType$
|
|
2894
|
+
type: ParamType$1.Boolean,
|
|
2895
2895
|
},
|
|
2896
2896
|
{
|
|
2897
2897
|
title: 'Teaching Staff?',
|
|
2898
2898
|
param: 'isTTM',
|
|
2899
|
-
type: ParamType$
|
|
2899
|
+
type: ParamType$1.Boolean,
|
|
2900
2900
|
startsHidden: true,
|
|
2901
2901
|
},
|
|
2902
2902
|
{
|
|
2903
2903
|
title: 'Admin?',
|
|
2904
2904
|
param: 'isAdmin',
|
|
2905
|
-
type: ParamType$
|
|
2905
|
+
type: ParamType$1.Boolean,
|
|
2906
2906
|
startsHidden: true,
|
|
2907
2907
|
},
|
|
2908
2908
|
{
|
|
2909
2909
|
title: 'Course Canvas Id',
|
|
2910
2910
|
param: 'courseId',
|
|
2911
|
-
type: ParamType$
|
|
2911
|
+
type: ParamType$1.Int,
|
|
2912
2912
|
startsHidden: true,
|
|
2913
2913
|
},
|
|
2914
2914
|
{
|
|
2915
2915
|
title: 'Course Name',
|
|
2916
2916
|
param: 'courseName',
|
|
2917
|
-
type: ParamType$
|
|
2917
|
+
type: ParamType$1.String,
|
|
2918
2918
|
},
|
|
2919
2919
|
{
|
|
2920
2920
|
title: 'Browser Name',
|
|
2921
2921
|
param: 'browser.name',
|
|
2922
|
-
type: ParamType$
|
|
2922
|
+
type: ParamType$1.String,
|
|
2923
2923
|
startsHidden: true,
|
|
2924
2924
|
},
|
|
2925
2925
|
{
|
|
2926
2926
|
title: 'Browser Version',
|
|
2927
2927
|
param: 'browser.version',
|
|
2928
|
-
type: ParamType$
|
|
2928
|
+
type: ParamType$1.String,
|
|
2929
2929
|
startsHidden: true,
|
|
2930
2930
|
},
|
|
2931
2931
|
{
|
|
2932
2932
|
title: 'OS',
|
|
2933
2933
|
param: 'device.os',
|
|
2934
|
-
type: ParamType$
|
|
2934
|
+
type: ParamType$1.String,
|
|
2935
2935
|
startsHidden: true,
|
|
2936
2936
|
},
|
|
2937
2937
|
{
|
|
2938
2938
|
title: 'Mobile?',
|
|
2939
2939
|
param: 'device.isMobile',
|
|
2940
|
-
type: ParamType$
|
|
2940
|
+
type: ParamType$1.Boolean,
|
|
2941
2941
|
startsHidden: true,
|
|
2942
2942
|
},
|
|
2943
2943
|
{
|
|
2944
2944
|
title: 'Year',
|
|
2945
2945
|
param: 'year',
|
|
2946
|
-
type: ParamType$
|
|
2946
|
+
type: ParamType$1.Int,
|
|
2947
2947
|
},
|
|
2948
2948
|
{
|
|
2949
2949
|
title: 'Month',
|
|
2950
2950
|
param: 'month',
|
|
2951
|
-
type: ParamType$
|
|
2951
|
+
type: ParamType$1.Int,
|
|
2952
2952
|
},
|
|
2953
2953
|
{
|
|
2954
2954
|
title: 'Day',
|
|
2955
2955
|
param: 'day',
|
|
2956
|
-
type: ParamType$
|
|
2956
|
+
type: ParamType$1.Int,
|
|
2957
2957
|
},
|
|
2958
2958
|
{
|
|
2959
2959
|
title: 'Hour',
|
|
2960
2960
|
param: 'hour',
|
|
2961
|
-
type: ParamType$
|
|
2961
|
+
type: ParamType$1.Int,
|
|
2962
2962
|
},
|
|
2963
2963
|
{
|
|
2964
2964
|
title: 'Minute',
|
|
2965
2965
|
param: 'minute',
|
|
2966
|
-
type: ParamType$
|
|
2966
|
+
type: ParamType$1.Int,
|
|
2967
2967
|
startsHidden: true,
|
|
2968
2968
|
},
|
|
2969
2969
|
{
|
|
2970
2970
|
title: 'Timestamp',
|
|
2971
2971
|
param: 'timestamp',
|
|
2972
|
-
type: ParamType$
|
|
2972
|
+
type: ParamType$1.Int,
|
|
2973
2973
|
startsHidden: true,
|
|
2974
2974
|
},
|
|
2975
2975
|
{
|
|
2976
2976
|
title: 'Context',
|
|
2977
2977
|
param: 'context',
|
|
2978
|
-
type: ParamType$
|
|
2978
|
+
type: ParamType$1.String,
|
|
2979
2979
|
},
|
|
2980
2980
|
{
|
|
2981
2981
|
title: 'Subcontext',
|
|
2982
2982
|
param: 'subcontext',
|
|
2983
|
-
type: ParamType$
|
|
2983
|
+
type: ParamType$1.String,
|
|
2984
2984
|
},
|
|
2985
2985
|
{
|
|
2986
2986
|
title: 'Tags',
|
|
2987
2987
|
param: 'tags',
|
|
2988
|
-
type: ParamType$
|
|
2988
|
+
type: ParamType$1.JSON,
|
|
2989
2989
|
startsHidden: true,
|
|
2990
2990
|
},
|
|
2991
2991
|
{
|
|
2992
2992
|
title: 'Log Level',
|
|
2993
2993
|
param: 'level',
|
|
2994
|
-
type: ParamType$
|
|
2994
|
+
type: ParamType$1.String,
|
|
2995
2995
|
startsHidden: true,
|
|
2996
2996
|
},
|
|
2997
2997
|
{
|
|
2998
2998
|
title: 'Metadata',
|
|
2999
2999
|
param: 'metadata',
|
|
3000
|
-
type: ParamType$
|
|
3000
|
+
type: ParamType$1.JSON,
|
|
3001
3001
|
startsHidden: true,
|
|
3002
3002
|
},
|
|
3003
3003
|
{
|
|
3004
3004
|
title: 'Source',
|
|
3005
3005
|
param: 'source',
|
|
3006
|
-
type: ParamType$
|
|
3006
|
+
type: ParamType$1.String,
|
|
3007
3007
|
},
|
|
3008
3008
|
{
|
|
3009
3009
|
title: 'Server Route Path',
|
|
3010
3010
|
param: 'routePath',
|
|
3011
|
-
type: ParamType$
|
|
3011
|
+
type: ParamType$1.String,
|
|
3012
3012
|
startsHidden: true,
|
|
3013
3013
|
},
|
|
3014
3014
|
{
|
|
3015
3015
|
title: 'Server Route Template',
|
|
3016
3016
|
param: 'routeTemplate',
|
|
3017
|
-
type: ParamType$
|
|
3017
|
+
type: ParamType$1.String,
|
|
3018
3018
|
startsHidden: true,
|
|
3019
3019
|
},
|
|
3020
3020
|
{
|
|
3021
3021
|
title: 'Type',
|
|
3022
3022
|
param: 'type',
|
|
3023
|
-
type: ParamType$
|
|
3023
|
+
type: ParamType$1.String,
|
|
3024
3024
|
},
|
|
3025
3025
|
{
|
|
3026
3026
|
title: 'Error Message',
|
|
3027
3027
|
param: 'errorMessage',
|
|
3028
|
-
type: ParamType$
|
|
3028
|
+
type: ParamType$1.String,
|
|
3029
3029
|
startsHidden: true,
|
|
3030
3030
|
},
|
|
3031
3031
|
{
|
|
3032
3032
|
title: 'Error Code',
|
|
3033
3033
|
param: 'errorCode',
|
|
3034
|
-
type: ParamType$
|
|
3034
|
+
type: ParamType$1.String,
|
|
3035
3035
|
startsHidden: true,
|
|
3036
3036
|
},
|
|
3037
3037
|
{
|
|
3038
3038
|
title: 'Error Stack',
|
|
3039
3039
|
param: 'errorStack',
|
|
3040
|
-
type: ParamType$
|
|
3040
|
+
type: ParamType$1.String,
|
|
3041
3041
|
startsHidden: true,
|
|
3042
3042
|
},
|
|
3043
3043
|
{
|
|
3044
3044
|
title: 'Action Target',
|
|
3045
3045
|
param: 'target',
|
|
3046
|
-
type: ParamType$
|
|
3046
|
+
type: ParamType$1.String,
|
|
3047
3047
|
startsHidden: true,
|
|
3048
3048
|
},
|
|
3049
3049
|
{
|
|
3050
3050
|
title: 'Action Type',
|
|
3051
3051
|
param: 'action',
|
|
3052
|
-
type: ParamType$
|
|
3052
|
+
type: ParamType$1.String,
|
|
3053
3053
|
startsHidden: true,
|
|
3054
3054
|
},
|
|
3055
3055
|
];
|
|
@@ -3115,7 +3115,7 @@ const genHumanReadableName = (machineReadableName) => {
|
|
|
3115
3115
|
};
|
|
3116
3116
|
/* ------------- Actions ------------ */
|
|
3117
3117
|
// Types of actions
|
|
3118
|
-
var ActionType$
|
|
3118
|
+
var ActionType$3;
|
|
3119
3119
|
(function (ActionType) {
|
|
3120
3120
|
// Show the loading bar
|
|
3121
3121
|
ActionType["StartLoading"] = "start-loading";
|
|
@@ -3137,7 +3137,7 @@ var ActionType$4;
|
|
|
3137
3137
|
ActionType["UpdateActionErrorFilterState"] = "update-action-error-filter-state";
|
|
3138
3138
|
// Update the advanced filter state
|
|
3139
3139
|
ActionType["UpdateAdvancedFilterState"] = "update-advanced-filter-state";
|
|
3140
|
-
})(ActionType$
|
|
3140
|
+
})(ActionType$3 || (ActionType$3 = {}));
|
|
3141
3141
|
/**
|
|
3142
3142
|
* Reducer that executes actions
|
|
3143
3143
|
* @author Gabe Abrams
|
|
@@ -3146,36 +3146,36 @@ var ActionType$4;
|
|
|
3146
3146
|
*/
|
|
3147
3147
|
const reducer$3 = (state, action) => {
|
|
3148
3148
|
switch (action.type) {
|
|
3149
|
-
case ActionType$
|
|
3149
|
+
case ActionType$3.StartLoading: {
|
|
3150
3150
|
return Object.assign(Object.assign({}, state), { loading: true });
|
|
3151
3151
|
}
|
|
3152
|
-
case ActionType$
|
|
3152
|
+
case ActionType$3.FinishLoading: {
|
|
3153
3153
|
return Object.assign(Object.assign({}, state), { loading: false, logMap: action.logMap });
|
|
3154
3154
|
}
|
|
3155
|
-
case ActionType$
|
|
3155
|
+
case ActionType$3.ToggleFilterDrawer: {
|
|
3156
3156
|
return Object.assign(Object.assign({}, state), { expandedFilterDrawer: (state.expandedFilterDrawer === action.filterDrawer
|
|
3157
3157
|
? undefined // hide
|
|
3158
3158
|
: action.filterDrawer) });
|
|
3159
3159
|
}
|
|
3160
|
-
case ActionType$
|
|
3160
|
+
case ActionType$3.HideFilterDrawer: {
|
|
3161
3161
|
return Object.assign(Object.assign({}, state), { expandedFilterDrawer: undefined });
|
|
3162
3162
|
}
|
|
3163
|
-
case ActionType$
|
|
3163
|
+
case ActionType$3.ResetFilters: {
|
|
3164
3164
|
return Object.assign(Object.assign({}, state), { dateFilterState: action.initDateFilterState, contextFilterState: action.initContextFilterState, tagFilterState: action.initTagFilterState, actionErrorFilterState: action.initActionErrorFilterState, advancedFilterState: action.initAdvancedFilterState });
|
|
3165
3165
|
}
|
|
3166
|
-
case ActionType$
|
|
3166
|
+
case ActionType$3.UpdateDateFilterState: {
|
|
3167
3167
|
return Object.assign(Object.assign({}, state), { dateFilterState: action.dateFilterState });
|
|
3168
3168
|
}
|
|
3169
|
-
case ActionType$
|
|
3169
|
+
case ActionType$3.UpdateContextFilterState: {
|
|
3170
3170
|
return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
|
|
3171
3171
|
}
|
|
3172
|
-
case ActionType$
|
|
3172
|
+
case ActionType$3.UpdateTagFilterState: {
|
|
3173
3173
|
return Object.assign(Object.assign({}, state), { tagFilterState: action.tagFilterState });
|
|
3174
3174
|
}
|
|
3175
|
-
case ActionType$
|
|
3175
|
+
case ActionType$3.UpdateActionErrorFilterState: {
|
|
3176
3176
|
return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
|
|
3177
3177
|
}
|
|
3178
|
-
case ActionType$
|
|
3178
|
+
case ActionType$3.UpdateAdvancedFilterState: {
|
|
3179
3179
|
return Object.assign(Object.assign({}, state), { advancedFilterState: action.advancedFilterState });
|
|
3180
3180
|
}
|
|
3181
3181
|
default: {
|
|
@@ -3352,10 +3352,10 @@ const LogReviewer = (props) => {
|
|
|
3352
3352
|
* @author Gabe Abrams
|
|
3353
3353
|
* @param newDateFilterState the new date filter state
|
|
3354
3354
|
*/
|
|
3355
|
-
const handleDateRangeUpdated = (newDateFilterState) => __awaiter
|
|
3355
|
+
const handleDateRangeUpdated = (newDateFilterState) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3356
3356
|
// Update state
|
|
3357
3357
|
dispatch({
|
|
3358
|
-
type: ActionType$
|
|
3358
|
+
type: ActionType$3.UpdateDateFilterState,
|
|
3359
3359
|
dateFilterState: newDateFilterState,
|
|
3360
3360
|
});
|
|
3361
3361
|
// Check which year/month combos we need to load
|
|
@@ -3366,7 +3366,7 @@ const LogReviewer = (props) => {
|
|
|
3366
3366
|
}
|
|
3367
3367
|
// Start loading
|
|
3368
3368
|
dispatch({
|
|
3369
|
-
type: ActionType$
|
|
3369
|
+
type: ActionType$3.StartLoading,
|
|
3370
3370
|
});
|
|
3371
3371
|
// Load required months
|
|
3372
3372
|
try {
|
|
@@ -3374,7 +3374,7 @@ const LogReviewer = (props) => {
|
|
|
3374
3374
|
// Destructure
|
|
3375
3375
|
const { year, month } = toLoad[i];
|
|
3376
3376
|
// Load
|
|
3377
|
-
const logs = yield visitServerEndpoint
|
|
3377
|
+
const logs = yield visitServerEndpoint({
|
|
3378
3378
|
path: `${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/${year}/months/${month}`,
|
|
3379
3379
|
method: 'GET',
|
|
3380
3380
|
});
|
|
@@ -3386,11 +3386,11 @@ const LogReviewer = (props) => {
|
|
|
3386
3386
|
}
|
|
3387
3387
|
}
|
|
3388
3388
|
catch (err) {
|
|
3389
|
-
return showFatalError
|
|
3389
|
+
return showFatalError(err);
|
|
3390
3390
|
}
|
|
3391
3391
|
// Finish loading
|
|
3392
3392
|
dispatch({
|
|
3393
|
-
type: ActionType$
|
|
3393
|
+
type: ActionType$3.FinishLoading,
|
|
3394
3394
|
logMap,
|
|
3395
3395
|
});
|
|
3396
3396
|
});
|
|
@@ -3416,7 +3416,7 @@ const LogReviewer = (props) => {
|
|
|
3416
3416
|
/* ------------- Loading ------------ */
|
|
3417
3417
|
if (loading) {
|
|
3418
3418
|
body = (React__default.createElement("div", { className: "text-center p-5" },
|
|
3419
|
-
React__default.createElement(LoadingSpinner
|
|
3419
|
+
React__default.createElement(LoadingSpinner, null)));
|
|
3420
3420
|
}
|
|
3421
3421
|
/* ------------ Review UI ----------- */
|
|
3422
3422
|
if (!loading) {
|
|
@@ -3429,7 +3429,7 @@ const LogReviewer = (props) => {
|
|
|
3429
3429
|
React__default.createElement("div", { className: "LogReviewer-filter-toggle-buttons alert alert-secondary p-2 m-0" },
|
|
3430
3430
|
React__default.createElement("button", { type: "button", id: "LogReviewer-toggle-date-filter-drawer", className: `btn btn-${FilterDrawer.Date === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle date filter drawer", onClick: () => {
|
|
3431
3431
|
dispatch({
|
|
3432
|
-
type: ActionType$
|
|
3432
|
+
type: ActionType$3.ToggleFilterDrawer,
|
|
3433
3433
|
filterDrawer: FilterDrawer.Date,
|
|
3434
3434
|
});
|
|
3435
3435
|
} },
|
|
@@ -3437,7 +3437,7 @@ const LogReviewer = (props) => {
|
|
|
3437
3437
|
"Date"),
|
|
3438
3438
|
React__default.createElement("button", { type: "button", id: "LogReviewer-toggle-context-filter-drawer", className: `btn btn-${FilterDrawer.Context === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle context filter drawer", onClick: () => {
|
|
3439
3439
|
dispatch({
|
|
3440
|
-
type: ActionType$
|
|
3440
|
+
type: ActionType$3.ToggleFilterDrawer,
|
|
3441
3441
|
filterDrawer: FilterDrawer.Context,
|
|
3442
3442
|
});
|
|
3443
3443
|
} },
|
|
@@ -3445,7 +3445,7 @@ const LogReviewer = (props) => {
|
|
|
3445
3445
|
"Context"),
|
|
3446
3446
|
(LogMetadata.Tag && Object.keys(LogMetadata.Tag).length > 0) && (React__default.createElement("button", { type: "button", id: "LogReviewer-toggle-tag-filter-drawer", className: `btn btn-${FilterDrawer.Tag === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle tag filter drawer", onClick: () => {
|
|
3447
3447
|
dispatch({
|
|
3448
|
-
type: ActionType$
|
|
3448
|
+
type: ActionType$3.ToggleFilterDrawer,
|
|
3449
3449
|
filterDrawer: FilterDrawer.Tag,
|
|
3450
3450
|
});
|
|
3451
3451
|
} },
|
|
@@ -3453,7 +3453,7 @@ const LogReviewer = (props) => {
|
|
|
3453
3453
|
"Tag")),
|
|
3454
3454
|
React__default.createElement("button", { type: "button", id: "LogReviewer-toggle-action-filter-drawer", className: `btn btn-${FilterDrawer.Action === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle action and error filter drawer", onClick: () => {
|
|
3455
3455
|
dispatch({
|
|
3456
|
-
type: ActionType$
|
|
3456
|
+
type: ActionType$3.ToggleFilterDrawer,
|
|
3457
3457
|
filterDrawer: FilterDrawer.Action,
|
|
3458
3458
|
});
|
|
3459
3459
|
} },
|
|
@@ -3461,7 +3461,7 @@ const LogReviewer = (props) => {
|
|
|
3461
3461
|
"Action"),
|
|
3462
3462
|
React__default.createElement("button", { type: "button", id: "LogReviewer-toggle-advanced-filter-drawer", className: `btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle advanced filter drawer", onClick: () => {
|
|
3463
3463
|
dispatch({
|
|
3464
|
-
type: ActionType$
|
|
3464
|
+
type: ActionType$3.ToggleFilterDrawer,
|
|
3465
3465
|
filterDrawer: FilterDrawer.Advanced,
|
|
3466
3466
|
});
|
|
3467
3467
|
} },
|
|
@@ -3469,7 +3469,7 @@ const LogReviewer = (props) => {
|
|
|
3469
3469
|
"Advanced"),
|
|
3470
3470
|
React__default.createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
|
|
3471
3471
|
dispatch({
|
|
3472
|
-
type: ActionType$
|
|
3472
|
+
type: ActionType$3.ResetFilters,
|
|
3473
3473
|
initActionErrorFilterState,
|
|
3474
3474
|
initAdvancedFilterState,
|
|
3475
3475
|
initContextFilterState,
|
|
@@ -3499,7 +3499,7 @@ const LogReviewer = (props) => {
|
|
|
3499
3499
|
|| (year === dateFilterState.startDate.year
|
|
3500
3500
|
&& month === dateFilterState.startDate.month
|
|
3501
3501
|
&& day < dateFilterState.startDate.day)) {
|
|
3502
|
-
return alert$
|
|
3502
|
+
return alert$1('Invalid Start Date', 'The start date cannot be before the end date.');
|
|
3503
3503
|
}
|
|
3504
3504
|
dateFilterState.endDate = { month, day, year };
|
|
3505
3505
|
handleDateRangeUpdated(dateFilterState);
|
|
@@ -3591,7 +3591,7 @@ const LogReviewer = (props) => {
|
|
|
3591
3591
|
}
|
|
3592
3592
|
});
|
|
3593
3593
|
dispatch({
|
|
3594
|
-
type: ActionType$
|
|
3594
|
+
type: ActionType$3.UpdateContextFilterState,
|
|
3595
3595
|
contextFilterState,
|
|
3596
3596
|
});
|
|
3597
3597
|
} }));
|
|
@@ -3603,10 +3603,10 @@ const LogReviewer = (props) => {
|
|
|
3603
3603
|
React__default.createElement("div", { className: "d-flex gap-1 flex-wrap" }, Object.keys((_d = LogMetadata.Tag) !== null && _d !== void 0 ? _d : {})
|
|
3604
3604
|
.map((tag) => {
|
|
3605
3605
|
const description = genHumanReadableName(tag);
|
|
3606
|
-
return (React__default.createElement(CheckboxButton
|
|
3606
|
+
return (React__default.createElement(CheckboxButton, { key: tag, id: `LogReviewer-tag-${tag}-checkbox`, text: description, ariaLabel: `require that logs be tagged with "${description}" or any other selected tag`, checked: tagFilterState[tag], onChanged: (checked) => {
|
|
3607
3607
|
tagFilterState[tag] = checked;
|
|
3608
3608
|
dispatch({
|
|
3609
|
-
type: ActionType$
|
|
3609
|
+
type: ActionType$3.UpdateTagFilterState,
|
|
3610
3610
|
tagFilterState,
|
|
3611
3611
|
});
|
|
3612
3612
|
} }));
|
|
@@ -3616,47 +3616,47 @@ const LogReviewer = (props) => {
|
|
|
3616
3616
|
// Create filter UI
|
|
3617
3617
|
filterDrawer = (React__default.createElement(React__default.Fragment, null,
|
|
3618
3618
|
React__default.createElement(TabBox, { title: "Log Type" },
|
|
3619
|
-
React__default.createElement(RadioButton
|
|
3619
|
+
React__default.createElement(RadioButton, { id: "LogReviewer-type-all", text: "All Logs", onSelected: () => {
|
|
3620
3620
|
actionErrorFilterState.type = undefined;
|
|
3621
3621
|
dispatch({
|
|
3622
|
-
type: ActionType$
|
|
3622
|
+
type: ActionType$3.UpdateActionErrorFilterState,
|
|
3623
3623
|
actionErrorFilterState,
|
|
3624
3624
|
});
|
|
3625
3625
|
}, ariaLabel: "show logs of all types", selected: actionErrorFilterState.type === undefined }),
|
|
3626
|
-
React__default.createElement(RadioButton
|
|
3626
|
+
React__default.createElement(RadioButton, { id: "LogReviewer-type-action-only", text: "Action Logs Only", onSelected: () => {
|
|
3627
3627
|
actionErrorFilterState.type = LogType$1.Action;
|
|
3628
3628
|
dispatch({
|
|
3629
|
-
type: ActionType$
|
|
3629
|
+
type: ActionType$3.UpdateActionErrorFilterState,
|
|
3630
3630
|
actionErrorFilterState,
|
|
3631
3631
|
});
|
|
3632
3632
|
}, ariaLabel: "only show action logs", selected: actionErrorFilterState.type === LogType$1.Action }),
|
|
3633
|
-
React__default.createElement(RadioButton
|
|
3633
|
+
React__default.createElement(RadioButton, { id: "LogReviewer-type-error-only", text: "Action Error Only", onSelected: () => {
|
|
3634
3634
|
actionErrorFilterState.type = LogType$1.Error;
|
|
3635
3635
|
dispatch({
|
|
3636
|
-
type: ActionType$
|
|
3636
|
+
type: ActionType$3.UpdateActionErrorFilterState,
|
|
3637
3637
|
actionErrorFilterState,
|
|
3638
3638
|
});
|
|
3639
3639
|
}, ariaLabel: "only show error logs", selected: actionErrorFilterState.type === LogType$1.Error, noMarginOnRight: true })),
|
|
3640
3640
|
(actionErrorFilterState.type === undefined
|
|
3641
3641
|
|| actionErrorFilterState.type === LogType$1.Action) && (React__default.createElement(TabBox, { title: "Action Log Details" },
|
|
3642
|
-
React__default.createElement(ButtonInputGroup
|
|
3642
|
+
React__default.createElement(ButtonInputGroup, { label: "Action", className: "mb-2", wrapButtonsAndAddGaps: true }, Object.keys(LogAction$1)
|
|
3643
3643
|
.map((action) => {
|
|
3644
3644
|
const description = genHumanReadableName(action);
|
|
3645
|
-
return (React__default.createElement(CheckboxButton
|
|
3645
|
+
return (React__default.createElement(CheckboxButton, { key: action, id: `LogReviewer-action-${action}-checkbox`, text: description, ariaLabel: `include logs with action type "${description}" in results`, noMarginOnRight: true, checked: actionErrorFilterState.action[action], onChanged: (checked) => {
|
|
3646
3646
|
actionErrorFilterState.action[action] = checked;
|
|
3647
3647
|
dispatch({
|
|
3648
|
-
type: ActionType$
|
|
3648
|
+
type: ActionType$3.UpdateActionErrorFilterState,
|
|
3649
3649
|
actionErrorFilterState,
|
|
3650
3650
|
});
|
|
3651
3651
|
} }));
|
|
3652
3652
|
})),
|
|
3653
|
-
React__default.createElement(ButtonInputGroup
|
|
3653
|
+
React__default.createElement(ButtonInputGroup, { label: "Target", wrapButtonsAndAddGaps: true }, Object.keys(targetMap)
|
|
3654
3654
|
.map((target) => {
|
|
3655
3655
|
const description = genHumanReadableName(target);
|
|
3656
|
-
return (React__default.createElement(CheckboxButton
|
|
3656
|
+
return (React__default.createElement(CheckboxButton, { key: target, id: `LogReviewer-target-${target}-checkbox`, text: description, ariaLabel: `include logs with target "${description}" in results`, checked: actionErrorFilterState.target[target], noMarginOnRight: true, onChanged: (checked) => {
|
|
3657
3657
|
actionErrorFilterState.target[target] = checked;
|
|
3658
3658
|
dispatch({
|
|
3659
|
-
type: ActionType$
|
|
3659
|
+
type: ActionType$3.UpdateActionErrorFilterState,
|
|
3660
3660
|
actionErrorFilterState,
|
|
3661
3661
|
});
|
|
3662
3662
|
} }));
|
|
@@ -3668,7 +3668,7 @@ const LogReviewer = (props) => {
|
|
|
3668
3668
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for error message", value: actionErrorFilterState.errorMessage, placeholder: "e.g. undefined is not a function", onChange: (e) => {
|
|
3669
3669
|
actionErrorFilterState.errorMessage = e.target.value;
|
|
3670
3670
|
dispatch({
|
|
3671
|
-
type: ActionType$
|
|
3671
|
+
type: ActionType$3.UpdateActionErrorFilterState,
|
|
3672
3672
|
actionErrorFilterState,
|
|
3673
3673
|
});
|
|
3674
3674
|
} })),
|
|
@@ -3679,7 +3679,7 @@ const LogReviewer = (props) => {
|
|
|
3679
3679
|
.trim()
|
|
3680
3680
|
.toUpperCase());
|
|
3681
3681
|
dispatch({
|
|
3682
|
-
type: ActionType$
|
|
3682
|
+
type: ActionType$3.UpdateActionErrorFilterState,
|
|
3683
3683
|
actionErrorFilterState,
|
|
3684
3684
|
});
|
|
3685
3685
|
} }))))));
|
|
@@ -3693,7 +3693,7 @@ const LogReviewer = (props) => {
|
|
|
3693
3693
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user first name", value: advancedFilterState.userFirstName, placeholder: "e.g. Divardo", onChange: (e) => {
|
|
3694
3694
|
advancedFilterState.userFirstName = e.target.value;
|
|
3695
3695
|
dispatch({
|
|
3696
|
-
type: ActionType$
|
|
3696
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3697
3697
|
advancedFilterState,
|
|
3698
3698
|
});
|
|
3699
3699
|
} })),
|
|
@@ -3702,7 +3702,7 @@ const LogReviewer = (props) => {
|
|
|
3702
3702
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user last name", value: advancedFilterState.userLastName, placeholder: "e.g. Calicci", onChange: (e) => {
|
|
3703
3703
|
advancedFilterState.userLastName = e.target.value;
|
|
3704
3704
|
dispatch({
|
|
3705
|
-
type: ActionType$
|
|
3705
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3706
3706
|
advancedFilterState,
|
|
3707
3707
|
});
|
|
3708
3708
|
} })),
|
|
@@ -3712,7 +3712,7 @@ const LogReviewer = (props) => {
|
|
|
3712
3712
|
advancedFilterState.userEmail = ((e.target.value)
|
|
3713
3713
|
.trim());
|
|
3714
3714
|
dispatch({
|
|
3715
|
-
type: ActionType$
|
|
3715
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3716
3716
|
advancedFilterState,
|
|
3717
3717
|
});
|
|
3718
3718
|
} })),
|
|
@@ -3726,29 +3726,29 @@ const LogReviewer = (props) => {
|
|
|
3726
3726
|
.trim());
|
|
3727
3727
|
}
|
|
3728
3728
|
dispatch({
|
|
3729
|
-
type: ActionType$
|
|
3729
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3730
3730
|
advancedFilterState,
|
|
3731
3731
|
});
|
|
3732
3732
|
} })),
|
|
3733
|
-
React__default.createElement(ButtonInputGroup
|
|
3734
|
-
React__default.createElement(CheckboxButton
|
|
3733
|
+
React__default.createElement(ButtonInputGroup, { label: "Role" },
|
|
3734
|
+
React__default.createElement(CheckboxButton, { text: "Students", onChanged: (checked) => {
|
|
3735
3735
|
advancedFilterState.includeLearners = checked;
|
|
3736
3736
|
dispatch({
|
|
3737
|
-
type: ActionType$
|
|
3737
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3738
3738
|
advancedFilterState,
|
|
3739
3739
|
});
|
|
3740
3740
|
}, checked: advancedFilterState.includeLearners, ariaLabel: "show logs from students" }),
|
|
3741
|
-
React__default.createElement(CheckboxButton
|
|
3741
|
+
React__default.createElement(CheckboxButton, { text: "Teaching Team Members", onChanged: (checked) => {
|
|
3742
3742
|
advancedFilterState.includeTTMs = checked;
|
|
3743
3743
|
dispatch({
|
|
3744
|
-
type: ActionType$
|
|
3744
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3745
3745
|
advancedFilterState,
|
|
3746
3746
|
});
|
|
3747
3747
|
}, checked: advancedFilterState.includeTTMs, ariaLabel: "show logs from teaching team members" }),
|
|
3748
|
-
React__default.createElement(CheckboxButton
|
|
3748
|
+
React__default.createElement(CheckboxButton, { text: "Admins", onChanged: (checked) => {
|
|
3749
3749
|
advancedFilterState.includeAdmins = checked;
|
|
3750
3750
|
dispatch({
|
|
3751
|
-
type: ActionType$
|
|
3751
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3752
3752
|
advancedFilterState,
|
|
3753
3753
|
});
|
|
3754
3754
|
}, checked: advancedFilterState.includeAdmins, ariaLabel: "show logs from admins" }))),
|
|
@@ -3758,7 +3758,7 @@ const LogReviewer = (props) => {
|
|
|
3758
3758
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for course name", value: advancedFilterState.courseName, placeholder: "e.g. GLC 200", onChange: (e) => {
|
|
3759
3759
|
advancedFilterState.courseName = e.target.value;
|
|
3760
3760
|
dispatch({
|
|
3761
|
-
type: ActionType$
|
|
3761
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3762
3762
|
advancedFilterState,
|
|
3763
3763
|
});
|
|
3764
3764
|
} })),
|
|
@@ -3772,53 +3772,53 @@ const LogReviewer = (props) => {
|
|
|
3772
3772
|
.trim());
|
|
3773
3773
|
}
|
|
3774
3774
|
dispatch({
|
|
3775
|
-
type: ActionType$
|
|
3775
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3776
3776
|
advancedFilterState,
|
|
3777
3777
|
});
|
|
3778
3778
|
} }))),
|
|
3779
3779
|
React__default.createElement(TabBox, { title: "Device" },
|
|
3780
|
-
React__default.createElement(ButtonInputGroup
|
|
3781
|
-
React__default.createElement(RadioButton
|
|
3780
|
+
React__default.createElement(ButtonInputGroup, { label: "Device Type" },
|
|
3781
|
+
React__default.createElement(RadioButton, { text: "All Devices", ariaLabel: "show logs from all devices", selected: advancedFilterState.isMobile === undefined, onSelected: () => {
|
|
3782
3782
|
advancedFilterState.isMobile = undefined;
|
|
3783
3783
|
dispatch({
|
|
3784
|
-
type: ActionType$
|
|
3784
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3785
3785
|
advancedFilterState,
|
|
3786
3786
|
});
|
|
3787
3787
|
} }),
|
|
3788
|
-
React__default.createElement(RadioButton
|
|
3788
|
+
React__default.createElement(RadioButton, { text: "Mobile Only", ariaLabel: "show logs from mobile devices", selected: advancedFilterState.isMobile === true, onSelected: () => {
|
|
3789
3789
|
advancedFilterState.isMobile = true;
|
|
3790
3790
|
dispatch({
|
|
3791
|
-
type: ActionType$
|
|
3791
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3792
3792
|
advancedFilterState,
|
|
3793
3793
|
});
|
|
3794
3794
|
} }),
|
|
3795
|
-
React__default.createElement(RadioButton
|
|
3795
|
+
React__default.createElement(RadioButton, { text: "Desktop Only", ariaLabel: "show logs from desktop devices", selected: advancedFilterState.isMobile === false, onSelected: () => {
|
|
3796
3796
|
advancedFilterState.isMobile = false;
|
|
3797
3797
|
dispatch({
|
|
3798
|
-
type: ActionType$
|
|
3798
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3799
3799
|
advancedFilterState,
|
|
3800
3800
|
});
|
|
3801
3801
|
}, noMarginOnRight: true }))),
|
|
3802
3802
|
React__default.createElement(TabBox, { title: "Source" },
|
|
3803
|
-
React__default.createElement(ButtonInputGroup
|
|
3804
|
-
React__default.createElement(RadioButton
|
|
3803
|
+
React__default.createElement(ButtonInputGroup, { label: "Source Type" },
|
|
3804
|
+
React__default.createElement(RadioButton, { text: "Both", ariaLabel: "show logs from all sources", selected: advancedFilterState.source === undefined, onSelected: () => {
|
|
3805
3805
|
advancedFilterState.source = undefined;
|
|
3806
3806
|
dispatch({
|
|
3807
|
-
type: ActionType$
|
|
3807
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3808
3808
|
advancedFilterState,
|
|
3809
3809
|
});
|
|
3810
3810
|
} }),
|
|
3811
|
-
React__default.createElement(RadioButton
|
|
3811
|
+
React__default.createElement(RadioButton, { text: "Client Only", ariaLabel: "show logs from client source", selected: advancedFilterState.source === LogSource$1.Client, onSelected: () => {
|
|
3812
3812
|
advancedFilterState.source = LogSource$1.Client;
|
|
3813
3813
|
dispatch({
|
|
3814
|
-
type: ActionType$
|
|
3814
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3815
3815
|
advancedFilterState,
|
|
3816
3816
|
});
|
|
3817
3817
|
} }),
|
|
3818
|
-
React__default.createElement(RadioButton
|
|
3818
|
+
React__default.createElement(RadioButton, { text: "Server Only", ariaLabel: "show logs from server source", selected: advancedFilterState.source === LogSource$1.Server, onSelected: () => {
|
|
3819
3819
|
advancedFilterState.source = LogSource$1.Server;
|
|
3820
3820
|
dispatch({
|
|
3821
|
-
type: ActionType$
|
|
3821
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3822
3822
|
advancedFilterState,
|
|
3823
3823
|
});
|
|
3824
3824
|
}, noMarginOnRight: true })),
|
|
@@ -3829,7 +3829,7 @@ const LogReviewer = (props) => {
|
|
|
3829
3829
|
advancedFilterState.courseName = ((e.target.value)
|
|
3830
3830
|
.trim());
|
|
3831
3831
|
dispatch({
|
|
3832
|
-
type: ActionType$
|
|
3832
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3833
3833
|
advancedFilterState,
|
|
3834
3834
|
});
|
|
3835
3835
|
} })),
|
|
@@ -3839,7 +3839,7 @@ const LogReviewer = (props) => {
|
|
|
3839
3839
|
advancedFilterState.courseName = ((e.target.value)
|
|
3840
3840
|
.trim());
|
|
3841
3841
|
dispatch({
|
|
3842
|
-
type: ActionType$
|
|
3842
|
+
type: ActionType$3.UpdateAdvancedFilterState,
|
|
3843
3843
|
advancedFilterState,
|
|
3844
3844
|
});
|
|
3845
3845
|
} })))))));
|
|
@@ -3848,1250 +3848,287 @@ const LogReviewer = (props) => {
|
|
|
3848
3848
|
// Filters UI
|
|
3849
3849
|
const filters = (React__default.createElement(React__default.Fragment, null,
|
|
3850
3850
|
filterToggles,
|
|
3851
|
-
filterDrawer && (React__default.createElement(Drawer, { customBackgroundColor: "#eee" }, filterDrawer))));
|
|
3852
|
-
// Actually filter the logs
|
|
3853
|
-
// > Perform filters
|
|
3854
|
-
const logs = [];
|
|
3855
|
-
Object.keys(logMap).forEach((year) => {
|
|
3856
|
-
Object.keys(logMap[year]).forEach((month) => {
|
|
3857
|
-
logMap[year][month].forEach((log) => {
|
|
3858
|
-
/* ----------- Date Filter ---------- */
|
|
3859
|
-
var _a;
|
|
3860
|
-
// Before start date
|
|
3861
|
-
if (
|
|
3862
|
-
// Previous year
|
|
3863
|
-
log.year < dateFilterState.startDate.year
|
|
3864
|
-
// Same year, earlier month
|
|
3865
|
-
|| ((log.year === dateFilterState.startDate.year)
|
|
3866
|
-
&& (log.month < dateFilterState.startDate.month))
|
|
3867
|
-
// Same year, same month, earlier day
|
|
3868
|
-
|| ((log.year === dateFilterState.startDate.year)
|
|
3869
|
-
&& (log.month === dateFilterState.startDate.month)
|
|
3870
|
-
&& (log.day < dateFilterState.startDate.day))) {
|
|
3871
|
-
return;
|
|
3872
|
-
}
|
|
3873
|
-
// After end date
|
|
3874
|
-
if (
|
|
3875
|
-
// Later year
|
|
3876
|
-
log.year > dateFilterState.endDate.year
|
|
3877
|
-
// Same year, later month
|
|
3878
|
-
|| ((log.year === dateFilterState.endDate.year)
|
|
3879
|
-
&& (log.month > dateFilterState.endDate.month))
|
|
3880
|
-
// Same year, same month, later day
|
|
3881
|
-
|| ((log.year === dateFilterState.endDate.year)
|
|
3882
|
-
&& (log.month === dateFilterState.endDate.month)
|
|
3883
|
-
&& (log.day > dateFilterState.endDate.day))) {
|
|
3884
|
-
return;
|
|
3885
|
-
}
|
|
3886
|
-
/* --------- Context Filter --------- */
|
|
3887
|
-
// Context doesn't match
|
|
3888
|
-
if (
|
|
3889
|
-
// Whole context is deselected
|
|
3890
|
-
contextFilterState[log.context] === false
|
|
3891
|
-
// None of the subcontexts are selected
|
|
3892
|
-
|| (
|
|
3893
|
-
// Has subcontexts
|
|
3894
|
-
typeof contextFilterState[log.context] !== 'boolean'
|
|
3895
|
-
// None of the subcontexts are selected
|
|
3896
|
-
&& Object.values((_a = contextFilterState[log.context]) !== null && _a !== void 0 ? _a : {})
|
|
3897
|
-
.every((isSelected) => {
|
|
3898
|
-
return !isSelected;
|
|
3899
|
-
}))) {
|
|
3900
|
-
return;
|
|
3901
|
-
}
|
|
3902
|
-
// Subcontext doesn't match
|
|
3903
|
-
if (
|
|
3904
|
-
// Log context is not "uncategorized" (no point in further filters)
|
|
3905
|
-
log.context !== LogBuiltInMetadata.Context.Uncategorized
|
|
3906
|
-
// Log has a subcontext
|
|
3907
|
-
&& log.subcontext
|
|
3908
|
-
// Context has subcontexts
|
|
3909
|
-
&& (contextFilterState[log.context]
|
|
3910
|
-
&& contextFilterState[log.context] !== false
|
|
3911
|
-
&& contextFilterState[log.context] !== true)
|
|
3912
|
-
// Subcontext is not selected
|
|
3913
|
-
&& !contextFilterState[log.context][log.subcontext]) {
|
|
3914
|
-
return;
|
|
3915
|
-
}
|
|
3916
|
-
/* -------------- Tags -------------- */
|
|
3917
|
-
// No tags match
|
|
3918
|
-
if (
|
|
3919
|
-
// At least one tag is required
|
|
3920
|
-
Object.values(tagFilterState)
|
|
3921
|
-
.filter((isSelected) => {
|
|
3922
|
-
return isSelected;
|
|
3923
|
-
})
|
|
3924
|
-
.length > 0
|
|
3925
|
-
// No tags match
|
|
3926
|
-
&& log.tags.every((tag) => {
|
|
3927
|
-
return !tagFilterState[tag];
|
|
3928
|
-
})) {
|
|
3929
|
-
return;
|
|
3930
|
-
}
|
|
3931
|
-
/* ------- Actions and Errors ------- */
|
|
3932
|
-
// Log type doesn't match
|
|
3933
|
-
if (
|
|
3934
|
-
// Filter won't allow all types
|
|
3935
|
-
actionErrorFilterState.type !== undefined
|
|
3936
|
-
// Log type doesn't match
|
|
3937
|
-
&& actionErrorFilterState.type !== log.type) {
|
|
3938
|
-
return;
|
|
3939
|
-
}
|
|
3940
|
-
// Filter errors
|
|
3941
|
-
if (log.type === LogType$1.Error) {
|
|
3942
|
-
// Message doesn't match
|
|
3943
|
-
if (
|
|
3944
|
-
// Message exists
|
|
3945
|
-
log.errorMessage
|
|
3946
|
-
// Message filter exists
|
|
3947
|
-
&& actionErrorFilterState.errorMessage.trim().length > 0
|
|
3948
|
-
// Message doesn't match
|
|
3949
|
-
&& log.errorMessage.toLowerCase().includes(actionErrorFilterState.errorMessage.trim().toLowerCase())) {
|
|
3950
|
-
return;
|
|
3951
|
-
}
|
|
3952
|
-
// Code doesn't match
|
|
3953
|
-
if (
|
|
3954
|
-
// Code exists
|
|
3955
|
-
log.errorCode
|
|
3956
|
-
// Code filter exists
|
|
3957
|
-
&& actionErrorFilterState.errorCode.trim().length > 0
|
|
3958
|
-
// Code doesn't match
|
|
3959
|
-
&& log.errorCode.toUpperCase().includes(actionErrorFilterState.errorCode.trim().toUpperCase())) {
|
|
3960
|
-
return;
|
|
3961
|
-
}
|
|
3962
|
-
}
|
|
3963
|
-
// Filter actions
|
|
3964
|
-
if (log.type === LogType$1.Action) {
|
|
3965
|
-
// Target isn't selected
|
|
3966
|
-
if (
|
|
3967
|
-
// Target exists
|
|
3968
|
-
log.target
|
|
3969
|
-
// Target isn't selected
|
|
3970
|
-
&& !actionErrorFilterState.target[log.target]) {
|
|
3971
|
-
return;
|
|
3972
|
-
}
|
|
3973
|
-
// Action
|
|
3974
|
-
if (
|
|
3975
|
-
// Action exists
|
|
3976
|
-
log.action
|
|
3977
|
-
// Action isn't selected
|
|
3978
|
-
&& !actionErrorFilterState.action[log.action]) {
|
|
3979
|
-
return;
|
|
3980
|
-
}
|
|
3981
|
-
}
|
|
3982
|
-
/* --------- Advanced Filter -------- */
|
|
3983
|
-
// First name doesn't match
|
|
3984
|
-
if (
|
|
3985
|
-
// First name exists
|
|
3986
|
-
log.userFirstName
|
|
3987
|
-
// First name query doesn't match
|
|
3988
|
-
&& !log.userFirstName.toLowerCase().includes(advancedFilterState.userFirstName.toLowerCase().trim())) {
|
|
3989
|
-
return;
|
|
3990
|
-
}
|
|
3991
|
-
// Last name doesn't match
|
|
3992
|
-
if (
|
|
3993
|
-
// Last name exists
|
|
3994
|
-
log.userLastName
|
|
3995
|
-
// Last name query doesn't match
|
|
3996
|
-
&& !log.userLastName.toLowerCase().includes(advancedFilterState.userLastName.toLowerCase().trim())) {
|
|
3997
|
-
return;
|
|
3998
|
-
}
|
|
3999
|
-
// Email doesn't match
|
|
4000
|
-
if (
|
|
4001
|
-
// Email exists
|
|
4002
|
-
log.userEmail
|
|
4003
|
-
// Email query doesn't match
|
|
4004
|
-
&& !log.userEmail.toLowerCase().includes(advancedFilterState.userEmail.toLowerCase().trim())) {
|
|
4005
|
-
return;
|
|
4006
|
-
}
|
|
4007
|
-
// User id doesn't match
|
|
4008
|
-
if (
|
|
4009
|
-
// User id exists
|
|
4010
|
-
log.userId
|
|
4011
|
-
// User id doesn't match
|
|
4012
|
-
&& !String(log.userId).includes(advancedFilterState.userId.trim())) {
|
|
4013
|
-
return;
|
|
4014
|
-
}
|
|
4015
|
-
// Learner not allowed
|
|
4016
|
-
if (
|
|
4017
|
-
// User is a learner
|
|
4018
|
-
log.isLearner
|
|
4019
|
-
// Learners aren't included
|
|
4020
|
-
&& !advancedFilterState.includeLearners) {
|
|
4021
|
-
return;
|
|
4022
|
-
}
|
|
4023
|
-
// TTM not allowed
|
|
4024
|
-
if (
|
|
4025
|
-
// User is a ttm
|
|
4026
|
-
log.isTTM
|
|
4027
|
-
// TTMs aren't included
|
|
4028
|
-
&& !advancedFilterState.includeTTMs) {
|
|
4029
|
-
return;
|
|
4030
|
-
}
|
|
4031
|
-
// Admin not allowed
|
|
4032
|
-
if (
|
|
4033
|
-
// User is an admin
|
|
4034
|
-
log.isAdmin
|
|
4035
|
-
// Admins aren't included
|
|
4036
|
-
&& !advancedFilterState.includeAdmins) {
|
|
4037
|
-
return;
|
|
4038
|
-
}
|
|
4039
|
-
// Course Id doesn't match
|
|
4040
|
-
if (
|
|
4041
|
-
// Course Id exists
|
|
4042
|
-
log.courseId
|
|
4043
|
-
// Course Id doesn't match
|
|
4044
|
-
&& !String(log.courseId).includes(advancedFilterState.courseId.trim())) {
|
|
4045
|
-
return;
|
|
4046
|
-
}
|
|
4047
|
-
// Course name doesn't match
|
|
4048
|
-
if (
|
|
4049
|
-
// Course name exists
|
|
4050
|
-
log.courseName
|
|
4051
|
-
// Course name doesn't match
|
|
4052
|
-
&& !String(log.courseName).includes(advancedFilterState.courseName.trim())) {
|
|
4053
|
-
return;
|
|
4054
|
-
}
|
|
4055
|
-
// Mobile filter doesn't match
|
|
4056
|
-
if (
|
|
4057
|
-
// Mobile filter exists
|
|
4058
|
-
advancedFilterState.isMobile !== undefined
|
|
4059
|
-
// Device info exists
|
|
4060
|
-
&& log.device
|
|
4061
|
-
// Mobile filter doesn't match
|
|
4062
|
-
&& (advancedFilterState.isMobile !== log.device.isMobile)) {
|
|
4063
|
-
return;
|
|
4064
|
-
}
|
|
4065
|
-
// Log source doesn't match
|
|
4066
|
-
if (
|
|
4067
|
-
// Source filter exists
|
|
4068
|
-
advancedFilterState.source !== undefined
|
|
4069
|
-
// Source info exists
|
|
4070
|
-
&& log.source
|
|
4071
|
-
// Source filter doesn't match
|
|
4072
|
-
&& (advancedFilterState.source !== log.source)) {
|
|
4073
|
-
return;
|
|
4074
|
-
}
|
|
4075
|
-
// Route path doesn't match (Only for server source)
|
|
4076
|
-
if (
|
|
4077
|
-
// Source is server
|
|
4078
|
-
(log.source === LogSource$1.Server)
|
|
4079
|
-
// Route path is being filtered
|
|
4080
|
-
&& (advancedFilterState.routePath.trim().length)
|
|
4081
|
-
// Route path doesn't match
|
|
4082
|
-
&& !(log.routePath.includes(advancedFilterState.routePath.trim()))) {
|
|
4083
|
-
return;
|
|
4084
|
-
}
|
|
4085
|
-
// Route template doesn't match (Only for server source)
|
|
4086
|
-
if (
|
|
4087
|
-
// Source is server
|
|
4088
|
-
(log.source === LogSource$1.Server)
|
|
4089
|
-
// Route template is being filtered
|
|
4090
|
-
&& (advancedFilterState.routeTemplate.trim().length)
|
|
4091
|
-
// Route template doesn't match
|
|
4092
|
-
&& !(log.routeTemplate.includes(advancedFilterState.routeTemplate.trim()))) {
|
|
4093
|
-
return;
|
|
4094
|
-
}
|
|
4095
|
-
/* -------------- Done -------------- */
|
|
4096
|
-
// Made it past all filters. Add to the list
|
|
4097
|
-
logs.push(log);
|
|
4098
|
-
});
|
|
4099
|
-
});
|
|
4100
|
-
});
|
|
4101
|
-
/*----------------------------------------*/
|
|
4102
|
-
/* Data */
|
|
4103
|
-
/*----------------------------------------*/
|
|
4104
|
-
// Nothing to show notice
|
|
4105
|
-
const noLogsNotice = (logs.length === 0
|
|
4106
|
-
? (React__default.createElement("div", { className: "alert alert-warning text-center mt-2" },
|
|
4107
|
-
React__default.createElement("h4", { className: "m-1" }, "No Logs to Show"),
|
|
4108
|
-
React__default.createElement("div", null, "Either your filters are too strict or no matching logs have been created yet.")))
|
|
4109
|
-
: undefined);
|
|
4110
|
-
// Create intelliTable
|
|
4111
|
-
const dataTable = (React__default.createElement(IntelliTable, { title: "Matching Logs:", csvName: `Logs from ${getHumanReadableDate()}`, id: "logs", data: logs, columns: columns }));
|
|
4112
|
-
// Main body
|
|
4113
|
-
body = (React__default.createElement(React__default.Fragment, null,
|
|
4114
|
-
filters,
|
|
4115
|
-
React__default.createElement("div", { className: "mt-2" },
|
|
4116
|
-
dataTable,
|
|
4117
|
-
noLogsNotice)));
|
|
4118
|
-
}
|
|
4119
|
-
/* ---------- Wrap in Modal --------- */
|
|
4120
|
-
return (React__default.createElement("div", { className: "LogReviewer-outer-container" },
|
|
4121
|
-
React__default.createElement("style", null, style$1),
|
|
4122
|
-
React__default.createElement("div", { className: "LogReviewer-inner-container" },
|
|
4123
|
-
React__default.createElement("div", { className: "LogReviewer-header" },
|
|
4124
|
-
React__default.createElement("div", { className: "LogReviewer-header-title" },
|
|
4125
|
-
React__default.createElement("h3", { className: "text-center m-0" }, "Log Review Dashboard")),
|
|
4126
|
-
React__default.createElement("div", { style: { width: 0 } },
|
|
4127
|
-
React__default.createElement("button", { type: "button", className: "LogReviewer-header-close-button btn btn-dark btn-lg pe-0", "aria-label": "close log reviewer panel", onClick: onClose },
|
|
4128
|
-
React__default.createElement(FontAwesomeIcon, { icon: faTimes })))),
|
|
4129
|
-
React__default.createElement("div", { className: "LogReviewer-contents" }, body))));
|
|
4130
|
-
};
|
|
4131
|
-
|
|
4132
|
-
/******************************************************************************
|
|
4133
|
-
Copyright (c) Microsoft Corporation.
|
|
4134
|
-
|
|
4135
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
4136
|
-
purpose with or without fee is hereby granted.
|
|
4137
|
-
|
|
4138
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
4139
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
4140
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
4141
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
4142
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
4143
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4144
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
4145
|
-
***************************************************************************** */
|
|
4146
|
-
|
|
4147
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
4148
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4149
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4150
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4151
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
4152
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
4153
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
4154
|
-
});
|
|
4155
|
-
}
|
|
4156
|
-
|
|
4157
|
-
// Highest error code = DRK10
|
|
4158
|
-
/**
|
|
4159
|
-
* List of error codes built into the react kit
|
|
4160
|
-
* @author Gabe Abrams
|
|
4161
|
-
*/
|
|
4162
|
-
var ReactKitErrorCode;
|
|
4163
|
-
(function (ReactKitErrorCode) {
|
|
4164
|
-
ReactKitErrorCode["NoResponse"] = "DRK1";
|
|
4165
|
-
ReactKitErrorCode["NoCode"] = "DRK2";
|
|
4166
|
-
ReactKitErrorCode["SessionExpired"] = "DRK3";
|
|
4167
|
-
ReactKitErrorCode["MissingParameter"] = "DRK4";
|
|
4168
|
-
ReactKitErrorCode["InvalidParameter"] = "DRK5";
|
|
4169
|
-
ReactKitErrorCode["WrongCourse"] = "DRK6";
|
|
4170
|
-
ReactKitErrorCode["NoCACCLSendRequestFunction"] = "DRK7";
|
|
4171
|
-
ReactKitErrorCode["NoCACCLGetLaunchInfoFunction"] = "DRK8";
|
|
4172
|
-
ReactKitErrorCode["NotTTM"] = "DRK9";
|
|
4173
|
-
ReactKitErrorCode["NotAdmin"] = "DRK10";
|
|
4174
|
-
})(ReactKitErrorCode || (ReactKitErrorCode = {}));
|
|
4175
|
-
var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
4176
|
-
|
|
4177
|
-
/**
|
|
4178
|
-
* Types of buttons in the modal
|
|
4179
|
-
* @author Gabe Abrams
|
|
4180
|
-
*/
|
|
4181
|
-
var ModalButtonType;
|
|
4182
|
-
(function (ModalButtonType) {
|
|
4183
|
-
ModalButtonType["Okay"] = "okay";
|
|
4184
|
-
ModalButtonType["Cancel"] = "cancel";
|
|
4185
|
-
ModalButtonType["Yes"] = "yes";
|
|
4186
|
-
ModalButtonType["No"] = "no";
|
|
4187
|
-
ModalButtonType["Abandon"] = "abandon";
|
|
4188
|
-
ModalButtonType["GoBack"] = "goBack";
|
|
4189
|
-
ModalButtonType["Continue"] = "continue";
|
|
4190
|
-
ModalButtonType["ImSure"] = "imSure";
|
|
4191
|
-
ModalButtonType["Delete"] = "delete";
|
|
4192
|
-
ModalButtonType["Confirm"] = "confirm";
|
|
4193
|
-
})(ModalButtonType || (ModalButtonType = {}));
|
|
4194
|
-
var ModalButtonType$1 = ModalButtonType;
|
|
4195
|
-
|
|
4196
|
-
/**
|
|
4197
|
-
* Types of modals
|
|
4198
|
-
* @author Gabe Abrams
|
|
4199
|
-
*/
|
|
4200
|
-
var ModalType;
|
|
4201
|
-
(function (ModalType) {
|
|
4202
|
-
ModalType["Okay"] = "okay";
|
|
4203
|
-
ModalType["OkayCancel"] = "okay-cancel";
|
|
4204
|
-
ModalType["YesNo"] = "yes-no";
|
|
4205
|
-
ModalType["YesNoCancel"] = "yes-no-cancel";
|
|
4206
|
-
ModalType["AbandonGoBack"] = "abandon-goBack";
|
|
4207
|
-
ModalType["ImSureCancel"] = "imSure-cancel";
|
|
4208
|
-
ModalType["DeleteCancel"] = "delete-cancel";
|
|
4209
|
-
ModalType["ConfirmCancel"] = "confirm-cancel";
|
|
4210
|
-
ModalType["NoButtons"] = "-";
|
|
4211
|
-
})(ModalType || (ModalType = {}));
|
|
4212
|
-
var ModalType$1 = ModalType;
|
|
4213
|
-
|
|
4214
|
-
/**
|
|
4215
|
-
* Bootstrap variants
|
|
4216
|
-
* @author Gabe Abrams
|
|
4217
|
-
*/
|
|
4218
|
-
var Variant;
|
|
4219
|
-
(function (Variant) {
|
|
4220
|
-
Variant["Primary"] = "primary";
|
|
4221
|
-
Variant["Secondary"] = "secondary";
|
|
4222
|
-
Variant["Success"] = "success";
|
|
4223
|
-
Variant["Warning"] = "warning";
|
|
4224
|
-
Variant["Info"] = "info";
|
|
4225
|
-
Variant["Danger"] = "danger";
|
|
4226
|
-
Variant["Light"] = "light";
|
|
4227
|
-
Variant["Dark"] = "dark";
|
|
4228
|
-
})(Variant || (Variant = {}));
|
|
4229
|
-
var Variant$1 = Variant;
|
|
4230
|
-
|
|
4231
|
-
/**
|
|
4232
|
-
* Modal sizes
|
|
4233
|
-
* @author Gabe Abrams
|
|
4234
|
-
*/
|
|
4235
|
-
var ModalSize;
|
|
4236
|
-
(function (ModalSize) {
|
|
4237
|
-
ModalSize["Small"] = "sm";
|
|
4238
|
-
ModalSize["Medium"] = "md";
|
|
4239
|
-
ModalSize["Large"] = "lg";
|
|
4240
|
-
ModalSize["ExtraLarge"] = "xl";
|
|
4241
|
-
})(ModalSize || (ModalSize = {}));
|
|
4242
|
-
// Modal type to list of buttons
|
|
4243
|
-
({
|
|
4244
|
-
[ModalType$1.Okay]: [
|
|
4245
|
-
ModalButtonType$1.Okay,
|
|
4246
|
-
],
|
|
4247
|
-
[ModalType$1.OkayCancel]: [
|
|
4248
|
-
ModalButtonType$1.Okay,
|
|
4249
|
-
ModalButtonType$1.Cancel,
|
|
4250
|
-
],
|
|
4251
|
-
[ModalType$1.YesNo]: [
|
|
4252
|
-
ModalButtonType$1.Yes,
|
|
4253
|
-
ModalButtonType$1.No,
|
|
4254
|
-
],
|
|
4255
|
-
[ModalType$1.YesNoCancel]: [
|
|
4256
|
-
ModalButtonType$1.Yes,
|
|
4257
|
-
ModalButtonType$1.No,
|
|
4258
|
-
ModalButtonType$1.Cancel,
|
|
4259
|
-
],
|
|
4260
|
-
[ModalType$1.AbandonGoBack]: [
|
|
4261
|
-
ModalButtonType$1.Abandon,
|
|
4262
|
-
ModalButtonType$1.GoBack,
|
|
4263
|
-
],
|
|
4264
|
-
[ModalType$1.ImSureCancel]: [
|
|
4265
|
-
ModalButtonType$1.ImSure,
|
|
4266
|
-
ModalButtonType$1.Cancel,
|
|
4267
|
-
],
|
|
4268
|
-
[ModalType$1.DeleteCancel]: [
|
|
4269
|
-
ModalButtonType$1.Delete,
|
|
4270
|
-
ModalButtonType$1.Cancel,
|
|
4271
|
-
],
|
|
4272
|
-
[ModalType$1.ConfirmCancel]: [
|
|
4273
|
-
ModalButtonType$1.Confirm,
|
|
4274
|
-
ModalButtonType$1.Cancel,
|
|
4275
|
-
],
|
|
4276
|
-
});
|
|
4277
|
-
// Button type styling and labels
|
|
4278
|
-
({
|
|
4279
|
-
[ModalButtonType$1.Okay]: {
|
|
4280
|
-
label: 'Okay',
|
|
4281
|
-
variant: Variant$1.Dark,
|
|
4282
|
-
},
|
|
4283
|
-
[ModalButtonType$1.Cancel]: {
|
|
4284
|
-
label: 'Cancel',
|
|
4285
|
-
variant: Variant$1.Secondary,
|
|
4286
|
-
},
|
|
4287
|
-
[ModalButtonType$1.Yes]: {
|
|
4288
|
-
label: 'Yes',
|
|
4289
|
-
variant: Variant$1.Dark,
|
|
4290
|
-
},
|
|
4291
|
-
[ModalButtonType$1.No]: {
|
|
4292
|
-
label: 'No',
|
|
4293
|
-
variant: Variant$1.Secondary,
|
|
4294
|
-
},
|
|
4295
|
-
[ModalButtonType$1.Abandon]: {
|
|
4296
|
-
label: 'Abandon Changes',
|
|
4297
|
-
variant: Variant$1.Warning,
|
|
4298
|
-
},
|
|
4299
|
-
[ModalButtonType$1.GoBack]: {
|
|
4300
|
-
label: 'Go Back',
|
|
4301
|
-
variant: Variant$1.Secondary,
|
|
4302
|
-
},
|
|
4303
|
-
[ModalButtonType$1.Continue]: {
|
|
4304
|
-
label: 'Continue',
|
|
4305
|
-
variant: Variant$1.Dark,
|
|
4306
|
-
},
|
|
4307
|
-
[ModalButtonType$1.ImSure]: {
|
|
4308
|
-
label: 'I am sure',
|
|
4309
|
-
variant: Variant$1.Warning,
|
|
4310
|
-
},
|
|
4311
|
-
[ModalButtonType$1.Delete]: {
|
|
4312
|
-
label: 'Yes, Delete',
|
|
4313
|
-
variant: Variant$1.Danger,
|
|
4314
|
-
},
|
|
4315
|
-
[ModalButtonType$1.Confirm]: {
|
|
4316
|
-
label: 'Confirm',
|
|
4317
|
-
variant: Variant$1.Dark,
|
|
4318
|
-
},
|
|
4319
|
-
});
|
|
4320
|
-
|
|
4321
|
-
/**
|
|
4322
|
-
* An error with a code
|
|
4323
|
-
* @author Gabe Abrams
|
|
4324
|
-
*/
|
|
4325
|
-
class ErrorWithCode extends Error {
|
|
4326
|
-
constructor(message, code) {
|
|
4327
|
-
super(message);
|
|
4328
|
-
this.name = 'ErrorWithCode';
|
|
4329
|
-
this.code = code;
|
|
4330
|
-
}
|
|
4331
|
-
}
|
|
4332
|
-
/**
|
|
4333
|
-
* Send a request using caccl's send request feature
|
|
4334
|
-
* @author Gabe Abrams
|
|
4335
|
-
* @param opts send request options
|
|
4336
|
-
* @returns send request response
|
|
4337
|
-
*/
|
|
4338
|
-
const cacclSendRequest = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4339
|
-
// Make sure send request has been passed in
|
|
4340
|
-
{
|
|
4341
|
-
throw new ErrorWithCode(`\nThe request could not be sent because the AppWrapper component does not have a copy of sendRequest from CACCL.\nIf you are currently writing tests for your app, this means you did not properly stub the server response.\nMethod: ${opts.method}\nPath: ${opts.path}\n\n`, ReactKitErrorCode$1.NoCACCLSendRequestFunction);
|
|
4342
|
-
}
|
|
4343
|
-
});
|
|
4344
|
-
/**
|
|
4345
|
-
* Show an alert modal with an "Okay" button
|
|
4346
|
-
* @author Gabe Abrams
|
|
4347
|
-
* @param title the title text to display at the top of the alert
|
|
4348
|
-
* @param text the text to display in the alert
|
|
4349
|
-
*/
|
|
4350
|
-
const alert$1 = (title, text) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4351
|
-
// Fallback if alert not available
|
|
4352
|
-
{
|
|
4353
|
-
window.alert(`${title}\n\n${text}`);
|
|
4354
|
-
return undefined;
|
|
4355
|
-
}
|
|
4356
|
-
});
|
|
4357
|
-
/**
|
|
4358
|
-
* Show a fatal error message
|
|
4359
|
-
* @author Gabe Abrams
|
|
4360
|
-
* @param error the error to show
|
|
4361
|
-
* @param [errorTitle] title of the error box
|
|
4362
|
-
*/
|
|
4363
|
-
const showFatalError = (error, errorTitle = 'An Error Occurred') => {
|
|
4364
|
-
var _a, _b;
|
|
4365
|
-
// Determine message and code
|
|
4366
|
-
const message = (typeof error === 'string'
|
|
4367
|
-
? error.trim()
|
|
4368
|
-
: String((_a = error.message) !== null && _a !== void 0 ? _a : 'An unknown error occurred.'));
|
|
4369
|
-
const code = (typeof error === 'string'
|
|
4370
|
-
? ReactKitErrorCode$1.NoCode
|
|
4371
|
-
: String((_b = error.code) !== null && _b !== void 0 ? _b : ReactKitErrorCode$1.NoCode));
|
|
4372
|
-
// Handle case where app hasn't loaded
|
|
4373
|
-
{
|
|
4374
|
-
alert$1(errorTitle, `${message} (code: ${code}). Please contact support.`);
|
|
4375
|
-
return undefined;
|
|
4376
|
-
}
|
|
4377
|
-
};
|
|
4378
|
-
|
|
4379
|
-
/**
|
|
4380
|
-
* Loading spinner/indicator
|
|
4381
|
-
* @author Gabe Abrams
|
|
4382
|
-
*/
|
|
4383
|
-
/*------------------------------------------------------------------------*/
|
|
4384
|
-
/* Style */
|
|
4385
|
-
/*------------------------------------------------------------------------*/
|
|
4386
|
-
const style$5 = `
|
|
4387
|
-
/* Container fades in */
|
|
4388
|
-
.LoadingSpinner-container {
|
|
4389
|
-
animation-name: LoadingSpinner-container-fade-in;
|
|
4390
|
-
animation-duration: 0.3s;
|
|
4391
|
-
animation-delay: 0.4s;
|
|
4392
|
-
animation-fill-mode: both;
|
|
4393
|
-
animation-timing-function: ease-out;
|
|
4394
|
-
}
|
|
4395
|
-
@keyframes LoadingSpinner-container-fade-in {
|
|
4396
|
-
0% {
|
|
4397
|
-
opacity: 0;
|
|
4398
|
-
}
|
|
4399
|
-
100% {
|
|
4400
|
-
opacity: 1;
|
|
4401
|
-
}
|
|
4402
|
-
}
|
|
4403
|
-
|
|
4404
|
-
/* Blips */
|
|
4405
|
-
.LoadingSpinner-blip-1,
|
|
4406
|
-
.LoadingSpinner-blip-2,
|
|
4407
|
-
.LoadingSpinner-blip-3,
|
|
4408
|
-
.LoadingSpinner-blip-4 {
|
|
4409
|
-
font-size: 1.8rem;
|
|
4410
|
-
opacity: 0.6;
|
|
4411
|
-
margin-top: 1rem;
|
|
4412
|
-
margin-bottom: 1rem;
|
|
4413
|
-
}
|
|
4414
|
-
|
|
4415
|
-
/* First Blip */
|
|
4416
|
-
.LoadingSpinner-blip-1 {
|
|
4417
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
4418
|
-
}
|
|
4419
|
-
|
|
4420
|
-
/* Second Blip */
|
|
4421
|
-
.LoadingSpinner-blip-2 {
|
|
4422
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
4423
|
-
-webkit-animation-delay: 0.1s;
|
|
4424
|
-
animation-delay: 0.1s;
|
|
4425
|
-
}
|
|
4426
|
-
|
|
4427
|
-
/* Third Blip */
|
|
4428
|
-
.LoadingSpinner-blip-3 {
|
|
4429
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
4430
|
-
animation-delay: 0.2s;
|
|
4431
|
-
}
|
|
4432
|
-
|
|
4433
|
-
/* Fourth Blip */
|
|
4434
|
-
.LoadingSpinner-blip-4 {
|
|
4435
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
4436
|
-
animation-delay: 0.3s;
|
|
4437
|
-
}
|
|
4438
|
-
|
|
4439
|
-
/* Pop Animation for Each Blip */
|
|
4440
|
-
@keyframes LoadingSpinner-pop-animation {
|
|
4441
|
-
0% {
|
|
4442
|
-
transform: scale(1.0);
|
|
4443
|
-
}
|
|
4444
|
-
10% {
|
|
4445
|
-
transform: scale(1.5);
|
|
4446
|
-
}
|
|
4447
|
-
30% {
|
|
4448
|
-
transform: scale(1.0);
|
|
4449
|
-
}
|
|
4450
|
-
100% {
|
|
4451
|
-
transform: scale(1.0);
|
|
4452
|
-
}
|
|
4453
|
-
}
|
|
4454
|
-
`;
|
|
4455
|
-
/*------------------------------------------------------------------------*/
|
|
4456
|
-
/* Component */
|
|
4457
|
-
/*------------------------------------------------------------------------*/
|
|
4458
|
-
const LoadingSpinner = () => {
|
|
4459
|
-
/*------------------------------------------------------------------------*/
|
|
4460
|
-
/* Render */
|
|
4461
|
-
/*------------------------------------------------------------------------*/
|
|
4462
|
-
// Add all four blips to a container
|
|
4463
|
-
return (React__default.createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
4464
|
-
React__default.createElement("style", null, style$5),
|
|
4465
|
-
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-1 me-1" }),
|
|
4466
|
-
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-2 me-1" }),
|
|
4467
|
-
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-3 me-1" }),
|
|
4468
|
-
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-4" })));
|
|
4469
|
-
};
|
|
4470
|
-
|
|
4471
|
-
/**
|
|
4472
|
-
* A radio selection button
|
|
4473
|
-
* @author Gabe Abrams
|
|
4474
|
-
*/
|
|
4475
|
-
/*------------------------------------------------------------------------*/
|
|
4476
|
-
/* Component */
|
|
4477
|
-
/*------------------------------------------------------------------------*/
|
|
4478
|
-
const RadioButton = (props) => {
|
|
4479
|
-
/*------------------------------------------------------------------------*/
|
|
4480
|
-
/* Setup */
|
|
4481
|
-
/*------------------------------------------------------------------------*/
|
|
4482
|
-
/* -------------- Props ------------- */
|
|
4483
|
-
const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = Variant$1.Secondary, unselectedVariant = Variant$1.Light, small, } = props;
|
|
4484
|
-
/*------------------------------------------------------------------------*/
|
|
4485
|
-
/* Render */
|
|
4486
|
-
/*------------------------------------------------------------------------*/
|
|
4487
|
-
/*----------------------------------------*/
|
|
4488
|
-
/* Main UI */
|
|
4489
|
-
/*----------------------------------------*/
|
|
4490
|
-
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: () => {
|
|
4491
|
-
if (!selected) {
|
|
4492
|
-
onSelected();
|
|
4493
|
-
}
|
|
4494
|
-
} },
|
|
4495
|
-
React__default.createElement(FontAwesomeIcon, { icon: selected ? faDotCircle : faCircle$1, className: "me-1" }),
|
|
4496
|
-
text));
|
|
4497
|
-
};
|
|
4498
|
-
|
|
4499
|
-
/**
|
|
4500
|
-
* A checkbox button
|
|
4501
|
-
* @author Gabe Abrams
|
|
4502
|
-
*/
|
|
4503
|
-
/*------------------------------------------------------------------------*/
|
|
4504
|
-
/* Component */
|
|
4505
|
-
/*------------------------------------------------------------------------*/
|
|
4506
|
-
const CheckboxButton = (props) => {
|
|
4507
|
-
/*------------------------------------------------------------------------*/
|
|
4508
|
-
/* Setup */
|
|
4509
|
-
/*------------------------------------------------------------------------*/
|
|
4510
|
-
/* -------------- Props ------------- */
|
|
4511
|
-
const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = Variant$1.Secondary, uncheckedVariant = Variant$1.Light, small, dashed, } = props;
|
|
4512
|
-
/*------------------------------------------------------------------------*/
|
|
4513
|
-
/* Render */
|
|
4514
|
-
/*------------------------------------------------------------------------*/
|
|
4515
|
-
/*----------------------------------------*/
|
|
4516
|
-
/* Main UI */
|
|
4517
|
-
/*----------------------------------------*/
|
|
4518
|
-
// Determine the icon
|
|
4519
|
-
let icon;
|
|
4520
|
-
if (checked) {
|
|
4521
|
-
icon = faCheckSquare;
|
|
4522
|
-
}
|
|
4523
|
-
else {
|
|
4524
|
-
icon = (dashed
|
|
4525
|
-
? faSquareMinus
|
|
4526
|
-
: faSquare);
|
|
4527
|
-
}
|
|
4528
|
-
// Create the button
|
|
4529
|
-
return (React__default.createElement("button", { type: "button", id: id, title: title, className: `CheckboxButton-status-${checked ? 'checked' : 'unchecked'} ${dashed ? 'CheckboxButton-dashed ' : ''}btn btn-${checked ? checkedVariant : uncheckedVariant}${checked ? ' selected' : ''}${small ? ' btn-sm' : ''} m-0${noMarginOnRight ? '' : ' me-1'} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": `${ariaLabel}${checked ? ': currently checked' : ''}`, onClick: () => {
|
|
4530
|
-
onChanged(!checked);
|
|
4531
|
-
} },
|
|
4532
|
-
React__default.createElement(FontAwesomeIcon, { icon: icon, className: "me-1" }),
|
|
4533
|
-
text));
|
|
4534
|
-
};
|
|
4535
|
-
|
|
4536
|
-
/**
|
|
4537
|
-
* Input group with a title and space for buttons
|
|
4538
|
-
* @author Gabe Abrams
|
|
4539
|
-
*/
|
|
4540
|
-
/*------------------------------------------------------------------------*/
|
|
4541
|
-
/* Component */
|
|
4542
|
-
/*------------------------------------------------------------------------*/
|
|
4543
|
-
const ButtonInputGroup = (props) => {
|
|
4544
|
-
/*------------------------------------------------------------------------*/
|
|
4545
|
-
/* Setup */
|
|
4546
|
-
/*------------------------------------------------------------------------*/
|
|
4547
|
-
/* -------------- Props ------------- */
|
|
4548
|
-
// Destructure all props
|
|
4549
|
-
const { label, minLabelWidth, children, } = props;
|
|
4550
|
-
/*------------------------------------------------------------------------*/
|
|
4551
|
-
/* Render */
|
|
4552
|
-
/*------------------------------------------------------------------------*/
|
|
4553
|
-
/*----------------------------------------*/
|
|
4554
|
-
/* Main UI */
|
|
4555
|
-
/*----------------------------------------*/
|
|
4556
|
-
return (React__default.createElement("div", { className: "input-group" },
|
|
4557
|
-
React__default.createElement("div", { className: "input-group-prepend d-flex w-100" },
|
|
4558
|
-
React__default.createElement("span", { className: "input-group-text", style: {
|
|
4559
|
-
minWidth: (minLabelWidth !== null && minLabelWidth !== void 0 ? minLabelWidth : undefined),
|
|
4560
|
-
borderTopRightRadius: 0,
|
|
4561
|
-
borderBottomRightRadius: 0,
|
|
4562
|
-
} }, label),
|
|
4563
|
-
React__default.createElement("span", { className: "input-group-text flex-grow-1 rounded-right", style: {
|
|
4564
|
-
backgroundColor: 'white',
|
|
4565
|
-
borderTopLeftRadius: 0,
|
|
4566
|
-
borderBottomLeftRadius: 0,
|
|
4567
|
-
borderLeftWidth: 0,
|
|
4568
|
-
} }, children))));
|
|
4569
|
-
};
|
|
4570
|
-
|
|
4571
|
-
/**
|
|
4572
|
-
* Copiable text box
|
|
4573
|
-
* @author Gabe Abrams
|
|
4574
|
-
*/
|
|
4575
|
-
/* ------------- Actions ------------ */
|
|
4576
|
-
// Types of actions
|
|
4577
|
-
var ActionType$1$1;
|
|
4578
|
-
(function (ActionType) {
|
|
4579
|
-
// Indicate that the text was recently copied
|
|
4580
|
-
ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
|
|
4581
|
-
// Clear the status
|
|
4582
|
-
ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
|
|
4583
|
-
})(ActionType$1$1 || (ActionType$1$1 = {}));
|
|
4584
|
-
|
|
4585
|
-
/**
|
|
4586
|
-
* Reusable nested item picker
|
|
4587
|
-
* @author Yuen Ler Chow
|
|
4588
|
-
*/
|
|
4589
|
-
/* ------------- Actions ------------ */
|
|
4590
|
-
// Types of actions
|
|
4591
|
-
var ActionType$3;
|
|
4592
|
-
(function (ActionType) {
|
|
4593
|
-
// Toggle whether the children are being shown
|
|
4594
|
-
ActionType["ToggleItems"] = "toggle-items";
|
|
4595
|
-
})(ActionType$3 || (ActionType$3 = {}));
|
|
4596
|
-
|
|
4597
|
-
// Keep track of whether or not session expiry has already been handled
|
|
4598
|
-
let sessionAlreadyExpired = false;
|
|
4599
|
-
/*------------------------------------------------------------------------*/
|
|
4600
|
-
/* Stub Logic */
|
|
4601
|
-
/*------------------------------------------------------------------------*/
|
|
4602
|
-
// Stored stub responses
|
|
4603
|
-
const stubResponses = {};
|
|
4604
|
-
/*------------------------------------------------------------------------*/
|
|
4605
|
-
/* Main */
|
|
4606
|
-
/*------------------------------------------------------------------------*/
|
|
4607
|
-
/**
|
|
4608
|
-
* Visit an endpoint on the server [for client only]
|
|
4609
|
-
* @author Gabe Abrams
|
|
4610
|
-
* @param opts object containing all arguments
|
|
4611
|
-
* @param opts.path - the path of the server endpoint
|
|
4612
|
-
* @param [opts.method=GET] - the method of the endpoint
|
|
4613
|
-
* @param [opts.params] - query/body parameters to include
|
|
4614
|
-
* @returns response from server
|
|
4615
|
-
*/
|
|
4616
|
-
const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4617
|
-
var _a, _b, _c;
|
|
4618
|
-
const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET');
|
|
4619
|
-
// Handle stubs
|
|
4620
|
-
const stubResponse = (_b = stubResponses[method]) === null || _b === void 0 ? void 0 : _b[opts.path];
|
|
4621
|
-
if (stubResponse) {
|
|
4622
|
-
// Remove from list
|
|
4623
|
-
try {
|
|
4624
|
-
stubResponses[method][opts.path] = undefined;
|
|
4625
|
-
}
|
|
4626
|
-
catch (err) {
|
|
4627
|
-
// Ignore
|
|
4628
|
-
}
|
|
4629
|
-
// Success
|
|
4630
|
-
if (stubResponse.success) {
|
|
4631
|
-
return stubResponse.body;
|
|
4632
|
-
}
|
|
4633
|
-
// Error
|
|
4634
|
-
throw new ErrorWithCode(stubResponse.errorMessage, stubResponse.errorCode);
|
|
4635
|
-
}
|
|
4636
|
-
// Send the request
|
|
4637
|
-
const response = yield cacclSendRequest({
|
|
4638
|
-
path: opts.path,
|
|
4639
|
-
method: (_c = opts.method) !== null && _c !== void 0 ? _c : 'GET',
|
|
4640
|
-
params: opts.params,
|
|
4641
|
-
});
|
|
4642
|
-
// Check for failure
|
|
4643
|
-
if (!response || !response.body) {
|
|
4644
|
-
throw new ErrorWithCode('We didn\'t get a response from the server. Please check your internet connection.', ReactKitErrorCode$1.NoResponse);
|
|
4645
|
-
}
|
|
4646
|
-
if (!response.body.success) {
|
|
4647
|
-
// Session expired
|
|
4648
|
-
if (response.body.code === ReactKitErrorCode$1.SessionExpired) {
|
|
4649
|
-
// Skip notice if session was already expired
|
|
4650
|
-
if (sessionAlreadyExpired) {
|
|
4651
|
-
// Never return (browser is already reloading)
|
|
4652
|
-
yield new Promise(() => {
|
|
4653
|
-
// Promise that never returns
|
|
4654
|
-
});
|
|
4655
|
-
}
|
|
4656
|
-
sessionAlreadyExpired = true;
|
|
4657
|
-
// Show session expiration message
|
|
4658
|
-
{
|
|
4659
|
-
// Fallback to alert
|
|
4660
|
-
// eslint-disable-next-line no-alert
|
|
4661
|
-
alert('Your session has expired. Please start over.');
|
|
4662
|
-
}
|
|
4663
|
-
// Never return (don't continue execution)
|
|
4664
|
-
yield new Promise(() => {
|
|
4665
|
-
// Promise that never returns
|
|
4666
|
-
});
|
|
4667
|
-
}
|
|
4668
|
-
// Other errors
|
|
4669
|
-
throw new ErrorWithCode((response.body.message
|
|
4670
|
-
|| 'An unknown error occurred. Please contact an admin.'), (response.body.code
|
|
4671
|
-
|| ReactKitErrorCode$1.NoCode));
|
|
4672
|
-
}
|
|
4673
|
-
// Success! Extract the body
|
|
4674
|
-
const { body } = response.body;
|
|
4675
|
-
// Return
|
|
4676
|
-
return body;
|
|
4677
|
-
});
|
|
4678
|
-
|
|
4679
|
-
// Import custom error
|
|
4680
|
-
// Stored copy of caccl functions
|
|
4681
|
-
let _cacclGetLaunchInfo$1;
|
|
4682
|
-
/*------------------------------------------------------------------------*/
|
|
4683
|
-
/* Helpers */
|
|
4684
|
-
/*------------------------------------------------------------------------*/
|
|
4685
|
-
/**
|
|
4686
|
-
* Get launch info via CACCL
|
|
4687
|
-
* @author Gabe Abrams
|
|
4688
|
-
* @param req express request object
|
|
4689
|
-
* @returns object { launched, launchInfo }
|
|
4690
|
-
*/
|
|
4691
|
-
const cacclGetLaunchInfo$1 = (req) => {
|
|
4692
|
-
{
|
|
4693
|
-
throw new ErrorWithCode('Could not get launch info because server was not initialized with dce-reactkit\'s initServer function', ReactKitErrorCode$1.NoCACCLGetLaunchInfoFunction);
|
|
4694
|
-
}
|
|
4695
|
-
};
|
|
4696
|
-
|
|
4697
|
-
/**
|
|
4698
|
-
* Server-side API param types
|
|
4699
|
-
* @author Gabe Abrams
|
|
4700
|
-
*/
|
|
4701
|
-
var ParamType;
|
|
4702
|
-
(function (ParamType) {
|
|
4703
|
-
ParamType["Boolean"] = "boolean";
|
|
4704
|
-
ParamType["BooleanOptional"] = "boolean-optional";
|
|
4705
|
-
ParamType["Float"] = "float";
|
|
4706
|
-
ParamType["FloatOptional"] = "float-optional";
|
|
4707
|
-
ParamType["Int"] = "int";
|
|
4708
|
-
ParamType["IntOptional"] = "int-optional";
|
|
4709
|
-
ParamType["JSON"] = "json";
|
|
4710
|
-
ParamType["JSONOptional"] = "json-optional";
|
|
4711
|
-
ParamType["String"] = "string";
|
|
4712
|
-
ParamType["StringOptional"] = "string-optional";
|
|
4713
|
-
})(ParamType || (ParamType = {}));
|
|
4714
|
-
var ParamType$1 = ParamType;
|
|
4715
|
-
|
|
4716
|
-
// Import shared types
|
|
4717
|
-
/**
|
|
4718
|
-
* Handle an error and respond to the client
|
|
4719
|
-
* @author Gabe Abrams
|
|
4720
|
-
* @param res express response
|
|
4721
|
-
* @param error error info
|
|
4722
|
-
* @param opts.err the error to send to the client
|
|
4723
|
-
* or the error message
|
|
4724
|
-
* @param [opts.code] an error code (only used if err.code is not
|
|
4725
|
-
* included)
|
|
4726
|
-
* @param [opts.status=500] the https status code to use
|
|
4727
|
-
* defined)
|
|
4728
|
-
*/
|
|
4729
|
-
const handleError$1 = (res, error) => {
|
|
4730
|
-
// Get the error message
|
|
4731
|
-
let message;
|
|
4732
|
-
if (error && error.message) {
|
|
4733
|
-
message = (error.message || 'An unknown error occurred.');
|
|
4734
|
-
}
|
|
4735
|
-
else if (typeof error === 'string') {
|
|
4736
|
-
message = (error.trim().length > 0
|
|
4737
|
-
? error
|
|
4738
|
-
: 'An unknown error occurred.');
|
|
4739
|
-
}
|
|
4740
|
-
else {
|
|
4741
|
-
message = 'An unknown error occurred.';
|
|
4742
|
-
}
|
|
4743
|
-
// Get the error code
|
|
4744
|
-
const code = (error.code || ReactKitErrorCode$1.NoCode);
|
|
4745
|
-
// Get the status code
|
|
4746
|
-
const status = (error.status || 500);
|
|
4747
|
-
// Respond to user
|
|
4748
|
-
res
|
|
4749
|
-
// Set the http status code
|
|
4750
|
-
.status(status)
|
|
4751
|
-
// Send a JSON response
|
|
4752
|
-
.json({
|
|
4753
|
-
// Error message
|
|
4754
|
-
message,
|
|
4755
|
-
// Error code
|
|
4756
|
-
code,
|
|
4757
|
-
// Success = false flag so client can detect server-side errors
|
|
4758
|
-
success: false,
|
|
4759
|
-
});
|
|
4760
|
-
return undefined;
|
|
4761
|
-
};
|
|
4762
|
-
|
|
4763
|
-
/**
|
|
4764
|
-
* Send successful API response
|
|
4765
|
-
* @author Gabe Abrams
|
|
4766
|
-
* @param res express response
|
|
4767
|
-
* @param body the body of the response to send to the client
|
|
4768
|
-
*/
|
|
4769
|
-
const handleSuccess$1 = (res, body) => {
|
|
4770
|
-
// Send a http 200 json response
|
|
4771
|
-
res.json({
|
|
4772
|
-
// Include the body as a parameter
|
|
4773
|
-
body,
|
|
4774
|
-
// Success = true flag so client can detect successful responses
|
|
4775
|
-
success: true,
|
|
4776
|
-
});
|
|
4777
|
-
return undefined;
|
|
4778
|
-
};
|
|
4779
|
-
|
|
4780
|
-
/**
|
|
4781
|
-
* Generate an express API route handler
|
|
4782
|
-
* @author Gabe Abrams
|
|
4783
|
-
* @param opts object containing all arguments
|
|
4784
|
-
* @param opts.paramTypes map containing the types for each parameter that is
|
|
4785
|
-
* included in the request (map: param name => type)
|
|
4786
|
-
* @param opts.handler function that processes the request
|
|
4787
|
-
* @returns express route handler that takes the following arguments:
|
|
4788
|
-
* params (map: param name => value), handleSuccess (function for handling
|
|
4789
|
-
* successful requests), handleError (function for handling failed requests),
|
|
4790
|
-
* req (express request object), res (express response object),
|
|
4791
|
-
* next (express next function). Params also has userId, userFirstName,
|
|
4792
|
-
* userLastName, isLearner, isTTM, isAdmin, and any other variables that
|
|
4793
|
-
* are directly added to the session
|
|
4794
|
-
*/
|
|
4795
|
-
const genRouteHandler$1 = (opts) => {
|
|
4796
|
-
// Return a route handler
|
|
4797
|
-
return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4798
|
-
var _a, _b;
|
|
4799
|
-
// Output params
|
|
4800
|
-
const output = {};
|
|
4801
|
-
/*----------------------------------------*/
|
|
4802
|
-
/* Parse Params */
|
|
4803
|
-
/*----------------------------------------*/
|
|
4804
|
-
// Process items one by one
|
|
4805
|
-
const paramList = Object.entries((_a = opts.paramTypes) !== null && _a !== void 0 ? _a : {});
|
|
4806
|
-
for (let i = 0; i < paramList.length; i++) {
|
|
4807
|
-
const [name, type] = paramList[i];
|
|
4808
|
-
// Find the value as a string
|
|
4809
|
-
const value = (req.params[name]
|
|
4810
|
-
|| req.query[name]
|
|
4811
|
-
|| req.body[name]);
|
|
4812
|
-
// Parse
|
|
4813
|
-
if (type === ParamType$1.Boolean || type === ParamType$1.BooleanOptional) {
|
|
4814
|
-
// Boolean
|
|
4815
|
-
// Handle case where value doesn't exist
|
|
4816
|
-
if (value === undefined) {
|
|
4817
|
-
if (type === ParamType$1.BooleanOptional) {
|
|
4818
|
-
output[name] = undefined;
|
|
3851
|
+
filterDrawer && (React__default.createElement(Drawer, { customBackgroundColor: "#eee" }, filterDrawer))));
|
|
3852
|
+
// Actually filter the logs
|
|
3853
|
+
// > Perform filters
|
|
3854
|
+
const logs = [];
|
|
3855
|
+
Object.keys(logMap).forEach((year) => {
|
|
3856
|
+
Object.keys(logMap[year]).forEach((month) => {
|
|
3857
|
+
logMap[year][month].forEach((log) => {
|
|
3858
|
+
/* ----------- Date Filter ---------- */
|
|
3859
|
+
var _a;
|
|
3860
|
+
// Before start date
|
|
3861
|
+
if (
|
|
3862
|
+
// Previous year
|
|
3863
|
+
log.year < dateFilterState.startDate.year
|
|
3864
|
+
// Same year, earlier month
|
|
3865
|
+
|| ((log.year === dateFilterState.startDate.year)
|
|
3866
|
+
&& (log.month < dateFilterState.startDate.month))
|
|
3867
|
+
// Same year, same month, earlier day
|
|
3868
|
+
|| ((log.year === dateFilterState.startDate.year)
|
|
3869
|
+
&& (log.month === dateFilterState.startDate.month)
|
|
3870
|
+
&& (log.day < dateFilterState.startDate.day))) {
|
|
3871
|
+
return;
|
|
4819
3872
|
}
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
3873
|
+
// After end date
|
|
3874
|
+
if (
|
|
3875
|
+
// Later year
|
|
3876
|
+
log.year > dateFilterState.endDate.year
|
|
3877
|
+
// Same year, later month
|
|
3878
|
+
|| ((log.year === dateFilterState.endDate.year)
|
|
3879
|
+
&& (log.month > dateFilterState.endDate.month))
|
|
3880
|
+
// Same year, same month, later day
|
|
3881
|
+
|| ((log.year === dateFilterState.endDate.year)
|
|
3882
|
+
&& (log.month === dateFilterState.endDate.month)
|
|
3883
|
+
&& (log.day > dateFilterState.endDate.day))) {
|
|
3884
|
+
return;
|
|
4826
3885
|
}
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
//
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
}
|
|
4843
|
-
}
|
|
4844
|
-
else if (type === ParamType$1.Float || type === ParamType$1.FloatOptional) {
|
|
4845
|
-
// Float
|
|
4846
|
-
// Handle case where value doesn't exist
|
|
4847
|
-
if (value === undefined) {
|
|
4848
|
-
if (type === ParamType$1.FloatOptional) {
|
|
4849
|
-
output[name] = undefined;
|
|
3886
|
+
/* --------- Context Filter --------- */
|
|
3887
|
+
// Context doesn't match
|
|
3888
|
+
if (
|
|
3889
|
+
// Whole context is deselected
|
|
3890
|
+
contextFilterState[log.context] === false
|
|
3891
|
+
// None of the subcontexts are selected
|
|
3892
|
+
|| (
|
|
3893
|
+
// Has subcontexts
|
|
3894
|
+
typeof contextFilterState[log.context] !== 'boolean'
|
|
3895
|
+
// None of the subcontexts are selected
|
|
3896
|
+
&& Object.values((_a = contextFilterState[log.context]) !== null && _a !== void 0 ? _a : {})
|
|
3897
|
+
.every((isSelected) => {
|
|
3898
|
+
return !isSelected;
|
|
3899
|
+
}))) {
|
|
3900
|
+
return;
|
|
4850
3901
|
}
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
3902
|
+
// Subcontext doesn't match
|
|
3903
|
+
if (
|
|
3904
|
+
// Log context is not "uncategorized" (no point in further filters)
|
|
3905
|
+
log.context !== LogBuiltInMetadata.Context.Uncategorized
|
|
3906
|
+
// Log has a subcontext
|
|
3907
|
+
&& log.subcontext
|
|
3908
|
+
// Context has subcontexts
|
|
3909
|
+
&& (contextFilterState[log.context]
|
|
3910
|
+
&& contextFilterState[log.context] !== false
|
|
3911
|
+
&& contextFilterState[log.context] !== true)
|
|
3912
|
+
// Subcontext is not selected
|
|
3913
|
+
&& !contextFilterState[log.context][log.subcontext]) {
|
|
3914
|
+
return;
|
|
4857
3915
|
}
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
else if (type === ParamType$1.Int || type === ParamType$1.IntOptional) {
|
|
4873
|
-
// Int
|
|
4874
|
-
// Handle case where value doesn't exist
|
|
4875
|
-
if (value === undefined) {
|
|
4876
|
-
if (type === ParamType$1.IntOptional) {
|
|
4877
|
-
output[name] = undefined;
|
|
3916
|
+
/* -------------- Tags -------------- */
|
|
3917
|
+
// No tags match
|
|
3918
|
+
if (
|
|
3919
|
+
// At least one tag is required
|
|
3920
|
+
Object.values(tagFilterState)
|
|
3921
|
+
.filter((isSelected) => {
|
|
3922
|
+
return isSelected;
|
|
3923
|
+
})
|
|
3924
|
+
.length > 0
|
|
3925
|
+
// No tags match
|
|
3926
|
+
&& log.tags.every((tag) => {
|
|
3927
|
+
return !tagFilterState[tag];
|
|
3928
|
+
})) {
|
|
3929
|
+
return;
|
|
4878
3930
|
}
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
3931
|
+
/* ------- Actions and Errors ------- */
|
|
3932
|
+
// Log type doesn't match
|
|
3933
|
+
if (
|
|
3934
|
+
// Filter won't allow all types
|
|
3935
|
+
actionErrorFilterState.type !== undefined
|
|
3936
|
+
// Log type doesn't match
|
|
3937
|
+
&& actionErrorFilterState.type !== log.type) {
|
|
3938
|
+
return;
|
|
4885
3939
|
}
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
3940
|
+
// Filter errors
|
|
3941
|
+
if (log.type === LogType$1.Error) {
|
|
3942
|
+
// Message doesn't match
|
|
3943
|
+
if (
|
|
3944
|
+
// Message exists
|
|
3945
|
+
log.errorMessage
|
|
3946
|
+
// Message filter exists
|
|
3947
|
+
&& actionErrorFilterState.errorMessage.trim().length > 0
|
|
3948
|
+
// Message doesn't match
|
|
3949
|
+
&& log.errorMessage.toLowerCase().includes(actionErrorFilterState.errorMessage.trim().toLowerCase())) {
|
|
3950
|
+
return;
|
|
3951
|
+
}
|
|
3952
|
+
// Code doesn't match
|
|
3953
|
+
if (
|
|
3954
|
+
// Code exists
|
|
3955
|
+
log.errorCode
|
|
3956
|
+
// Code filter exists
|
|
3957
|
+
&& actionErrorFilterState.errorCode.trim().length > 0
|
|
3958
|
+
// Code doesn't match
|
|
3959
|
+
&& log.errorCode.toUpperCase().includes(actionErrorFilterState.errorCode.trim().toUpperCase())) {
|
|
3960
|
+
return;
|
|
3961
|
+
}
|
|
4906
3962
|
}
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
3963
|
+
// Filter actions
|
|
3964
|
+
if (log.type === LogType$1.Action) {
|
|
3965
|
+
// Target isn't selected
|
|
3966
|
+
if (
|
|
3967
|
+
// Target exists
|
|
3968
|
+
log.target
|
|
3969
|
+
// Target isn't selected
|
|
3970
|
+
&& !actionErrorFilterState.target[log.target]) {
|
|
3971
|
+
return;
|
|
3972
|
+
}
|
|
3973
|
+
// Action
|
|
3974
|
+
if (
|
|
3975
|
+
// Action exists
|
|
3976
|
+
log.action
|
|
3977
|
+
// Action isn't selected
|
|
3978
|
+
&& !actionErrorFilterState.action[log.action]) {
|
|
3979
|
+
return;
|
|
3980
|
+
}
|
|
4913
3981
|
}
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
//
|
|
4918
|
-
|
|
4919
|
-
|
|
3982
|
+
/* --------- Advanced Filter -------- */
|
|
3983
|
+
// First name doesn't match
|
|
3984
|
+
if (
|
|
3985
|
+
// First name exists
|
|
3986
|
+
log.userFirstName
|
|
3987
|
+
// First name query doesn't match
|
|
3988
|
+
&& !log.userFirstName.toLowerCase().includes(advancedFilterState.userFirstName.toLowerCase().trim())) {
|
|
3989
|
+
return;
|
|
4920
3990
|
}
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
3991
|
+
// Last name doesn't match
|
|
3992
|
+
if (
|
|
3993
|
+
// Last name exists
|
|
3994
|
+
log.userLastName
|
|
3995
|
+
// Last name query doesn't match
|
|
3996
|
+
&& !log.userLastName.toLowerCase().includes(advancedFilterState.userLastName.toLowerCase().trim())) {
|
|
3997
|
+
return;
|
|
4927
3998
|
}
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
output[name] = undefined;
|
|
3999
|
+
// Email doesn't match
|
|
4000
|
+
if (
|
|
4001
|
+
// Email exists
|
|
4002
|
+
log.userEmail
|
|
4003
|
+
// Email query doesn't match
|
|
4004
|
+
&& !log.userEmail.toLowerCase().includes(advancedFilterState.userEmail.toLowerCase().trim())) {
|
|
4005
|
+
return;
|
|
4936
4006
|
}
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4007
|
+
// User id doesn't match
|
|
4008
|
+
if (
|
|
4009
|
+
// User id exists
|
|
4010
|
+
log.userId
|
|
4011
|
+
// User id doesn't match
|
|
4012
|
+
&& !String(log.userId).includes(advancedFilterState.userId.trim())) {
|
|
4013
|
+
return;
|
|
4943
4014
|
}
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
//
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4015
|
+
// Learner not allowed
|
|
4016
|
+
if (
|
|
4017
|
+
// User is a learner
|
|
4018
|
+
log.isLearner
|
|
4019
|
+
// Learners aren't included
|
|
4020
|
+
&& !advancedFilterState.includeLearners) {
|
|
4021
|
+
return;
|
|
4022
|
+
}
|
|
4023
|
+
// TTM not allowed
|
|
4024
|
+
if (
|
|
4025
|
+
// User is a ttm
|
|
4026
|
+
log.isTTM
|
|
4027
|
+
// TTMs aren't included
|
|
4028
|
+
&& !advancedFilterState.includeTTMs) {
|
|
4029
|
+
return;
|
|
4030
|
+
}
|
|
4031
|
+
// Admin not allowed
|
|
4032
|
+
if (
|
|
4033
|
+
// User is an admin
|
|
4034
|
+
log.isAdmin
|
|
4035
|
+
// Admins aren't included
|
|
4036
|
+
&& !advancedFilterState.includeAdmins) {
|
|
4037
|
+
return;
|
|
4038
|
+
}
|
|
4039
|
+
// Course Id doesn't match
|
|
4040
|
+
if (
|
|
4041
|
+
// Course Id exists
|
|
4042
|
+
log.courseId
|
|
4043
|
+
// Course Id doesn't match
|
|
4044
|
+
&& !String(log.courseId).includes(advancedFilterState.courseId.trim())) {
|
|
4045
|
+
return;
|
|
4046
|
+
}
|
|
4047
|
+
// Course name doesn't match
|
|
4048
|
+
if (
|
|
4049
|
+
// Course name exists
|
|
4050
|
+
log.courseName
|
|
4051
|
+
// Course name doesn't match
|
|
4052
|
+
&& !String(log.courseName).includes(advancedFilterState.courseName.trim())) {
|
|
4053
|
+
return;
|
|
4054
|
+
}
|
|
4055
|
+
// Mobile filter doesn't match
|
|
4056
|
+
if (
|
|
4057
|
+
// Mobile filter exists
|
|
4058
|
+
advancedFilterState.isMobile !== undefined
|
|
4059
|
+
// Device info exists
|
|
4060
|
+
&& log.device
|
|
4061
|
+
// Mobile filter doesn't match
|
|
4062
|
+
&& (advancedFilterState.isMobile !== log.device.isMobile)) {
|
|
4063
|
+
return;
|
|
4064
|
+
}
|
|
4065
|
+
// Log source doesn't match
|
|
4066
|
+
if (
|
|
4067
|
+
// Source filter exists
|
|
4068
|
+
advancedFilterState.source !== undefined
|
|
4069
|
+
// Source info exists
|
|
4070
|
+
&& log.source
|
|
4071
|
+
// Source filter doesn't match
|
|
4072
|
+
&& (advancedFilterState.source !== log.source)) {
|
|
4073
|
+
return;
|
|
4074
|
+
}
|
|
4075
|
+
// Route path doesn't match (Only for server source)
|
|
4076
|
+
if (
|
|
4077
|
+
// Source is server
|
|
4078
|
+
(log.source === LogSource$1.Server)
|
|
4079
|
+
// Route path is being filtered
|
|
4080
|
+
&& (advancedFilterState.routePath.trim().length)
|
|
4081
|
+
// Route path doesn't match
|
|
4082
|
+
&& !(log.routePath.includes(advancedFilterState.routePath.trim()))) {
|
|
4083
|
+
return;
|
|
4084
|
+
}
|
|
4085
|
+
// Route template doesn't match (Only for server source)
|
|
4086
|
+
if (
|
|
4087
|
+
// Source is server
|
|
4088
|
+
(log.source === LogSource$1.Server)
|
|
4089
|
+
// Route template is being filtered
|
|
4090
|
+
&& (advancedFilterState.routeTemplate.trim().length)
|
|
4091
|
+
// Route template doesn't match
|
|
4092
|
+
&& !(log.routeTemplate.includes(advancedFilterState.routeTemplate.trim()))) {
|
|
4093
|
+
return;
|
|
4094
|
+
}
|
|
4095
|
+
/* -------------- Done -------------- */
|
|
4096
|
+
// Made it past all filters. Add to the list
|
|
4097
|
+
logs.push(log);
|
|
4957
4098
|
});
|
|
4958
|
-
}
|
|
4959
|
-
}
|
|
4960
|
-
/*----------------------------------------*/
|
|
4961
|
-
/* Launch Info */
|
|
4962
|
-
/*----------------------------------------*/
|
|
4963
|
-
// Get launch info
|
|
4964
|
-
const { launched, launchInfo } = cacclGetLaunchInfo$1(req);
|
|
4965
|
-
if (!launched || !launchInfo) {
|
|
4966
|
-
return handleError$1(res, {
|
|
4967
|
-
message: 'Your session has expired. Please refresh the page and try again.',
|
|
4968
|
-
code: ReactKitErrorCode$1.SessionExpired,
|
|
4969
|
-
status: 440,
|
|
4970
|
-
});
|
|
4971
|
-
}
|
|
4972
|
-
// Error if user info cannot be found
|
|
4973
|
-
if (!launchInfo.userId
|
|
4974
|
-
|| !launchInfo.userFirstName
|
|
4975
|
-
|| !launchInfo.userLastName
|
|
4976
|
-
|| (launchInfo.notInCourse
|
|
4977
|
-
&& !launchInfo.isAdmin)
|
|
4978
|
-
|| (!launchInfo.isTTM
|
|
4979
|
-
&& !launchInfo.isLearner
|
|
4980
|
-
&& !launchInfo.isAdmin)) {
|
|
4981
|
-
return handleError$1(res, {
|
|
4982
|
-
message: 'Your session was invalid. Please refresh the page and try again.',
|
|
4983
|
-
code: ReactKitErrorCode$1.SessionExpired,
|
|
4984
|
-
status: 440,
|
|
4985
4099
|
});
|
|
4986
|
-
}
|
|
4987
|
-
// Add launch info to output
|
|
4988
|
-
output.userId = launchInfo.userId;
|
|
4989
|
-
output.userFirstName = launchInfo.userFirstName;
|
|
4990
|
-
output.userLastName = launchInfo.userLastName;
|
|
4991
|
-
output.userEmail = launchInfo.userEmail;
|
|
4992
|
-
output.isLearner = !!launchInfo.isLearner;
|
|
4993
|
-
output.isTTM = !!launchInfo.isTTM;
|
|
4994
|
-
output.isAdmin = !!launchInfo.isAdmin;
|
|
4995
|
-
output.courseId = ((_b = output.courseId) !== null && _b !== void 0 ? _b : launchInfo.courseId);
|
|
4996
|
-
output.courseName = launchInfo.contextLabel;
|
|
4997
|
-
// Add other session variables
|
|
4998
|
-
Object.keys(req.session).forEach((propName) => {
|
|
4999
|
-
// Skip if prop already in output
|
|
5000
|
-
if (output[propName] !== undefined) {
|
|
5001
|
-
return;
|
|
5002
|
-
}
|
|
5003
|
-
// Add to output
|
|
5004
|
-
const value = req.session[propName];
|
|
5005
|
-
if (typeof value === 'string'
|
|
5006
|
-
|| typeof value === 'boolean'
|
|
5007
|
-
|| typeof value === 'number') {
|
|
5008
|
-
output[propName] = value;
|
|
5009
|
-
}
|
|
5010
4100
|
});
|
|
5011
4101
|
/*----------------------------------------*/
|
|
5012
|
-
/*
|
|
5013
|
-
/*----------------------------------------*/
|
|
5014
|
-
// Make sure the user actually launched from the appropriate course
|
|
5015
|
-
if (output.courseId
|
|
5016
|
-
&& launchInfo.courseId
|
|
5017
|
-
&& output.courseId !== launchInfo.courseId
|
|
5018
|
-
&& !output.isTTM
|
|
5019
|
-
&& !output.isAdmin) {
|
|
5020
|
-
// Course of interest is not the launch course
|
|
5021
|
-
return handleError$1(res, {
|
|
5022
|
-
message: 'You switched sessions by opening this app in another tab. Please refresh the page and try again.',
|
|
5023
|
-
code: ReactKitErrorCode$1.WrongCourse,
|
|
5024
|
-
status: 401,
|
|
5025
|
-
});
|
|
5026
|
-
}
|
|
5027
|
-
/*----------------------------------------*/
|
|
5028
|
-
/* Require Proper Permissions */
|
|
4102
|
+
/* Data */
|
|
5029
4103
|
/*----------------------------------------*/
|
|
5030
|
-
//
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
code: ReactKitErrorCode$1.NotAdmin,
|
|
5057
|
-
status: 401,
|
|
5058
|
-
});
|
|
5059
|
-
}
|
|
5060
|
-
/*------------------------------------------------------------------------*/
|
|
5061
|
-
/* Call handler */
|
|
5062
|
-
/*------------------------------------------------------------------------*/
|
|
5063
|
-
try {
|
|
5064
|
-
const results = yield opts.handler({
|
|
5065
|
-
params: output,
|
|
5066
|
-
req,
|
|
5067
|
-
res,
|
|
5068
|
-
next,
|
|
5069
|
-
});
|
|
5070
|
-
// Send results to client
|
|
5071
|
-
handleSuccess$1(res, results !== null && results !== void 0 ? results : undefined);
|
|
5072
|
-
}
|
|
5073
|
-
catch (err) {
|
|
5074
|
-
// Send error to client
|
|
5075
|
-
handleError$1(res, err);
|
|
5076
|
-
}
|
|
5077
|
-
});
|
|
4104
|
+
// Nothing to show notice
|
|
4105
|
+
const noLogsNotice = (logs.length === 0
|
|
4106
|
+
? (React__default.createElement("div", { className: "alert alert-warning text-center mt-2" },
|
|
4107
|
+
React__default.createElement("h4", { className: "m-1" }, "No Logs to Show"),
|
|
4108
|
+
React__default.createElement("div", null, "Either your filters are too strict or no matching logs have been created yet.")))
|
|
4109
|
+
: undefined);
|
|
4110
|
+
// Create intelliTable
|
|
4111
|
+
const dataTable = (React__default.createElement(IntelliTable, { title: "Matching Logs:", csvName: `Logs from ${getHumanReadableDate()}`, id: "logs", data: logs, columns: columns }));
|
|
4112
|
+
// Main body
|
|
4113
|
+
body = (React__default.createElement(React__default.Fragment, null,
|
|
4114
|
+
filters,
|
|
4115
|
+
React__default.createElement("div", { className: "mt-2" },
|
|
4116
|
+
dataTable,
|
|
4117
|
+
noLogsNotice)));
|
|
4118
|
+
}
|
|
4119
|
+
/* ---------- Wrap in Modal --------- */
|
|
4120
|
+
return (React__default.createElement("div", { className: "LogReviewer-outer-container" },
|
|
4121
|
+
React__default.createElement("style", null, style$1),
|
|
4122
|
+
React__default.createElement("div", { className: "LogReviewer-inner-container" },
|
|
4123
|
+
React__default.createElement("div", { className: "LogReviewer-header" },
|
|
4124
|
+
React__default.createElement("div", { className: "LogReviewer-header-title" },
|
|
4125
|
+
React__default.createElement("h3", { className: "text-center m-0" }, "Log Review Dashboard")),
|
|
4126
|
+
React__default.createElement("div", { style: { width: 0 } },
|
|
4127
|
+
React__default.createElement("button", { type: "button", className: "LogReviewer-header-close-button btn btn-dark btn-lg pe-0", "aria-label": "close log reviewer panel", onClick: onClose },
|
|
4128
|
+
React__default.createElement(FontAwesomeIcon, { icon: faTimes })))),
|
|
4129
|
+
React__default.createElement("div", { className: "LogReviewer-contents" }, body))));
|
|
5078
4130
|
};
|
|
5079
4131
|
|
|
5080
|
-
/**
|
|
5081
|
-
* Days of the week
|
|
5082
|
-
* @author Gabe Abrams
|
|
5083
|
-
*/
|
|
5084
|
-
var DayOfWeek$2;
|
|
5085
|
-
(function (DayOfWeek) {
|
|
5086
|
-
DayOfWeek["Monday"] = "m";
|
|
5087
|
-
DayOfWeek["Tuesday"] = "t";
|
|
5088
|
-
DayOfWeek["Wednesday"] = "w";
|
|
5089
|
-
DayOfWeek["Thursday"] = "r";
|
|
5090
|
-
DayOfWeek["Friday"] = "f";
|
|
5091
|
-
DayOfWeek["Saturday"] = "s";
|
|
5092
|
-
DayOfWeek["Sunday"] = "u";
|
|
5093
|
-
})(DayOfWeek$2 || (DayOfWeek$2 = {}));
|
|
5094
|
-
|
|
5095
4132
|
/**
|
|
5096
4133
|
* Options for field types
|
|
5097
4134
|
* @author Yuen Ler Chow
|
|
@@ -40649,7 +39686,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40649
39686
|
* Save changes to the DBEntry and then finish
|
|
40650
39687
|
* @author Yuen Ler Chow
|
|
40651
39688
|
*/
|
|
40652
|
-
const save = () => __awaiter
|
|
39689
|
+
const save = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40653
39690
|
// Start the save loading indicator
|
|
40654
39691
|
dispatch({ type: ActionType$1.StartSave });
|
|
40655
39692
|
// add all default values to the entry
|
|
@@ -40919,7 +39956,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40919
39956
|
return renderEntryField(field, disabled);
|
|
40920
39957
|
}),
|
|
40921
39958
|
React__default.createElement("div", { className: "text-center mt-2" },
|
|
40922
|
-
React__default.createElement("button", { type: "button", id: "AddOrEditDBEntry-save-changes-button", className: "btn btn-primary btn-lg me-1", "aria-label": "Save changes", onClick: () => __awaiter
|
|
39959
|
+
React__default.createElement("button", { type: "button", id: "AddOrEditDBEntry-save-changes-button", className: "btn btn-primary btn-lg me-1", "aria-label": "Save changes", onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40923
39960
|
if (validationError) {
|
|
40924
39961
|
return alert$1('Please fix the following error', validationError);
|
|
40925
39962
|
}
|
|
@@ -40950,6 +39987,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40950
39987
|
* @author Yuen Ler Chow
|
|
40951
39988
|
* @param collectionName the name of the collection
|
|
40952
39989
|
* @param [adminsOnly] true if the endpoint is for admins only
|
|
39990
|
+
* @returns the endpoint path
|
|
40953
39991
|
*/
|
|
40954
39992
|
const generateEndpointPath = (collectionName, adminsOnly) => {
|
|
40955
39993
|
// Determine prefix based on whether the endpoint is for admins only
|
|
@@ -41062,7 +40100,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
41062
40100
|
* @author Yuen Ler Chow
|
|
41063
40101
|
* @param entry the database entry to delete
|
|
41064
40102
|
*/
|
|
41065
|
-
const deleteEntry = (entry) => __awaiter
|
|
40103
|
+
const deleteEntry = (entry) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41066
40104
|
// Confirm
|
|
41067
40105
|
const confirmed = yield confirm('Remove?', `Are you sure you want to remove this ${itemName}?`, {
|
|
41068
40106
|
confirmButtonText: 'Remove Item',
|
|
@@ -41078,7 +40116,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
41078
40116
|
type: ActionType.StartDelete,
|
|
41079
40117
|
});
|
|
41080
40118
|
// Perform deletion
|
|
41081
|
-
yield visitServerEndpoint
|
|
40119
|
+
yield visitServerEndpoint({
|
|
41082
40120
|
path: `${endpoint}/${entry[idPropName]}`,
|
|
41083
40121
|
method: 'DELETE',
|
|
41084
40122
|
});
|
|
@@ -41090,7 +40128,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
41090
40128
|
});
|
|
41091
40129
|
}
|
|
41092
40130
|
catch (err) {
|
|
41093
|
-
return showFatalError
|
|
40131
|
+
return showFatalError(err);
|
|
41094
40132
|
}
|
|
41095
40133
|
});
|
|
41096
40134
|
/*------------------------------------------------------------------------*/
|
|
@@ -41101,10 +40139,10 @@ const DBEntryManagerPanel = (props) => {
|
|
|
41101
40139
|
* @author Yuen Ler Chow
|
|
41102
40140
|
*/
|
|
41103
40141
|
useEffect(() => {
|
|
41104
|
-
(() => __awaiter
|
|
40142
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
41105
40143
|
// Load list of database entries
|
|
41106
40144
|
try {
|
|
41107
|
-
const data = yield visitServerEndpoint
|
|
40145
|
+
const data = yield visitServerEndpoint({
|
|
41108
40146
|
path: endpoint,
|
|
41109
40147
|
method: 'GET',
|
|
41110
40148
|
params: {
|
|
@@ -41118,7 +40156,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
41118
40156
|
});
|
|
41119
40157
|
}
|
|
41120
40158
|
catch (err) {
|
|
41121
|
-
return showFatalError
|
|
40159
|
+
return showFatalError(err);
|
|
41122
40160
|
}
|
|
41123
40161
|
}))();
|
|
41124
40162
|
}, []);
|
|
@@ -41131,7 +40169,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
41131
40169
|
let body;
|
|
41132
40170
|
/* ------------- Loading ------------ */
|
|
41133
40171
|
if (loading) {
|
|
41134
|
-
body = (React__default.createElement(LoadingSpinner
|
|
40172
|
+
body = (React__default.createElement(LoadingSpinner, null));
|
|
41135
40173
|
}
|
|
41136
40174
|
/* ------------- List of entries ------------ */
|
|
41137
40175
|
if (!loading && !adding && !dbEntryToEdit) {
|
|
@@ -41415,7 +40453,7 @@ let _logCollection;
|
|
|
41415
40453
|
*/
|
|
41416
40454
|
const cacclGetLaunchInfo = (req) => {
|
|
41417
40455
|
if (!_cacclGetLaunchInfo) {
|
|
41418
|
-
throw new ErrorWithCode
|
|
40456
|
+
throw new ErrorWithCode('Could not get launch info because server was not initialized with dce-reactkit\'s initServer function', ReactKitErrorCode$1.NoCACCLGetLaunchInfoFunction);
|
|
41419
40457
|
}
|
|
41420
40458
|
return _cacclGetLaunchInfo(req);
|
|
41421
40459
|
};
|
|
@@ -41475,16 +40513,16 @@ const initServer = (opts) => {
|
|
|
41475
40513
|
*/
|
|
41476
40514
|
opts.app.post(LOG_ROUTE_PATH, genRouteHandler({
|
|
41477
40515
|
paramTypes: {
|
|
41478
|
-
context: ParamType$
|
|
41479
|
-
subcontext: ParamType$
|
|
41480
|
-
tags: ParamType$
|
|
41481
|
-
level: ParamType$
|
|
41482
|
-
metadata: ParamType$
|
|
41483
|
-
errorMessage: ParamType$
|
|
41484
|
-
errorCode: ParamType$
|
|
41485
|
-
errorStack: ParamType$
|
|
41486
|
-
target: ParamType$
|
|
41487
|
-
action: ParamType$
|
|
40516
|
+
context: ParamType$1.String,
|
|
40517
|
+
subcontext: ParamType$1.String,
|
|
40518
|
+
tags: ParamType$1.JSON,
|
|
40519
|
+
level: ParamType$1.String,
|
|
40520
|
+
metadata: ParamType$1.JSON,
|
|
40521
|
+
errorMessage: ParamType$1.StringOptional,
|
|
40522
|
+
errorCode: ParamType$1.StringOptional,
|
|
40523
|
+
errorStack: ParamType$1.StringOptional,
|
|
40524
|
+
target: ParamType$1.StringOptional,
|
|
40525
|
+
action: ParamType$1.StringOptional,
|
|
41488
40526
|
},
|
|
41489
40527
|
handler: ({ params, logServerEvent }) => {
|
|
41490
40528
|
// Create log info
|
|
@@ -41530,7 +40568,7 @@ const initServer = (opts) => {
|
|
|
41530
40568
|
* @param isAdmin if true, the user is an admin
|
|
41531
40569
|
* @returns true if the user can review logs
|
|
41532
40570
|
*/
|
|
41533
|
-
const canReviewLogs = (userId, isAdmin) => __awaiter
|
|
40571
|
+
const canReviewLogs = (userId, isAdmin) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41534
40572
|
// Immediately deny access if user is not an admin
|
|
41535
40573
|
if (!isAdmin) {
|
|
41536
40574
|
return false;
|
|
@@ -41563,7 +40601,7 @@ const initServer = (opts) => {
|
|
|
41563
40601
|
* @returns {boolean} true if user has access
|
|
41564
40602
|
*/
|
|
41565
40603
|
opts.app.get(LOG_REVIEW_STATUS_ROUTE, genRouteHandler({
|
|
41566
|
-
handler: ({ params }) => __awaiter
|
|
40604
|
+
handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41567
40605
|
const { userId, isAdmin } = params;
|
|
41568
40606
|
const canReview = yield canReviewLogs(userId, isAdmin);
|
|
41569
40607
|
return canReview;
|
|
@@ -41578,16 +40616,16 @@ const initServer = (opts) => {
|
|
|
41578
40616
|
*/
|
|
41579
40617
|
opts.app.get(`${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/:year/months/:month`, genRouteHandler({
|
|
41580
40618
|
paramTypes: {
|
|
41581
|
-
year: ParamType$
|
|
41582
|
-
month: ParamType$
|
|
40619
|
+
year: ParamType$1.Int,
|
|
40620
|
+
month: ParamType$1.Int,
|
|
41583
40621
|
},
|
|
41584
|
-
handler: ({ params }) => __awaiter
|
|
40622
|
+
handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41585
40623
|
// Get user info
|
|
41586
40624
|
const { year, month, userId, isAdmin, } = params;
|
|
41587
40625
|
// Validate user
|
|
41588
40626
|
const canReview = yield canReviewLogs(userId, isAdmin);
|
|
41589
40627
|
if (!canReview) {
|
|
41590
|
-
throw new ErrorWithCode
|
|
40628
|
+
throw new ErrorWithCode('You cannot access this resource because you do not have the appropriate permissions.', ReactKitErrorCode$1.NotAllowedToReviewLogs);
|
|
41591
40629
|
}
|
|
41592
40630
|
// Query for logs
|
|
41593
40631
|
const logs = yield _logCollection.find({
|
|
@@ -41628,7 +40666,7 @@ const handleError = (res, error) => {
|
|
|
41628
40666
|
message = 'An unknown error occurred.';
|
|
41629
40667
|
}
|
|
41630
40668
|
// Get the error code
|
|
41631
|
-
const code = (error.code || ReactKitErrorCode$
|
|
40669
|
+
const code = (error.code || ReactKitErrorCode$1.NoCode);
|
|
41632
40670
|
// Get the status code
|
|
41633
40671
|
const status = (error.status || 500);
|
|
41634
40672
|
// Respond to user
|
|
@@ -41682,7 +40720,7 @@ const genErrorPage = (opts = {}) => {
|
|
|
41682
40720
|
const title = ((_a = opts.title) !== null && _a !== void 0 ? _a : 'An Error Occurred');
|
|
41683
40721
|
const pageTitle = ((_b = opts.pageTitle) !== null && _b !== void 0 ? _b : title);
|
|
41684
40722
|
const description = ((_c = opts.description) !== null && _c !== void 0 ? _c : 'An unknown server error occurred. Please contact support.');
|
|
41685
|
-
const code = ((_d = opts.code) !== null && _d !== void 0 ? _d : ReactKitErrorCode$
|
|
40723
|
+
const code = ((_d = opts.code) !== null && _d !== void 0 ? _d : ReactKitErrorCode$1.NoCode);
|
|
41686
40724
|
return `
|
|
41687
40725
|
<head>
|
|
41688
40726
|
<!-- Metadata -->
|
|
@@ -41921,7 +40959,7 @@ const parseUserAgent = (userAgent) => {
|
|
|
41921
40959
|
*/
|
|
41922
40960
|
const genRouteHandler = (opts) => {
|
|
41923
40961
|
// Return a route handler
|
|
41924
|
-
return (req, res, next) => __awaiter
|
|
40962
|
+
return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41925
40963
|
var _a, _b;
|
|
41926
40964
|
// Output params
|
|
41927
40965
|
const output = {};
|
|
@@ -41937,17 +40975,17 @@ const genRouteHandler = (opts) => {
|
|
|
41937
40975
|
|| req.query[name]
|
|
41938
40976
|
|| req.body[name]);
|
|
41939
40977
|
// Parse
|
|
41940
|
-
if (type === ParamType$
|
|
40978
|
+
if (type === ParamType$1.Boolean || type === ParamType$1.BooleanOptional) {
|
|
41941
40979
|
// Boolean
|
|
41942
40980
|
// Handle case where value doesn't exist
|
|
41943
40981
|
if (value === undefined) {
|
|
41944
|
-
if (type === ParamType$
|
|
40982
|
+
if (type === ParamType$1.BooleanOptional) {
|
|
41945
40983
|
output[name] = undefined;
|
|
41946
40984
|
}
|
|
41947
40985
|
else {
|
|
41948
40986
|
return handleError(res, {
|
|
41949
40987
|
message: `Parameter ${name} is required, but it was not included.`,
|
|
41950
|
-
code: ReactKitErrorCode$
|
|
40988
|
+
code: ReactKitErrorCode$1.MissingParameter,
|
|
41951
40989
|
status: 422,
|
|
41952
40990
|
});
|
|
41953
40991
|
}
|
|
@@ -41968,17 +41006,17 @@ const genRouteHandler = (opts) => {
|
|
|
41968
41006
|
].indexOf(simpleVal) >= 0);
|
|
41969
41007
|
}
|
|
41970
41008
|
}
|
|
41971
|
-
else if (type === ParamType$
|
|
41009
|
+
else if (type === ParamType$1.Float || type === ParamType$1.FloatOptional) {
|
|
41972
41010
|
// Float
|
|
41973
41011
|
// Handle case where value doesn't exist
|
|
41974
41012
|
if (value === undefined) {
|
|
41975
|
-
if (type === ParamType$
|
|
41013
|
+
if (type === ParamType$1.FloatOptional) {
|
|
41976
41014
|
output[name] = undefined;
|
|
41977
41015
|
}
|
|
41978
41016
|
else {
|
|
41979
41017
|
return handleError(res, {
|
|
41980
41018
|
message: `Parameter ${name} is required, but it was not included.`,
|
|
41981
|
-
code: ReactKitErrorCode$
|
|
41019
|
+
code: ReactKitErrorCode$1.MissingParameter,
|
|
41982
41020
|
status: 422,
|
|
41983
41021
|
});
|
|
41984
41022
|
}
|
|
@@ -41991,22 +41029,22 @@ const genRouteHandler = (opts) => {
|
|
|
41991
41029
|
// Issue!
|
|
41992
41030
|
return handleError(res, {
|
|
41993
41031
|
message: `Request data was malformed: ${name} was not a valid float.`,
|
|
41994
|
-
code: ReactKitErrorCode$
|
|
41032
|
+
code: ReactKitErrorCode$1.InvalidParameter,
|
|
41995
41033
|
status: 422,
|
|
41996
41034
|
});
|
|
41997
41035
|
}
|
|
41998
41036
|
}
|
|
41999
|
-
else if (type === ParamType$
|
|
41037
|
+
else if (type === ParamType$1.Int || type === ParamType$1.IntOptional) {
|
|
42000
41038
|
// Int
|
|
42001
41039
|
// Handle case where value doesn't exist
|
|
42002
41040
|
if (value === undefined) {
|
|
42003
|
-
if (type === ParamType$
|
|
41041
|
+
if (type === ParamType$1.IntOptional) {
|
|
42004
41042
|
output[name] = undefined;
|
|
42005
41043
|
}
|
|
42006
41044
|
else {
|
|
42007
41045
|
return handleError(res, {
|
|
42008
41046
|
message: `Parameter ${name} is required, but it was not included.`,
|
|
42009
|
-
code: ReactKitErrorCode$
|
|
41047
|
+
code: ReactKitErrorCode$1.MissingParameter,
|
|
42010
41048
|
status: 422,
|
|
42011
41049
|
});
|
|
42012
41050
|
}
|
|
@@ -42019,22 +41057,22 @@ const genRouteHandler = (opts) => {
|
|
|
42019
41057
|
// Issue!
|
|
42020
41058
|
return handleError(res, {
|
|
42021
41059
|
message: `Request data was malformed: ${name} was not a valid int.`,
|
|
42022
|
-
code: ReactKitErrorCode$
|
|
41060
|
+
code: ReactKitErrorCode$1.InvalidParameter,
|
|
42023
41061
|
status: 422,
|
|
42024
41062
|
});
|
|
42025
41063
|
}
|
|
42026
41064
|
}
|
|
42027
|
-
else if (type === ParamType$
|
|
41065
|
+
else if (type === ParamType$1.JSON || type === ParamType$1.JSONOptional) {
|
|
42028
41066
|
// Stringified JSON
|
|
42029
41067
|
// Handle case where value doesn't exist
|
|
42030
41068
|
if (value === undefined) {
|
|
42031
|
-
if (type === ParamType$
|
|
41069
|
+
if (type === ParamType$1.JSONOptional) {
|
|
42032
41070
|
output[name] = undefined;
|
|
42033
41071
|
}
|
|
42034
41072
|
else {
|
|
42035
41073
|
return handleError(res, {
|
|
42036
41074
|
message: `Parameter ${name} is required, but it was not included.`,
|
|
42037
|
-
code: ReactKitErrorCode$
|
|
41075
|
+
code: ReactKitErrorCode$1.MissingParameter,
|
|
42038
41076
|
status: 422,
|
|
42039
41077
|
});
|
|
42040
41078
|
}
|
|
@@ -42048,23 +41086,23 @@ const genRouteHandler = (opts) => {
|
|
|
42048
41086
|
catch (err) {
|
|
42049
41087
|
return handleError(res, {
|
|
42050
41088
|
message: `Request data was malformed: ${name} was not a valid JSON payload.`,
|
|
42051
|
-
code: ReactKitErrorCode$
|
|
41089
|
+
code: ReactKitErrorCode$1.InvalidParameter,
|
|
42052
41090
|
status: 422,
|
|
42053
41091
|
});
|
|
42054
41092
|
}
|
|
42055
41093
|
}
|
|
42056
41094
|
}
|
|
42057
|
-
else if (type === ParamType$
|
|
41095
|
+
else if (type === ParamType$1.String || type === ParamType$1.StringOptional) {
|
|
42058
41096
|
// String
|
|
42059
41097
|
// Handle case where value doesn't exist
|
|
42060
41098
|
if (value === undefined) {
|
|
42061
|
-
if (type === ParamType$
|
|
41099
|
+
if (type === ParamType$1.StringOptional) {
|
|
42062
41100
|
output[name] = undefined;
|
|
42063
41101
|
}
|
|
42064
41102
|
else {
|
|
42065
41103
|
return handleError(res, {
|
|
42066
41104
|
message: `Parameter ${name} is required, but it was not included.`,
|
|
42067
|
-
code: ReactKitErrorCode$
|
|
41105
|
+
code: ReactKitErrorCode$1.MissingParameter,
|
|
42068
41106
|
status: 422,
|
|
42069
41107
|
});
|
|
42070
41108
|
}
|
|
@@ -42079,7 +41117,7 @@ const genRouteHandler = (opts) => {
|
|
|
42079
41117
|
// No valid data type
|
|
42080
41118
|
return handleError(res, {
|
|
42081
41119
|
message: `An internal error occurred: we could not determine the type of ${name}.`,
|
|
42082
|
-
code: ReactKitErrorCode$
|
|
41120
|
+
code: ReactKitErrorCode$1.InvalidParameter,
|
|
42083
41121
|
status: 422,
|
|
42084
41122
|
});
|
|
42085
41123
|
}
|
|
@@ -42096,7 +41134,7 @@ const genRouteHandler = (opts) => {
|
|
|
42096
41134
|
&& !opts.skipSessionCheck) {
|
|
42097
41135
|
return handleError(res, {
|
|
42098
41136
|
message: 'Your session has expired. Please refresh the page and try again.',
|
|
42099
|
-
code: ReactKitErrorCode$
|
|
41137
|
+
code: ReactKitErrorCode$1.SessionExpired,
|
|
42100
41138
|
status: 401,
|
|
42101
41139
|
});
|
|
42102
41140
|
}
|
|
@@ -42116,7 +41154,7 @@ const genRouteHandler = (opts) => {
|
|
|
42116
41154
|
&& !opts.skipSessionCheck) {
|
|
42117
41155
|
return handleError(res, {
|
|
42118
41156
|
message: 'Your session was invalid. Please refresh the page and try again.',
|
|
42119
|
-
code: ReactKitErrorCode$
|
|
41157
|
+
code: ReactKitErrorCode$1.SessionExpired,
|
|
42120
41158
|
status: 401,
|
|
42121
41159
|
});
|
|
42122
41160
|
}
|
|
@@ -42175,7 +41213,7 @@ const genRouteHandler = (opts) => {
|
|
|
42175
41213
|
// Course of interest is not the launch course
|
|
42176
41214
|
return handleError(res, {
|
|
42177
41215
|
message: 'You switched sessions by opening this app in another tab. Please refresh the page and try again.',
|
|
42178
|
-
code: ReactKitErrorCode$
|
|
41216
|
+
code: ReactKitErrorCode$1.WrongCourse,
|
|
42179
41217
|
status: 401,
|
|
42180
41218
|
});
|
|
42181
41219
|
}
|
|
@@ -42195,7 +41233,7 @@ const genRouteHandler = (opts) => {
|
|
|
42195
41233
|
// User does not have access
|
|
42196
41234
|
return handleError(res, {
|
|
42197
41235
|
message: 'This action is only allowed if you are a teaching team member for the course. Please go back to Canvas, log in as a teaching team member, and try again.',
|
|
42198
|
-
code: ReactKitErrorCode$
|
|
41236
|
+
code: ReactKitErrorCode$1.NotTTM,
|
|
42199
41237
|
status: 401,
|
|
42200
41238
|
});
|
|
42201
41239
|
}
|
|
@@ -42208,7 +41246,7 @@ const genRouteHandler = (opts) => {
|
|
|
42208
41246
|
// User does not have access
|
|
42209
41247
|
return handleError(res, {
|
|
42210
41248
|
message: 'This action is only allowed if you are a Canvas admin. Please go back to Canvas, log in as an admin, and try again.',
|
|
42211
|
-
code: ReactKitErrorCode$
|
|
41249
|
+
code: ReactKitErrorCode$1.NotAdmin,
|
|
42212
41250
|
status: 401,
|
|
42213
41251
|
});
|
|
42214
41252
|
}
|
|
@@ -42220,7 +41258,7 @@ const genRouteHandler = (opts) => {
|
|
|
42220
41258
|
* Log an event on the server
|
|
42221
41259
|
* @author Gabe Abrams
|
|
42222
41260
|
*/
|
|
42223
|
-
const logServerEvent = (opts) => __awaiter
|
|
41261
|
+
const logServerEvent = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42224
41262
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
42225
41263
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42226
41264
|
// that indicates that this is actually a client event, but we don't
|
|
@@ -42264,7 +41302,7 @@ const genRouteHandler = (opts) => {
|
|
|
42264
41302
|
? {
|
|
42265
41303
|
type: LogType$1.Error,
|
|
42266
41304
|
errorMessage: (_j = opts.error.message) !== null && _j !== void 0 ? _j : 'Unknown message',
|
|
42267
|
-
errorCode: (_k = opts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$
|
|
41305
|
+
errorCode: (_k = opts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$1.NoCode,
|
|
42268
41306
|
errorStack: (_l = opts.error.stack) !== null && _l !== void 0 ? _l : 'No stack',
|
|
42269
41307
|
}
|
|
42270
41308
|
: {
|
|
@@ -42469,7 +41507,7 @@ const startMinWait = (minWaitMs) => {
|
|
|
42469
41507
|
* Finish the remaining time to wait
|
|
42470
41508
|
* @author Gabe Abrams
|
|
42471
41509
|
*/
|
|
42472
|
-
return () => __awaiter
|
|
41510
|
+
return () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42473
41511
|
const endTimestamp = Date.now();
|
|
42474
41512
|
// Calculate remaining time to wait
|
|
42475
41513
|
const elapsedTimeMs = (endTimestamp - startTimestamp);
|
|
@@ -42556,7 +41594,7 @@ const onlyKeepLetters = (str) => {
|
|
|
42556
41594
|
* once
|
|
42557
41595
|
* @returns array of resolved values in the same order as the task functions
|
|
42558
41596
|
*/
|
|
42559
|
-
const parallelLimit = (taskFunctions, limit) => __awaiter
|
|
41597
|
+
const parallelLimit = (taskFunctions, limit) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42560
41598
|
const results = [];
|
|
42561
41599
|
// Wait until finished with all tasks
|
|
42562
41600
|
yield new Promise((resolve) => {
|
|
@@ -42567,7 +41605,7 @@ const parallelLimit = (taskFunctions, limit) => __awaiter$1(void 0, void 0, void
|
|
|
42567
41605
|
* Start the next task
|
|
42568
41606
|
* @author Gabe Abrams
|
|
42569
41607
|
*/
|
|
42570
|
-
const startTask = () => __awaiter
|
|
41608
|
+
const startTask = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42571
41609
|
const taskIndex = nextTaskIndex++;
|
|
42572
41610
|
// Get the task
|
|
42573
41611
|
const taskFunction = taskFunctions[taskIndex];
|
|
@@ -42620,14 +41658,14 @@ let canReview = undefined;
|
|
|
42620
41658
|
* @author Gabe Abrams
|
|
42621
41659
|
* @returns true if current user can review logs
|
|
42622
41660
|
*/
|
|
42623
|
-
const canReviewLogs = () => __awaiter
|
|
41661
|
+
const canReviewLogs = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42624
41662
|
// If cached, use that value
|
|
42625
41663
|
if (canReview !== undefined) {
|
|
42626
41664
|
return canReview;
|
|
42627
41665
|
}
|
|
42628
41666
|
// Ask on server
|
|
42629
41667
|
try {
|
|
42630
|
-
canReview = !!(yield visitServerEndpoint
|
|
41668
|
+
canReview = !!(yield visitServerEndpoint({
|
|
42631
41669
|
path: LOG_REVIEW_STATUS_ROUTE,
|
|
42632
41670
|
method: 'GET',
|
|
42633
41671
|
}));
|
|
@@ -42750,11 +41788,11 @@ const addDBEditorEndpoints = (opts) => {
|
|
|
42750
41788
|
* @author Yuen Ler Chow
|
|
42751
41789
|
* @returns {any[]} the list of items in the collection
|
|
42752
41790
|
*/
|
|
42753
|
-
app.get(endpointPath, genRouteHandler
|
|
41791
|
+
app.get(endpointPath, genRouteHandler({
|
|
42754
41792
|
paramTypes: {
|
|
42755
41793
|
filterQuery: ParamType$1.JSONOptional,
|
|
42756
41794
|
},
|
|
42757
|
-
handler: ({ params }) => __awaiter
|
|
41795
|
+
handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42758
41796
|
var _a;
|
|
42759
41797
|
const filterQuery = (_a = params.filterQuery) !== null && _a !== void 0 ? _a : {};
|
|
42760
41798
|
const categories = yield collection.find(filterQuery);
|
|
@@ -42766,11 +41804,11 @@ const addDBEditorEndpoints = (opts) => {
|
|
|
42766
41804
|
* @author Yuen Ler Chow
|
|
42767
41805
|
* @param {any} item the item to create
|
|
42768
41806
|
*/
|
|
42769
|
-
app.post(endpointPath, genRouteHandler
|
|
41807
|
+
app.post(endpointPath, genRouteHandler({
|
|
42770
41808
|
paramTypes: {
|
|
42771
41809
|
item: ParamType$1.JSON,
|
|
42772
41810
|
},
|
|
42773
|
-
handler: ({ params, }) => __awaiter
|
|
41811
|
+
handler: ({ params, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42774
41812
|
// Destructure params
|
|
42775
41813
|
const { item, } = params;
|
|
42776
41814
|
yield collection.insert(item);
|
|
@@ -42780,11 +41818,11 @@ const addDBEditorEndpoints = (opts) => {
|
|
|
42780
41818
|
* Remove an item from the collection by id
|
|
42781
41819
|
* @author Yuen Ler Chow
|
|
42782
41820
|
*/
|
|
42783
|
-
app.delete(`${endpointPath}/:id`, genRouteHandler
|
|
41821
|
+
app.delete(`${endpointPath}/:id`, genRouteHandler({
|
|
42784
41822
|
paramTypes: {
|
|
42785
41823
|
id: ParamType$1.String,
|
|
42786
41824
|
},
|
|
42787
|
-
handler: ({ params, }) => __awaiter
|
|
41825
|
+
handler: ({ params, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42788
41826
|
// Destructure params
|
|
42789
41827
|
const { id, } = params;
|
|
42790
41828
|
yield collection.delete({ id });
|
|
@@ -42808,5 +41846,5 @@ var DayOfWeek;
|
|
|
42808
41846
|
})(DayOfWeek || (DayOfWeek = {}));
|
|
42809
41847
|
var DayOfWeek$1 = DayOfWeek;
|
|
42810
41848
|
|
|
42811
|
-
export { AppWrapper, ButtonInputGroup
|
|
41849
|
+
export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SimpleDateChooser, TabBox, Variant$1 as Variant, abbreviate, addDBEditorEndpoints, alert$1 as alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
|
|
42812
41850
|
//# sourceMappingURL=index.js.map
|