dce-reactkit 3.2.1 → 3.2.2-beta.2
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 +2106 -416
- package/dist/cjs/index.js.map +1 -1
- 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/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 +8 -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 +2103 -418
- package/dist/esm/index.js.map +1 -1
- 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/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 +8 -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 +163 -47
- package/package.json +1 -1
- package/sandbox.js +78 -17
- package/src/components/AppWrapper.tsx +15 -0
- package/src/components/CSVDownloadButton.tsx +102 -0
- package/src/components/IntelliTable.tsx +610 -0
- package/src/components/LogReviewer.tsx +2038 -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/index.ts +14 -0
- package/src/server/initServer.ts +105 -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,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,8 @@ 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';
|
|
46
51
|
import ModalButtonType from './types/ModalButtonType';
|
|
47
52
|
import ModalSize from './types/ModalSize';
|
|
48
53
|
import ModalType from './types/ModalType';
|
|
@@ -55,5 +60,7 @@ import LogType from './types/LogType';
|
|
|
55
60
|
import LogSource from './types/LogSource';
|
|
56
61
|
import LogAction from './types/LogAction';
|
|
57
62
|
import LogBuiltInMetadata from './types/LogBuiltInMetadata';
|
|
63
|
+
import LogMetadataType from './types/LogMetadataType';
|
|
64
|
+
import IntelliTableColumn from './types/IntelliTableColumn';
|
|
58
65
|
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, };
|
|
66
|
+
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, 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 admins] 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;
|