dce-reactkit 3.2.2-beta.4 → 3.2.2-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +388 -198
- 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/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/esm/index.js +388 -198
- 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/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/index.d.ts +20 -17
- package/package.json +1 -1
- package/src/components/ButtonInputGroup.tsx +5 -2
- package/src/components/CSVDownloadButton.tsx +1 -1
- package/src/components/Drawer.tsx +9 -1
- package/src/components/IntelliTable.tsx +80 -21
- package/src/components/ItemPicker/NestableItemList.tsx +32 -14
- package/src/components/ItemPicker/index.tsx +4 -0
- package/src/components/LogReviewer.tsx +300 -146
- package/src/components/SimpleDateChooser.tsx +20 -7
- package/src/helpers/genCSV.ts +21 -4
- package/src/helpers/genRouteHandler.ts +2 -2
- package/src/helpers/logClientEvent.tsx +6 -1
- package/src/server/initServer.ts +11 -4
- package/src/types/LogAction.ts +16 -16
- package/src/types/LogBuiltInMetadata.ts +5 -5
|
@@ -111,13 +111,26 @@ const SimpleDateChooser: React.FC<Props> = (props) => {
|
|
|
111
111
|
// Figure out which days are allowed
|
|
112
112
|
const days = [];
|
|
113
113
|
const numDaysInMonth = (new Date(year, month, 0)).getDate();
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
if (chooseFromPast) {
|
|
115
|
+
// Past selection
|
|
116
|
+
const numDaysToAdd = (
|
|
117
|
+
(month === today.month)
|
|
118
|
+
? today.day // Current month, only add up to today
|
|
119
|
+
: numDaysInMonth // Past month, add all days
|
|
120
|
+
);
|
|
121
|
+
for (let day = 1; day <= numDaysToAdd; day++) {
|
|
122
|
+
days.push(day);
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
// Future selection: add all remaining days of the month
|
|
126
|
+
const firstDay = (
|
|
127
|
+
month === today.month
|
|
128
|
+
? today.day // Current month: start at current date
|
|
129
|
+
: 1 // Future month: start at beginning of month
|
|
130
|
+
);
|
|
131
|
+
for (let day = firstDay; day <= numDaysInMonth; day++) {
|
|
132
|
+
days.push(day);
|
|
133
|
+
}
|
|
121
134
|
}
|
|
122
135
|
|
|
123
136
|
choices.push({
|
package/src/helpers/genCSV.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* @returns escaped cell text
|
|
6
6
|
*/
|
|
7
7
|
const escapeCellText = (text: string): string => {
|
|
8
|
-
if (!text.includes(',')) {
|
|
8
|
+
if (!String(text).includes(',')) {
|
|
9
9
|
// No need to escape
|
|
10
|
-
return text;
|
|
10
|
+
return String(text);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// Perform escape
|
|
14
|
-
return `"${text.replace(/"/g, '""')}`;
|
|
14
|
+
return `"${String(text).replace(/"/g, '""')}`;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -46,7 +46,24 @@ const genCSV = (
|
|
|
46
46
|
csv += (
|
|
47
47
|
columns
|
|
48
48
|
.map((column) => {
|
|
49
|
-
|
|
49
|
+
let contents: string;
|
|
50
|
+
const cell = datum[column.param];
|
|
51
|
+
if (
|
|
52
|
+
typeof cell === 'string'
|
|
53
|
+
|| typeof cell === 'number'
|
|
54
|
+
) {
|
|
55
|
+
contents = String(cell);
|
|
56
|
+
} else if (
|
|
57
|
+
typeof cell === 'undefined'
|
|
58
|
+
|| cell === null
|
|
59
|
+
) {
|
|
60
|
+
contents = '';
|
|
61
|
+
} else if (typeof cell === 'object') {
|
|
62
|
+
contents = JSON.stringify(cell);
|
|
63
|
+
} else {
|
|
64
|
+
contents = '';
|
|
65
|
+
}
|
|
66
|
+
return escapeCellText(contents);
|
|
50
67
|
})
|
|
51
68
|
.join(',')
|
|
52
69
|
);
|
|
@@ -500,7 +500,7 @@ const genRouteHandler = (
|
|
|
500
500
|
isAdmin: !!launchInfo.isAdmin,
|
|
501
501
|
isTTM: !!launchInfo.isTTM,
|
|
502
502
|
courseId: launchInfo.courseId,
|
|
503
|
-
courseName: launchInfo.
|
|
503
|
+
courseName: launchInfo.contextLabel,
|
|
504
504
|
browser,
|
|
505
505
|
device,
|
|
506
506
|
year,
|
|
@@ -539,7 +539,7 @@ const genRouteHandler = (
|
|
|
539
539
|
type: LogType.Action,
|
|
540
540
|
target: (
|
|
541
541
|
(opts as any).target
|
|
542
|
-
?? LogBuiltInMetadata.Target.
|
|
542
|
+
?? LogBuiltInMetadata.Target.NoTarget
|
|
543
543
|
),
|
|
544
544
|
action: (
|
|
545
545
|
(opts as any).action
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import LOG_ROUTE_PATH from '../constants/LOG_ROUTE_PATH';
|
|
3
3
|
import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
|
|
4
4
|
import LogFunction from '../types/LogFunction';
|
|
5
|
+
import LogLevel from '../types/LogLevel';
|
|
5
6
|
|
|
6
7
|
// Import shared functions
|
|
7
8
|
import visitServerEndpoint from './visitServerEndpoint';
|
|
@@ -27,6 +28,10 @@ const logClientEvent: LogFunction = async (opts) => {
|
|
|
27
28
|
opts.subcontext
|
|
28
29
|
?? LogBuiltInMetadata.Context.Uncategorized
|
|
29
30
|
),
|
|
31
|
+
level: (
|
|
32
|
+
opts.level
|
|
33
|
+
?? LogLevel.Info
|
|
34
|
+
),
|
|
30
35
|
tags: JSON.stringify(opts.tags ?? []),
|
|
31
36
|
metadata: JSON.stringify(opts.metadata ?? {}),
|
|
32
37
|
errorMessage: (
|
|
@@ -48,7 +53,7 @@ const logClientEvent: LogFunction = async (opts) => {
|
|
|
48
53
|
(opts as any).action
|
|
49
54
|
? (
|
|
50
55
|
(opts as any).target
|
|
51
|
-
?? LogBuiltInMetadata.Target.
|
|
56
|
+
?? LogBuiltInMetadata.Target.NoTarget
|
|
52
57
|
)
|
|
53
58
|
: undefined
|
|
54
59
|
),
|
package/src/server/initServer.ts
CHANGED
|
@@ -240,7 +240,7 @@ const initServer = (
|
|
|
240
240
|
* @param {number} month the month to query (e.g. 1 = January)
|
|
241
241
|
* @returns {Log[]} list of logs from the given month
|
|
242
242
|
*/
|
|
243
|
-
opts.app.
|
|
243
|
+
opts.app.get(
|
|
244
244
|
`${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/:year/months/:month`,
|
|
245
245
|
genRouteHandler({
|
|
246
246
|
paramTypes: {
|
|
@@ -249,10 +249,14 @@ const initServer = (
|
|
|
249
249
|
},
|
|
250
250
|
handler: async ({ params }) => {
|
|
251
251
|
// Get user info
|
|
252
|
-
const {
|
|
252
|
+
const {
|
|
253
|
+
year,
|
|
254
|
+
month,
|
|
255
|
+
userId,
|
|
256
|
+
isAdmin,
|
|
257
|
+
} = params;
|
|
253
258
|
|
|
254
259
|
// Validate user
|
|
255
|
-
// isAdmin is already checked because path starts with '/admin'
|
|
256
260
|
const canReview = await canReviewLogs(userId, isAdmin);
|
|
257
261
|
if (!canReview) {
|
|
258
262
|
throw new ErrorWithCode(
|
|
@@ -262,7 +266,10 @@ const initServer = (
|
|
|
262
266
|
}
|
|
263
267
|
|
|
264
268
|
// Query for logs
|
|
265
|
-
const logs: Log[] = await _logCollection.find({
|
|
269
|
+
const logs: Log[] = await _logCollection.find({
|
|
270
|
+
year,
|
|
271
|
+
month,
|
|
272
|
+
});
|
|
266
273
|
|
|
267
274
|
// Return logs
|
|
268
275
|
return logs;
|
package/src/types/LogAction.ts
CHANGED
|
@@ -4,37 +4,37 @@
|
|
|
4
4
|
*/
|
|
5
5
|
enum LogAction {
|
|
6
6
|
// Target was opened by the user (it was not on screen, but now it is)
|
|
7
|
-
Open = '
|
|
7
|
+
Open = 'Open',
|
|
8
8
|
// Target was closed by the user (it was on screen, but now it is not)
|
|
9
|
-
Close = '
|
|
9
|
+
Close = 'Close',
|
|
10
10
|
// Target was cancelled by the user (it was on closed without saving)
|
|
11
|
-
Cancel = '
|
|
11
|
+
Cancel = 'Cancel',
|
|
12
12
|
// Target was expanded by the user (it always remains on screen, but size was changed)
|
|
13
|
-
Expand = '
|
|
13
|
+
Expand = 'Expand',
|
|
14
14
|
// Target was collapsed by the user (it always remains on screen, but size was changed)
|
|
15
|
-
Collapse = '
|
|
15
|
+
Collapse = 'Collapse',
|
|
16
16
|
// Target was viewed by the user (only for items that are not opened or closed, those must use Open/Close actions)
|
|
17
|
-
View = '
|
|
17
|
+
View = 'View',
|
|
18
18
|
// Target interrupted the user (popup, dialog, validation message, etc. appeared without user prompting)
|
|
19
|
-
Interrupt = '
|
|
19
|
+
Interrupt = 'Interrupt',
|
|
20
20
|
// Target was created by the user (it did not exist before)
|
|
21
|
-
Create = '
|
|
21
|
+
Create = 'Create',
|
|
22
22
|
// Target was edited by the user (it existed and was changed)
|
|
23
|
-
Edit = '
|
|
23
|
+
Edit = 'Edit',
|
|
24
24
|
// Target was deleted by the user (it existed and now it doesn't)
|
|
25
|
-
Delete = '
|
|
25
|
+
Delete = 'Delete',
|
|
26
26
|
// Target was added by the user (it already existed and was added to another place)
|
|
27
|
-
Add = '
|
|
27
|
+
Add = 'Add',
|
|
28
28
|
// Target was removed by the user (it was removed from something but still exists)
|
|
29
|
-
Remove = '
|
|
29
|
+
Remove = 'Remove',
|
|
30
30
|
// Target was activated by the user (click, check, tap, keypress, etc.)
|
|
31
|
-
Activate = '
|
|
31
|
+
Activate = 'Activate',
|
|
32
32
|
// Target was deactivated by the user (click away, uncheck, tap outside of, tab away, etc.)
|
|
33
|
-
Deactivate = '
|
|
33
|
+
Deactivate = 'Deactivate',
|
|
34
34
|
// User showed interest in a target (hover, peek, etc.)
|
|
35
|
-
Peek = '
|
|
35
|
+
Peek = 'Peek',
|
|
36
36
|
// Unknown action
|
|
37
|
-
Unknown = '
|
|
37
|
+
Unknown = 'Unknown',
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export default LogAction;
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
const LogBuiltInMetadata = {
|
|
6
6
|
// Contexts
|
|
7
7
|
Context: {
|
|
8
|
-
Uncategorized: '
|
|
9
|
-
ServerRenderedErrorPage: '
|
|
10
|
-
ServerEndpointError: '
|
|
11
|
-
ClientFatalError: '
|
|
8
|
+
Uncategorized: 'Uncategorized',
|
|
9
|
+
ServerRenderedErrorPage: 'ServerRenderedErrorPage',
|
|
10
|
+
ServerEndpointError: 'ServerEndpointError',
|
|
11
|
+
ClientFatalError: 'ClientFatalError',
|
|
12
12
|
},
|
|
13
13
|
// Targets
|
|
14
14
|
Target: {
|
|
15
|
-
|
|
15
|
+
NoTarget: 'NoTarget',
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
|