dce-reactkit 3.2.2-beta.5 → 3.2.2-beta.51
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 +741 -446
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ButtonInputGroup.d.ts +1 -0
- package/dist/cjs/types/components/Drawer.d.ts +1 -0
- package/dist/cjs/types/components/IntelliTable.d.ts +1 -0
- package/dist/cjs/types/components/ItemPicker/NestableItemList.d.ts +1 -0
- package/dist/cjs/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/cjs/types/types/LogAction.d.ts +16 -16
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataContextMap.d.ts +11 -0
- package/dist/cjs/types/types/LogMetadataTagMap.d.ts +8 -0
- package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +8 -0
- package/dist/cjs/types/types/LogMetadataType.d.ts +6 -12
- package/dist/esm/index.js +742 -447
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ButtonInputGroup.d.ts +1 -0
- package/dist/esm/types/components/Drawer.d.ts +1 -0
- package/dist/esm/types/components/IntelliTable.d.ts +1 -0
- package/dist/esm/types/components/ItemPicker/NestableItemList.d.ts +1 -0
- package/dist/esm/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/esm/types/types/LogAction.d.ts +16 -16
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataContextMap.d.ts +11 -0
- package/dist/esm/types/types/LogMetadataTagMap.d.ts +8 -0
- package/dist/esm/types/types/LogMetadataTargetMap.d.ts +8 -0
- package/dist/esm/types/types/LogMetadataType.d.ts +6 -12
- package/dist/index.d.ts +51 -29
- package/package.json +1 -1
- package/src/components/ButtonInputGroup.tsx +5 -2
- package/src/components/CSVDownloadButton.tsx +2 -2
- package/src/components/Drawer.tsx +9 -1
- package/src/components/IntelliTable.tsx +181 -26
- package/src/components/ItemPicker/NestableItemList.tsx +32 -14
- package/src/components/ItemPicker/index.tsx +4 -0
- package/src/components/LogReviewer.tsx +635 -406
- package/src/components/SimpleDateChooser.tsx +28 -23
- package/src/helpers/genCSV.ts +22 -4
- package/src/helpers/genRouteHandler.ts +2 -2
- package/src/helpers/logClientEvent.tsx +1 -1
- package/src/server/initServer.ts +10 -3
- package/src/types/LogAction.ts +16 -16
- package/src/types/LogBuiltInMetadata.ts +5 -5
- package/src/types/LogMetadataContextMap.ts +15 -0
- package/src/types/LogMetadataTagMap.ts +9 -0
- package/src/types/LogMetadataTargetMap.ts +9 -0
- package/src/types/LogMetadataType.ts +8 -15
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useReducer } from 'react';
|
|
2
2
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { faExclamationTriangle, faCircle, faDotCircle, faCheckSquare, faHourglass, faClipboard, faChevronDown, faChevronRight, faCloudDownloadAlt, faCheckCircle, faXmarkCircle,
|
|
3
|
+
import { faExclamationTriangle, faCircle, faDotCircle, faCheckSquare, faHourglass, faClipboard, faChevronDown, faChevronRight, faCloudDownloadAlt, faMinus, faCheckCircle, faXmarkCircle, faSort, faSortDown, faSortUp, faCalendar, faTag, faHammer, faList, faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
4
4
|
import { faCircle as faCircle$1, faSquareMinus, faSquare } from '@fortawesome/free-regular-svg-icons';
|
|
5
5
|
|
|
6
6
|
/******************************************************************************
|
|
@@ -511,14 +511,14 @@ const LOG_ROUTE_PATH = `${ROUTE_PATH_PREFIX}/log`;
|
|
|
511
511
|
const LogBuiltInMetadata = {
|
|
512
512
|
// Contexts
|
|
513
513
|
Context: {
|
|
514
|
-
Uncategorized: '
|
|
515
|
-
ServerRenderedErrorPage: '
|
|
516
|
-
ServerEndpointError: '
|
|
517
|
-
ClientFatalError: '
|
|
514
|
+
Uncategorized: 'Uncategorized',
|
|
515
|
+
ServerRenderedErrorPage: 'ServerRenderedErrorPage',
|
|
516
|
+
ServerEndpointError: 'ServerEndpointError',
|
|
517
|
+
ClientFatalError: 'ClientFatalError',
|
|
518
518
|
},
|
|
519
519
|
// Targets
|
|
520
520
|
Target: {
|
|
521
|
-
|
|
521
|
+
NoTarget: 'NoTarget',
|
|
522
522
|
},
|
|
523
523
|
};
|
|
524
524
|
|
|
@@ -674,7 +674,7 @@ const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
674
674
|
? opts.error.stack
|
|
675
675
|
: undefined),
|
|
676
676
|
target: (opts.action
|
|
677
|
-
? ((_g = opts.target) !== null && _g !== void 0 ? _g : LogBuiltInMetadata.Target.
|
|
677
|
+
? ((_g = opts.target) !== null && _g !== void 0 ? _g : LogBuiltInMetadata.Target.NoTarget)
|
|
678
678
|
: undefined),
|
|
679
679
|
action: (opts.action
|
|
680
680
|
? opts.action
|
|
@@ -1180,21 +1180,21 @@ const ButtonInputGroup = (props) => {
|
|
|
1180
1180
|
/*------------------------------------------------------------------------*/
|
|
1181
1181
|
/* -------------- Props ------------- */
|
|
1182
1182
|
// Destructure all props
|
|
1183
|
-
const { label, minLabelWidth, children, } = props;
|
|
1183
|
+
const { label, minLabelWidth, children, className, } = props;
|
|
1184
1184
|
/*------------------------------------------------------------------------*/
|
|
1185
1185
|
/* Render */
|
|
1186
1186
|
/*------------------------------------------------------------------------*/
|
|
1187
1187
|
/*----------------------------------------*/
|
|
1188
1188
|
/* Main UI */
|
|
1189
1189
|
/*----------------------------------------*/
|
|
1190
|
-
return (React.createElement("div", { className:
|
|
1190
|
+
return (React.createElement("div", { className: `input-group ${className !== null && className !== void 0 ? className : ''}` },
|
|
1191
1191
|
React.createElement("div", { className: "input-group-prepend d-flex w-100" },
|
|
1192
1192
|
React.createElement("span", { className: "input-group-text", style: {
|
|
1193
1193
|
minWidth: (minLabelWidth !== null && minLabelWidth !== void 0 ? minLabelWidth : undefined),
|
|
1194
1194
|
borderTopRightRadius: 0,
|
|
1195
1195
|
borderBottomRightRadius: 0,
|
|
1196
1196
|
} }, label),
|
|
1197
|
-
React.createElement("span", { className: "input-group-text flex-grow-1 rounded-right", style: {
|
|
1197
|
+
React.createElement("span", { className: "input-group-text flex-grow-1 rounded-right d-flex flex-wrap", style: {
|
|
1198
1198
|
backgroundColor: 'white',
|
|
1199
1199
|
borderTopLeftRadius: 0,
|
|
1200
1200
|
borderBottomLeftRadius: 0,
|
|
@@ -1299,18 +1299,6 @@ const getTimeInfoInET = (dateOrTimestamp) => {
|
|
|
1299
1299
|
};
|
|
1300
1300
|
};
|
|
1301
1301
|
|
|
1302
|
-
/**
|
|
1303
|
-
* Force a number to stay within specific bounds
|
|
1304
|
-
* @author Gabe Abrams
|
|
1305
|
-
* @param num the number to move into the bounds
|
|
1306
|
-
* @param min the minimum number in the bound
|
|
1307
|
-
* @param max the maximum number in the bound
|
|
1308
|
-
* @returns bounded number
|
|
1309
|
-
*/
|
|
1310
|
-
const forceNumIntoBounds = (num, min, max) => {
|
|
1311
|
-
return Math.max(min, Math.min(max, num));
|
|
1312
|
-
};
|
|
1313
|
-
|
|
1314
1302
|
/**
|
|
1315
1303
|
* A very simple, lightweight date chooser
|
|
1316
1304
|
* @author Gabe Abrams
|
|
@@ -1325,7 +1313,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1325
1313
|
var _a;
|
|
1326
1314
|
/* -------------- Props ------------- */
|
|
1327
1315
|
const { ariaLabel, name, month, day, year, onChange, chooseFromPast, } = props;
|
|
1328
|
-
|
|
1316
|
+
const numMonthsToShow = ((_a = props.numMonthsToShow) !== null && _a !== void 0 ? _a : 6);
|
|
1329
1317
|
/*------------------------------------------------------------------------*/
|
|
1330
1318
|
/* Render */
|
|
1331
1319
|
/*------------------------------------------------------------------------*/
|
|
@@ -1339,7 +1327,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1339
1327
|
let startMonth = today.month;
|
|
1340
1328
|
if (chooseFromPast) {
|
|
1341
1329
|
startMonth -= Math.max(0, numMonthsToShow - 1);
|
|
1342
|
-
|
|
1330
|
+
while (startMonth <= 0) {
|
|
1343
1331
|
startMonth += 12;
|
|
1344
1332
|
startYear -= 1;
|
|
1345
1333
|
}
|
|
@@ -1347,22 +1335,35 @@ const SimpleDateChooser = (props) => {
|
|
|
1347
1335
|
for (let i = 0; i < numMonthsToShow; i++) {
|
|
1348
1336
|
// Get month and year info
|
|
1349
1337
|
const unmoddedMonth = (startMonth + i);
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1338
|
+
let month = unmoddedMonth;
|
|
1339
|
+
while (month > 12) {
|
|
1340
|
+
month -= 12;
|
|
1341
|
+
}
|
|
1353
1342
|
const monthName = getMonthName(month).full;
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
: startYear);
|
|
1343
|
+
// Year is start year +1 for each 12 months
|
|
1344
|
+
const year = (startYear + (Math.floor(unmoddedMonth / 12)));
|
|
1357
1345
|
// Figure out which days are allowed
|
|
1358
1346
|
const days = [];
|
|
1359
1347
|
const numDaysInMonth = (new Date(year, month, 0)).getDate();
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1348
|
+
if (chooseFromPast) {
|
|
1349
|
+
// Past selection
|
|
1350
|
+
const numDaysToAdd = ((month === today.month)
|
|
1351
|
+
? today.day // Current month, only add up to today
|
|
1352
|
+
: numDaysInMonth // Past month, add all days
|
|
1353
|
+
);
|
|
1354
|
+
for (let day = 1; day <= numDaysToAdd; day++) {
|
|
1355
|
+
days.push(day);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
else {
|
|
1359
|
+
// Future selection: add all remaining days of the month
|
|
1360
|
+
const firstDay = (month === today.month
|
|
1361
|
+
? today.day // Current month: start at current date
|
|
1362
|
+
: 1 // Future month: start at beginning of month
|
|
1363
|
+
);
|
|
1364
|
+
for (let day = firstDay; day <= numDaysInMonth; day++) {
|
|
1365
|
+
days.push(day);
|
|
1366
|
+
}
|
|
1366
1367
|
}
|
|
1367
1368
|
choices.push({
|
|
1368
1369
|
choiceName: `${monthName} ${year}`,
|
|
@@ -1433,14 +1434,16 @@ const Drawer = (props) => {
|
|
|
1433
1434
|
/*------------------------------------------------------------------------*/
|
|
1434
1435
|
/* -------------- Props ------------- */
|
|
1435
1436
|
// Destructure all props
|
|
1436
|
-
const { children, } = props;
|
|
1437
|
+
const { customBackgroundColor, children, } = props;
|
|
1437
1438
|
/*------------------------------------------------------------------------*/
|
|
1438
1439
|
/* Render */
|
|
1439
1440
|
/*------------------------------------------------------------------------*/
|
|
1440
1441
|
/*----------------------------------------*/
|
|
1441
1442
|
/* Main UI */
|
|
1442
1443
|
/*----------------------------------------*/
|
|
1443
|
-
return (React.createElement("div", { className: "Drawer-container"
|
|
1444
|
+
return (React.createElement("div", { className: "Drawer-container", style: {
|
|
1445
|
+
backgroundColor: (customBackgroundColor !== null && customBackgroundColor !== void 0 ? customBackgroundColor : undefined),
|
|
1446
|
+
} },
|
|
1444
1447
|
React.createElement("style", null, style$4),
|
|
1445
1448
|
children));
|
|
1446
1449
|
};
|
|
@@ -1903,24 +1906,25 @@ const CopiableBox = (props) => {
|
|
|
1903
1906
|
/**
|
|
1904
1907
|
* Reusable nested item picker
|
|
1905
1908
|
* @author Yuen Ler Chow
|
|
1909
|
+
* @author Gabe Abrams
|
|
1906
1910
|
*/
|
|
1907
1911
|
/* ------------- Actions ------------ */
|
|
1908
1912
|
// Types of actions
|
|
1909
1913
|
var ActionType$2;
|
|
1910
1914
|
(function (ActionType) {
|
|
1911
|
-
// Toggle whether
|
|
1912
|
-
ActionType["
|
|
1915
|
+
// Toggle whether a child are being shown
|
|
1916
|
+
ActionType["ToggleChild"] = "toggle-child";
|
|
1913
1917
|
})(ActionType$2 || (ActionType$2 = {}));
|
|
1914
1918
|
/**
|
|
1915
1919
|
* Reducer that executes actions
|
|
1916
|
-
* @author
|
|
1920
|
+
* @author Gabe Abrams
|
|
1917
1921
|
* @param state current state
|
|
1918
1922
|
* @param action action to execute
|
|
1919
1923
|
*/
|
|
1920
1924
|
const reducer$2 = (state, action) => {
|
|
1921
1925
|
switch (action.type) {
|
|
1922
|
-
case ActionType$2.
|
|
1923
|
-
return {
|
|
1926
|
+
case ActionType$2.ToggleChild: {
|
|
1927
|
+
return Object.assign(Object.assign({}, state), { childExpanded: Object.assign(Object.assign({}, state.childExpanded), { [String(action.id)]: !state.childExpanded[String(action.id)] }) });
|
|
1924
1928
|
}
|
|
1925
1929
|
default: {
|
|
1926
1930
|
return state;
|
|
@@ -1938,14 +1942,19 @@ const NestableItemList = (props) => {
|
|
|
1938
1942
|
// Destructure all props
|
|
1939
1943
|
const { items, onChanged, } = props;
|
|
1940
1944
|
/* -------------- State ------------- */
|
|
1945
|
+
// Create initial map of child expanded booleans
|
|
1946
|
+
const initChildExpanded = {};
|
|
1947
|
+
items.forEach((item) => {
|
|
1948
|
+
initChildExpanded[String(item.id)] = false;
|
|
1949
|
+
});
|
|
1941
1950
|
// Initial state
|
|
1942
1951
|
const initialState = {
|
|
1943
|
-
|
|
1952
|
+
childExpanded: initChildExpanded,
|
|
1944
1953
|
};
|
|
1945
1954
|
// Initialize state
|
|
1946
1955
|
const [state, dispatch] = useReducer(reducer$2, initialState);
|
|
1947
1956
|
// Destructure common state
|
|
1948
|
-
const {
|
|
1957
|
+
const { childExpanded, } = state;
|
|
1949
1958
|
/*------------------------------------------------------------------------*/
|
|
1950
1959
|
/* Component Functions */
|
|
1951
1960
|
/*------------------------------------------------------------------------*/
|
|
@@ -2033,14 +2042,15 @@ const NestableItemList = (props) => {
|
|
|
2033
2042
|
backgroundColor: 'transparent',
|
|
2034
2043
|
}, type: "button", onClick: () => {
|
|
2035
2044
|
dispatch({
|
|
2036
|
-
type: ActionType$2.
|
|
2045
|
+
type: ActionType$2.ToggleChild,
|
|
2046
|
+
id: item.id,
|
|
2037
2047
|
});
|
|
2038
|
-
}, "aria-label": `${
|
|
2039
|
-
React.createElement(FontAwesomeIcon, { icon:
|
|
2048
|
+
}, "aria-label": `${childExpanded[item.id] ? 'Hide' : 'Show'} items in ${item.name}` },
|
|
2049
|
+
React.createElement(FontAwesomeIcon, { icon: childExpanded[item.id] ? faChevronDown : faChevronRight })))),
|
|
2040
2050
|
React.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) => {
|
|
2041
2051
|
onChanged(changeChecked(item.id, checked, items));
|
|
2042
2052
|
}, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$1.Light }),
|
|
2043
|
-
item.isGroup &&
|
|
2053
|
+
(item.isGroup && childExpanded[item.id]) && (React.createElement("div", { className: "NestableItemList-children-container", style: {
|
|
2044
2054
|
paddingLeft: '2.2rem',
|
|
2045
2055
|
} },
|
|
2046
2056
|
React.createElement(NestableItemList, { items: item.children, onChanged: (updatedItems) => {
|
|
@@ -2062,7 +2072,7 @@ const ItemPicker = (props) => {
|
|
|
2062
2072
|
/*------------------------------------------------------------------------*/
|
|
2063
2073
|
/* -------------- Props ------------- */
|
|
2064
2074
|
// Destructure all props
|
|
2065
|
-
const { title, items, onChanged, } = props;
|
|
2075
|
+
const { title, items, onChanged, noBottomMargin, } = props;
|
|
2066
2076
|
/*------------------------------------------------------------------------*/
|
|
2067
2077
|
/* Component Functions */
|
|
2068
2078
|
/*------------------------------------------------------------------------*/
|
|
@@ -2072,11 +2082,34 @@ const ItemPicker = (props) => {
|
|
|
2072
2082
|
/*----------------------------------------*/
|
|
2073
2083
|
/* Main UI */
|
|
2074
2084
|
/*----------------------------------------*/
|
|
2075
|
-
return (React.createElement(TabBox, { title: title },
|
|
2085
|
+
return (React.createElement(TabBox, { title: title, noBottomMargin: noBottomMargin },
|
|
2076
2086
|
React.createElement("div", { style: { overflowX: 'auto' } },
|
|
2077
2087
|
React.createElement(NestableItemList, { items: items, onChanged: onChanged }))));
|
|
2078
2088
|
};
|
|
2079
2089
|
|
|
2090
|
+
// Import shared helpers
|
|
2091
|
+
/**
|
|
2092
|
+
* Get a human-readable description of a date (all in ET)
|
|
2093
|
+
* @author Gabe Abrams
|
|
2094
|
+
* @param [dateOrTimestamp=today] the date or timestamp for the date to describe
|
|
2095
|
+
* @returns human-readable description of the date
|
|
2096
|
+
*/
|
|
2097
|
+
const getHumanReadableDate = (dateOrTimestamp) => {
|
|
2098
|
+
// Get the date info
|
|
2099
|
+
const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
|
|
2100
|
+
const currYear = getTimeInfoInET().year;
|
|
2101
|
+
// Get the short month description
|
|
2102
|
+
const monthName = getMonthName(month).short;
|
|
2103
|
+
// Create start of description
|
|
2104
|
+
let description = `${monthName} ${day}${getOrdinal(day)}`;
|
|
2105
|
+
// Add on year if it's different
|
|
2106
|
+
if (year !== currYear) {
|
|
2107
|
+
description += ` ${year}`;
|
|
2108
|
+
}
|
|
2109
|
+
// Return description
|
|
2110
|
+
return description;
|
|
2111
|
+
};
|
|
2112
|
+
|
|
2080
2113
|
/**
|
|
2081
2114
|
* Path of the route for storing client-side logs
|
|
2082
2115
|
* @author Gabe Abrams
|
|
@@ -2116,37 +2149,37 @@ var LogType$1 = LogType;
|
|
|
2116
2149
|
var LogAction;
|
|
2117
2150
|
(function (LogAction) {
|
|
2118
2151
|
// Target was opened by the user (it was not on screen, but now it is)
|
|
2119
|
-
LogAction["Open"] = "
|
|
2152
|
+
LogAction["Open"] = "Open";
|
|
2120
2153
|
// Target was closed by the user (it was on screen, but now it is not)
|
|
2121
|
-
LogAction["Close"] = "
|
|
2154
|
+
LogAction["Close"] = "Close";
|
|
2122
2155
|
// Target was cancelled by the user (it was on closed without saving)
|
|
2123
|
-
LogAction["Cancel"] = "
|
|
2156
|
+
LogAction["Cancel"] = "Cancel";
|
|
2124
2157
|
// Target was expanded by the user (it always remains on screen, but size was changed)
|
|
2125
|
-
LogAction["Expand"] = "
|
|
2158
|
+
LogAction["Expand"] = "Expand";
|
|
2126
2159
|
// Target was collapsed by the user (it always remains on screen, but size was changed)
|
|
2127
|
-
LogAction["Collapse"] = "
|
|
2160
|
+
LogAction["Collapse"] = "Collapse";
|
|
2128
2161
|
// Target was viewed by the user (only for items that are not opened or closed, those must use Open/Close actions)
|
|
2129
|
-
LogAction["View"] = "
|
|
2162
|
+
LogAction["View"] = "View";
|
|
2130
2163
|
// Target interrupted the user (popup, dialog, validation message, etc. appeared without user prompting)
|
|
2131
|
-
LogAction["Interrupt"] = "
|
|
2164
|
+
LogAction["Interrupt"] = "Interrupt";
|
|
2132
2165
|
// Target was created by the user (it did not exist before)
|
|
2133
|
-
LogAction["Create"] = "
|
|
2166
|
+
LogAction["Create"] = "Create";
|
|
2134
2167
|
// Target was edited by the user (it existed and was changed)
|
|
2135
|
-
LogAction["Edit"] = "
|
|
2168
|
+
LogAction["Edit"] = "Edit";
|
|
2136
2169
|
// Target was deleted by the user (it existed and now it doesn't)
|
|
2137
|
-
LogAction["Delete"] = "
|
|
2170
|
+
LogAction["Delete"] = "Delete";
|
|
2138
2171
|
// Target was added by the user (it already existed and was added to another place)
|
|
2139
|
-
LogAction["Add"] = "
|
|
2172
|
+
LogAction["Add"] = "Add";
|
|
2140
2173
|
// Target was removed by the user (it was removed from something but still exists)
|
|
2141
|
-
LogAction["Remove"] = "
|
|
2174
|
+
LogAction["Remove"] = "Remove";
|
|
2142
2175
|
// Target was activated by the user (click, check, tap, keypress, etc.)
|
|
2143
|
-
LogAction["Activate"] = "
|
|
2176
|
+
LogAction["Activate"] = "Activate";
|
|
2144
2177
|
// Target was deactivated by the user (click away, uncheck, tap outside of, tab away, etc.)
|
|
2145
|
-
LogAction["Deactivate"] = "
|
|
2178
|
+
LogAction["Deactivate"] = "Deactivate";
|
|
2146
2179
|
// User showed interest in a target (hover, peek, etc.)
|
|
2147
|
-
LogAction["Peek"] = "
|
|
2180
|
+
LogAction["Peek"] = "Peek";
|
|
2148
2181
|
// Unknown action
|
|
2149
|
-
LogAction["Unknown"] = "
|
|
2182
|
+
LogAction["Unknown"] = "Unknown";
|
|
2150
2183
|
})(LogAction || (LogAction = {}));
|
|
2151
2184
|
var LogAction$1 = LogAction;
|
|
2152
2185
|
|
|
@@ -2188,12 +2221,12 @@ const roundToNumDecimals = (num, numDecimals) => {
|
|
|
2188
2221
|
* @returns escaped cell text
|
|
2189
2222
|
*/
|
|
2190
2223
|
const escapeCellText = (text) => {
|
|
2191
|
-
if (!text.includes(',')) {
|
|
2224
|
+
if (!String(text).includes(',')) {
|
|
2192
2225
|
// No need to escape
|
|
2193
|
-
return text;
|
|
2226
|
+
return String(text);
|
|
2194
2227
|
}
|
|
2195
2228
|
// Perform escape
|
|
2196
|
-
return `"${text.replace(/"/g, '""')}`;
|
|
2229
|
+
return `"${String(text).replace(/"/g, '""')}`;
|
|
2197
2230
|
};
|
|
2198
2231
|
/**
|
|
2199
2232
|
* Generate a CSV file
|
|
@@ -2212,9 +2245,26 @@ const genCSV = (data, columns) => {
|
|
|
2212
2245
|
.join(','));
|
|
2213
2246
|
// Add each row
|
|
2214
2247
|
data.forEach((datum) => {
|
|
2248
|
+
csv += '\n';
|
|
2215
2249
|
csv += (columns
|
|
2216
2250
|
.map((column) => {
|
|
2217
|
-
|
|
2251
|
+
let contents;
|
|
2252
|
+
const cell = datum[column.param];
|
|
2253
|
+
if (typeof cell === 'string'
|
|
2254
|
+
|| typeof cell === 'number') {
|
|
2255
|
+
contents = String(cell);
|
|
2256
|
+
}
|
|
2257
|
+
else if (typeof cell === 'undefined'
|
|
2258
|
+
|| cell === null) {
|
|
2259
|
+
contents = '';
|
|
2260
|
+
}
|
|
2261
|
+
else if (typeof cell === 'object') {
|
|
2262
|
+
contents = JSON.stringify(cell);
|
|
2263
|
+
}
|
|
2264
|
+
else {
|
|
2265
|
+
contents = '';
|
|
2266
|
+
}
|
|
2267
|
+
return escapeCellText(contents);
|
|
2218
2268
|
})
|
|
2219
2269
|
.join(','));
|
|
2220
2270
|
});
|
|
@@ -2243,11 +2293,12 @@ const CSVDownloadButton = (props) => {
|
|
|
2243
2293
|
/* Main UI */
|
|
2244
2294
|
/*----------------------------------------*/
|
|
2245
2295
|
// Render the button
|
|
2246
|
-
return (React.createElement("a", { id: id, download: filename, href: `data:application/octet-stream,${csv}`, className: `CSVDownloadButton-button ${className !== null && className !== void 0 ? className : 'btn btn-secondary'}`, "aria-label": (ariaLabel
|
|
2296
|
+
return (React.createElement("a", { id: id, download: filename, href: `data:application/octet-stream,${encodeURIComponent(csv)}`, className: `CSVDownloadButton-button ${className !== null && className !== void 0 ? className : 'btn btn-secondary'}`, "aria-label": (ariaLabel
|
|
2247
2297
|
? `Click to download ${filename}`
|
|
2248
2298
|
: ariaLabel), style: style, onClick: onClick },
|
|
2249
2299
|
!children && (React.createElement(React.Fragment, null,
|
|
2250
|
-
React.createElement(FontAwesomeIcon, { icon: faCloudDownloadAlt
|
|
2300
|
+
React.createElement(FontAwesomeIcon, { icon: faCloudDownloadAlt }),
|
|
2301
|
+
' ',
|
|
2251
2302
|
"Download CSV")),
|
|
2252
2303
|
children));
|
|
2253
2304
|
};
|
|
@@ -2271,9 +2322,13 @@ var ActionType$1;
|
|
|
2271
2322
|
// Toggle sort column param
|
|
2272
2323
|
ActionType["ToggleSortColumn"] = "toggle-sort-column";
|
|
2273
2324
|
// Toggle the visibility of a column
|
|
2274
|
-
ActionType["
|
|
2325
|
+
ActionType["UpdateColumnVisibility"] = "update-column-visibility";
|
|
2275
2326
|
// Toggle the column visibility customization modal
|
|
2276
2327
|
ActionType["ToggleColVisCusModalVisibility"] = "toggle-col-vis-cus-modal-visibility";
|
|
2328
|
+
// Show all columns
|
|
2329
|
+
ActionType["ShowAllColumns"] = "show-all-columns";
|
|
2330
|
+
// Hide all columns
|
|
2331
|
+
ActionType["HideAllColumns"] = "hide-all-columns";
|
|
2277
2332
|
})(ActionType$1 || (ActionType$1 = {}));
|
|
2278
2333
|
/**
|
|
2279
2334
|
* Reducer that executes actions
|
|
@@ -2295,14 +2350,28 @@ const reducer$1 = (state, action) => {
|
|
|
2295
2350
|
// Stop sorting by column
|
|
2296
2351
|
return Object.assign(Object.assign({}, state), { sortColumnParam: undefined, sortType: SortType.Ascending });
|
|
2297
2352
|
}
|
|
2298
|
-
case ActionType$1.
|
|
2353
|
+
case ActionType$1.UpdateColumnVisibility: {
|
|
2299
2354
|
const { columnVisibilityMap } = state;
|
|
2300
|
-
columnVisibilityMap[action.param] =
|
|
2355
|
+
columnVisibilityMap[action.param] = action.visible;
|
|
2301
2356
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2302
2357
|
}
|
|
2303
2358
|
case ActionType$1.ToggleColVisCusModalVisibility: {
|
|
2304
2359
|
return Object.assign(Object.assign({}, state), { columnVisibilityCustomizationModalVisible: !state.columnVisibilityCustomizationModalVisible });
|
|
2305
2360
|
}
|
|
2361
|
+
case ActionType$1.ShowAllColumns: {
|
|
2362
|
+
const { columnVisibilityMap } = state;
|
|
2363
|
+
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2364
|
+
columnVisibilityMap[param] = true;
|
|
2365
|
+
});
|
|
2366
|
+
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2367
|
+
}
|
|
2368
|
+
case ActionType$1.HideAllColumns: {
|
|
2369
|
+
const { columnVisibilityMap } = state;
|
|
2370
|
+
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2371
|
+
columnVisibilityMap[param] = false;
|
|
2372
|
+
});
|
|
2373
|
+
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2374
|
+
}
|
|
2306
2375
|
default: {
|
|
2307
2376
|
return state;
|
|
2308
2377
|
}
|
|
@@ -2318,7 +2387,18 @@ const IntelliTable = (props) => {
|
|
|
2318
2387
|
var _a;
|
|
2319
2388
|
/* -------------- Props ------------- */
|
|
2320
2389
|
// Destructure all props
|
|
2321
|
-
const { title, id,
|
|
2390
|
+
const { title, id, columns, } = props;
|
|
2391
|
+
// Get data, show empty row if none
|
|
2392
|
+
const data = ((props.data && props.data.length > 0)
|
|
2393
|
+
? props.data
|
|
2394
|
+
: [{ id: 'empty-row' }]);
|
|
2395
|
+
// Get CSV filename
|
|
2396
|
+
let filename = `${title}.csv`;
|
|
2397
|
+
if (props.csvName) {
|
|
2398
|
+
filename = (props.csvName.endsWith('.csv')
|
|
2399
|
+
? props.csvName
|
|
2400
|
+
: `${props.csvName}.csv`);
|
|
2401
|
+
}
|
|
2322
2402
|
/* -------------- State ------------- */
|
|
2323
2403
|
// Initial state
|
|
2324
2404
|
const initColumnVisibilityMap = {};
|
|
@@ -2335,21 +2415,49 @@ const IntelliTable = (props) => {
|
|
|
2335
2415
|
const [state, dispatch] = useReducer(reducer$1, initialState);
|
|
2336
2416
|
// Destructure common state
|
|
2337
2417
|
const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
|
|
2418
|
+
/*------------------------------------------------------------------------*/
|
|
2419
|
+
/* Render */
|
|
2420
|
+
/*------------------------------------------------------------------------*/
|
|
2421
|
+
/*----------------------------------------*/
|
|
2422
|
+
/* Modal */
|
|
2423
|
+
/*----------------------------------------*/
|
|
2424
|
+
// Modal that may be defined
|
|
2425
|
+
let modal;
|
|
2338
2426
|
/* ------- Col Vis Customization Modal ------ */
|
|
2339
2427
|
if (columnVisibilityCustomizationModalVisible) {
|
|
2340
2428
|
// Create modal
|
|
2341
|
-
(React.createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
|
|
2429
|
+
modal = (React.createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
|
|
2430
|
+
const noColumnsSelected = (Object.values(columnVisibilityMap)
|
|
2431
|
+
.every((isSelected) => {
|
|
2432
|
+
return !isSelected;
|
|
2433
|
+
}));
|
|
2434
|
+
if (noColumnsSelected) {
|
|
2435
|
+
return alert$1('Choose at least one column', 'To continue, you have to choose at least one column to show');
|
|
2436
|
+
}
|
|
2342
2437
|
dispatch({
|
|
2343
2438
|
type: ActionType$1.ToggleColVisCusModalVisibility,
|
|
2344
2439
|
});
|
|
2345
|
-
}
|
|
2346
|
-
|
|
2440
|
+
}, okayVariant: Variant$1.Light },
|
|
2441
|
+
columns.map((column) => {
|
|
2442
|
+
return (React.createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
|
|
2443
|
+
dispatch({
|
|
2444
|
+
type: ActionType$1.UpdateColumnVisibility,
|
|
2445
|
+
param: column.param,
|
|
2446
|
+
visible: checked,
|
|
2447
|
+
});
|
|
2448
|
+
}, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.Secondary }));
|
|
2449
|
+
}),
|
|
2450
|
+
React.createElement("div", { className: "mt-3" }, "Or you can:"),
|
|
2451
|
+
React.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: () => {
|
|
2347
2452
|
dispatch({
|
|
2348
|
-
type: ActionType$1.
|
|
2349
|
-
param: column.param,
|
|
2453
|
+
type: ActionType$1.ShowAllColumns,
|
|
2350
2454
|
});
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2455
|
+
} }, "Select All"),
|
|
2456
|
+
React.createElement("button", { type: "button", id: `IntelliTable-${id}-select-none-columns`, className: "btn btn-secondary", "aria-label": `hide all columns in the ${title} table`, onClick: () => {
|
|
2457
|
+
dispatch({
|
|
2458
|
+
type: ActionType$1.HideAllColumns,
|
|
2459
|
+
});
|
|
2460
|
+
} }, "Deselect All")));
|
|
2353
2461
|
}
|
|
2354
2462
|
/*----------------------------------------*/
|
|
2355
2463
|
/* Main UI */
|
|
@@ -2363,6 +2471,7 @@ const IntelliTable = (props) => {
|
|
|
2363
2471
|
// Custom info based on current sort type
|
|
2364
2472
|
let sortButtonAriaLabel;
|
|
2365
2473
|
let sortIcon = faSort;
|
|
2474
|
+
let sortingByThisColumn = false;
|
|
2366
2475
|
if (!sortColumnParam) {
|
|
2367
2476
|
// Not being sorted yet
|
|
2368
2477
|
sortButtonAriaLabel = `sort ascending by ${column.title}`;
|
|
@@ -2370,6 +2479,7 @@ const IntelliTable = (props) => {
|
|
|
2370
2479
|
}
|
|
2371
2480
|
else if (column.param === sortColumnParam) {
|
|
2372
2481
|
// Already sorted by this column
|
|
2482
|
+
sortingByThisColumn = true;
|
|
2373
2483
|
if (sortType === SortType.Ascending) {
|
|
2374
2484
|
// Sorted ascending
|
|
2375
2485
|
sortButtonAriaLabel = `sort descending by ${column.title}`;
|
|
@@ -2387,11 +2497,14 @@ const IntelliTable = (props) => {
|
|
|
2387
2497
|
sortIcon = faSort;
|
|
2388
2498
|
}
|
|
2389
2499
|
// Create the cell UI
|
|
2390
|
-
return (React.createElement("th", { key: column.param, scope: "col", id: `IntelliTable-${id}-header-${column.param}
|
|
2391
|
-
|
|
2392
|
-
|
|
2500
|
+
return (React.createElement("th", { key: column.param, scope: "col", id: `IntelliTable-${id}-header-${column.param}`, className: "text-start", style: {
|
|
2501
|
+
borderRight: '0.05rem solid #555',
|
|
2502
|
+
borderLeft: '0.05rem solid #555',
|
|
2503
|
+
} },
|
|
2504
|
+
React.createElement("div", { className: "d-flex align-items-center justify-content-start flex-row h-100" },
|
|
2505
|
+
React.createElement("span", { className: "text-nowrap" }, column.title),
|
|
2393
2506
|
React.createElement("div", null,
|
|
2394
|
-
React.createElement("button", { type: "button", className:
|
|
2507
|
+
React.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: () => {
|
|
2395
2508
|
dispatch({
|
|
2396
2509
|
type: ActionType$1.ToggleSortColumn,
|
|
2397
2510
|
param: column.param,
|
|
@@ -2409,8 +2522,28 @@ const IntelliTable = (props) => {
|
|
|
2409
2522
|
const descending = (sortType === SortType.Descending);
|
|
2410
2523
|
if (sortColumnParam) {
|
|
2411
2524
|
sortedData.sort((a, b) => {
|
|
2525
|
+
var _a, _b;
|
|
2412
2526
|
const aVal = a[sortColumnParam];
|
|
2413
2527
|
const bVal = b[sortColumnParam];
|
|
2528
|
+
// Tiebreaker sort by timestamp, most recent first (used if tied)
|
|
2529
|
+
const tiebreaker = (((_a = b.timestamp) !== null && _a !== void 0 ? _a : 0)
|
|
2530
|
+
- ((_b = a.timestamp) !== null && _b !== void 0 ? _b : 0));
|
|
2531
|
+
// Auto-sort undefined and null to end of list
|
|
2532
|
+
if ((aVal === undefined || aVal === null)
|
|
2533
|
+
|| (bVal === undefined || bVal === null)) {
|
|
2534
|
+
// At least one was undefined
|
|
2535
|
+
if ((aVal === undefined || aVal === null)
|
|
2536
|
+
&& (bVal === undefined || bVal === null)) {
|
|
2537
|
+
// Both undefined
|
|
2538
|
+
return tiebreaker;
|
|
2539
|
+
}
|
|
2540
|
+
if (aVal === undefined || aVal === null) {
|
|
2541
|
+
// First was undefined
|
|
2542
|
+
return 1;
|
|
2543
|
+
}
|
|
2544
|
+
// Second was undefined
|
|
2545
|
+
return -1;
|
|
2546
|
+
}
|
|
2414
2547
|
// Sort differently based on the data type
|
|
2415
2548
|
// > Boolean
|
|
2416
2549
|
if (paramType === ParamType$1.Boolean) {
|
|
@@ -2420,7 +2553,7 @@ const IntelliTable = (props) => {
|
|
|
2420
2553
|
if (!aVal && bVal) {
|
|
2421
2554
|
return (descending ? 1 : -1);
|
|
2422
2555
|
}
|
|
2423
|
-
return
|
|
2556
|
+
return tiebreaker;
|
|
2424
2557
|
}
|
|
2425
2558
|
// > Number
|
|
2426
2559
|
if (paramType === ParamType$1.Int
|
|
@@ -2432,12 +2565,12 @@ const IntelliTable = (props) => {
|
|
|
2432
2565
|
// > String
|
|
2433
2566
|
if (paramType === ParamType$1.String) {
|
|
2434
2567
|
if (aVal < bVal) {
|
|
2435
|
-
return (descending ?
|
|
2568
|
+
return (descending ? 1 : -1);
|
|
2436
2569
|
}
|
|
2437
2570
|
if (aVal > bVal) {
|
|
2438
|
-
return (descending ? 1 :
|
|
2571
|
+
return (descending ? -1 : 1);
|
|
2439
2572
|
}
|
|
2440
|
-
return
|
|
2573
|
+
return tiebreaker;
|
|
2441
2574
|
}
|
|
2442
2575
|
// > JSON
|
|
2443
2576
|
if (paramType === ParamType$1.JSON) {
|
|
@@ -2452,7 +2585,7 @@ const IntelliTable = (props) => {
|
|
|
2452
2585
|
: (aSize - bSize));
|
|
2453
2586
|
}
|
|
2454
2587
|
// No sort
|
|
2455
|
-
return
|
|
2588
|
+
return tiebreaker;
|
|
2456
2589
|
});
|
|
2457
2590
|
}
|
|
2458
2591
|
// Table body
|
|
@@ -2477,9 +2610,12 @@ const IntelliTable = (props) => {
|
|
|
2477
2610
|
const noValue = (value === undefined
|
|
2478
2611
|
|| value === null);
|
|
2479
2612
|
visibleValue = (noValue
|
|
2480
|
-
? (React.createElement(FontAwesomeIcon, { icon:
|
|
2481
|
-
: (React.createElement(FontAwesomeIcon, { icon: faXmarkCircle })));
|
|
2613
|
+
? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2614
|
+
: (React.createElement(FontAwesomeIcon, { icon: fullValue ? faCheckCircle : faXmarkCircle })));
|
|
2482
2615
|
title = (fullValue ? 'True' : 'False');
|
|
2616
|
+
if (noValue) {
|
|
2617
|
+
title = 'Empty Cell';
|
|
2618
|
+
}
|
|
2483
2619
|
}
|
|
2484
2620
|
else if (column.type === ParamType$1.Int) {
|
|
2485
2621
|
fullValue = Number.parseInt(value, 10);
|
|
@@ -2488,6 +2624,9 @@ const IntelliTable = (props) => {
|
|
|
2488
2624
|
? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2489
2625
|
: fullValue);
|
|
2490
2626
|
title = String(fullValue);
|
|
2627
|
+
if (noValue) {
|
|
2628
|
+
title = 'Empty Cell';
|
|
2629
|
+
}
|
|
2491
2630
|
}
|
|
2492
2631
|
else if (column.type === ParamType$1.Float) {
|
|
2493
2632
|
fullValue = Number.parseFloat(value);
|
|
@@ -2496,14 +2635,22 @@ const IntelliTable = (props) => {
|
|
|
2496
2635
|
? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2497
2636
|
: roundToNumDecimals(fullValue, 2));
|
|
2498
2637
|
title = String(fullValue);
|
|
2638
|
+
if (noValue) {
|
|
2639
|
+
title = 'Empty Cell';
|
|
2640
|
+
}
|
|
2499
2641
|
}
|
|
2500
2642
|
else if (column.type === ParamType$1.String) {
|
|
2501
2643
|
fullValue = String(value).trim();
|
|
2502
|
-
const noValue = (value
|
|
2644
|
+
const noValue = (value === undefined
|
|
2645
|
+
|| value === null
|
|
2646
|
+
|| String(fullValue).trim().length === 0);
|
|
2503
2647
|
visibleValue = (noValue
|
|
2504
2648
|
? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2505
2649
|
: fullValue);
|
|
2506
2650
|
title = `"${value}"`;
|
|
2651
|
+
if (noValue) {
|
|
2652
|
+
title = 'Empty Cell';
|
|
2653
|
+
}
|
|
2507
2654
|
}
|
|
2508
2655
|
else if (column.type === ParamType$1.JSON) {
|
|
2509
2656
|
fullValue = JSON.stringify(value);
|
|
@@ -2513,9 +2660,13 @@ const IntelliTable = (props) => {
|
|
|
2513
2660
|
visibleValue = (noValue
|
|
2514
2661
|
? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
|
|
2515
2662
|
: fullValue);
|
|
2663
|
+
title = "JSON Object";
|
|
2516
2664
|
}
|
|
2517
2665
|
// Create UI
|
|
2518
|
-
return (React.createElement("td", { key: `${datum.id}-${column.param}`, title: title
|
|
2666
|
+
return (React.createElement("td", { key: `${datum.id}-${column.param}`, title: title, style: {
|
|
2667
|
+
borderRight: '0.05rem solid #555',
|
|
2668
|
+
borderLeft: '0.05rem solid #555',
|
|
2669
|
+
} }, visibleValue));
|
|
2519
2670
|
}));
|
|
2520
2671
|
// Add cells to a row
|
|
2521
2672
|
return (React.createElement("tr", { key: datum.id }, cells));
|
|
@@ -2532,14 +2683,17 @@ const IntelliTable = (props) => {
|
|
|
2532
2683
|
})
|
|
2533
2684
|
.length);
|
|
2534
2685
|
// Build CSV
|
|
2535
|
-
const csv = genCSV(data, columns)
|
|
2686
|
+
const csv = genCSV(data, columns.filter((column) => {
|
|
2687
|
+
return columnVisibilityMap[column.param];
|
|
2688
|
+
}));
|
|
2536
2689
|
// Build main UI
|
|
2537
2690
|
return (React.createElement("div", { className: `IntelliTable-container-${id}` },
|
|
2538
|
-
|
|
2691
|
+
modal,
|
|
2692
|
+
React.createElement("div", { className: "d-flex align-items-center justify-content-start" },
|
|
2539
2693
|
React.createElement("h3", { className: "m-0" }, title),
|
|
2540
2694
|
React.createElement("div", { className: "flex-grow-1 text-end" },
|
|
2541
|
-
React.createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename:
|
|
2542
|
-
React.createElement("button", { type: "button", className: "btn btn-secondary", "aria-label": `show panel for customizing which columns show in table ${title}`, id: `IntelliTable-${id}-show-column-customization-modal`, onClick: () => {
|
|
2695
|
+
React.createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
|
|
2696
|
+
React.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: () => {
|
|
2543
2697
|
dispatch({
|
|
2544
2698
|
type: ActionType$1.ToggleColVisCusModalVisibility,
|
|
2545
2699
|
});
|
|
@@ -2551,7 +2705,7 @@ const IntelliTable = (props) => {
|
|
|
2551
2705
|
numHiddenCols,
|
|
2552
2706
|
' ',
|
|
2553
2707
|
"hidden)"))))),
|
|
2554
|
-
React.createElement("div", { className: `IntelliTable-table-${id}`, style: {
|
|
2708
|
+
React.createElement("div", { className: `IntelliTable-table-${id} mt-2`, style: {
|
|
2555
2709
|
overflowX: 'auto',
|
|
2556
2710
|
} }, table)));
|
|
2557
2711
|
};
|
|
@@ -2603,6 +2757,11 @@ const style = `
|
|
|
2603
2757
|
border: 0.05rem solid black;
|
|
2604
2758
|
border-radius: 0.5rem;
|
|
2605
2759
|
overflow: hidden;
|
|
2760
|
+
padding: 0.7rem;
|
|
2761
|
+
|
|
2762
|
+
/* Solid background */
|
|
2763
|
+
background-color: white;
|
|
2764
|
+
color: black;
|
|
2606
2765
|
|
|
2607
2766
|
/* Place contents in flex column */
|
|
2608
2767
|
flex-direction: column;
|
|
@@ -2629,8 +2788,218 @@ const style = `
|
|
|
2629
2788
|
/* Vertical scroll */
|
|
2630
2789
|
overflow-y: auto;
|
|
2631
2790
|
}
|
|
2791
|
+
|
|
2792
|
+
.LogReviewer-header-close-button {
|
|
2793
|
+
border: 0 !important;
|
|
2794
|
+
background-color: transparent !important;
|
|
2795
|
+
padding-top: 0 !important;
|
|
2796
|
+
padding-bottom: 0 !important;
|
|
2797
|
+
padding-right: 1em !important;
|
|
2798
|
+
margin: 0 !important;
|
|
2799
|
+
color: #444 !important;
|
|
2800
|
+
|
|
2801
|
+
right: 0 !important;
|
|
2802
|
+
position: absolute !important;
|
|
2803
|
+
}
|
|
2804
|
+
.LogReviewer-header-close-button:hover {
|
|
2805
|
+
border: 0 !important;
|
|
2806
|
+
background-color: transparent !important;
|
|
2807
|
+
padding-top: 0 !important;
|
|
2808
|
+
padding-bottom: 0 !important;
|
|
2809
|
+
margin: 0 !important;
|
|
2810
|
+
color: #000 !important;
|
|
2811
|
+
}
|
|
2632
2812
|
`;
|
|
2633
2813
|
/*------------------------------------------------------------------------*/
|
|
2814
|
+
/* Constants */
|
|
2815
|
+
/*------------------------------------------------------------------------*/
|
|
2816
|
+
const columns = [
|
|
2817
|
+
{
|
|
2818
|
+
title: 'First Name',
|
|
2819
|
+
param: 'userFirstName',
|
|
2820
|
+
type: ParamType$1.String,
|
|
2821
|
+
},
|
|
2822
|
+
{
|
|
2823
|
+
title: 'Last Name',
|
|
2824
|
+
param: 'userLastName',
|
|
2825
|
+
type: ParamType$1.String,
|
|
2826
|
+
},
|
|
2827
|
+
{
|
|
2828
|
+
title: 'Email',
|
|
2829
|
+
param: 'userEmail',
|
|
2830
|
+
type: ParamType$1.String,
|
|
2831
|
+
},
|
|
2832
|
+
{
|
|
2833
|
+
title: 'Canvas Id',
|
|
2834
|
+
param: 'userId',
|
|
2835
|
+
type: ParamType$1.Int,
|
|
2836
|
+
},
|
|
2837
|
+
{
|
|
2838
|
+
title: 'Student?',
|
|
2839
|
+
param: 'isLearner',
|
|
2840
|
+
type: ParamType$1.Boolean,
|
|
2841
|
+
},
|
|
2842
|
+
{
|
|
2843
|
+
title: 'Teaching Staff?',
|
|
2844
|
+
param: 'isTTM',
|
|
2845
|
+
type: ParamType$1.Boolean,
|
|
2846
|
+
startsHidden: true,
|
|
2847
|
+
},
|
|
2848
|
+
{
|
|
2849
|
+
title: 'Admin?',
|
|
2850
|
+
param: 'isAdmin',
|
|
2851
|
+
type: ParamType$1.Boolean,
|
|
2852
|
+
startsHidden: true,
|
|
2853
|
+
},
|
|
2854
|
+
{
|
|
2855
|
+
title: 'Course Canvas Id',
|
|
2856
|
+
param: 'courseId',
|
|
2857
|
+
type: ParamType$1.Int,
|
|
2858
|
+
startsHidden: true,
|
|
2859
|
+
},
|
|
2860
|
+
{
|
|
2861
|
+
title: 'Course Name',
|
|
2862
|
+
param: 'courseName',
|
|
2863
|
+
type: ParamType$1.String,
|
|
2864
|
+
},
|
|
2865
|
+
{
|
|
2866
|
+
title: 'Browser Name',
|
|
2867
|
+
param: 'browser.name',
|
|
2868
|
+
type: ParamType$1.String,
|
|
2869
|
+
startsHidden: true,
|
|
2870
|
+
},
|
|
2871
|
+
{
|
|
2872
|
+
title: 'Browser Version',
|
|
2873
|
+
param: 'browser.version',
|
|
2874
|
+
type: ParamType$1.String,
|
|
2875
|
+
startsHidden: true,
|
|
2876
|
+
},
|
|
2877
|
+
{
|
|
2878
|
+
title: 'OS',
|
|
2879
|
+
param: 'device.os',
|
|
2880
|
+
type: ParamType$1.String,
|
|
2881
|
+
startsHidden: true,
|
|
2882
|
+
},
|
|
2883
|
+
{
|
|
2884
|
+
title: 'Mobile?',
|
|
2885
|
+
param: 'device.isMobile',
|
|
2886
|
+
type: ParamType$1.Boolean,
|
|
2887
|
+
startsHidden: true,
|
|
2888
|
+
},
|
|
2889
|
+
{
|
|
2890
|
+
title: 'Year',
|
|
2891
|
+
param: 'year',
|
|
2892
|
+
type: ParamType$1.Int,
|
|
2893
|
+
},
|
|
2894
|
+
{
|
|
2895
|
+
title: 'Month',
|
|
2896
|
+
param: 'month',
|
|
2897
|
+
type: ParamType$1.Int,
|
|
2898
|
+
},
|
|
2899
|
+
{
|
|
2900
|
+
title: 'Day',
|
|
2901
|
+
param: 'day',
|
|
2902
|
+
type: ParamType$1.Int,
|
|
2903
|
+
},
|
|
2904
|
+
{
|
|
2905
|
+
title: 'Hour',
|
|
2906
|
+
param: 'hour',
|
|
2907
|
+
type: ParamType$1.Int,
|
|
2908
|
+
},
|
|
2909
|
+
{
|
|
2910
|
+
title: 'Minute',
|
|
2911
|
+
param: 'minute',
|
|
2912
|
+
type: ParamType$1.Int,
|
|
2913
|
+
startsHidden: true,
|
|
2914
|
+
},
|
|
2915
|
+
{
|
|
2916
|
+
title: 'Timestamp',
|
|
2917
|
+
param: 'timestamp',
|
|
2918
|
+
type: ParamType$1.Int,
|
|
2919
|
+
startsHidden: true,
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
title: 'Context',
|
|
2923
|
+
param: 'context',
|
|
2924
|
+
type: ParamType$1.String,
|
|
2925
|
+
},
|
|
2926
|
+
{
|
|
2927
|
+
title: 'Subcontext',
|
|
2928
|
+
param: 'subcontext',
|
|
2929
|
+
type: ParamType$1.String,
|
|
2930
|
+
},
|
|
2931
|
+
{
|
|
2932
|
+
title: 'Tags',
|
|
2933
|
+
param: 'tags',
|
|
2934
|
+
type: ParamType$1.JSON,
|
|
2935
|
+
startsHidden: true,
|
|
2936
|
+
},
|
|
2937
|
+
{
|
|
2938
|
+
title: 'Log Level',
|
|
2939
|
+
param: 'level',
|
|
2940
|
+
type: ParamType$1.String,
|
|
2941
|
+
startsHidden: true,
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
title: 'Metadata',
|
|
2945
|
+
param: 'metadata',
|
|
2946
|
+
type: ParamType$1.JSON,
|
|
2947
|
+
startsHidden: true,
|
|
2948
|
+
},
|
|
2949
|
+
{
|
|
2950
|
+
title: 'Source',
|
|
2951
|
+
param: 'source',
|
|
2952
|
+
type: ParamType$1.String,
|
|
2953
|
+
},
|
|
2954
|
+
{
|
|
2955
|
+
title: 'Server Route Path',
|
|
2956
|
+
param: 'routePath',
|
|
2957
|
+
type: ParamType$1.String,
|
|
2958
|
+
startsHidden: true,
|
|
2959
|
+
},
|
|
2960
|
+
{
|
|
2961
|
+
title: 'Server Route Template',
|
|
2962
|
+
param: 'routeTemplate',
|
|
2963
|
+
type: ParamType$1.String,
|
|
2964
|
+
startsHidden: true,
|
|
2965
|
+
},
|
|
2966
|
+
{
|
|
2967
|
+
title: 'Type',
|
|
2968
|
+
param: 'type',
|
|
2969
|
+
type: ParamType$1.String,
|
|
2970
|
+
},
|
|
2971
|
+
{
|
|
2972
|
+
title: 'Error Message',
|
|
2973
|
+
param: 'errorMessage',
|
|
2974
|
+
type: ParamType$1.String,
|
|
2975
|
+
startsHidden: true,
|
|
2976
|
+
},
|
|
2977
|
+
{
|
|
2978
|
+
title: 'Error Code',
|
|
2979
|
+
param: 'errorCode',
|
|
2980
|
+
type: ParamType$1.String,
|
|
2981
|
+
startsHidden: true,
|
|
2982
|
+
},
|
|
2983
|
+
{
|
|
2984
|
+
title: 'Error Stack',
|
|
2985
|
+
param: 'errorStack',
|
|
2986
|
+
type: ParamType$1.String,
|
|
2987
|
+
startsHidden: true,
|
|
2988
|
+
},
|
|
2989
|
+
{
|
|
2990
|
+
title: 'Action Target',
|
|
2991
|
+
param: 'target',
|
|
2992
|
+
type: ParamType$1.String,
|
|
2993
|
+
startsHidden: true,
|
|
2994
|
+
},
|
|
2995
|
+
{
|
|
2996
|
+
title: 'Action Type',
|
|
2997
|
+
param: 'action',
|
|
2998
|
+
type: ParamType$1.String,
|
|
2999
|
+
startsHidden: true,
|
|
3000
|
+
},
|
|
3001
|
+
];
|
|
3002
|
+
/*------------------------------------------------------------------------*/
|
|
2634
3003
|
/* Static Functions */
|
|
2635
3004
|
/*------------------------------------------------------------------------*/
|
|
2636
3005
|
/**
|
|
@@ -2648,7 +3017,7 @@ const genHumanReadableName = (machineReadableName) => {
|
|
|
2648
3017
|
// Uppercase! Add a space before
|
|
2649
3018
|
humanReadableName += ' ';
|
|
2650
3019
|
}
|
|
2651
|
-
humanReadableName +=
|
|
3020
|
+
humanReadableName += char;
|
|
2652
3021
|
});
|
|
2653
3022
|
// Trim and return
|
|
2654
3023
|
return humanReadableName.trim();
|
|
@@ -2710,7 +3079,19 @@ const reducer = (state, action) => {
|
|
|
2710
3079
|
return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
|
|
2711
3080
|
}
|
|
2712
3081
|
case ActionType.UpdateTagFilterState: {
|
|
2713
|
-
|
|
3082
|
+
const { tagFilterState } = action;
|
|
3083
|
+
// Select all if every tag is deselected
|
|
3084
|
+
const numTagsSelected = (Object.values(tagFilterState)
|
|
3085
|
+
.filter((isSelected) => {
|
|
3086
|
+
return isSelected;
|
|
3087
|
+
})
|
|
3088
|
+
.length);
|
|
3089
|
+
if (numTagsSelected === 0) {
|
|
3090
|
+
Object.keys(tagFilterState).forEach((tag) => {
|
|
3091
|
+
tagFilterState[tag] = true;
|
|
3092
|
+
});
|
|
3093
|
+
}
|
|
3094
|
+
return Object.assign(Object.assign({}, state), { tagFilterState });
|
|
2714
3095
|
}
|
|
2715
3096
|
case ActionType.UpdateActionErrorFilterState: {
|
|
2716
3097
|
return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
|
|
@@ -2730,10 +3111,35 @@ const LogReviewer = (props) => {
|
|
|
2730
3111
|
/*------------------------------------------------------------------------*/
|
|
2731
3112
|
/* Setup */
|
|
2732
3113
|
/*------------------------------------------------------------------------*/
|
|
2733
|
-
var _a, _b, _c, _d, _e;
|
|
3114
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2734
3115
|
/* -------------- Props ------------- */
|
|
2735
3116
|
// Destructure props
|
|
2736
3117
|
const { LogMetadata, onClose, } = props;
|
|
3118
|
+
// Create complete map of contexts
|
|
3119
|
+
const contextMap = {};
|
|
3120
|
+
[
|
|
3121
|
+
((_a = LogMetadata.Context) !== null && _a !== void 0 ? _a : {}),
|
|
3122
|
+
LogBuiltInMetadata.Context,
|
|
3123
|
+
].forEach((partialContextMap) => {
|
|
3124
|
+
Object.keys(partialContextMap).forEach((context) => {
|
|
3125
|
+
// Add context
|
|
3126
|
+
contextMap[context] = context;
|
|
3127
|
+
// If context has children, add an "uncategorized" subcontext
|
|
3128
|
+
if (typeof contextMap[context] !== 'string') {
|
|
3129
|
+
contextMap[context][LogBuiltInMetadata.Context.Uncategorized] = (LogBuiltInMetadata.Context.Uncategorized);
|
|
3130
|
+
}
|
|
3131
|
+
});
|
|
3132
|
+
});
|
|
3133
|
+
// Create complete map of targets
|
|
3134
|
+
const targetMap = {};
|
|
3135
|
+
[
|
|
3136
|
+
((_b = LogMetadata.Target) !== null && _b !== void 0 ? _b : {}),
|
|
3137
|
+
LogBuiltInMetadata.Target,
|
|
3138
|
+
].forEach((partialTargetMap) => {
|
|
3139
|
+
Object.keys(partialTargetMap).forEach((target) => {
|
|
3140
|
+
targetMap[target] = target;
|
|
3141
|
+
});
|
|
3142
|
+
});
|
|
2737
3143
|
/* -------------- State ------------- */
|
|
2738
3144
|
// Create initial date filter state
|
|
2739
3145
|
const today = getTimeInfoInET();
|
|
@@ -2753,26 +3159,30 @@ const LogReviewer = (props) => {
|
|
|
2753
3159
|
};
|
|
2754
3160
|
// Create initial context filter state
|
|
2755
3161
|
const initContextFilterState = {};
|
|
2756
|
-
Object.keys((
|
|
3162
|
+
Object.keys((_c = LogMetadata.Context) !== null && _c !== void 0 ? _c : {}).forEach((context) => {
|
|
2757
3163
|
var _a, _b;
|
|
2758
3164
|
const contextValue = ((_a = LogMetadata.Context) !== null && _a !== void 0 ? _a : {})[context];
|
|
2759
3165
|
if (typeof contextValue === 'string') {
|
|
2760
|
-
// Case: no subcontexts
|
|
3166
|
+
// Case: no subcontexts, init as checked
|
|
2761
3167
|
initContextFilterState[contextValue] = true;
|
|
2762
3168
|
}
|
|
2763
3169
|
else {
|
|
2764
3170
|
// Case: subcontexts exist
|
|
2765
|
-
initContextFilterState[
|
|
3171
|
+
initContextFilterState[context] = {};
|
|
2766
3172
|
Object.values(((_b = LogMetadata.Context) !== null && _b !== void 0 ? _b : {})[context]).forEach((subcontext) => {
|
|
2767
|
-
|
|
2768
|
-
|
|
3173
|
+
// Skip self ("_")
|
|
3174
|
+
if (subcontext === '_') {
|
|
3175
|
+
return;
|
|
3176
|
+
}
|
|
3177
|
+
// Initialize as checked
|
|
3178
|
+
initContextFilterState[context][subcontext] = true;
|
|
2769
3179
|
});
|
|
2770
3180
|
}
|
|
2771
3181
|
});
|
|
2772
3182
|
// Create initial tag filter state
|
|
2773
3183
|
const initTagFilterState = {};
|
|
2774
|
-
Object.
|
|
2775
|
-
initTagFilterState[
|
|
3184
|
+
Object.keys((_d = LogMetadata.Tag) !== null && _d !== void 0 ? _d : {}).forEach((tag) => {
|
|
3185
|
+
initTagFilterState[tag] = false;
|
|
2776
3186
|
});
|
|
2777
3187
|
// Create advanced filter state
|
|
2778
3188
|
const initAdvancedFilterState = {
|
|
@@ -2798,12 +3208,16 @@ const LogReviewer = (props) => {
|
|
|
2798
3208
|
target: {},
|
|
2799
3209
|
action: {},
|
|
2800
3210
|
};
|
|
2801
|
-
Object.values((
|
|
3211
|
+
Object.values((_e = LogMetadata.Target) !== null && _e !== void 0 ? _e : {}).forEach((target) => {
|
|
2802
3212
|
initActionErrorFilterState.target[target] = true;
|
|
2803
3213
|
});
|
|
2804
3214
|
Object.values(LogAction$1).forEach((action) => {
|
|
2805
3215
|
initActionErrorFilterState.action[action] = true;
|
|
2806
3216
|
});
|
|
3217
|
+
// Add built-in targets
|
|
3218
|
+
Object.values(LogBuiltInMetadata.Target).forEach((target) => {
|
|
3219
|
+
initActionErrorFilterState.target[target] = true;
|
|
3220
|
+
});
|
|
2807
3221
|
// Initial state
|
|
2808
3222
|
const initialState = {
|
|
2809
3223
|
loading: true,
|
|
@@ -2837,15 +3251,18 @@ const LogReviewer = (props) => {
|
|
|
2837
3251
|
let month = newDateFilterState.startDate.month;
|
|
2838
3252
|
while (
|
|
2839
3253
|
// Earlier year
|
|
2840
|
-
(year
|
|
3254
|
+
(year < newDateFilterState.endDate.year)
|
|
2841
3255
|
// Current year but included month
|
|
2842
3256
|
|| (year === newDateFilterState.endDate.year
|
|
2843
3257
|
&& month <= newDateFilterState.endDate.month)) {
|
|
2844
|
-
// Add to list
|
|
2845
|
-
|
|
2846
|
-
year
|
|
2847
|
-
|
|
2848
|
-
|
|
3258
|
+
// Add to list if not already loaded
|
|
3259
|
+
if (!logMap[year]
|
|
3260
|
+
|| !logMap[year][month]) {
|
|
3261
|
+
toLoad.push({
|
|
3262
|
+
year,
|
|
3263
|
+
month,
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
2849
3266
|
// Increment
|
|
2850
3267
|
month += 1;
|
|
2851
3268
|
if (month > 12) {
|
|
@@ -2933,10 +3350,10 @@ const LogReviewer = (props) => {
|
|
|
2933
3350
|
/* Filters */
|
|
2934
3351
|
/*----------------------------------------*/
|
|
2935
3352
|
// Filter toggle
|
|
2936
|
-
const filterToggles = (React.createElement("div", { className: "LogReviewer-filter-toggles
|
|
3353
|
+
const filterToggles = (React.createElement("div", { className: "LogReviewer-filter-toggles" },
|
|
2937
3354
|
React.createElement("h3", { className: "m-0" }, "Filters:"),
|
|
2938
|
-
React.createElement("div", { className: "LogReviewer-filter-toggle-buttons" },
|
|
2939
|
-
React.createElement("button", { type: "button", id: "LogReviewer-toggle-date-filter-drawer", className: `btn btn-${FilterDrawer.Date === expandedFilterDrawer} me-2`, "aria-label": "toggle date filter drawer", onClick: () => {
|
|
3355
|
+
React.createElement("div", { className: "LogReviewer-filter-toggle-buttons alert alert-secondary p-2 m-0" },
|
|
3356
|
+
React.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: () => {
|
|
2940
3357
|
dispatch({
|
|
2941
3358
|
type: ActionType.ToggleFilterDrawer,
|
|
2942
3359
|
filterDrawer: FilterDrawer.Date,
|
|
@@ -2944,7 +3361,7 @@ const LogReviewer = (props) => {
|
|
|
2944
3361
|
} },
|
|
2945
3362
|
React.createElement(FontAwesomeIcon, { icon: faCalendar, className: "me-2" }),
|
|
2946
3363
|
"Date"),
|
|
2947
|
-
React.createElement("button", { type: "button", id: "LogReviewer-toggle-context-filter-drawer", className: `btn btn-${FilterDrawer.Context === expandedFilterDrawer} me-2`, "aria-label": "toggle context filter drawer", onClick: () => {
|
|
3364
|
+
React.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: () => {
|
|
2948
3365
|
dispatch({
|
|
2949
3366
|
type: ActionType.ToggleFilterDrawer,
|
|
2950
3367
|
filterDrawer: FilterDrawer.Context,
|
|
@@ -2952,15 +3369,15 @@ const LogReviewer = (props) => {
|
|
|
2952
3369
|
} },
|
|
2953
3370
|
React.createElement(FontAwesomeIcon, { icon: faCircle, className: "me-2" }),
|
|
2954
3371
|
"Context"),
|
|
2955
|
-
React.createElement("button", { type: "button", id: "LogReviewer-toggle-tag-filter-drawer", className: `btn btn-${FilterDrawer.Tag === expandedFilterDrawer} me-2`, "aria-label": "toggle tag filter drawer", onClick: () => {
|
|
3372
|
+
(LogMetadata.Tag && Object.keys(LogMetadata.Tag).length > 0) && (React.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: () => {
|
|
2956
3373
|
dispatch({
|
|
2957
3374
|
type: ActionType.ToggleFilterDrawer,
|
|
2958
3375
|
filterDrawer: FilterDrawer.Tag,
|
|
2959
3376
|
});
|
|
2960
3377
|
} },
|
|
2961
3378
|
React.createElement(FontAwesomeIcon, { icon: faTag, className: "me-2" }),
|
|
2962
|
-
"Tag"),
|
|
2963
|
-
React.createElement("button", { type: "button", id: "LogReviewer-toggle-action-filter-drawer", className: `btn btn-${FilterDrawer.Action === expandedFilterDrawer} me-2`, "aria-label": "toggle action and error filter drawer", onClick: () => {
|
|
3379
|
+
"Tag")),
|
|
3380
|
+
React.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: () => {
|
|
2964
3381
|
dispatch({
|
|
2965
3382
|
type: ActionType.ToggleFilterDrawer,
|
|
2966
3383
|
filterDrawer: FilterDrawer.Action,
|
|
@@ -2968,41 +3385,64 @@ const LogReviewer = (props) => {
|
|
|
2968
3385
|
} },
|
|
2969
3386
|
React.createElement(FontAwesomeIcon, { icon: faHammer, className: "me-2" }),
|
|
2970
3387
|
"Action"),
|
|
2971
|
-
React.createElement("button", { type: "button", id: "LogReviewer-toggle-advanced-filter-drawer", className: `btn btn-${FilterDrawer.Advanced === expandedFilterDrawer}`, "aria-label": "toggle advanced filter drawer", onClick: () => {
|
|
3388
|
+
React.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: () => {
|
|
2972
3389
|
dispatch({
|
|
2973
3390
|
type: ActionType.ToggleFilterDrawer,
|
|
2974
3391
|
filterDrawer: FilterDrawer.Advanced,
|
|
2975
3392
|
});
|
|
2976
3393
|
} },
|
|
2977
3394
|
React.createElement(FontAwesomeIcon, { icon: faList, className: "me-2" }),
|
|
2978
|
-
"Advanced")
|
|
3395
|
+
"Advanced"),
|
|
3396
|
+
React.createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
|
|
3397
|
+
dispatch({
|
|
3398
|
+
type: ActionType.ResetFilters,
|
|
3399
|
+
initActionErrorFilterState,
|
|
3400
|
+
initAdvancedFilterState,
|
|
3401
|
+
initContextFilterState,
|
|
3402
|
+
initDateFilterState,
|
|
3403
|
+
initTagFilterState,
|
|
3404
|
+
});
|
|
3405
|
+
} },
|
|
3406
|
+
React.createElement(FontAwesomeIcon, { icon: faTimes }),
|
|
3407
|
+
' ',
|
|
3408
|
+
"Reset"))));
|
|
2979
3409
|
// Filter drawer
|
|
2980
3410
|
let filterDrawer;
|
|
2981
3411
|
if (expandedFilterDrawer) {
|
|
2982
3412
|
if (expandedFilterDrawer === FilterDrawer.Date) {
|
|
2983
3413
|
filterDrawer = (React.createElement(TabBox, { title: "Date" },
|
|
2984
|
-
React.createElement(SimpleDateChooser, { ariaLabel: "filter start date", name: "filter-start-date", year: dateFilterState.startDate.year, month: dateFilterState.startDate.month, day: dateFilterState.startDate.day, onChange: (month, day, year) => {
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
dateFilterState: Object.assign(Object.assign({}, dateFilterState), { startDate: { month, day, year } }),
|
|
2988
|
-
});
|
|
3414
|
+
React.createElement(SimpleDateChooser, { ariaLabel: "filter start date", name: "filter-start-date", year: dateFilterState.startDate.year, month: dateFilterState.startDate.month, day: dateFilterState.startDate.day, chooseFromPast: true, numMonthsToShow: 36, onChange: (month, day, year) => {
|
|
3415
|
+
dateFilterState.startDate = { month, day, year };
|
|
3416
|
+
handleDateRangeUpdated(dateFilterState);
|
|
2989
3417
|
} }),
|
|
2990
3418
|
' ',
|
|
2991
3419
|
"to",
|
|
2992
3420
|
' ',
|
|
2993
|
-
React.createElement(SimpleDateChooser, { ariaLabel: "filter end date", name: "filter-end-date", year: dateFilterState.endDate.year, month: dateFilterState.endDate.month, day: dateFilterState.endDate.day, onChange: (month, day, year) => {
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
3421
|
+
React.createElement(SimpleDateChooser, { ariaLabel: "filter end date", name: "filter-end-date", year: dateFilterState.endDate.year, month: dateFilterState.endDate.month, day: dateFilterState.endDate.day, chooseFromPast: true, numMonthsToShow: 12, onChange: (month, day, year) => {
|
|
3422
|
+
if (year < dateFilterState.startDate.year
|
|
3423
|
+
|| (year === dateFilterState.startDate.year
|
|
3424
|
+
&& month < dateFilterState.startDate.month)
|
|
3425
|
+
|| (year === dateFilterState.startDate.year
|
|
3426
|
+
&& month === dateFilterState.startDate.month
|
|
3427
|
+
&& day < dateFilterState.startDate.day)) {
|
|
3428
|
+
return alert$1('Invalid Start Date', 'The start date cannot be before the end date.');
|
|
3429
|
+
}
|
|
3430
|
+
dateFilterState.endDate = { month, day, year };
|
|
3431
|
+
handleDateRangeUpdated(dateFilterState);
|
|
2998
3432
|
} })));
|
|
2999
3433
|
}
|
|
3000
3434
|
else if (expandedFilterDrawer === FilterDrawer.Context) {
|
|
3001
3435
|
// Create item picker items
|
|
3002
|
-
const
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3436
|
+
const builtInPickableItem = {
|
|
3437
|
+
id: '_',
|
|
3438
|
+
name: 'Auto-logged',
|
|
3439
|
+
isGroup: true,
|
|
3440
|
+
children: [],
|
|
3441
|
+
};
|
|
3442
|
+
const pickableItems = [];
|
|
3443
|
+
Object.keys(contextMap)
|
|
3444
|
+
.forEach((context) => {
|
|
3445
|
+
const value = (contextMap)[context];
|
|
3006
3446
|
if (typeof value === 'string') {
|
|
3007
3447
|
// No subcategories
|
|
3008
3448
|
const item = {
|
|
@@ -3011,38 +3451,64 @@ const LogReviewer = (props) => {
|
|
|
3011
3451
|
isGroup: false,
|
|
3012
3452
|
checked: !!contextFilterState[context],
|
|
3013
3453
|
};
|
|
3014
|
-
|
|
3454
|
+
// Add built-in items to its own folder
|
|
3455
|
+
const isBuiltIn = context in LogBuiltInMetadata.Context;
|
|
3456
|
+
if (isBuiltIn) {
|
|
3457
|
+
// Add to built-in pickable item
|
|
3458
|
+
builtInPickableItem.children.push(item);
|
|
3459
|
+
}
|
|
3460
|
+
else {
|
|
3461
|
+
// Add to pickable items list
|
|
3462
|
+
pickableItems.push(item);
|
|
3463
|
+
}
|
|
3015
3464
|
}
|
|
3016
3465
|
// Has subcategories
|
|
3017
3466
|
const children = (Object.keys(value)
|
|
3467
|
+
// Remove parent name
|
|
3018
3468
|
.filter((subcontext) => {
|
|
3019
3469
|
return subcontext !== '_';
|
|
3020
3470
|
})
|
|
3471
|
+
// Create child pickable items
|
|
3021
3472
|
.map((subcontext) => {
|
|
3022
3473
|
return {
|
|
3023
|
-
id:
|
|
3474
|
+
id: subcontext,
|
|
3024
3475
|
name: genHumanReadableName(subcontext),
|
|
3025
3476
|
isGroup: false,
|
|
3026
|
-
checked:
|
|
3477
|
+
checked: contextFilterState[context][subcontext],
|
|
3027
3478
|
};
|
|
3028
3479
|
}));
|
|
3029
3480
|
const item = {
|
|
3030
3481
|
id: context,
|
|
3031
|
-
name: context,
|
|
3482
|
+
name: genHumanReadableName(context),
|
|
3032
3483
|
isGroup: true,
|
|
3033
3484
|
children,
|
|
3034
3485
|
};
|
|
3035
|
-
|
|
3036
|
-
})
|
|
3486
|
+
pickableItems.push(item);
|
|
3487
|
+
});
|
|
3488
|
+
// Add built-in contexts to end ofl ist
|
|
3489
|
+
pickableItems.push(builtInPickableItem);
|
|
3037
3490
|
// Create filter UI
|
|
3038
3491
|
filterDrawer = (React.createElement(ItemPicker, { title: "Context", items: pickableItems, onChanged: (updatedItems) => {
|
|
3039
3492
|
// Update our state
|
|
3040
3493
|
updatedItems.forEach((pickableItem) => {
|
|
3041
3494
|
if (pickableItem.isGroup) {
|
|
3042
3495
|
// Has subcontexts
|
|
3043
|
-
pickableItem.
|
|
3044
|
-
|
|
3045
|
-
|
|
3496
|
+
if (pickableItem.id === '_') {
|
|
3497
|
+
// Built-in
|
|
3498
|
+
// Treat as if these were top-level contexts
|
|
3499
|
+
pickableItem.children.forEach((subcontextItem) => {
|
|
3500
|
+
contextFilterState[subcontextItem.id] = ('checked' in subcontextItem
|
|
3501
|
+
&& subcontextItem.checked);
|
|
3502
|
+
});
|
|
3503
|
+
}
|
|
3504
|
+
else {
|
|
3505
|
+
// Not built-in
|
|
3506
|
+
pickableItem.children.forEach((subcontextItem) => {
|
|
3507
|
+
if (!subcontextItem.isGroup) {
|
|
3508
|
+
contextFilterState[pickableItem.id][subcontextItem.id] = (subcontextItem.checked);
|
|
3509
|
+
}
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3046
3512
|
}
|
|
3047
3513
|
else {
|
|
3048
3514
|
// No subcontexts
|
|
@@ -3057,13 +3523,19 @@ const LogReviewer = (props) => {
|
|
|
3057
3523
|
}
|
|
3058
3524
|
else if (expandedFilterDrawer === FilterDrawer.Tag) {
|
|
3059
3525
|
// Create filter UI
|
|
3060
|
-
filterDrawer = (React.createElement(TabBox, { title: "Tags" },
|
|
3061
|
-
.
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
} }))
|
|
3066
|
-
|
|
3526
|
+
filterDrawer = (React.createElement(TabBox, { title: "Tags" },
|
|
3527
|
+
React.createElement("div", null, "If any are selected, logs must contain at least one but not necessarily all of the selected tags."),
|
|
3528
|
+
Object.keys((_f = LogMetadata.Tag) !== null && _f !== void 0 ? _f : {})
|
|
3529
|
+
.map((tag, i) => {
|
|
3530
|
+
const description = genHumanReadableName(tag);
|
|
3531
|
+
return (React.createElement(CheckboxButton, { id: `LogReviewer-tag-${tag}-checkbox`, text: description, ariaLabel: `require that logs be tagged with "${description}" or any other selected tag`, noMarginOnRight: i === Object.keys(tagFilterState).length - 1, checked: tagFilterState[tag], onChanged: (checked) => {
|
|
3532
|
+
tagFilterState[tag] = checked;
|
|
3533
|
+
dispatch({
|
|
3534
|
+
type: ActionType.UpdateTagFilterState,
|
|
3535
|
+
tagFilterState,
|
|
3536
|
+
});
|
|
3537
|
+
} }));
|
|
3538
|
+
})));
|
|
3067
3539
|
}
|
|
3068
3540
|
else if (expandedFilterDrawer === FilterDrawer.Action) {
|
|
3069
3541
|
// Create filter UI
|
|
@@ -3092,34 +3564,37 @@ const LogReviewer = (props) => {
|
|
|
3092
3564
|
}, ariaLabel: "only show error logs", selected: actionErrorFilterState.type === LogType$1.Error, noMarginOnRight: true })),
|
|
3093
3565
|
(actionErrorFilterState.type === undefined
|
|
3094
3566
|
|| actionErrorFilterState.type === LogType$1.Action) && (React.createElement(TabBox, { title: "Action Log Details" },
|
|
3095
|
-
React.createElement(ButtonInputGroup, { label: "Action" },
|
|
3096
|
-
.
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
actionErrorFilterState,
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3567
|
+
React.createElement(ButtonInputGroup, { label: "Action", className: "mb-2" },
|
|
3568
|
+
React.createElement("div", { className: "d-flex gap-1 flex-wrap" }, Object.keys(LogAction$1)
|
|
3569
|
+
.map((action) => {
|
|
3570
|
+
const description = genHumanReadableName(action);
|
|
3571
|
+
return (React.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) => {
|
|
3572
|
+
actionErrorFilterState.action[action] = checked;
|
|
3573
|
+
console.log(actionErrorFilterState, action, checked);
|
|
3574
|
+
dispatch({
|
|
3575
|
+
type: ActionType.UpdateActionErrorFilterState,
|
|
3576
|
+
actionErrorFilterState,
|
|
3577
|
+
});
|
|
3578
|
+
} }));
|
|
3579
|
+
}))),
|
|
3580
|
+
React.createElement(ButtonInputGroup, { label: "Target" },
|
|
3581
|
+
React.createElement("div", { className: "d-flex gap-1 flex-wrap" }, Object.keys(targetMap)
|
|
3582
|
+
.map((target) => {
|
|
3583
|
+
const description = genHumanReadableName(target);
|
|
3584
|
+
return (React.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) => {
|
|
3585
|
+
actionErrorFilterState.target[target] = checked;
|
|
3586
|
+
console.log(actionErrorFilterState, target, checked);
|
|
3587
|
+
dispatch({
|
|
3588
|
+
type: ActionType.UpdateActionErrorFilterState,
|
|
3589
|
+
actionErrorFilterState,
|
|
3590
|
+
});
|
|
3591
|
+
} }));
|
|
3592
|
+
}))))),
|
|
3118
3593
|
(actionErrorFilterState.type === undefined
|
|
3119
3594
|
|| actionErrorFilterState.type === LogType$1.Error) && (React.createElement(TabBox, { title: "Error Log Details" },
|
|
3120
3595
|
React.createElement("div", { className: "input-group mb-2" },
|
|
3121
3596
|
React.createElement("span", { className: "input-group-text" }, "Error Message"),
|
|
3122
|
-
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for error message", value: actionErrorFilterState.errorMessage, onChange: (e) => {
|
|
3597
|
+
React.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) => {
|
|
3123
3598
|
actionErrorFilterState.errorMessage = e.target.value;
|
|
3124
3599
|
dispatch({
|
|
3125
3600
|
type: ActionType.UpdateActionErrorFilterState,
|
|
@@ -3128,7 +3603,7 @@ const LogReviewer = (props) => {
|
|
|
3128
3603
|
} })),
|
|
3129
3604
|
React.createElement("div", { className: "input-group mb-2" },
|
|
3130
3605
|
React.createElement("span", { className: "input-group-text" }, "Error Code"),
|
|
3131
|
-
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for error code", value: actionErrorFilterState.
|
|
3606
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for error code", value: actionErrorFilterState.errorCode, placeholder: "e.g. GC22", onChange: (e) => {
|
|
3132
3607
|
actionErrorFilterState.errorCode = ((e.target.value)
|
|
3133
3608
|
.trim()
|
|
3134
3609
|
.toUpperCase());
|
|
@@ -3144,7 +3619,7 @@ const LogReviewer = (props) => {
|
|
|
3144
3619
|
React.createElement(TabBox, { title: "User Info" },
|
|
3145
3620
|
React.createElement("div", { className: "input-group mb-2" },
|
|
3146
3621
|
React.createElement("span", { className: "input-group-text" }, "User First Name"),
|
|
3147
|
-
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user first name", value: advancedFilterState.userFirstName, onChange: (e) => {
|
|
3622
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user first name", value: advancedFilterState.userFirstName, placeholder: "e.g. Divardo", onChange: (e) => {
|
|
3148
3623
|
advancedFilterState.userFirstName = e.target.value;
|
|
3149
3624
|
dispatch({
|
|
3150
3625
|
type: ActionType.UpdateAdvancedFilterState,
|
|
@@ -3153,7 +3628,7 @@ const LogReviewer = (props) => {
|
|
|
3153
3628
|
} })),
|
|
3154
3629
|
React.createElement("div", { className: "input-group mb-2" },
|
|
3155
3630
|
React.createElement("span", { className: "input-group-text" }, "User Last Name"),
|
|
3156
|
-
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user last name", value: advancedFilterState.userLastName, onChange: (e) => {
|
|
3631
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user last name", value: advancedFilterState.userLastName, placeholder: "e.g. Calicci", onChange: (e) => {
|
|
3157
3632
|
advancedFilterState.userLastName = e.target.value;
|
|
3158
3633
|
dispatch({
|
|
3159
3634
|
type: ActionType.UpdateAdvancedFilterState,
|
|
@@ -3162,7 +3637,7 @@ const LogReviewer = (props) => {
|
|
|
3162
3637
|
} })),
|
|
3163
3638
|
React.createElement("div", { className: "input-group mb-2" },
|
|
3164
3639
|
React.createElement("span", { className: "input-group-text" }, "User Email"),
|
|
3165
|
-
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user email", value: advancedFilterState.userEmail, onChange: (e) => {
|
|
3640
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user email", value: advancedFilterState.userEmail, placeholder: "e.g. calicci@fas.harvard.edu", onChange: (e) => {
|
|
3166
3641
|
advancedFilterState.userEmail = ((e.target.value)
|
|
3167
3642
|
.trim());
|
|
3168
3643
|
dispatch({
|
|
@@ -3172,7 +3647,7 @@ const LogReviewer = (props) => {
|
|
|
3172
3647
|
} })),
|
|
3173
3648
|
React.createElement("div", { className: "input-group mb-2" },
|
|
3174
3649
|
React.createElement("span", { className: "input-group-text" }, "User Canvas Id"),
|
|
3175
|
-
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user canvas id", value: advancedFilterState.userId, onChange: (e) => {
|
|
3650
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user canvas id", value: advancedFilterState.userId, placeholder: "e.g. 104985", onChange: (e) => {
|
|
3176
3651
|
const { value } = e.target;
|
|
3177
3652
|
// Only update if value contains only numbers
|
|
3178
3653
|
if (/^\d+$/.test(value)) {
|
|
@@ -3209,7 +3684,7 @@ const LogReviewer = (props) => {
|
|
|
3209
3684
|
React.createElement(TabBox, { title: "Course Info" },
|
|
3210
3685
|
React.createElement("div", { className: "input-group mb-2" },
|
|
3211
3686
|
React.createElement("span", { className: "input-group-text" }, "Course Name"),
|
|
3212
|
-
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for course name", value: advancedFilterState.courseName, onChange: (e) => {
|
|
3687
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for course name", value: advancedFilterState.courseName, placeholder: "e.g. GLC 200", onChange: (e) => {
|
|
3213
3688
|
advancedFilterState.courseName = e.target.value;
|
|
3214
3689
|
dispatch({
|
|
3215
3690
|
type: ActionType.UpdateAdvancedFilterState,
|
|
@@ -3218,7 +3693,7 @@ const LogReviewer = (props) => {
|
|
|
3218
3693
|
} })),
|
|
3219
3694
|
React.createElement("div", { className: "input-group mb-2" },
|
|
3220
3695
|
React.createElement("span", { className: "input-group-text" }, "Course Canvas Id"),
|
|
3221
|
-
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for course canvas id", value: advancedFilterState.courseId, onChange: (e) => {
|
|
3696
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for course canvas id", value: advancedFilterState.courseId, placeholder: "e.g. 15948", onChange: (e) => {
|
|
3222
3697
|
const { value } = e.target;
|
|
3223
3698
|
// Only update if value contains only numbers
|
|
3224
3699
|
if (/^\d+$/.test(value)) {
|
|
@@ -3276,37 +3751,38 @@ const LogReviewer = (props) => {
|
|
|
3276
3751
|
advancedFilterState,
|
|
3277
3752
|
});
|
|
3278
3753
|
}, noMarginOnRight: true })),
|
|
3279
|
-
React.createElement("div", { className: "
|
|
3280
|
-
React.createElement("
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
.
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
React.createElement("
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
.
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3754
|
+
advancedFilterState.source !== LogSource$1.Client && (React.createElement("div", { className: "mt-2" },
|
|
3755
|
+
React.createElement("div", { className: "input-group mb-2" },
|
|
3756
|
+
React.createElement("span", { className: "input-group-text" }, "Server Route Path"),
|
|
3757
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for server route path", value: advancedFilterState.routePath, placeholder: "e.g. /api/ttm/courses/12345", onChange: (e) => {
|
|
3758
|
+
advancedFilterState.courseName = ((e.target.value)
|
|
3759
|
+
.trim());
|
|
3760
|
+
dispatch({
|
|
3761
|
+
type: ActionType.UpdateAdvancedFilterState,
|
|
3762
|
+
advancedFilterState,
|
|
3763
|
+
});
|
|
3764
|
+
} })),
|
|
3765
|
+
React.createElement("div", { className: "input-group mb-2" },
|
|
3766
|
+
React.createElement("span", { className: "input-group-text" }, "Server Route Template"),
|
|
3767
|
+
React.createElement("input", { type: "text", className: "form-control", "aria-label": "query for server route template", value: advancedFilterState.routeTemplate, placeholder: "e.g. /api/ttm/courses/:courseId", onChange: (e) => {
|
|
3768
|
+
advancedFilterState.courseName = ((e.target.value)
|
|
3769
|
+
.trim());
|
|
3770
|
+
dispatch({
|
|
3771
|
+
type: ActionType.UpdateAdvancedFilterState,
|
|
3772
|
+
advancedFilterState,
|
|
3773
|
+
});
|
|
3774
|
+
} })))))));
|
|
3299
3775
|
}
|
|
3300
3776
|
}
|
|
3301
3777
|
// Filters UI
|
|
3302
3778
|
const filters = (React.createElement(React.Fragment, null,
|
|
3303
3779
|
filterToggles,
|
|
3304
|
-
filterDrawer && (React.createElement(Drawer,
|
|
3780
|
+
filterDrawer && (React.createElement(Drawer, { customBackgroundColor: "#eee" }, filterDrawer))));
|
|
3305
3781
|
// Actually filter the logs
|
|
3306
3782
|
// > Perform filters
|
|
3307
3783
|
const logs = [];
|
|
3308
3784
|
Object.keys(logMap).forEach((year) => {
|
|
3309
|
-
Object.keys(logMap).forEach((month) => {
|
|
3785
|
+
Object.keys(logMap[year]).forEach((month) => {
|
|
3310
3786
|
logMap[year][month].forEach((log) => {
|
|
3311
3787
|
/* ----------- Date Filter ---------- */
|
|
3312
3788
|
var _a;
|
|
@@ -3342,16 +3818,23 @@ const LogReviewer = (props) => {
|
|
|
3342
3818
|
// Whole context is deselected
|
|
3343
3819
|
contextFilterState[log.context] === false
|
|
3344
3820
|
// None of the subcontexts are selected
|
|
3345
|
-
|| (
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3821
|
+
|| (
|
|
3822
|
+
// Has subcontexts
|
|
3823
|
+
typeof contextFilterState[log.context] !== 'boolean'
|
|
3824
|
+
// None of the subcontexts are selected
|
|
3825
|
+
&& Object.values((_a = contextFilterState[log.context]) !== null && _a !== void 0 ? _a : {})
|
|
3826
|
+
.every((isSelected) => {
|
|
3827
|
+
return !isSelected;
|
|
3828
|
+
}))) {
|
|
3829
|
+
console.log(log.context, contextFilterState);
|
|
3349
3830
|
return;
|
|
3350
3831
|
}
|
|
3351
3832
|
// Subcontext doesn't match
|
|
3352
3833
|
if (
|
|
3353
|
-
// Log
|
|
3354
|
-
log.
|
|
3834
|
+
// Log context is not "uncategorized" (no point in further filters)
|
|
3835
|
+
log.context !== LogBuiltInMetadata.Context.Uncategorized
|
|
3836
|
+
// Log has a subcontext
|
|
3837
|
+
&& log.subcontext
|
|
3355
3838
|
// Context has subcontexts
|
|
3356
3839
|
&& (contextFilterState[log.context]
|
|
3357
3840
|
&& contextFilterState[log.context] !== false
|
|
@@ -3363,12 +3846,16 @@ const LogReviewer = (props) => {
|
|
|
3363
3846
|
/* -------------- Tags -------------- */
|
|
3364
3847
|
// No tags match
|
|
3365
3848
|
if (
|
|
3366
|
-
//
|
|
3367
|
-
|
|
3849
|
+
// At least one tag is required
|
|
3850
|
+
Object.values(tagFilterState)
|
|
3851
|
+
.filter((isSelected) => {
|
|
3852
|
+
return isSelected;
|
|
3853
|
+
})
|
|
3854
|
+
.length > 0
|
|
3368
3855
|
// No tags match
|
|
3369
|
-
&&
|
|
3856
|
+
&& log.tags.every((tag) => {
|
|
3370
3857
|
return !tagFilterState[tag];
|
|
3371
|
-
}))
|
|
3858
|
+
})) {
|
|
3372
3859
|
return;
|
|
3373
3860
|
}
|
|
3374
3861
|
/* ------- Actions and Errors ------- */
|
|
@@ -3502,7 +3989,7 @@ const LogReviewer = (props) => {
|
|
|
3502
3989
|
// Device info exists
|
|
3503
3990
|
&& log.device
|
|
3504
3991
|
// Mobile filter doesn't match
|
|
3505
|
-
&& (advancedFilterState.isMobile
|
|
3992
|
+
&& (advancedFilterState.isMobile !== log.device.isMobile)) {
|
|
3506
3993
|
return;
|
|
3507
3994
|
}
|
|
3508
3995
|
// Log source doesn't match
|
|
@@ -3544,199 +4031,20 @@ const LogReviewer = (props) => {
|
|
|
3544
4031
|
/*----------------------------------------*/
|
|
3545
4032
|
/* Data */
|
|
3546
4033
|
/*----------------------------------------*/
|
|
3547
|
-
//
|
|
3548
|
-
const
|
|
3549
|
-
{
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
},
|
|
3554
|
-
{
|
|
3555
|
-
title: 'Last Name',
|
|
3556
|
-
param: 'userLastName',
|
|
3557
|
-
type: ParamType$1.String,
|
|
3558
|
-
},
|
|
3559
|
-
{
|
|
3560
|
-
title: 'Email',
|
|
3561
|
-
param: 'userEmail',
|
|
3562
|
-
type: ParamType$1.String,
|
|
3563
|
-
},
|
|
3564
|
-
{
|
|
3565
|
-
title: 'Canvas Id',
|
|
3566
|
-
param: 'userId',
|
|
3567
|
-
type: ParamType$1.Int,
|
|
3568
|
-
},
|
|
3569
|
-
{
|
|
3570
|
-
title: 'Student',
|
|
3571
|
-
param: 'isLearner',
|
|
3572
|
-
type: ParamType$1.Boolean,
|
|
3573
|
-
},
|
|
3574
|
-
{
|
|
3575
|
-
title: 'Teaching Staff',
|
|
3576
|
-
param: 'isTTM',
|
|
3577
|
-
type: ParamType$1.Boolean,
|
|
3578
|
-
startsHidden: true,
|
|
3579
|
-
},
|
|
3580
|
-
{
|
|
3581
|
-
title: 'Admin',
|
|
3582
|
-
param: 'isAdmin',
|
|
3583
|
-
type: ParamType$1.Boolean,
|
|
3584
|
-
startsHidden: true,
|
|
3585
|
-
},
|
|
3586
|
-
{
|
|
3587
|
-
title: 'Course Canvas Id',
|
|
3588
|
-
param: 'courseId',
|
|
3589
|
-
type: ParamType$1.Int,
|
|
3590
|
-
startsHidden: true,
|
|
3591
|
-
},
|
|
3592
|
-
{
|
|
3593
|
-
title: 'Course Name',
|
|
3594
|
-
param: 'courseName',
|
|
3595
|
-
type: ParamType$1.String,
|
|
3596
|
-
},
|
|
3597
|
-
{
|
|
3598
|
-
title: 'Browser Name',
|
|
3599
|
-
param: 'browser.name',
|
|
3600
|
-
type: ParamType$1.String,
|
|
3601
|
-
startsHidden: true,
|
|
3602
|
-
},
|
|
3603
|
-
{
|
|
3604
|
-
title: 'Browser Version',
|
|
3605
|
-
param: 'browser.version',
|
|
3606
|
-
type: ParamType$1.String,
|
|
3607
|
-
startsHidden: true,
|
|
3608
|
-
},
|
|
3609
|
-
{
|
|
3610
|
-
title: 'OS',
|
|
3611
|
-
param: 'device.os',
|
|
3612
|
-
type: ParamType$1.String,
|
|
3613
|
-
startsHidden: true,
|
|
3614
|
-
},
|
|
3615
|
-
{
|
|
3616
|
-
title: 'Mobile',
|
|
3617
|
-
param: 'device.isMobile',
|
|
3618
|
-
type: ParamType$1.Boolean,
|
|
3619
|
-
startsHidden: true,
|
|
3620
|
-
},
|
|
3621
|
-
{
|
|
3622
|
-
title: 'Year',
|
|
3623
|
-
param: 'year',
|
|
3624
|
-
type: ParamType$1.Int,
|
|
3625
|
-
},
|
|
3626
|
-
{
|
|
3627
|
-
title: 'Month',
|
|
3628
|
-
param: 'month',
|
|
3629
|
-
type: ParamType$1.Int,
|
|
3630
|
-
},
|
|
3631
|
-
{
|
|
3632
|
-
title: 'Day',
|
|
3633
|
-
param: 'day',
|
|
3634
|
-
type: ParamType$1.Int,
|
|
3635
|
-
},
|
|
3636
|
-
{
|
|
3637
|
-
title: 'Hour',
|
|
3638
|
-
param: 'hour',
|
|
3639
|
-
type: ParamType$1.Int,
|
|
3640
|
-
},
|
|
3641
|
-
{
|
|
3642
|
-
title: 'Minute',
|
|
3643
|
-
param: 'minute',
|
|
3644
|
-
type: ParamType$1.Int,
|
|
3645
|
-
startsHidden: true,
|
|
3646
|
-
},
|
|
3647
|
-
{
|
|
3648
|
-
title: 'Timestamp',
|
|
3649
|
-
param: 'timestamp',
|
|
3650
|
-
type: ParamType$1.Int,
|
|
3651
|
-
startsHidden: true,
|
|
3652
|
-
},
|
|
3653
|
-
{
|
|
3654
|
-
title: 'Context',
|
|
3655
|
-
param: 'context',
|
|
3656
|
-
type: ParamType$1.String,
|
|
3657
|
-
},
|
|
3658
|
-
{
|
|
3659
|
-
title: 'Subcontext',
|
|
3660
|
-
param: 'subcontext',
|
|
3661
|
-
type: ParamType$1.String,
|
|
3662
|
-
},
|
|
3663
|
-
{
|
|
3664
|
-
title: 'Tags',
|
|
3665
|
-
param: 'tags',
|
|
3666
|
-
type: ParamType$1.JSON,
|
|
3667
|
-
startsHidden: true,
|
|
3668
|
-
},
|
|
3669
|
-
{
|
|
3670
|
-
title: 'Log Level',
|
|
3671
|
-
param: 'level',
|
|
3672
|
-
type: ParamType$1.String,
|
|
3673
|
-
startsHidden: true,
|
|
3674
|
-
},
|
|
3675
|
-
{
|
|
3676
|
-
title: 'Metadata',
|
|
3677
|
-
param: 'metadata',
|
|
3678
|
-
type: ParamType$1.JSON,
|
|
3679
|
-
startsHidden: true,
|
|
3680
|
-
},
|
|
3681
|
-
{
|
|
3682
|
-
title: 'Source',
|
|
3683
|
-
param: 'source',
|
|
3684
|
-
type: ParamType$1.String,
|
|
3685
|
-
},
|
|
3686
|
-
{
|
|
3687
|
-
title: 'Server Route Path',
|
|
3688
|
-
param: 'routePath',
|
|
3689
|
-
type: ParamType$1.String,
|
|
3690
|
-
startsHidden: true,
|
|
3691
|
-
},
|
|
3692
|
-
{
|
|
3693
|
-
title: 'Server Route Template',
|
|
3694
|
-
param: 'routeTemplate',
|
|
3695
|
-
type: ParamType$1.String,
|
|
3696
|
-
startsHidden: true,
|
|
3697
|
-
},
|
|
3698
|
-
{
|
|
3699
|
-
title: 'Type',
|
|
3700
|
-
param: 'type',
|
|
3701
|
-
type: ParamType$1.String,
|
|
3702
|
-
},
|
|
3703
|
-
{
|
|
3704
|
-
title: 'Error Message',
|
|
3705
|
-
param: 'errorMessage',
|
|
3706
|
-
type: ParamType$1.String,
|
|
3707
|
-
startsHidden: true,
|
|
3708
|
-
},
|
|
3709
|
-
{
|
|
3710
|
-
title: 'Error Code',
|
|
3711
|
-
param: 'errorCode',
|
|
3712
|
-
type: ParamType$1.String,
|
|
3713
|
-
startsHidden: true,
|
|
3714
|
-
},
|
|
3715
|
-
{
|
|
3716
|
-
title: 'Error Stack',
|
|
3717
|
-
param: 'errorStack',
|
|
3718
|
-
type: ParamType$1.String,
|
|
3719
|
-
startsHidden: true,
|
|
3720
|
-
},
|
|
3721
|
-
{
|
|
3722
|
-
title: 'Action Target',
|
|
3723
|
-
param: 'target',
|
|
3724
|
-
type: ParamType$1.String,
|
|
3725
|
-
startsHidden: true,
|
|
3726
|
-
},
|
|
3727
|
-
{
|
|
3728
|
-
title: 'Action Type',
|
|
3729
|
-
param: 'action',
|
|
3730
|
-
type: ParamType$1.String,
|
|
3731
|
-
startsHidden: true,
|
|
3732
|
-
},
|
|
3733
|
-
];
|
|
4034
|
+
// Nothing to show notice
|
|
4035
|
+
const noLogsNotice = (logs.length === 0
|
|
4036
|
+
? (React.createElement("div", { className: "alert alert-warning text-center mt-2" },
|
|
4037
|
+
React.createElement("h4", { className: "m-1" }, "No Logs to Show"),
|
|
4038
|
+
React.createElement("div", null, "Either your filters are too strict or no matching logs have been created yet.")))
|
|
4039
|
+
: undefined);
|
|
3734
4040
|
// Create intelliTable
|
|
3735
|
-
const dataTable = (React.createElement(IntelliTable, { title: "Matching Logs", id: "logs", data: logs, columns: columns }));
|
|
4041
|
+
const dataTable = (React.createElement(IntelliTable, { title: "Matching Logs:", csvName: `Logs from ${getHumanReadableDate()}`, id: "logs", data: logs, columns: columns }));
|
|
3736
4042
|
// Main body
|
|
3737
4043
|
body = (React.createElement(React.Fragment, null,
|
|
3738
4044
|
filters,
|
|
3739
|
-
|
|
4045
|
+
React.createElement("div", { className: "mt-2" },
|
|
4046
|
+
dataTable,
|
|
4047
|
+
noLogsNotice)));
|
|
3740
4048
|
}
|
|
3741
4049
|
/* ---------- Wrap in Modal --------- */
|
|
3742
4050
|
return (React.createElement("div", { className: "LogReviewer-outer-container" },
|
|
@@ -3744,14 +4052,10 @@ const LogReviewer = (props) => {
|
|
|
3744
4052
|
React.createElement("div", { className: "LogReviewer-inner-container" },
|
|
3745
4053
|
React.createElement("div", { className: "LogReviewer-header" },
|
|
3746
4054
|
React.createElement("div", { className: "LogReviewer-header-title" },
|
|
3747
|
-
React.createElement("
|
|
3748
|
-
React.createElement("
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
padding: 0,
|
|
3752
|
-
margin: 0,
|
|
3753
|
-
} },
|
|
3754
|
-
React.createElement(FontAwesomeIcon, { icon: faTimes }))),
|
|
4055
|
+
React.createElement("h3", { className: "text-center m-0" }, "Log Review Dashboard")),
|
|
4056
|
+
React.createElement("div", { style: { width: 0 } },
|
|
4057
|
+
React.createElement("button", { type: "button", className: "LogReviewer-header-close-button btn btn-dark btn-lg pe-0", "aria-label": "close log reviewer panel", onClick: onClose },
|
|
4058
|
+
React.createElement(FontAwesomeIcon, { icon: faTimes })))),
|
|
3755
4059
|
React.createElement("div", { className: "LogReviewer-contents" }, body))));
|
|
3756
4060
|
};
|
|
3757
4061
|
|
|
@@ -3847,6 +4151,18 @@ const floorToNumDecimals = (num, numDecimals) => {
|
|
|
3847
4151
|
return (Math.floor(num * rounder) / rounder);
|
|
3848
4152
|
};
|
|
3849
4153
|
|
|
4154
|
+
/**
|
|
4155
|
+
* Force a number to stay within specific bounds
|
|
4156
|
+
* @author Gabe Abrams
|
|
4157
|
+
* @param num the number to move into the bounds
|
|
4158
|
+
* @param min the minimum number in the bound
|
|
4159
|
+
* @param max the maximum number in the bound
|
|
4160
|
+
* @returns bounded number
|
|
4161
|
+
*/
|
|
4162
|
+
const forceNumIntoBounds = (num, min, max) => {
|
|
4163
|
+
return Math.max(min, Math.min(max, num));
|
|
4164
|
+
};
|
|
4165
|
+
|
|
3850
4166
|
/**
|
|
3851
4167
|
* Pad a number's decimal with zeros on the right
|
|
3852
4168
|
* (e.g. 5.2 becomes 5.20 with 2 digit padding)
|
|
@@ -4082,15 +4398,17 @@ const initServer = (opts) => {
|
|
|
4082
4398
|
},
|
|
4083
4399
|
handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4084
4400
|
// Get user info
|
|
4085
|
-
const { userId, isAdmin } = params;
|
|
4401
|
+
const { year, month, userId, isAdmin, } = params;
|
|
4086
4402
|
// Validate user
|
|
4087
|
-
// isAdmin is already checked because path starts with '/admin'
|
|
4088
4403
|
const canReview = yield canReviewLogs(userId, isAdmin);
|
|
4089
4404
|
if (!canReview) {
|
|
4090
4405
|
throw new ErrorWithCode('You cannot access this resource because you do not have the appropriate permissions.', ReactKitErrorCode$1.NotAllowedToReviewLogs);
|
|
4091
4406
|
}
|
|
4092
4407
|
// Query for logs
|
|
4093
|
-
const logs = yield _logCollection.find({
|
|
4408
|
+
const logs = yield _logCollection.find({
|
|
4409
|
+
year,
|
|
4410
|
+
month,
|
|
4411
|
+
});
|
|
4094
4412
|
// Return logs
|
|
4095
4413
|
return logs;
|
|
4096
4414
|
}),
|
|
@@ -4739,7 +5057,7 @@ const genRouteHandler = (opts) => {
|
|
|
4739
5057
|
isAdmin: !!launchInfo.isAdmin,
|
|
4740
5058
|
isTTM: !!launchInfo.isTTM,
|
|
4741
5059
|
courseId: launchInfo.courseId,
|
|
4742
|
-
courseName: launchInfo.
|
|
5060
|
+
courseName: launchInfo.contextLabel,
|
|
4743
5061
|
browser,
|
|
4744
5062
|
device,
|
|
4745
5063
|
year,
|
|
@@ -4766,7 +5084,7 @@ const genRouteHandler = (opts) => {
|
|
|
4766
5084
|
}
|
|
4767
5085
|
: {
|
|
4768
5086
|
type: LogType$1.Action,
|
|
4769
|
-
target: ((_m = opts.target) !== null && _m !== void 0 ? _m : LogBuiltInMetadata.Target.
|
|
5087
|
+
target: ((_m = opts.target) !== null && _m !== void 0 ? _m : LogBuiltInMetadata.Target.NoTarget),
|
|
4770
5088
|
action: ((_o = opts.action) !== null && _o !== void 0 ? _o : LogAction$1.Unknown),
|
|
4771
5089
|
});
|
|
4772
5090
|
// Source-specific info
|
|
@@ -4979,29 +5297,6 @@ const startMinWait = (minWaitMs) => {
|
|
|
4979
5297
|
});
|
|
4980
5298
|
};
|
|
4981
5299
|
|
|
4982
|
-
// Import shared helpers
|
|
4983
|
-
/**
|
|
4984
|
-
* Get a human-readable description of a date (all in ET)
|
|
4985
|
-
* @author Gabe Abrams
|
|
4986
|
-
* @param [dateOrTimestamp=today] the date or timestamp for the date to describe
|
|
4987
|
-
* @returns human-readable description of the date
|
|
4988
|
-
*/
|
|
4989
|
-
const getHumanReadableDate = (dateOrTimestamp) => {
|
|
4990
|
-
// Get the date info
|
|
4991
|
-
const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
|
|
4992
|
-
const currYear = getTimeInfoInET().year;
|
|
4993
|
-
// Get the short month description
|
|
4994
|
-
const monthName = getMonthName(month).short;
|
|
4995
|
-
// Create start of description
|
|
4996
|
-
let description = `${monthName} ${day}${getOrdinal(day)}`;
|
|
4997
|
-
// Add on year if it's different
|
|
4998
|
-
if (year !== currYear) {
|
|
4999
|
-
description += ` ${year}`;
|
|
5000
|
-
}
|
|
5001
|
-
// Return description
|
|
5002
|
-
return description;
|
|
5003
|
-
};
|
|
5004
|
-
|
|
5005
5300
|
/**
|
|
5006
5301
|
* Get the current part of day (morning, evening, etc.)
|
|
5007
5302
|
* @author Gabe Abrams
|