dce-reactkit 3.2.1 → 3.2.2-beta.10
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/.vscode/settings.json +3 -0
- package/dist/cjs/index.js +2195 -442
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ButtonInputGroup.d.ts +1 -0
- package/dist/cjs/types/components/CSVDownloadButton.d.ts +19 -0
- package/dist/cjs/types/components/IntelliTable.d.ts +17 -0
- package/dist/cjs/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/cjs/types/components/LogReviewer.d.ts +13 -0
- package/dist/cjs/types/components/SimpleDateChooser.d.ts +1 -0
- package/dist/cjs/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
- package/dist/cjs/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
- package/dist/cjs/types/helpers/canReviewLogs.d.ts +7 -0
- package/dist/cjs/types/helpers/genCSV.d.ts +14 -0
- package/dist/cjs/types/helpers/getMonthName.d.ts +14 -0
- package/dist/cjs/types/index.d.ts +9 -1
- package/dist/cjs/types/server/initServer.d.ts +8 -0
- package/dist/cjs/types/types/IntelliTableColumn.d.ts +12 -0
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +1 -0
- package/dist/cjs/types/types/LogMetadataType.d.ts +19 -0
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +2 -1
- package/dist/esm/index.js +2191 -444
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ButtonInputGroup.d.ts +1 -0
- package/dist/esm/types/components/CSVDownloadButton.d.ts +19 -0
- package/dist/esm/types/components/IntelliTable.d.ts +17 -0
- package/dist/esm/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/esm/types/components/LogReviewer.d.ts +13 -0
- package/dist/esm/types/components/SimpleDateChooser.d.ts +1 -0
- package/dist/esm/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
- package/dist/esm/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
- package/dist/esm/types/helpers/canReviewLogs.d.ts +7 -0
- package/dist/esm/types/helpers/genCSV.d.ts +14 -0
- package/dist/esm/types/helpers/getMonthName.d.ts +14 -0
- package/dist/esm/types/index.d.ts +9 -1
- package/dist/esm/types/server/initServer.d.ts +8 -0
- package/dist/esm/types/types/IntelliTableColumn.d.ts +12 -0
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +1 -0
- package/dist/esm/types/types/LogMetadataType.d.ts +19 -0
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +2 -1
- package/dist/index.d.ts +172 -47
- package/package.json +1 -1
- package/sandbox.js +78 -17
- package/src/components/AppWrapper.tsx +15 -0
- package/src/components/ButtonInputGroup.tsx +4 -1
- package/src/components/CSVDownloadButton.tsx +102 -0
- package/src/components/IntelliTable.tsx +610 -0
- package/src/components/ItemPicker/index.tsx +4 -0
- package/src/components/LogReviewer.tsx +2091 -0
- package/src/components/SimpleDateChooser.tsx +26 -27
- package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +9 -0
- package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +10 -0
- package/src/helpers/canReviewLogs.ts +33 -0
- package/src/helpers/genCSV.ts +59 -0
- package/src/helpers/getHumanReadableDate.ts +6 -17
- package/src/helpers/getMonthName.ts +29 -0
- package/src/helpers/logClientEvent.tsx +5 -0
- package/src/index.ts +16 -0
- package/src/server/initServer.ts +125 -3
- package/src/types/IntelliTableColumn.ts +24 -0
- package/src/types/LogBuiltInMetadata.ts +1 -0
- package/src/types/LogMetadataType.ts +23 -0
- package/src/types/ReactKitErrorCode.tsx +2 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log reviewer panel that allows users (must be approved admins) to
|
|
3
|
+
* review logs written by dce-reactkit
|
|
4
|
+
* @author Gabe Abrams
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import LogMetadataType from '../types/LogMetadataType';
|
|
8
|
+
declare type Props = {
|
|
9
|
+
LogMetadata: LogMetadataType;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
};
|
|
12
|
+
declare const LogReviewer: React.FC<Props>;
|
|
13
|
+
export default LogReviewer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a CSV file
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
* @param data list of row data in the form of json objects
|
|
5
|
+
* @param columns list of columns to include in the csv
|
|
6
|
+
* @returns multiline csv string
|
|
7
|
+
*/
|
|
8
|
+
declare const genCSV: (data: {
|
|
9
|
+
[k: string]: any;
|
|
10
|
+
}[], columns: {
|
|
11
|
+
title: string;
|
|
12
|
+
param: string;
|
|
13
|
+
}[]) => string;
|
|
14
|
+
export default genCSV;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the name of a month given the month number (1 = January, etc.)
|
|
3
|
+
* If an invalid number is provided, we will treat it like January
|
|
4
|
+
* @author Gabe Abrams
|
|
5
|
+
* @param month the number of the month
|
|
6
|
+
* @returns object containing multiple month name formats:
|
|
7
|
+
* { short, full } where short will look like "Jan" and full will look like
|
|
8
|
+
* "January"
|
|
9
|
+
*/
|
|
10
|
+
declare const getMonthName: (month: number) => {
|
|
11
|
+
short: string;
|
|
12
|
+
full: string;
|
|
13
|
+
};
|
|
14
|
+
export default getMonthName;
|
|
@@ -13,6 +13,9 @@ import PopFailureMark from './components/PopFailureMark';
|
|
|
13
13
|
import PopPendingMark from './components/PopPendingMark';
|
|
14
14
|
import CopiableBox from './components/CopiableBox';
|
|
15
15
|
import ItemPicker from './components/ItemPicker';
|
|
16
|
+
import LogReviewer from './components/LogReviewer';
|
|
17
|
+
import IntelliTable from './components/IntelliTable';
|
|
18
|
+
import CSVDownloadButton from './components/CSVDownloadButton';
|
|
16
19
|
import ErrorWithCode from './errors/ErrorWithCode';
|
|
17
20
|
import MINUTE_IN_MS from './constants/MINUTE_IN_MS';
|
|
18
21
|
import HOUR_IN_MS from './constants/HOUR_IN_MS';
|
|
@@ -43,6 +46,9 @@ import onlyKeepLetters from './helpers/onlyKeepLetters';
|
|
|
43
46
|
import parallelLimit from './helpers/parallelLimit';
|
|
44
47
|
import logClientEvent from './helpers/logClientEvent';
|
|
45
48
|
import initLogCollection from './server/initLogCollection';
|
|
49
|
+
import getMonthName from './helpers/getMonthName';
|
|
50
|
+
import genCSV from './helpers/genCSV';
|
|
51
|
+
import canReviewLogs from './helpers/canReviewLogs';
|
|
46
52
|
import ModalButtonType from './types/ModalButtonType';
|
|
47
53
|
import ModalSize from './types/ModalSize';
|
|
48
54
|
import ModalType from './types/ModalType';
|
|
@@ -55,5 +61,7 @@ import LogType from './types/LogType';
|
|
|
55
61
|
import LogSource from './types/LogSource';
|
|
56
62
|
import LogAction from './types/LogAction';
|
|
57
63
|
import LogBuiltInMetadata from './types/LogBuiltInMetadata';
|
|
64
|
+
import LogMetadataType from './types/LogMetadataType';
|
|
65
|
+
import IntelliTableColumn from './types/IntelliTableColumn';
|
|
58
66
|
import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
59
|
-
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, visitServerEndpoint, logClientEvent, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, PickableItem, ParamType, };
|
|
67
|
+
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, visitServerEndpoint, logClientEvent, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, IntelliTableColumn, PickableItem, ParamType, };
|
|
@@ -25,10 +25,18 @@ export declare const internalGetLogCollection: () => any;
|
|
|
25
25
|
* @param opts.getLaunchInfo CACCL LTI's get launch info function
|
|
26
26
|
* @param [opts.logCollection] mongo collection from dce-mango to use for
|
|
27
27
|
* storing logs. If none is included, logs are written to the console
|
|
28
|
+
* @param [opts.logReviewAdmins=all] info on which admins can review
|
|
29
|
+
* logs from the client. If not included, all Canvas admins are allowed to
|
|
30
|
+
* review logs. If null, no Canvas admins are allowed to review logs.
|
|
31
|
+
* If an array of Canvas userIds (numbers), only Canvas admins with those
|
|
32
|
+
* userIds are allowed to review logs. If a dce-mango collection, only
|
|
33
|
+
* Canvas admins with entries in that collection ({ userId, ...}) are allowed
|
|
34
|
+
* to review logs
|
|
28
35
|
*/
|
|
29
36
|
declare const initServer: (opts: {
|
|
30
37
|
app: any;
|
|
31
38
|
getLaunchInfo: GetLaunchInfoFunction;
|
|
32
39
|
logCollection?: any;
|
|
40
|
+
logReviewAdmins?: (number[] | any);
|
|
33
41
|
}) => void;
|
|
34
42
|
export default initServer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ParamType from './ParamType';
|
|
2
|
+
/**
|
|
3
|
+
* Column description for a column in the IntelliTable
|
|
4
|
+
* @author Gabe Abrams
|
|
5
|
+
*/
|
|
6
|
+
declare type IntelliTableColumn = {
|
|
7
|
+
title: string;
|
|
8
|
+
param: string;
|
|
9
|
+
type: (ParamType.Boolean | ParamType.Float | ParamType.Int | ParamType.String | ParamType.JSON);
|
|
10
|
+
startsHidden?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export default IntelliTableColumn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type of a LogMetadata file
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
declare type LogMetadataType = {
|
|
6
|
+
Context?: {
|
|
7
|
+
[k: string]: (string | {
|
|
8
|
+
_: string;
|
|
9
|
+
[k: string]: string;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
Tag?: {
|
|
13
|
+
[k: string]: string;
|
|
14
|
+
};
|
|
15
|
+
Target?: {
|
|
16
|
+
[k: string]: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default LogMetadataType;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare enum Variant {
|
|
|
22
22
|
* @author Gabe Abrams
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
declare type Props$
|
|
25
|
+
declare type Props$g = {
|
|
26
26
|
children: React.ReactNode;
|
|
27
27
|
sendRequest: SendRequestFunction;
|
|
28
28
|
dark?: boolean;
|
|
@@ -80,7 +80,7 @@ declare const confirm: (title: string, text: string, opts?: {
|
|
|
80
80
|
* @param [errorTitle] title of the error box
|
|
81
81
|
*/
|
|
82
82
|
declare const showFatalError: (error: any, errorTitle?: string) => undefined;
|
|
83
|
-
declare const AppWrapper: React.FC<Props$
|
|
83
|
+
declare const AppWrapper: React.FC<Props$g>;
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Loading spinner/indicator
|
|
@@ -93,12 +93,12 @@ declare const LoadingSpinner: () => JSX.Element;
|
|
|
93
93
|
* @author Gabe Abrams
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
|
-
declare type Props$
|
|
96
|
+
declare type Props$f = {
|
|
97
97
|
error: any;
|
|
98
98
|
title?: string;
|
|
99
99
|
onClose?: () => void;
|
|
100
100
|
};
|
|
101
|
-
declare const ErrorBox: React.FC<Props$
|
|
101
|
+
declare const ErrorBox: React.FC<Props$f>;
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* Types of buttons in the modal
|
|
@@ -149,7 +149,7 @@ declare enum ModalType {
|
|
|
149
149
|
* @author Gabe Abrams
|
|
150
150
|
*/
|
|
151
151
|
|
|
152
|
-
declare type Props$
|
|
152
|
+
declare type Props$e = {
|
|
153
153
|
type?: ModalType;
|
|
154
154
|
size?: ModalSize;
|
|
155
155
|
title?: React.ReactNode;
|
|
@@ -178,27 +178,27 @@ declare type Props$b = {
|
|
|
178
178
|
confirmVariant?: Variant;
|
|
179
179
|
onTopOfOtherModals?: boolean;
|
|
180
180
|
};
|
|
181
|
-
declare const Modal: React.FC<Props$
|
|
181
|
+
declare const Modal: React.FC<Props$e>;
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
184
|
* A box with a tab on the top that holds buttons and other content
|
|
185
185
|
* @author Gabe Abrams
|
|
186
186
|
*/
|
|
187
187
|
|
|
188
|
-
declare type Props$
|
|
188
|
+
declare type Props$d = {
|
|
189
189
|
title: React.ReactNode;
|
|
190
190
|
children: React.ReactNode;
|
|
191
191
|
noBottomMargin?: boolean;
|
|
192
192
|
noBottomPadding?: boolean;
|
|
193
193
|
};
|
|
194
|
-
declare const TabBox: React.FC<Props$
|
|
194
|
+
declare const TabBox: React.FC<Props$d>;
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
197
|
* A radio selection button
|
|
198
198
|
* @author Gabe Abrams
|
|
199
199
|
*/
|
|
200
200
|
|
|
201
|
-
declare type Props$
|
|
201
|
+
declare type Props$c = {
|
|
202
202
|
text: string;
|
|
203
203
|
onSelected: () => void;
|
|
204
204
|
ariaLabel: string;
|
|
@@ -210,14 +210,14 @@ declare type Props$9 = {
|
|
|
210
210
|
unselectedVariant?: Variant;
|
|
211
211
|
small?: boolean;
|
|
212
212
|
};
|
|
213
|
-
declare const RadioButton: React.FC<Props$
|
|
213
|
+
declare const RadioButton: React.FC<Props$c>;
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
216
|
* A checkbox button
|
|
217
217
|
* @author Gabe Abrams
|
|
218
218
|
*/
|
|
219
219
|
|
|
220
|
-
declare type Props$
|
|
220
|
+
declare type Props$b = {
|
|
221
221
|
text: string;
|
|
222
222
|
onChanged: (checked: boolean) => void;
|
|
223
223
|
ariaLabel: string;
|
|
@@ -231,26 +231,27 @@ declare type Props$8 = {
|
|
|
231
231
|
small?: boolean;
|
|
232
232
|
dashed?: boolean;
|
|
233
233
|
};
|
|
234
|
-
declare const CheckboxButton: React.FC<Props$
|
|
234
|
+
declare const CheckboxButton: React.FC<Props$b>;
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
237
|
* Input group with a title and space for buttons
|
|
238
238
|
* @author Gabe Abrams
|
|
239
239
|
*/
|
|
240
240
|
|
|
241
|
-
declare type Props$
|
|
241
|
+
declare type Props$a = {
|
|
242
242
|
label: string;
|
|
243
243
|
minLabelWidth?: string;
|
|
244
244
|
children: React.ReactNode;
|
|
245
|
+
className?: string;
|
|
245
246
|
};
|
|
246
|
-
declare const ButtonInputGroup: React.FC<Props$
|
|
247
|
+
declare const ButtonInputGroup: React.FC<Props$a>;
|
|
247
248
|
|
|
248
249
|
/**
|
|
249
250
|
* A very simple, lightweight date chooser
|
|
250
251
|
* @author Gabe Abrams
|
|
251
252
|
*/
|
|
252
253
|
|
|
253
|
-
declare type Props$
|
|
254
|
+
declare type Props$9 = {
|
|
254
255
|
ariaLabel: string;
|
|
255
256
|
name: string;
|
|
256
257
|
month: number;
|
|
@@ -264,61 +265,62 @@ declare type Props$6 = {
|
|
|
264
265
|
*/
|
|
265
266
|
onChange: (month: number, day: number, year: number) => void;
|
|
266
267
|
numMonthsToShow?: number;
|
|
268
|
+
chooseFromPast?: boolean;
|
|
267
269
|
};
|
|
268
|
-
declare const SimpleDateChooser: React.FC<Props$
|
|
270
|
+
declare const SimpleDateChooser: React.FC<Props$9>;
|
|
269
271
|
|
|
270
272
|
/**
|
|
271
273
|
* Drawer container
|
|
272
274
|
* @author Gabe Abrams
|
|
273
275
|
*/
|
|
274
276
|
|
|
275
|
-
declare type Props$
|
|
277
|
+
declare type Props$8 = {
|
|
276
278
|
children: React.ReactNode;
|
|
277
279
|
};
|
|
278
|
-
declare const Drawer: React.FC<Props$
|
|
280
|
+
declare const Drawer: React.FC<Props$8>;
|
|
279
281
|
|
|
280
282
|
/**
|
|
281
283
|
* Success checkmark that pops into view
|
|
282
284
|
* @author Gabe Abrams
|
|
283
285
|
*/
|
|
284
286
|
|
|
285
|
-
declare type Props$
|
|
287
|
+
declare type Props$7 = {
|
|
286
288
|
sizeRem?: number;
|
|
287
289
|
circleVariant?: string;
|
|
288
290
|
checkVariant?: string;
|
|
289
291
|
};
|
|
290
|
-
declare const PopSuccessMark: React.FC<Props$
|
|
292
|
+
declare const PopSuccessMark: React.FC<Props$7>;
|
|
291
293
|
|
|
292
294
|
/**
|
|
293
295
|
* Failure x mark that pops into view
|
|
294
296
|
* @author Gabe Abrams
|
|
295
297
|
*/
|
|
296
298
|
|
|
297
|
-
declare type Props$
|
|
299
|
+
declare type Props$6 = {
|
|
298
300
|
sizeRem?: number;
|
|
299
301
|
circleVariant?: string;
|
|
300
302
|
xVariant?: string;
|
|
301
303
|
};
|
|
302
|
-
declare const PopFailureMark: React.FC<Props$
|
|
304
|
+
declare const PopFailureMark: React.FC<Props$6>;
|
|
303
305
|
|
|
304
306
|
/**
|
|
305
307
|
* Failure pending that pops into view
|
|
306
308
|
* @author Gabe Abrams
|
|
307
309
|
*/
|
|
308
310
|
|
|
309
|
-
declare type Props$
|
|
311
|
+
declare type Props$5 = {
|
|
310
312
|
sizeRem?: number;
|
|
311
313
|
circleVariant?: string;
|
|
312
314
|
hourglassVariant?: string;
|
|
313
315
|
};
|
|
314
|
-
declare const PopPendingMark: React.FC<Props$
|
|
316
|
+
declare const PopPendingMark: React.FC<Props$5>;
|
|
315
317
|
|
|
316
318
|
/**
|
|
317
319
|
* Copiable text box
|
|
318
320
|
* @author Gabe Abrams
|
|
319
321
|
*/
|
|
320
322
|
|
|
321
|
-
declare type Props$
|
|
323
|
+
declare type Props$4 = {
|
|
322
324
|
text: string;
|
|
323
325
|
maxTextWidthRem?: number;
|
|
324
326
|
label?: string;
|
|
@@ -330,7 +332,7 @@ declare type Props$1 = {
|
|
|
330
332
|
textAreaId?: string;
|
|
331
333
|
copyButtonId?: string;
|
|
332
334
|
};
|
|
333
|
-
declare const CopiableBox: React.FC<Props$
|
|
335
|
+
declare const CopiableBox: React.FC<Props$4>;
|
|
334
336
|
|
|
335
337
|
/**
|
|
336
338
|
* An item that can be chosen (for use within ItemPicker)
|
|
@@ -353,7 +355,7 @@ declare type PickableItem = ({
|
|
|
353
355
|
* @author Yuen Ler Chow
|
|
354
356
|
*/
|
|
355
357
|
|
|
356
|
-
declare type Props = {
|
|
358
|
+
declare type Props$3 = {
|
|
357
359
|
title: string;
|
|
358
360
|
items: PickableItem[];
|
|
359
361
|
/**
|
|
@@ -362,8 +364,103 @@ declare type Props = {
|
|
|
362
364
|
* values updated
|
|
363
365
|
*/
|
|
364
366
|
onChanged: (updatedItems: PickableItem[]) => void;
|
|
367
|
+
noBottomMargin?: boolean;
|
|
368
|
+
};
|
|
369
|
+
declare const ItemPicker: React.FC<Props$3>;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Type of a LogMetadata file
|
|
373
|
+
* @author Gabe Abrams
|
|
374
|
+
*/
|
|
375
|
+
declare type LogMetadataType = {
|
|
376
|
+
Context?: {
|
|
377
|
+
[k: string]: (string | {
|
|
378
|
+
_: string;
|
|
379
|
+
[k: string]: string;
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
Tag?: {
|
|
383
|
+
[k: string]: string;
|
|
384
|
+
};
|
|
385
|
+
Target?: {
|
|
386
|
+
[k: string]: string;
|
|
387
|
+
};
|
|
365
388
|
};
|
|
366
|
-
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Log reviewer panel that allows users (must be approved admins) to
|
|
392
|
+
* review logs written by dce-reactkit
|
|
393
|
+
* @author Gabe Abrams
|
|
394
|
+
*/
|
|
395
|
+
|
|
396
|
+
declare type Props$2 = {
|
|
397
|
+
LogMetadata: LogMetadataType;
|
|
398
|
+
onClose: () => void;
|
|
399
|
+
};
|
|
400
|
+
declare const LogReviewer: React.FC<Props$2>;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Server-side API param types
|
|
404
|
+
* @author Gabe Abrams
|
|
405
|
+
*/
|
|
406
|
+
declare enum ParamType {
|
|
407
|
+
Boolean = "boolean",
|
|
408
|
+
BooleanOptional = "boolean-optional",
|
|
409
|
+
Float = "float",
|
|
410
|
+
FloatOptional = "float-optional",
|
|
411
|
+
Int = "int",
|
|
412
|
+
IntOptional = "int-optional",
|
|
413
|
+
JSON = "json",
|
|
414
|
+
JSONOptional = "json-optional",
|
|
415
|
+
String = "string",
|
|
416
|
+
StringOptional = "string-optional"
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Column description for a column in the IntelliTable
|
|
421
|
+
* @author Gabe Abrams
|
|
422
|
+
*/
|
|
423
|
+
declare type IntelliTableColumn = {
|
|
424
|
+
title: string;
|
|
425
|
+
param: string;
|
|
426
|
+
type: (ParamType.Boolean | ParamType.Float | ParamType.Int | ParamType.String | ParamType.JSON);
|
|
427
|
+
startsHidden?: boolean;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Intelligent table
|
|
432
|
+
* @author Gabe Abrams
|
|
433
|
+
*/
|
|
434
|
+
|
|
435
|
+
declare type Props$1 = {
|
|
436
|
+
title: string;
|
|
437
|
+
id: string;
|
|
438
|
+
data: {
|
|
439
|
+
id: string | number;
|
|
440
|
+
[k: string]: any;
|
|
441
|
+
}[];
|
|
442
|
+
columns: IntelliTableColumn[];
|
|
443
|
+
};
|
|
444
|
+
declare const IntelliTable: React.FC<Props$1>;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Button for downloading a csv file
|
|
448
|
+
* @author Gabe Abrams
|
|
449
|
+
*/
|
|
450
|
+
|
|
451
|
+
declare type Props = {
|
|
452
|
+
filename: string;
|
|
453
|
+
csv: string;
|
|
454
|
+
id?: string;
|
|
455
|
+
className?: string;
|
|
456
|
+
ariaLabel?: string;
|
|
457
|
+
style?: {
|
|
458
|
+
[k: string]: any;
|
|
459
|
+
};
|
|
460
|
+
onClick?: () => void;
|
|
461
|
+
children?: React.ReactNode;
|
|
462
|
+
};
|
|
463
|
+
declare const CSVDownloadButton: React.FC<Props>;
|
|
367
464
|
|
|
368
465
|
/**
|
|
369
466
|
* An error with a code
|
|
@@ -498,23 +595,6 @@ declare const visitServerEndpoint: (opts: {
|
|
|
498
595
|
} | undefined;
|
|
499
596
|
}) => Promise<any>;
|
|
500
597
|
|
|
501
|
-
/**
|
|
502
|
-
* Server-side API param types
|
|
503
|
-
* @author Gabe Abrams
|
|
504
|
-
*/
|
|
505
|
-
declare enum ParamType {
|
|
506
|
-
Boolean = "boolean",
|
|
507
|
-
BooleanOptional = "boolean-optional",
|
|
508
|
-
Float = "float",
|
|
509
|
-
FloatOptional = "float-optional",
|
|
510
|
-
Int = "int",
|
|
511
|
-
IntOptional = "int-optional",
|
|
512
|
-
JSON = "json",
|
|
513
|
-
JSONOptional = "json-optional",
|
|
514
|
-
String = "string",
|
|
515
|
-
StringOptional = "string-optional"
|
|
516
|
-
}
|
|
517
|
-
|
|
518
598
|
/**
|
|
519
599
|
* Allowed log levels
|
|
520
600
|
* @author Gabe Abrams
|
|
@@ -744,11 +824,19 @@ declare type GetLaunchInfoFunction = (req: any) => {
|
|
|
744
824
|
* @param opts.getLaunchInfo CACCL LTI's get launch info function
|
|
745
825
|
* @param [opts.logCollection] mongo collection from dce-mango to use for
|
|
746
826
|
* storing logs. If none is included, logs are written to the console
|
|
827
|
+
* @param [opts.logReviewAdmins=all] info on which admins can review
|
|
828
|
+
* logs from the client. If not included, all Canvas admins are allowed to
|
|
829
|
+
* review logs. If null, no Canvas admins are allowed to review logs.
|
|
830
|
+
* If an array of Canvas userIds (numbers), only Canvas admins with those
|
|
831
|
+
* userIds are allowed to review logs. If a dce-mango collection, only
|
|
832
|
+
* Canvas admins with entries in that collection ({ userId, ...}) are allowed
|
|
833
|
+
* to review logs
|
|
747
834
|
*/
|
|
748
835
|
declare const initServer: (opts: {
|
|
749
836
|
app: any;
|
|
750
837
|
getLaunchInfo: GetLaunchInfoFunction;
|
|
751
838
|
logCollection?: any;
|
|
839
|
+
logReviewAdmins?: (number[] | any);
|
|
752
840
|
}) => void;
|
|
753
841
|
|
|
754
842
|
/**
|
|
@@ -861,6 +949,41 @@ declare const logClientEvent: LogFunction;
|
|
|
861
949
|
*/
|
|
862
950
|
declare const initLogCollection: (Collection: any) => any;
|
|
863
951
|
|
|
952
|
+
/**
|
|
953
|
+
* Get the name of a month given the month number (1 = January, etc.)
|
|
954
|
+
* If an invalid number is provided, we will treat it like January
|
|
955
|
+
* @author Gabe Abrams
|
|
956
|
+
* @param month the number of the month
|
|
957
|
+
* @returns object containing multiple month name formats:
|
|
958
|
+
* { short, full } where short will look like "Jan" and full will look like
|
|
959
|
+
* "January"
|
|
960
|
+
*/
|
|
961
|
+
declare const getMonthName: (month: number) => {
|
|
962
|
+
short: string;
|
|
963
|
+
full: string;
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Generate a CSV file
|
|
968
|
+
* @author Gabe Abrams
|
|
969
|
+
* @param data list of row data in the form of json objects
|
|
970
|
+
* @param columns list of columns to include in the csv
|
|
971
|
+
* @returns multiline csv string
|
|
972
|
+
*/
|
|
973
|
+
declare const genCSV: (data: {
|
|
974
|
+
[k: string]: any;
|
|
975
|
+
}[], columns: {
|
|
976
|
+
title: string;
|
|
977
|
+
param: string;
|
|
978
|
+
}[]) => string;
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Check if the current user can review logs
|
|
982
|
+
* @author Gabe Abrams
|
|
983
|
+
* @returns true if current user can review logs
|
|
984
|
+
*/
|
|
985
|
+
declare const canReviewLogs: () => Promise<boolean>;
|
|
986
|
+
|
|
864
987
|
/**
|
|
865
988
|
* List of error codes built into the react kit
|
|
866
989
|
* @author Gabe Abrams
|
|
@@ -875,7 +998,8 @@ declare enum ReactKitErrorCode {
|
|
|
875
998
|
NoCACCLSendRequestFunction = "DRK7",
|
|
876
999
|
NoCACCLGetLaunchInfoFunction = "DRK8",
|
|
877
1000
|
NotTTM = "DRK9",
|
|
878
|
-
NotAdmin = "DRK10"
|
|
1001
|
+
NotAdmin = "DRK10",
|
|
1002
|
+
NotAllowedToReviewLogs = "DRK11"
|
|
879
1003
|
}
|
|
880
1004
|
|
|
881
1005
|
/**
|
|
@@ -901,10 +1025,11 @@ declare const LogBuiltInMetadata: {
|
|
|
901
1025
|
Uncategorized: string;
|
|
902
1026
|
ServerRenderedErrorPage: string;
|
|
903
1027
|
ServerEndpointError: string;
|
|
1028
|
+
ClientFatalError: string;
|
|
904
1029
|
};
|
|
905
1030
|
Target: {
|
|
906
1031
|
NoSpecificTarget: string;
|
|
907
1032
|
};
|
|
908
1033
|
};
|
|
909
1034
|
|
|
910
|
-
export { AppWrapper, ButtonInputGroup, CheckboxButton, CopiableBox, DAY_IN_MS, DayOfWeek, Drawer, ErrorBox, ErrorWithCode, HOUR_IN_MS, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, Variant, abbreviate, alert, avg, ceilToNumDecimals, confirm, floorToNumDecimals, forceNumIntoBounds, genRouteHandler, getHumanReadableDate, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initLogCollection, initServer, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
|
|
1035
|
+
export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DayOfWeek, Drawer, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, Variant, abbreviate, alert, avg, canReviewLogs, ceilToNumDecimals, confirm, floorToNumDecimals, forceNumIntoBounds, genCSV, genRouteHandler, getHumanReadableDate, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initLogCollection, initServer, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
|