dce-reactkit 3.12.3 → 4.0.0-beta-logreviewer.1
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 +8550 -8958
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/LoadingSpinner.d.ts +2 -2
- package/dist/cjs/types/components/Pagination.d.ts +9 -0
- package/dist/cjs/types/components/Tooltip.d.ts +1 -1
- package/dist/cjs/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +6 -0
- package/dist/cjs/types/helpers/cloneDeep.d.ts +8 -0
- package/dist/cjs/types/index.d.ts +14 -11
- package/dist/cjs/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +13 -0
- package/dist/cjs/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +17 -0
- package/dist/cjs/types/types/LogReviewerFilterState/ContextFilterState.d.ts +6 -0
- package/dist/cjs/types/types/LogReviewerFilterState/DateFilterState.d.ts +13 -0
- package/dist/cjs/types/types/LogReviewerFilterState/TagFilterState.d.ts +4 -0
- package/dist/cjs/types/types/LogReviewerFilterState/index.d.ts +17 -0
- package/dist/cjs/types/types/ParamType.d.ts +10 -10
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +1 -15
- package/dist/esm/index.js +8544 -8950
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/LoadingSpinner.d.ts +2 -2
- package/dist/esm/types/components/Pagination.d.ts +9 -0
- package/dist/esm/types/components/Tooltip.d.ts +1 -1
- package/dist/esm/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +6 -0
- package/dist/esm/types/helpers/cloneDeep.d.ts +8 -0
- package/dist/esm/types/index.d.ts +14 -11
- package/dist/esm/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +13 -0
- package/dist/esm/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +17 -0
- package/dist/esm/types/types/LogReviewerFilterState/ContextFilterState.d.ts +6 -0
- package/dist/esm/types/types/LogReviewerFilterState/DateFilterState.d.ts +13 -0
- package/dist/esm/types/types/LogReviewerFilterState/TagFilterState.d.ts +4 -0
- package/dist/esm/types/types/LogReviewerFilterState/index.d.ts +17 -0
- package/dist/esm/types/types/ParamType.d.ts +10 -10
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +1 -15
- package/dist/index.d.ts +218 -336
- package/package.json +6 -8
- package/src/components/AppWrapper.tsx +3 -1
- package/src/components/CheckboxButton.tsx +1 -1
- package/src/components/Dropdown.tsx +1 -1
- package/src/components/LogReviewer.tsx +1133 -1307
- package/src/components/Modal/index.tsx +1 -1
- package/src/components/Pagination.tsx +162 -0
- package/src/components/RadioButton.tsx +3 -1
- package/src/components/Tooltip.tsx +1 -1
- package/src/constants/LOG_REVIEW_GET_LOGS_ROUTE.ts +9 -0
- package/src/helpers/cloneDeep.ts +11 -0
- package/src/{client → helpers}/initClient.tsx +5 -1
- package/src/helpers/logClientEvent.tsx +3 -1
- package/src/helpers/visitServerEndpoint.tsx +1 -1
- package/src/index.ts +24 -20
- package/src/types/LogReviewerFilterState/ActionErrorFilterState.ts +21 -0
- package/src/types/LogReviewerFilterState/AdvancedFilterState.ts +33 -0
- package/src/types/LogReviewerFilterState/ContextFilterState.ts +13 -0
- package/src/types/LogReviewerFilterState/DateFilterState.ts +23 -0
- package/src/types/LogReviewerFilterState/TagFilterState.ts +6 -0
- package/src/types/LogReviewerFilterState/index.ts +24 -0
- package/src/types/ParamType.ts +10 -10
- package/src/types/ReactKitErrorCode.tsx +1 -17
- package/dist/cjs/types/components/ItemPicker/index.test.d.ts +0 -1
- package/dist/cjs/types/helpers/addDBEditorEndpoints.d.ts +0 -41
- package/dist/cjs/types/helpers/genRouteHandler.d.ts +0 -76
- package/dist/cjs/types/helpers/handleError.d.ts +0 -18
- package/dist/cjs/types/helpers/handleSuccess.d.ts +0 -8
- package/dist/cjs/types/helpers/parseUserAgent.d.ts +0 -17
- package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +0 -24
- package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +0 -33
- package/dist/cjs/types/server/initLogCollection.d.ts +0 -8
- package/dist/cjs/types/server/initServer.d.ts +0 -42
- package/dist/esm/types/components/ItemPicker/index.test.d.ts +0 -1
- package/dist/esm/types/helpers/addDBEditorEndpoints.d.ts +0 -41
- package/dist/esm/types/helpers/genRouteHandler.d.ts +0 -76
- package/dist/esm/types/helpers/handleError.d.ts +0 -18
- package/dist/esm/types/helpers/handleSuccess.d.ts +0 -8
- package/dist/esm/types/helpers/parseUserAgent.d.ts +0 -17
- package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +0 -24
- package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +0 -33
- package/dist/esm/types/server/initLogCollection.d.ts +0 -8
- package/dist/esm/types/server/initServer.d.ts +0 -42
- package/src/components/ItemPicker/index.test.tsx +0 -783
- package/src/helpers/addDBEditorEndpoints.ts +0 -128
- package/src/helpers/genRouteHandler.ts +0 -948
- package/src/helpers/handleError.ts +0 -65
- package/src/helpers/handleSuccess.ts +0 -18
- package/src/helpers/parseUserAgent.ts +0 -108
- package/src/helpers/visitEndpointOnAnotherServer/index.ts +0 -93
- package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +0 -164
- package/src/server/initLogCollection.ts +0 -27
- package/src/server/initServer.ts +0 -287
- /package/dist/cjs/types/{client → helpers}/initClient.d.ts +0 -0
- /package/dist/esm/types/{client → helpers}/initClient.d.ts +0 -0
|
@@ -32,7 +32,7 @@ import NUM_MODAL_PORTALS from '../../constants/NUM_MODAL_PORTALS';
|
|
|
32
32
|
// Import shared helpers
|
|
33
33
|
// TODO: fix dependency cycle
|
|
34
34
|
// eslint-disable-next-line import/no-cycle
|
|
35
|
-
import { isDarkModeOn } from '../../
|
|
35
|
+
import { isDarkModeOn } from '../../helpers/initClient';
|
|
36
36
|
|
|
37
37
|
/*------------------------------------------------------------------------*/
|
|
38
38
|
/* ------------------------------ Constants ----------------------------- */
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Import React
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
// Import FontAwesome
|
|
5
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
6
|
+
import { faArrowLeft, faArrowRight } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
|
|
8
|
+
/*------------------------------------------------------------------------*/
|
|
9
|
+
/* -------------------------------- Types ------------------------------- */
|
|
10
|
+
/*------------------------------------------------------------------------*/
|
|
11
|
+
|
|
12
|
+
// Props
|
|
13
|
+
type Props = {
|
|
14
|
+
// Current page number (1-indexed)
|
|
15
|
+
currentPage: number,
|
|
16
|
+
// Total number of pages
|
|
17
|
+
numPages: number,
|
|
18
|
+
// True if a page change is in progress (to disable buttons)
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
// Callback when a page is clicked
|
|
21
|
+
onPageChanged: (page: number) => void;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/*------------------------------------------------------------------------*/
|
|
25
|
+
/* ------------------------------ Component ----------------------------- */
|
|
26
|
+
/*------------------------------------------------------------------------*/
|
|
27
|
+
|
|
28
|
+
const Pagination: React.FC<Props> = ({
|
|
29
|
+
currentPage,
|
|
30
|
+
numPages,
|
|
31
|
+
loading = false,
|
|
32
|
+
onPageChanged,
|
|
33
|
+
}) => {
|
|
34
|
+
/*------------------------------------------------------------------------*/
|
|
35
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
36
|
+
/*------------------------------------------------------------------------*/
|
|
37
|
+
|
|
38
|
+
// Compute pages to display
|
|
39
|
+
const pages: number[] = [];
|
|
40
|
+
const delta = 2; // how many pages to show on either side of current
|
|
41
|
+
let start = Math.max(1, currentPage - delta);
|
|
42
|
+
let end = Math.min(numPages, currentPage + delta);
|
|
43
|
+
|
|
44
|
+
// If we are too close to the beginning or end, shift the window.
|
|
45
|
+
if (currentPage - delta < 1) {
|
|
46
|
+
end = Math.min(numPages, end + (1 - (currentPage - delta)));
|
|
47
|
+
}
|
|
48
|
+
if (currentPage + delta > numPages) {
|
|
49
|
+
start = Math.max(1, start - ((currentPage + delta) - numPages));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
for (let i = start; i <= end; i++) {
|
|
53
|
+
pages.push(i);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/*------------------------------------------------------------------------*/
|
|
57
|
+
/* ------------------------------- Render ------------------------------- */
|
|
58
|
+
/*------------------------------------------------------------------------*/
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<nav aria-label="Page navigation for logs" className="mt-3">
|
|
62
|
+
<ul className="pagination justify-content-center">
|
|
63
|
+
{/* Previous Button */}
|
|
64
|
+
<li className={`page-item ${(currentPage <= 1 || loading) ? 'disabled' : ''}`}>
|
|
65
|
+
<button
|
|
66
|
+
type="button"
|
|
67
|
+
className="page-link"
|
|
68
|
+
onClick={() => { return onPageChanged(currentPage - 1); }}
|
|
69
|
+
disabled={currentPage <= 1 || loading}
|
|
70
|
+
aria-label="Go to previous page"
|
|
71
|
+
>
|
|
72
|
+
<FontAwesomeIcon icon={faArrowLeft} />
|
|
73
|
+
{' '}
|
|
74
|
+
Prev
|
|
75
|
+
</button>
|
|
76
|
+
</li>
|
|
77
|
+
|
|
78
|
+
{/* First page (if needed) */}
|
|
79
|
+
{currentPage > 3
|
|
80
|
+
&& pages[0] !== 1
|
|
81
|
+
&& (
|
|
82
|
+
<li className="page-item">
|
|
83
|
+
<button
|
|
84
|
+
type="button"
|
|
85
|
+
className="page-link"
|
|
86
|
+
onClick={() => { return onPageChanged(1); }}
|
|
87
|
+
disabled={loading}
|
|
88
|
+
aria-label="Go to page 1"
|
|
89
|
+
>
|
|
90
|
+
1
|
|
91
|
+
</button>
|
|
92
|
+
</li>
|
|
93
|
+
)}
|
|
94
|
+
|
|
95
|
+
{/* Ellipsis if gap between first page and start of window */}
|
|
96
|
+
{currentPage > 4 && (
|
|
97
|
+
<li className="page-item disabled">
|
|
98
|
+
<span className="page-link">...</span>
|
|
99
|
+
</li>
|
|
100
|
+
)}
|
|
101
|
+
|
|
102
|
+
{/* Page numbers */}
|
|
103
|
+
{pages.map((pageNum) => {
|
|
104
|
+
return (
|
|
105
|
+
<li key={pageNum} className={`page-item ${pageNum === currentPage ? 'active' : ''}`}>
|
|
106
|
+
<button
|
|
107
|
+
type="button"
|
|
108
|
+
className="page-link"
|
|
109
|
+
onClick={() => { return onPageChanged(pageNum); }}
|
|
110
|
+
disabled={loading}
|
|
111
|
+
aria-label={`Go to page ${pageNum}`}
|
|
112
|
+
>
|
|
113
|
+
{pageNum}
|
|
114
|
+
</button>
|
|
115
|
+
</li>
|
|
116
|
+
);
|
|
117
|
+
})}
|
|
118
|
+
|
|
119
|
+
{/* Ellipsis if gap between end of window and last page */}
|
|
120
|
+
{currentPage < numPages - 3 && (
|
|
121
|
+
<li className="page-item disabled">
|
|
122
|
+
<span className="page-link">...</span>
|
|
123
|
+
</li>
|
|
124
|
+
)}
|
|
125
|
+
|
|
126
|
+
{/* Last page (if needed) */}
|
|
127
|
+
{currentPage < numPages - 2
|
|
128
|
+
&& pages[pages.length - 1] !== numPages
|
|
129
|
+
&& (
|
|
130
|
+
<li className="page-item">
|
|
131
|
+
<button
|
|
132
|
+
type="button"
|
|
133
|
+
className="page-link"
|
|
134
|
+
onClick={() => { return onPageChanged(numPages); }}
|
|
135
|
+
disabled={loading}
|
|
136
|
+
aria-label="Go to last page"
|
|
137
|
+
>
|
|
138
|
+
{numPages}
|
|
139
|
+
</button>
|
|
140
|
+
</li>
|
|
141
|
+
)}
|
|
142
|
+
|
|
143
|
+
{/* Next Button */}
|
|
144
|
+
<li className={`page-item ${(currentPage >= numPages || loading) ? 'disabled' : ''}`}>
|
|
145
|
+
<button
|
|
146
|
+
type="button"
|
|
147
|
+
className="page-link"
|
|
148
|
+
onClick={() => { return onPageChanged(currentPage + 1); }}
|
|
149
|
+
disabled={currentPage >= numPages || loading}
|
|
150
|
+
aria-label="Go to next page"
|
|
151
|
+
>
|
|
152
|
+
Next
|
|
153
|
+
{' '}
|
|
154
|
+
<FontAwesomeIcon icon={faArrowRight} />
|
|
155
|
+
</button>
|
|
156
|
+
</li>
|
|
157
|
+
</ul>
|
|
158
|
+
</nav>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default Pagination;
|
|
@@ -13,7 +13,9 @@ import { faCircle } from '@fortawesome/free-regular-svg-icons';
|
|
|
13
13
|
|
|
14
14
|
// Import shared types
|
|
15
15
|
import Variant from '../types/Variant';
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
// Import shared helpers
|
|
18
|
+
import { isDarkModeOn } from '../helpers/initClient';
|
|
17
19
|
|
|
18
20
|
/*------------------------------------------------------------------------*/
|
|
19
21
|
/* -------------------------------- Types ------------------------------- */
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
// eslint-disable-next-line import/no-cycle
|
|
4
4
|
import { showFatalError } from '../components/AppWrapper';
|
|
5
5
|
|
|
6
|
+
// Import other helpers
|
|
7
|
+
import waitMs from './waitMs';
|
|
8
|
+
|
|
6
9
|
// Import shared types
|
|
7
10
|
import ErrorWithCode from '../errors/ErrorWithCode';
|
|
8
|
-
import waitMs from '../helpers/waitMs';
|
|
9
11
|
import ReactKitErrorCode from '../types/ReactKitErrorCode';
|
|
10
12
|
|
|
11
13
|
/*----------------------------------------*/
|
|
@@ -164,10 +166,12 @@ const initClient = (
|
|
|
164
166
|
storedSendRequest = async () => {
|
|
165
167
|
throw new Error('Cannot send requests because there is no server');
|
|
166
168
|
};
|
|
169
|
+
noServer = true;
|
|
167
170
|
} else {
|
|
168
171
|
// Store values
|
|
169
172
|
storedSendRequest = opts.sendRequest;
|
|
170
173
|
sessionExpiredMessage = opts.sessionExpiredMessage;
|
|
174
|
+
noServer = false;
|
|
171
175
|
}
|
|
172
176
|
|
|
173
177
|
// Handle universal parts
|
|
@@ -5,10 +5,12 @@ import LogFunction from '../types/LogFunction';
|
|
|
5
5
|
import LogLevel from '../types/LogLevel';
|
|
6
6
|
|
|
7
7
|
// Import shared functions
|
|
8
|
+
// TODO: fix dependency cycle
|
|
9
|
+
// eslint-disable-next-line import/no-cycle
|
|
8
10
|
import visitServerEndpoint from './visitServerEndpoint';
|
|
9
11
|
|
|
10
12
|
// Import status
|
|
11
|
-
import { appHasNoServer } from '
|
|
13
|
+
import { appHasNoServer } from './initClient';
|
|
12
14
|
|
|
13
15
|
/* ------- Metadata Populator ------- */
|
|
14
16
|
|
|
@@ -7,7 +7,7 @@ import ReactKitErrorCode from '../types/ReactKitErrorCode';
|
|
|
7
7
|
// Import helpers
|
|
8
8
|
// TODO: fix dependency cycle
|
|
9
9
|
// eslint-disable-next-line import/no-cycle
|
|
10
|
-
import { getSendRequest } from '
|
|
10
|
+
import { getSendRequest } from './initClient';
|
|
11
11
|
import { showSessionExpiredMessage } from '../components/AppWrapper';
|
|
12
12
|
|
|
13
13
|
/*------------------------------------------------------------------------*/
|
package/src/index.ts
CHANGED
|
@@ -38,12 +38,16 @@ import ErrorWithCode from './errors/ErrorWithCode';
|
|
|
38
38
|
import MINUTE_IN_MS from './constants/MINUTE_IN_MS';
|
|
39
39
|
import HOUR_IN_MS from './constants/HOUR_IN_MS';
|
|
40
40
|
import DAY_IN_MS from './constants/DAY_IN_MS';
|
|
41
|
+
import LOG_REVIEW_ROUTE_PATH_PREFIX from './constants/LOG_REVIEW_ROUTE_PATH_PREFIX';
|
|
42
|
+
import LOG_ROUTE_PATH from './constants/LOG_ROUTE_PATH';
|
|
43
|
+
import LOG_REVIEW_STATUS_ROUTE from './constants/LOG_REVIEW_STATUS_ROUTE';
|
|
44
|
+
import LOG_REVIEW_GET_LOGS_ROUTE from './constants/LOG_REVIEW_GET_LOGS_ROUTE';
|
|
41
45
|
|
|
42
46
|
// Import dynamic constants
|
|
43
47
|
import DynamicWord from './dynamicConstants/DynamicWord';
|
|
44
48
|
|
|
45
49
|
// Import helpers
|
|
46
|
-
import initClient from './
|
|
50
|
+
import initClient from './helpers/initClient';
|
|
47
51
|
import abbreviate from './helpers/abbreviate';
|
|
48
52
|
import avg from './helpers/avg';
|
|
49
53
|
import ceilToNumDecimals from './helpers/ceilToNumDecimals';
|
|
@@ -55,10 +59,6 @@ import roundToNumDecimals from './helpers/roundToNumDecimals';
|
|
|
55
59
|
import sum from './helpers/sum';
|
|
56
60
|
import waitMs from './helpers/waitMs';
|
|
57
61
|
import visitServerEndpoint from './helpers/visitServerEndpoint';
|
|
58
|
-
import genRouteHandler from './helpers/genRouteHandler';
|
|
59
|
-
import handleError from './helpers/handleError';
|
|
60
|
-
import handleSuccess from './helpers/handleSuccess';
|
|
61
|
-
import initServer from './server/initServer';
|
|
62
62
|
import getOrdinal from './helpers/getOrdinal';
|
|
63
63
|
import getTimeInfoInET from './helpers/getTimeInfoInET';
|
|
64
64
|
import stubServerEndpoint from './helpers/stubServerEndpoint';
|
|
@@ -69,7 +69,6 @@ import stringsToHumanReadableList from './helpers/stringsToHumanReadableList';
|
|
|
69
69
|
import onlyKeepLetters from './helpers/onlyKeepLetters';
|
|
70
70
|
import parallelLimit from './helpers/parallelLimit';
|
|
71
71
|
import logClientEvent, { setClientEventMetadataPopulator } from './helpers/logClientEvent';
|
|
72
|
-
import initLogCollection from './server/initLogCollection';
|
|
73
72
|
import getMonthName from './helpers/getMonthName';
|
|
74
73
|
import genCSV from './helpers/genCSV';
|
|
75
74
|
import canReviewLogs from './helpers/canReviewLogs';
|
|
@@ -77,7 +76,6 @@ import isMobileOrTablet from './helpers/isMobileOrTablet';
|
|
|
77
76
|
import extractProp from './helpers/extractProp';
|
|
78
77
|
import compareArraysByProp from './helpers/compareArraysByProp';
|
|
79
78
|
import getLocalTimeInfo from './helpers/getLocalTimeInfo';
|
|
80
|
-
import addDBEditorEndpoints from './helpers/addDBEditorEndpoints';
|
|
81
79
|
import genCommaList from './helpers/genCommaList';
|
|
82
80
|
import validateEmail from './helpers/validators/validateEmail';
|
|
83
81
|
import validatePhoneNumber from './helpers/validators/validatePhoneNumber';
|
|
@@ -94,16 +92,15 @@ import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
|
|
|
94
92
|
import someAsync from './helpers/asyncArrayFunctions/someAsync';
|
|
95
93
|
import capitalize from './helpers/capitalize';
|
|
96
94
|
import shuffleArray from './helpers/shuffleArray';
|
|
97
|
-
import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
|
|
98
95
|
import getWordCount from './helpers/getWordCount';
|
|
96
|
+
import cloneDeep from './helpers/cloneDeep';
|
|
99
97
|
|
|
100
98
|
// Import types
|
|
99
|
+
import ParamType from './types/ParamType';
|
|
101
100
|
import ModalButtonType from './types/ModalButtonType';
|
|
102
101
|
import ModalSize from './types/ModalSize';
|
|
103
102
|
import ModalType from './types/ModalType';
|
|
104
|
-
import ReactKitErrorCode from './types/ReactKitErrorCode';
|
|
105
103
|
import Variant from './types/Variant';
|
|
106
|
-
import ParamType from './types/ParamType';
|
|
107
104
|
import DayOfWeek from './types/DayOfWeek';
|
|
108
105
|
import Log from './types/Log';
|
|
109
106
|
import LogType from './types/LogType';
|
|
@@ -112,8 +109,14 @@ import LogAction from './types/LogAction';
|
|
|
112
109
|
import LogBuiltInMetadata from './types/LogBuiltInMetadata';
|
|
113
110
|
import LogMetadataType from './types/LogMetadataType';
|
|
114
111
|
import LogFunction from './types/LogFunction';
|
|
112
|
+
import LogTypeSpecificInfo from './types/Log/LogTypeSpecificInfo';
|
|
113
|
+
import LogMainInfo from './types/Log/LogMainInfo';
|
|
114
|
+
import LogSourceSpecificInfo from './types/Log/LogSourceSpecificInfo';
|
|
115
|
+
import LogLevel from './types/LogLevel';
|
|
115
116
|
import IntelliTableColumn from './types/IntelliTableColumn';
|
|
116
117
|
import DropdownItemType from './types/DropdownItemType';
|
|
118
|
+
import ReactKitErrorCode from './types/ReactKitErrorCode';
|
|
119
|
+
import LogReviewerFilterState from './types/LogReviewerFilterState';
|
|
117
120
|
|
|
118
121
|
// Component-specific-types
|
|
119
122
|
import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
@@ -159,6 +162,10 @@ export {
|
|
|
159
162
|
MINUTE_IN_MS,
|
|
160
163
|
HOUR_IN_MS,
|
|
161
164
|
DAY_IN_MS,
|
|
165
|
+
LOG_REVIEW_ROUTE_PATH_PREFIX,
|
|
166
|
+
LOG_ROUTE_PATH,
|
|
167
|
+
LOG_REVIEW_STATUS_ROUTE,
|
|
168
|
+
LOG_REVIEW_GET_LOGS_ROUTE,
|
|
162
169
|
// Dynamic Constants
|
|
163
170
|
DynamicWord,
|
|
164
171
|
// Helpers
|
|
@@ -203,6 +210,7 @@ export {
|
|
|
203
210
|
capitalize,
|
|
204
211
|
shuffleArray,
|
|
205
212
|
getWordCount,
|
|
213
|
+
cloneDeep,
|
|
206
214
|
// Client helpers
|
|
207
215
|
initClient,
|
|
208
216
|
visitServerEndpoint,
|
|
@@ -212,15 +220,8 @@ export {
|
|
|
212
220
|
combineClassNames,
|
|
213
221
|
useForceRender,
|
|
214
222
|
setClientEventMetadataPopulator,
|
|
215
|
-
// Server helpers
|
|
216
|
-
initServer,
|
|
217
|
-
genRouteHandler,
|
|
218
|
-
handleError,
|
|
219
|
-
handleSuccess,
|
|
220
|
-
initLogCollection,
|
|
221
|
-
addDBEditorEndpoints,
|
|
222
|
-
visitEndpointOnAnotherServer,
|
|
223
223
|
// Types
|
|
224
|
+
ParamType,
|
|
224
225
|
ModalButtonType,
|
|
225
226
|
ModalSize,
|
|
226
227
|
ModalType,
|
|
@@ -234,13 +235,16 @@ export {
|
|
|
234
235
|
LogBuiltInMetadata,
|
|
235
236
|
LogMetadataType,
|
|
236
237
|
LogFunction,
|
|
238
|
+
LogTypeSpecificInfo,
|
|
239
|
+
LogMainInfo,
|
|
240
|
+
LogSourceSpecificInfo,
|
|
241
|
+
LogLevel,
|
|
237
242
|
IntelliTableColumn,
|
|
238
243
|
DropdownItemType,
|
|
244
|
+
LogReviewerFilterState,
|
|
239
245
|
// Component-specific-types
|
|
240
246
|
PickableItem,
|
|
241
247
|
DBEntry,
|
|
242
248
|
DBEntryField,
|
|
243
249
|
DBEntryFieldType,
|
|
244
|
-
// Server types
|
|
245
|
-
ParamType,
|
|
246
250
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import LogType from '../LogType';
|
|
2
|
+
|
|
3
|
+
// Action filter state (only relevant for action logs)
|
|
4
|
+
type ActionErrorFilterState = {
|
|
5
|
+
// Required type of log
|
|
6
|
+
type: LogType | undefined, // If undefined, no filter applied
|
|
7
|
+
// Query for error message (only relevant if type is error)
|
|
8
|
+
errorMessage: string, // If empty, no filter applied
|
|
9
|
+
// Query for error code (only relevant if type is error)
|
|
10
|
+
errorCode: string, // If empty, no filter applied
|
|
11
|
+
// Action targets to include (only relevant if type is action)
|
|
12
|
+
target: {
|
|
13
|
+
[k: string]: boolean
|
|
14
|
+
},
|
|
15
|
+
// Action types to include (only relevant if type is action)
|
|
16
|
+
action: {
|
|
17
|
+
[k: string]: boolean
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default ActionErrorFilterState;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import LogSource from '../LogSource';
|
|
2
|
+
|
|
3
|
+
// Advanced filter state
|
|
4
|
+
type AdvancedFilterState = {
|
|
5
|
+
// Query for user first name (case insensitive)
|
|
6
|
+
userFirstName: string, // If empty, no filter applied
|
|
7
|
+
// Query for user last name (case insensitive)
|
|
8
|
+
userLastName: string, // If empty, no filter applied
|
|
9
|
+
// Query for user email (case insensitive)
|
|
10
|
+
userEmail: string, // If empty, no filter applied
|
|
11
|
+
// Match for userId (numerical)
|
|
12
|
+
userId: string, // If empty, no filter applied
|
|
13
|
+
// If true, include students
|
|
14
|
+
includeLearners: boolean,
|
|
15
|
+
// If true, include ttms
|
|
16
|
+
includeTTMs: boolean,
|
|
17
|
+
// If true, include admins
|
|
18
|
+
includeAdmins: boolean,
|
|
19
|
+
// Match for courseId (numerical)
|
|
20
|
+
courseId: string, // If empty, no filter applied
|
|
21
|
+
// Query for course name (case insensitive)
|
|
22
|
+
courseName: string, // If empty, no filter applied
|
|
23
|
+
// Required isMobile value
|
|
24
|
+
isMobile: (true | false | undefined), // If undefined, no filter applied
|
|
25
|
+
// Required log source value
|
|
26
|
+
source: LogSource | undefined, // If undefined, no filter applied
|
|
27
|
+
// Query for route path (only relevant if source is server)
|
|
28
|
+
routePath: string, // If empty, no filter applied
|
|
29
|
+
// Query for route template (only relevant if source is server)
|
|
30
|
+
routeTemplate: string, // If empty, no filter applied
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default AdvancedFilterState;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Date filter state
|
|
2
|
+
type DateFilterState = {
|
|
3
|
+
// Current start date
|
|
4
|
+
startDate: {
|
|
5
|
+
// Full year
|
|
6
|
+
year: number,
|
|
7
|
+
// 1-indexed month
|
|
8
|
+
month: number,
|
|
9
|
+
// 1-indexed day
|
|
10
|
+
day: number,
|
|
11
|
+
},
|
|
12
|
+
// Current end date
|
|
13
|
+
endDate: {
|
|
14
|
+
// Full year
|
|
15
|
+
year: number,
|
|
16
|
+
// 1-indexed month
|
|
17
|
+
month: number,
|
|
18
|
+
// 1-indexed day
|
|
19
|
+
day: number,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default DateFilterState;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import DateFilterState from './DateFilterState';
|
|
2
|
+
import ContextFilterState from './ContextFilterState';
|
|
3
|
+
import TagFilterState from './TagFilterState';
|
|
4
|
+
import ActionErrorFilterState from './ActionErrorFilterState';
|
|
5
|
+
import AdvancedFilterState from './AdvancedFilterState';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A bundle of filter state objects for each type of filter
|
|
9
|
+
* @author Gabe Abrams
|
|
10
|
+
*/
|
|
11
|
+
type LogReviewerFilterState = {
|
|
12
|
+
// Date filter state
|
|
13
|
+
dateFilterState: DateFilterState,
|
|
14
|
+
// Context filter state
|
|
15
|
+
contextFilterState: ContextFilterState,
|
|
16
|
+
// Tag filter state
|
|
17
|
+
tagFilterState: TagFilterState,
|
|
18
|
+
// Action error filter state
|
|
19
|
+
actionErrorFilterState: ActionErrorFilterState,
|
|
20
|
+
// Advanced filter state
|
|
21
|
+
advancedFilterState: AdvancedFilterState,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default LogReviewerFilterState;
|
package/src/types/ParamType.ts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* @author Gabe Abrams
|
|
4
4
|
*/
|
|
5
5
|
enum ParamType {
|
|
6
|
-
Boolean = '
|
|
7
|
-
BooleanOptional = '
|
|
8
|
-
Float = '
|
|
9
|
-
FloatOptional = '
|
|
10
|
-
Int = '
|
|
11
|
-
IntOptional = '
|
|
12
|
-
JSON = '
|
|
13
|
-
JSONOptional = '
|
|
14
|
-
String = '
|
|
15
|
-
StringOptional = '
|
|
6
|
+
Boolean = 'Boolean', // Boolean
|
|
7
|
+
BooleanOptional = 'BooleanOptional', // Optional boolean
|
|
8
|
+
Float = 'Float', // Float Number
|
|
9
|
+
FloatOptional = 'FloatOptional', // Optional Float Number
|
|
10
|
+
Int = 'Int', // Integer Number
|
|
11
|
+
IntOptional = 'IntOptional', // Optional Integer Number
|
|
12
|
+
JSON = 'JSON', // JSONified object
|
|
13
|
+
JSONOptional = 'JSONOptional', // Optional JSONified object
|
|
14
|
+
String = 'String', // String
|
|
15
|
+
StringOptional = 'StringOptional', // Optional string
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default ParamType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Highest error code =
|
|
1
|
+
// Highest error code = DRK34
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* List of error codes built into the react kit
|
|
@@ -8,23 +8,7 @@ enum ReactKitErrorCode {
|
|
|
8
8
|
NoResponse = 'DRK1',
|
|
9
9
|
NoCode = 'DRK2',
|
|
10
10
|
SessionExpired = 'DRK3',
|
|
11
|
-
MissingParameter = 'DRK4',
|
|
12
|
-
InvalidParameter = 'DRK5',
|
|
13
|
-
HostNotAllowed = 'DRK17',
|
|
14
|
-
HostBanned = 'DRK18',
|
|
15
|
-
WrongCourse = 'DRK6',
|
|
16
11
|
NoCACCLSendRequestFunction = 'DRK7',
|
|
17
|
-
NoCACCLGetLaunchInfoFunction = 'DRK8',
|
|
18
|
-
NotTTM = 'DRK9',
|
|
19
|
-
NotAdmin = 'DRK10',
|
|
20
|
-
NotAllowedToReviewLogs = 'DRK11',
|
|
21
|
-
ThemeCheckedBeforeReactKitReady = 'DRK12',
|
|
22
|
-
SessionExpiredMessageGottenBeforeReactKitReady = 'DRK13',
|
|
23
|
-
|
|
24
|
-
// Server-to-server requests
|
|
25
|
-
NotConnected = 'DRK14',
|
|
26
|
-
SelfSigned = 'DRK15',
|
|
27
|
-
ResponseParseError = 'DRK16',
|
|
28
12
|
}
|
|
29
13
|
|
|
30
14
|
export default ReactKitErrorCode;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
/**
|
|
3
|
-
* Interface for a collection in the database
|
|
4
|
-
* @author Yuen Ler Chow
|
|
5
|
-
*/
|
|
6
|
-
type DCEMangoCollection = {
|
|
7
|
-
/**
|
|
8
|
-
* Find all items in the collection that match the filter query
|
|
9
|
-
* @param filterQuery query for the filter
|
|
10
|
-
* @returns list of items that match the filter query
|
|
11
|
-
*/
|
|
12
|
-
find: (filterQuery: any) => Promise<any[]>;
|
|
13
|
-
/**
|
|
14
|
-
* Insert an item into the collection
|
|
15
|
-
* @param item the item to insert
|
|
16
|
-
*/
|
|
17
|
-
insert: (item: any) => Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Delete an item in the collection
|
|
20
|
-
* @param id the id of the item to delete
|
|
21
|
-
*/
|
|
22
|
-
delete: (filterQuery: {
|
|
23
|
-
id: string;
|
|
24
|
-
}) => Promise<void>;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Add all routes for the DBEditor
|
|
28
|
-
* @author Yuen Ler Chow
|
|
29
|
-
* @param opts object containing all arguments
|
|
30
|
-
* @param opts.app express app to add routes too
|
|
31
|
-
* @param opts.collectionName the name of the collection
|
|
32
|
-
* @param opts.adminsOnly true if the endpoint is for admins only
|
|
33
|
-
* @param opts.collection dce-mango db collection
|
|
34
|
-
*/
|
|
35
|
-
declare const addDBEditorEndpoints: (opts: {
|
|
36
|
-
app: express.Application;
|
|
37
|
-
collectionName: string;
|
|
38
|
-
adminsOnly: boolean;
|
|
39
|
-
collection: DCEMangoCollection;
|
|
40
|
-
}) => void;
|
|
41
|
-
export default addDBEditorEndpoints;
|