dce-reactkit 3.9.0-beta-loading-modal.2 → 3.9.0-beta-loading-modal.3
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 +783 -201
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/initClient.d.ts +16 -2
- package/dist/cjs/types/components/AppWrapper.d.ts +32 -0
- package/dist/cjs/types/components/CheckboxButton.d.ts +1 -0
- package/dist/cjs/types/components/Dropdown.d.ts +32 -0
- package/dist/cjs/types/components/RadioButton.d.ts +2 -0
- package/dist/cjs/types/helpers/genRouteHandler.d.ts +8 -0
- package/dist/cjs/types/helpers/validators/ChicagoTitleCase.d.ts +9 -0
- package/dist/cjs/types/helpers/validators/validURL.d.ts +8 -0
- package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +24 -0
- package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +33 -0
- package/dist/cjs/types/index.d.ts +5 -2
- package/dist/cjs/types/types/DropdownItemType.d.ts +6 -0
- package/dist/cjs/types/types/ModalType.d.ts +1 -0
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +6 -1
- package/dist/esm/index.js +779 -202
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/client/initClient.d.ts +16 -2
- package/dist/esm/types/components/AppWrapper.d.ts +32 -0
- package/dist/esm/types/components/CheckboxButton.d.ts +1 -0
- package/dist/esm/types/components/Dropdown.d.ts +32 -0
- package/dist/esm/types/components/RadioButton.d.ts +2 -0
- package/dist/esm/types/helpers/genRouteHandler.d.ts +8 -0
- package/dist/esm/types/helpers/validators/ChicagoTitleCase.d.ts +9 -0
- package/dist/esm/types/helpers/validators/validURL.d.ts +8 -0
- package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +24 -0
- package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +33 -0
- package/dist/esm/types/index.d.ts +5 -2
- package/dist/esm/types/types/DropdownItemType.d.ts +6 -0
- package/dist/esm/types/types/ModalType.d.ts +1 -0
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +6 -1
- package/dist/index.d.ts +163 -46
- package/package.json +2 -1
- package/src/client/initClient.tsx +49 -11
- package/src/components/AppWrapper.tsx +258 -2
- package/src/components/CheckboxButton.tsx +24 -6
- package/src/components/Dropdown.tsx +317 -0
- package/src/components/IntelliTable.tsx +1 -1
- package/src/components/ItemPicker/NestableItemList.tsx +1 -0
- package/src/components/LogReviewer.tsx +17 -4
- package/src/components/Modal/index.tsx +4 -1
- package/src/components/MultiSwitch.tsx +1 -1
- package/src/components/RadioButton.tsx +33 -6
- package/src/components/SimpleDateChooser.tsx +8 -2
- package/src/helpers/genRouteHandler.ts +116 -17
- package/src/helpers/logClientEvent.tsx +8 -0
- package/src/helpers/validators/ChicagoTitleCase.test.ts +85 -0
- package/src/helpers/validators/ChicagoTitleCase.ts +32 -0
- package/src/helpers/validators/findURL.test.ts +83 -0
- package/src/helpers/validators/findURL.ts +43 -0
- package/src/helpers/validators/validURL.test.ts +90 -0
- package/src/helpers/validators/validURL.ts +18 -0
- package/src/helpers/visitEndpointOnAnotherServer/index.ts +93 -0
- package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +164 -0
- package/src/helpers/visitServerEndpoint.tsx +1 -0
- package/src/index.ts +8 -0
- package/src/server/initLogCollection.ts +5 -0
- package/src/server/initServer.ts +11 -5
- package/src/types/DropdownItemType.ts +11 -0
- package/src/types/ModalType.tsx +1 -0
- package/src/types/ReactKitErrorCode.tsx +8 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
|
|
2
|
+
// Import the function to be tested
|
|
3
|
+
// import isValid from './validURL';
|
|
4
|
+
|
|
5
|
+
// // Import constants
|
|
6
|
+
// import { INVALID_STRING_ERRORS, INVALID_REGEX_ERROR } from './shared/constants/ERROR_MESSAGES';
|
|
7
|
+
|
|
8
|
+
// /*------------------------------------------------------------------------*/
|
|
9
|
+
// /* ---------------------------- Valid Tests --------------------------- */
|
|
10
|
+
// /*------------------------------------------------------------------------*/
|
|
11
|
+
|
|
12
|
+
// const validUrls: string[] = [
|
|
13
|
+
// 'http://example.com',
|
|
14
|
+
// 'https://example.com',
|
|
15
|
+
// 'http://www.example.com',
|
|
16
|
+
// 'https://www.example.com',
|
|
17
|
+
// 'https://example.com/path',
|
|
18
|
+
// 'http://example.com/path',
|
|
19
|
+
// 'https://example.com?query=string',
|
|
20
|
+
// 'http://example.com?query=string',
|
|
21
|
+
// 'https://example.com#fragment',
|
|
22
|
+
// 'http://example.com#fragment',
|
|
23
|
+
// 'http://localhost',
|
|
24
|
+
// 'https://localhost:3000',
|
|
25
|
+
// 'http://localhost:3000',
|
|
26
|
+
// 'http://127.0.0.1',
|
|
27
|
+
// 'http://127.0.0.1:3000',
|
|
28
|
+
// 'ftp://example.com/path',
|
|
29
|
+
// 'ftp://example.com',
|
|
30
|
+
// 'https://127.0.0.1:3000',
|
|
31
|
+
// 'file:///C:/path/to/file'
|
|
32
|
+
// ];
|
|
33
|
+
|
|
34
|
+
// test(
|
|
35
|
+
// 'Returns true for a given valid URL.',
|
|
36
|
+
// async () => {
|
|
37
|
+
// validUrls.forEach((url) => {
|
|
38
|
+
// expect(isValid(url)).toBe(true);
|
|
39
|
+
// });
|
|
40
|
+
// },
|
|
41
|
+
// );
|
|
42
|
+
|
|
43
|
+
// /*------------------------------------------------------------------------*/
|
|
44
|
+
// /* ---------------------------- Invalid Tests --------------------------- */
|
|
45
|
+
// /*------------------------------------------------------------------------*/
|
|
46
|
+
|
|
47
|
+
// const invalidUrls: string[] = [
|
|
48
|
+
// '',
|
|
49
|
+
// ' ',
|
|
50
|
+
// 'example',
|
|
51
|
+
// 'http://',
|
|
52
|
+
// 'http://.',
|
|
53
|
+
// 'http://..',
|
|
54
|
+
// 'http://##/',
|
|
55
|
+
// 'http://../',
|
|
56
|
+
// 'http://??/',
|
|
57
|
+
// 'http://#',
|
|
58
|
+
// 'http://##',
|
|
59
|
+
// '//',
|
|
60
|
+
// '//a',
|
|
61
|
+
// '///a',
|
|
62
|
+
// '///',
|
|
63
|
+
// 'http:///a',
|
|
64
|
+
// 'http://www.foo.bar./',
|
|
65
|
+
// 'http://foo.bar/foo(bar)baz quux',
|
|
66
|
+
// 'http://3628126748',
|
|
67
|
+
// 'http://.www.foo.bar/',
|
|
68
|
+
// 'http://.www.foo.bar./',
|
|
69
|
+
// 'http://123.123.123',
|
|
70
|
+
// 'http://1.1.1.1.1',
|
|
71
|
+
// 'http://example.com:99999',
|
|
72
|
+
// 'http://example.com:80:80',
|
|
73
|
+
// 'http://example.com::80',
|
|
74
|
+
// 'http://example.com:-80',
|
|
75
|
+
// 'http://-example.com',
|
|
76
|
+
// 'http://example.com-',
|
|
77
|
+
// 'http://example.com_',
|
|
78
|
+
// 'http://example..com',
|
|
79
|
+
// 'http://example.com.',
|
|
80
|
+
// 'http://.example.com'
|
|
81
|
+
// ];
|
|
82
|
+
|
|
83
|
+
// test(
|
|
84
|
+
// 'Returns false for a given invalid URL.',
|
|
85
|
+
// async () => {
|
|
86
|
+
// invalidUrls.forEach((url) => {
|
|
87
|
+
// expect(isValid(url)).toBe(false);
|
|
88
|
+
// });
|
|
89
|
+
// },
|
|
90
|
+
// );
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function checks if a given input string is a valid URL.
|
|
3
|
+
* @author Leisha Bhandari
|
|
4
|
+
* @param URL: The input string that needs checked as a URL or not.
|
|
5
|
+
* @returns A true boolean value if the input string is a valid URL, and a false
|
|
6
|
+
* boolean value if the input string is a invalid URL
|
|
7
|
+
*/
|
|
8
|
+
function isValid(url: string): boolean {
|
|
9
|
+
// Uses the input URL to create a URL object
|
|
10
|
+
try {
|
|
11
|
+
new URL(url);
|
|
12
|
+
// URL constructor does not throw an error, so input URL is valid
|
|
13
|
+
return true;
|
|
14
|
+
} catch (err) {
|
|
15
|
+
// URL constructor throws an error, so input URL is invalid
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Import custom error
|
|
2
|
+
import ErrorWithCode from '../../errors/ErrorWithCode';
|
|
3
|
+
|
|
4
|
+
// Import shared types
|
|
5
|
+
import ReactKitErrorCode from '../../types/ReactKitErrorCode';
|
|
6
|
+
|
|
7
|
+
// Import other helpers
|
|
8
|
+
import sendServerToServerRequest from './sendServerToServerRequest';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Send a server-to-server request from this sever to another server that uses
|
|
12
|
+
* dce-reactkit [for server only]
|
|
13
|
+
* @author Gabe Abrams
|
|
14
|
+
* @param opts object containing all arguments
|
|
15
|
+
* @param opts.host - the host of the other server
|
|
16
|
+
* @param opts.path - the path of the other server's endpoint
|
|
17
|
+
* @param [opts.method=GET] - the method of the endpoint
|
|
18
|
+
* @param [opts.params] - query/body parameters to include
|
|
19
|
+
* @param [opts.headers] - headers to include
|
|
20
|
+
* @returns response from server
|
|
21
|
+
*/
|
|
22
|
+
const visitEndpointOnAnotherServer = async (
|
|
23
|
+
opts: {
|
|
24
|
+
host: string,
|
|
25
|
+
path: string,
|
|
26
|
+
method?: ('GET' | 'POST' | 'DELETE' | 'PUT'),
|
|
27
|
+
params?: { [key in string]: any },
|
|
28
|
+
headers?: { [k in string]: any },
|
|
29
|
+
},
|
|
30
|
+
): Promise<any> => {
|
|
31
|
+
// Remove properties with undefined values
|
|
32
|
+
let params: { [key in string]: any } | undefined;
|
|
33
|
+
if (opts.params) {
|
|
34
|
+
params = Object.fromEntries(
|
|
35
|
+
Object
|
|
36
|
+
.entries(opts.params)
|
|
37
|
+
.filter(([, value]) => {
|
|
38
|
+
return value !== undefined;
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Automatically JSONify arrays and objects
|
|
44
|
+
if (params) {
|
|
45
|
+
params = Object.fromEntries(
|
|
46
|
+
Object
|
|
47
|
+
.entries(params)
|
|
48
|
+
.map(([key, value]) => {
|
|
49
|
+
if (Array.isArray(value) || typeof value === 'object') {
|
|
50
|
+
return [key, JSON.stringify(value)];
|
|
51
|
+
}
|
|
52
|
+
return [key, value];
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Send the request
|
|
58
|
+
const response = await sendServerToServerRequest({
|
|
59
|
+
host: opts.host,
|
|
60
|
+
path: opts.path,
|
|
61
|
+
method: opts.method ?? 'GET',
|
|
62
|
+
params,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Check for failure
|
|
66
|
+
if (!response || !response.body) {
|
|
67
|
+
throw new ErrorWithCode(
|
|
68
|
+
'We didn\'t get a response from the server. Please check your internet connection.',
|
|
69
|
+
ReactKitErrorCode.NoResponse,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if (!response.body.success) {
|
|
73
|
+
// Other errors
|
|
74
|
+
throw new ErrorWithCode(
|
|
75
|
+
(
|
|
76
|
+
response.body.message
|
|
77
|
+
|| 'An unknown error occurred. Please contact an admin.'
|
|
78
|
+
),
|
|
79
|
+
(
|
|
80
|
+
response.body.code
|
|
81
|
+
|| ReactKitErrorCode.NoCode
|
|
82
|
+
),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Success! Extract the body
|
|
87
|
+
const { body } = response.body;
|
|
88
|
+
|
|
89
|
+
// Return
|
|
90
|
+
return body;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default visitEndpointOnAnotherServer;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Import libs
|
|
2
|
+
import qs from 'qs';
|
|
3
|
+
|
|
4
|
+
// Import shared types
|
|
5
|
+
import ReactKitErrorCode from '../../types/ReactKitErrorCode';
|
|
6
|
+
|
|
7
|
+
// Import custom error
|
|
8
|
+
import ErrorWithCode from '../../errors/ErrorWithCode';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Sends and retries an http request
|
|
12
|
+
* @author Gabriel Abrams
|
|
13
|
+
* @param opts object containing all arguments
|
|
14
|
+
* @param opts.path path to send request to
|
|
15
|
+
* @param [opts.host] host to send request to
|
|
16
|
+
* @param [opts.method=GET] http method to use
|
|
17
|
+
* @param [opts.params] body/data to include in the request
|
|
18
|
+
* @param [opts.headers] headers to include in the request
|
|
19
|
+
* @param [opts.sendCrossDomainCredentials=true if in development mode] if true,
|
|
20
|
+
* send cross-domain credentials even if not in dev mode
|
|
21
|
+
* @param [opts.responseType=JSON] expected response type
|
|
22
|
+
* @returns { body, status, headers } on success
|
|
23
|
+
*/
|
|
24
|
+
const sendServerToServerRequest = async (
|
|
25
|
+
opts: {
|
|
26
|
+
path: string,
|
|
27
|
+
host?: string,
|
|
28
|
+
method?: ('GET' | 'POST' | 'PUT' | 'DELETE'),
|
|
29
|
+
params?: { [k in string]: any },
|
|
30
|
+
headers?: { [k in string]: any },
|
|
31
|
+
responseType?: 'Text' | 'JSON',
|
|
32
|
+
},
|
|
33
|
+
): Promise<{
|
|
34
|
+
body: any,
|
|
35
|
+
status: number,
|
|
36
|
+
headers: { [k in string]: any },
|
|
37
|
+
}> => {
|
|
38
|
+
// Process method
|
|
39
|
+
const method: ('GET' | 'POST' | 'PUT' | 'DELETE') = (opts.method || 'GET');
|
|
40
|
+
|
|
41
|
+
// Encode objects within params
|
|
42
|
+
let params: {
|
|
43
|
+
[k in string]: any
|
|
44
|
+
} | undefined;
|
|
45
|
+
if (opts.params) {
|
|
46
|
+
params = {};
|
|
47
|
+
Object.entries(opts.params).forEach(([key, val]) => {
|
|
48
|
+
if (typeof val === 'object' && !Array.isArray(val)) {
|
|
49
|
+
(params as any)[key] = JSON.stringify(val);
|
|
50
|
+
} else {
|
|
51
|
+
(params as any)[key] = val;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Stringify parameters
|
|
57
|
+
const stringifiedParams = qs.stringify(params || {}, {
|
|
58
|
+
encodeValuesOnly: true,
|
|
59
|
+
arrayFormat: 'brackets',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Create url (include query if GET)
|
|
63
|
+
const query = (method === 'GET' ? `?${stringifiedParams}` : '');
|
|
64
|
+
let url;
|
|
65
|
+
if (!opts.host) {
|
|
66
|
+
// No host included at all. Just send to a path
|
|
67
|
+
url = `${opts.path}${query}`;
|
|
68
|
+
} else {
|
|
69
|
+
url = `https://${opts.host}${opts.path}${query}`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Update headers
|
|
73
|
+
const headers = opts.headers || {};
|
|
74
|
+
let data: string | null | { [k: string]: any } | undefined = null;
|
|
75
|
+
if (!headers['Content-Type']) {
|
|
76
|
+
// Form encoded
|
|
77
|
+
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
78
|
+
// Add data if applicable
|
|
79
|
+
data = (method !== 'GET' ? stringifiedParams : null);
|
|
80
|
+
} else {
|
|
81
|
+
// JSON encode
|
|
82
|
+
data = params;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Encode data
|
|
86
|
+
let encodedData: URLSearchParams | string | undefined;
|
|
87
|
+
if (data) {
|
|
88
|
+
if (headers['Content-Type'] === 'application/x-www-form-urlencoded') {
|
|
89
|
+
encodedData = new URLSearchParams(params);
|
|
90
|
+
} else {
|
|
91
|
+
encodedData = JSON.stringify(data);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Send request
|
|
96
|
+
try {
|
|
97
|
+
const response = await fetch(
|
|
98
|
+
url,
|
|
99
|
+
{
|
|
100
|
+
method,
|
|
101
|
+
mode: 'cors',
|
|
102
|
+
headers: headers ?? {},
|
|
103
|
+
body: (
|
|
104
|
+
(method !== 'GET' && encodedData)
|
|
105
|
+
? encodedData
|
|
106
|
+
: undefined
|
|
107
|
+
),
|
|
108
|
+
redirect: 'follow',
|
|
109
|
+
},
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
// Get headers map
|
|
113
|
+
const responseHeaders: {
|
|
114
|
+
[k in string]: string
|
|
115
|
+
} = {};
|
|
116
|
+
response.headers.forEach((value, key) => {
|
|
117
|
+
responseHeaders[key] = value;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Process response based on responseType
|
|
121
|
+
try {
|
|
122
|
+
// Parse response
|
|
123
|
+
let responseBody: any;
|
|
124
|
+
if (
|
|
125
|
+
opts.responseType
|
|
126
|
+
&& opts.responseType === 'Text'
|
|
127
|
+
) {
|
|
128
|
+
// Response type is text
|
|
129
|
+
responseBody = await response.text();
|
|
130
|
+
} else {
|
|
131
|
+
// Response type is JSON
|
|
132
|
+
responseBody = await response.json();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Return response
|
|
136
|
+
return {
|
|
137
|
+
body: responseBody,
|
|
138
|
+
status: response.status,
|
|
139
|
+
headers: responseHeaders,
|
|
140
|
+
};
|
|
141
|
+
} catch (err) {
|
|
142
|
+
throw new ErrorWithCode(
|
|
143
|
+
`Failed to parse response as ${opts.responseType}: ${(err as any)?.message}`,
|
|
144
|
+
ReactKitErrorCode.ResponseParseError,
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
} catch (err) {
|
|
148
|
+
// Self-signed certificate error:
|
|
149
|
+
if ((err as any)?.message?.includes('self signed certificate')) {
|
|
150
|
+
throw new ErrorWithCode(
|
|
151
|
+
'We refused to send a request because the receiver has self-signed certificates.',
|
|
152
|
+
ReactKitErrorCode.SelfSigned,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// No tries left
|
|
157
|
+
throw new ErrorWithCode(
|
|
158
|
+
`We encountered an error when trying to send a network request. If this issue persists, contact an admin. Error: ${(err as any)?.message}`,
|
|
159
|
+
ReactKitErrorCode.NotConnected,
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export default sendServerToServerRequest;
|
|
@@ -102,6 +102,7 @@ const visitServerEndpoint = async (
|
|
|
102
102
|
params?: { [key in string]: any },
|
|
103
103
|
},
|
|
104
104
|
): Promise<any> => {
|
|
105
|
+
// Set default method
|
|
105
106
|
const method = (opts.method ?? 'GET');
|
|
106
107
|
// Handle stubs
|
|
107
108
|
const stubResponse = stubResponses[method]?.[opts.path];
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Import components
|
|
2
2
|
import AppWrapper, {
|
|
3
3
|
alert,
|
|
4
|
+
prompt,
|
|
4
5
|
confirm,
|
|
5
6
|
showFatalError,
|
|
6
7
|
addFatalErrorHandler,
|
|
@@ -28,6 +29,7 @@ import Tooltip from './components/Tooltip';
|
|
|
28
29
|
import ToggleSwitch from './components/ToggleSwitch';
|
|
29
30
|
import AutoscrollToBottomContainer from './components/AutoscrollToBottomContainer';
|
|
30
31
|
import MultiSwitch from './components/MultiSwitch';
|
|
32
|
+
import Dropdown from './components/Dropdown';
|
|
31
33
|
|
|
32
34
|
// Import errors
|
|
33
35
|
import ErrorWithCode from './errors/ErrorWithCode';
|
|
@@ -92,6 +94,7 @@ import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
|
|
|
92
94
|
import someAsync from './helpers/asyncArrayFunctions/someAsync';
|
|
93
95
|
import capitalize from './helpers/capitalize';
|
|
94
96
|
import shuffleArray from './helpers/shuffleArray';
|
|
97
|
+
import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
|
|
95
98
|
|
|
96
99
|
// Import types
|
|
97
100
|
import ModalButtonType from './types/ModalButtonType';
|
|
@@ -109,6 +112,7 @@ import LogBuiltInMetadata from './types/LogBuiltInMetadata';
|
|
|
109
112
|
import LogMetadataType from './types/LogMetadataType';
|
|
110
113
|
import LogFunction from './types/LogFunction';
|
|
111
114
|
import IntelliTableColumn from './types/IntelliTableColumn';
|
|
115
|
+
import DropdownItemType from './types/DropdownItemType';
|
|
112
116
|
|
|
113
117
|
// Component-specific-types
|
|
114
118
|
import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
@@ -142,8 +146,10 @@ export {
|
|
|
142
146
|
ToggleSwitch,
|
|
143
147
|
AutoscrollToBottomContainer,
|
|
144
148
|
MultiSwitch,
|
|
149
|
+
Dropdown,
|
|
145
150
|
// Global functions
|
|
146
151
|
alert,
|
|
152
|
+
prompt,
|
|
147
153
|
confirm,
|
|
148
154
|
showFatalError,
|
|
149
155
|
// Errors
|
|
@@ -211,6 +217,7 @@ export {
|
|
|
211
217
|
handleSuccess,
|
|
212
218
|
initLogCollection,
|
|
213
219
|
addDBEditorEndpoints,
|
|
220
|
+
visitEndpointOnAnotherServer,
|
|
214
221
|
// Types
|
|
215
222
|
ModalButtonType,
|
|
216
223
|
ModalSize,
|
|
@@ -226,6 +233,7 @@ export {
|
|
|
226
233
|
LogMetadataType,
|
|
227
234
|
LogFunction,
|
|
228
235
|
IntelliTableColumn,
|
|
236
|
+
DropdownItemType,
|
|
229
237
|
// Component-specific-types
|
|
230
238
|
PickableItem,
|
|
231
239
|
DBEntry,
|
package/src/server/initServer.ts
CHANGED
|
@@ -246,12 +246,14 @@ const initServer = (
|
|
|
246
246
|
paramTypes: {
|
|
247
247
|
year: ParamType.Int,
|
|
248
248
|
month: ParamType.Int,
|
|
249
|
+
pageNumber: ParamType.Int,
|
|
249
250
|
},
|
|
250
251
|
handler: async ({ params }) => {
|
|
251
252
|
// Get user info
|
|
252
253
|
const {
|
|
253
254
|
year,
|
|
254
255
|
month,
|
|
256
|
+
pageNumber,
|
|
255
257
|
userId,
|
|
256
258
|
isAdmin,
|
|
257
259
|
} = params;
|
|
@@ -266,13 +268,17 @@ const initServer = (
|
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
// Query for logs
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
const response = await _logCollection.findPaged({
|
|
272
|
+
query: {
|
|
273
|
+
year,
|
|
274
|
+
month,
|
|
275
|
+
},
|
|
276
|
+
perPage: 1000,
|
|
277
|
+
pageNumber,
|
|
272
278
|
});
|
|
273
279
|
|
|
274
|
-
// Return
|
|
275
|
-
return
|
|
280
|
+
// Return response
|
|
281
|
+
return response;
|
|
276
282
|
},
|
|
277
283
|
}),
|
|
278
284
|
);
|
package/src/types/ModalType.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Highest error code =
|
|
1
|
+
// Highest error code = DRK18
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* List of error codes built into the react kit
|
|
@@ -10,6 +10,8 @@ enum ReactKitErrorCode {
|
|
|
10
10
|
SessionExpired = 'DRK3',
|
|
11
11
|
MissingParameter = 'DRK4',
|
|
12
12
|
InvalidParameter = 'DRK5',
|
|
13
|
+
HostNotAllowed = 'DRK17',
|
|
14
|
+
HostBanned = 'DRK18',
|
|
13
15
|
WrongCourse = 'DRK6',
|
|
14
16
|
NoCACCLSendRequestFunction = 'DRK7',
|
|
15
17
|
NoCACCLGetLaunchInfoFunction = 'DRK8',
|
|
@@ -18,6 +20,11 @@ enum ReactKitErrorCode {
|
|
|
18
20
|
NotAllowedToReviewLogs = 'DRK11',
|
|
19
21
|
ThemeCheckedBeforeReactKitReady = 'DRK12',
|
|
20
22
|
SessionExpiredMessageGottenBeforeReactKitReady = 'DRK13',
|
|
23
|
+
|
|
24
|
+
// Server-to-server requests
|
|
25
|
+
NotConnected = 'DRK14',
|
|
26
|
+
SelfSigned = 'DRK15',
|
|
27
|
+
ResponseParseError = 'DRK16',
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
export default ReactKitErrorCode;
|