dce-reactkit 3.12.3 → 4.0.0-beta.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/.vscode/settings.json +1 -3
- package/README.md +20 -0
- package/dist/cjs/index.js +156 -1792
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ItemPicker/index.d.ts +0 -1
- package/dist/cjs/types/components/Modal/ModalProps.d.ts +0 -2
- package/dist/cjs/types/components/TabBox.d.ts +0 -1
- package/dist/cjs/types/index.d.ts +8 -12
- 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 +157 -1785
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ItemPicker/index.d.ts +0 -1
- package/dist/esm/types/components/Modal/ModalProps.d.ts +0 -2
- package/dist/esm/types/components/TabBox.d.ts +0 -1
- package/dist/esm/types/index.d.ts +8 -12
- 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 +122 -351
- package/genEncodedSecret.ts +84 -0
- package/package.json +7 -5
- package/rollup.config.js +2 -0
- package/src/components/AppWrapper.tsx +3 -1
- package/src/components/CheckboxButton.tsx +1 -1
- package/src/components/Dropdown.tsx +1 -1
- package/src/components/IntelliTable.tsx +1 -1
- package/src/components/ItemPicker/NestableItemList.tsx +0 -1
- package/src/components/ItemPicker/index.tsx +0 -96
- package/src/components/Modal/ModalProps.ts +0 -4
- package/src/components/Modal/index.tsx +21 -60
- package/src/components/RadioButton.tsx +3 -1
- package/src/components/TabBox.tsx +9 -27
- 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 +12 -22
- package/src/types/ParamType.ts +10 -10
- package/src/types/ReactKitErrorCode.tsx +1 -17
- 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/getWordCount.d.ts +0 -10
- 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/helpers/addDBEditorEndpoints.d.ts +0 -41
- package/dist/esm/types/helpers/genRouteHandler.d.ts +0 -76
- package/dist/esm/types/helpers/getWordCount.d.ts +0 -10
- 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/getWordCount.ts +0 -26
- 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,10 +32,12 @@ import ErrorWithCode from '../errors/ErrorWithCode';
|
|
|
32
32
|
// TODO: fix dependency cycle
|
|
33
33
|
// eslint-disable-next-line import/no-cycle
|
|
34
34
|
import logClientEvent from '../helpers/logClientEvent';
|
|
35
|
+
// TODO: fix dependency cycle
|
|
36
|
+
// eslint-disable-next-line import/no-cycle
|
|
35
37
|
import {
|
|
36
38
|
getSessionExpiredMessage,
|
|
37
39
|
isDarkModeOn,
|
|
38
|
-
} from '../
|
|
40
|
+
} from '../helpers/initClient';
|
|
39
41
|
import waitMs from '../helpers/waitMs';
|
|
40
42
|
|
|
41
43
|
// Import constants
|
|
@@ -15,7 +15,7 @@ import { faSquare, faSquareMinus } from '@fortawesome/free-regular-svg-icons';
|
|
|
15
15
|
import Variant from '../types/Variant';
|
|
16
16
|
|
|
17
17
|
// Import shared helpers
|
|
18
|
-
import { isDarkModeOn } from '../
|
|
18
|
+
import { isDarkModeOn } from '../helpers/initClient';
|
|
19
19
|
|
|
20
20
|
/*------------------------------------------------------------------------*/
|
|
21
21
|
/* -------------------------------- Types ------------------------------- */
|
|
@@ -16,7 +16,7 @@ import Variant from '../types/Variant';
|
|
|
16
16
|
import DropdownItemType from '../types/DropdownItemType';
|
|
17
17
|
|
|
18
18
|
// Check dark mode
|
|
19
|
-
import { isDarkModeOn } from '../
|
|
19
|
+
import { isDarkModeOn } from '../helpers/initClient';
|
|
20
20
|
|
|
21
21
|
/*------------------------------------------------------------------------*/
|
|
22
22
|
/* -------------------------------- Types ------------------------------- */
|
|
@@ -315,7 +315,7 @@ const IntelliTable: React.FC<Props> = (props) => {
|
|
|
315
315
|
checked={columnVisibilityMap[column.param]}
|
|
316
316
|
ariaLabel={`show "${column.title}" column in the ${title} table`}
|
|
317
317
|
checkedVariant={Variant.Light}
|
|
318
|
-
uncheckedVariant={Variant.
|
|
318
|
+
uncheckedVariant={Variant.Secondary}
|
|
319
319
|
/>
|
|
320
320
|
);
|
|
321
321
|
})
|
|
@@ -33,8 +33,6 @@ type Props = {
|
|
|
33
33
|
onChanged: (updatedItems: PickableItem[]) => void,
|
|
34
34
|
// If true, don't add margin to bottom of item picker
|
|
35
35
|
noBottomMargin?: boolean,
|
|
36
|
-
// If true, hide select all or none buttons
|
|
37
|
-
hideSelectAllOrNoneButtons?: boolean,
|
|
38
36
|
};
|
|
39
37
|
|
|
40
38
|
/*------------------------------------------------------------------------*/
|
|
@@ -54,61 +52,12 @@ const ItemPicker: React.FC<Props> = (props) => {
|
|
|
54
52
|
items,
|
|
55
53
|
onChanged,
|
|
56
54
|
noBottomMargin,
|
|
57
|
-
hideSelectAllOrNoneButtons,
|
|
58
55
|
} = props;
|
|
59
56
|
|
|
60
57
|
/*------------------------------------------------------------------------*/
|
|
61
58
|
/* ------------------------- Component Functions ------------------------ */
|
|
62
59
|
/*------------------------------------------------------------------------*/
|
|
63
60
|
|
|
64
|
-
/**
|
|
65
|
-
* Updates the checked state of an item (including all children)
|
|
66
|
-
* @author Yuen Ler Chow
|
|
67
|
-
* @param item the item to update
|
|
68
|
-
* @param checked the new checked state
|
|
69
|
-
* @returns the updated item
|
|
70
|
-
*/
|
|
71
|
-
const updateItemChecked = (
|
|
72
|
-
item: PickableItem,
|
|
73
|
-
checked: boolean,
|
|
74
|
-
): PickableItem => {
|
|
75
|
-
if (item.isGroup) {
|
|
76
|
-
return {
|
|
77
|
-
...item,
|
|
78
|
-
children: item.children.map((child) => {
|
|
79
|
-
return updateItemChecked(child, checked);
|
|
80
|
-
}),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
return { ...item, checked };
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Selects all items in the list
|
|
88
|
-
* @author Yuen Ler Chow
|
|
89
|
-
*/
|
|
90
|
-
const handleSelectAll = () => {
|
|
91
|
-
const updatedItems = items.map(
|
|
92
|
-
(item) => {
|
|
93
|
-
return updateItemChecked(item, true);
|
|
94
|
-
},
|
|
95
|
-
);
|
|
96
|
-
onChanged(updatedItems);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Deselects all items in the list
|
|
101
|
-
* @author Yuen Ler Chow
|
|
102
|
-
*/
|
|
103
|
-
const handleDeselectAll = () => {
|
|
104
|
-
const updatedItems = items.map(
|
|
105
|
-
(item) => {
|
|
106
|
-
return updateItemChecked(item, false);
|
|
107
|
-
},
|
|
108
|
-
);
|
|
109
|
-
onChanged(updatedItems);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
61
|
/*------------------------------------------------------------------------*/
|
|
113
62
|
/* ------------------------------- Render ------------------------------- */
|
|
114
63
|
/*------------------------------------------------------------------------*/
|
|
@@ -117,55 +66,10 @@ const ItemPicker: React.FC<Props> = (props) => {
|
|
|
117
66
|
/* --------------- Main UI -------------- */
|
|
118
67
|
/*----------------------------------------*/
|
|
119
68
|
|
|
120
|
-
// Select all/none
|
|
121
|
-
const selectAllOrNone = (
|
|
122
|
-
!hideSelectAllOrNoneButtons
|
|
123
|
-
? (
|
|
124
|
-
<div
|
|
125
|
-
className="d-flex h-100 align-items-end flex-row"
|
|
126
|
-
>
|
|
127
|
-
<div className="d-flex justify-content-end">
|
|
128
|
-
{/* Label */}
|
|
129
|
-
<div
|
|
130
|
-
className="me-2"
|
|
131
|
-
style={{ fontSize: '1.2rem' }}
|
|
132
|
-
>
|
|
133
|
-
Select
|
|
134
|
-
</div>
|
|
135
|
-
{/* Buttons */}
|
|
136
|
-
<div className="btn-group" role="group">
|
|
137
|
-
{/* All */}
|
|
138
|
-
<button
|
|
139
|
-
type="button"
|
|
140
|
-
style={{ borderRight: '0.1rem solid white' }}
|
|
141
|
-
aria-label="Select all contexts"
|
|
142
|
-
className="btn btn-secondary py-0"
|
|
143
|
-
onClick={handleSelectAll}
|
|
144
|
-
>
|
|
145
|
-
All
|
|
146
|
-
</button>
|
|
147
|
-
{/* None */}
|
|
148
|
-
<button
|
|
149
|
-
type="button"
|
|
150
|
-
aria-label="Deselect all contexts"
|
|
151
|
-
className="btn btn-secondary py-0"
|
|
152
|
-
onClick={handleDeselectAll}
|
|
153
|
-
>
|
|
154
|
-
None
|
|
155
|
-
</button>
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
158
|
-
</div>
|
|
159
|
-
)
|
|
160
|
-
: undefined
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
// Main UI
|
|
164
69
|
return (
|
|
165
70
|
<TabBox
|
|
166
71
|
title={title}
|
|
167
72
|
noBottomMargin={noBottomMargin}
|
|
168
|
-
topRightChildren={selectAllOrNone}
|
|
169
73
|
>
|
|
170
74
|
<div style={{ overflowX: 'auto' }}>
|
|
171
75
|
<NestableItemList
|
|
@@ -69,10 +69,6 @@ type ModalProps = {
|
|
|
69
69
|
confirmVariant?: Variant,
|
|
70
70
|
// True if modal should be on top of other modals
|
|
71
71
|
onTopOfOtherModals?: boolean,
|
|
72
|
-
// If true, the modal is loading
|
|
73
|
-
isLoading?: boolean,
|
|
74
|
-
// If true, the loading is cancelable
|
|
75
|
-
isLoadingCancelable?: boolean,
|
|
76
72
|
};
|
|
77
73
|
|
|
78
74
|
export default ModalProps;
|
|
@@ -14,9 +14,6 @@ import React, { useState, useEffect, useRef } from 'react';
|
|
|
14
14
|
import ReactDOM from 'react-dom';
|
|
15
15
|
|
|
16
16
|
// Import other components
|
|
17
|
-
import LoadingSpinner from '../LoadingSpinner';
|
|
18
|
-
|
|
19
|
-
// Import helpers
|
|
20
17
|
import waitMs from '../../helpers/waitMs';
|
|
21
18
|
|
|
22
19
|
// Import types
|
|
@@ -32,7 +29,7 @@ import NUM_MODAL_PORTALS from '../../constants/NUM_MODAL_PORTALS';
|
|
|
32
29
|
// Import shared helpers
|
|
33
30
|
// TODO: fix dependency cycle
|
|
34
31
|
// eslint-disable-next-line import/no-cycle
|
|
35
|
-
import { isDarkModeOn } from '../../
|
|
32
|
+
import { isDarkModeOn } from '../../helpers/initClient';
|
|
36
33
|
|
|
37
34
|
/*------------------------------------------------------------------------*/
|
|
38
35
|
/* ------------------------------ Constants ----------------------------- */
|
|
@@ -44,7 +41,6 @@ const BASE_Z_INDEX_ON_TOP = 2000000000;
|
|
|
44
41
|
|
|
45
42
|
// Constants
|
|
46
43
|
const MS_TO_ANIMATE = 200; // Animation duration
|
|
47
|
-
const MS_TO_WAIT_BEFORE_SHOWING_LOADING_INDICATOR = 1000;
|
|
48
44
|
|
|
49
45
|
// Modal type to list of buttons
|
|
50
46
|
const modalTypeToModalButtonTypes: {
|
|
@@ -260,8 +256,6 @@ const Modal: React.FC<ModalProps> = (props) => {
|
|
|
260
256
|
dontAllowBackdropExit,
|
|
261
257
|
dontShowXButton,
|
|
262
258
|
onTopOfOtherModals,
|
|
263
|
-
isLoading,
|
|
264
|
-
isLoadingCancelable,
|
|
265
259
|
} = props;
|
|
266
260
|
|
|
267
261
|
// Determine if no header either
|
|
@@ -272,7 +266,6 @@ const Modal: React.FC<ModalProps> = (props) => {
|
|
|
272
266
|
// True if animation is in use
|
|
273
267
|
const [animatingIn, setAnimatingIn] = useState(true);
|
|
274
268
|
const [animatingPop, setAnimatingPop] = useState(false);
|
|
275
|
-
const [showModal, setShowModal] = useState(false);
|
|
276
269
|
|
|
277
270
|
/* -------------- Refs -------------- */
|
|
278
271
|
|
|
@@ -305,15 +298,6 @@ const Modal: React.FC<ModalProps> = (props) => {
|
|
|
305
298
|
if (mounted.current) {
|
|
306
299
|
setAnimatingIn(false);
|
|
307
300
|
}
|
|
308
|
-
if (isLoading) {
|
|
309
|
-
// wait before showing modal
|
|
310
|
-
await waitMs(MS_TO_WAIT_BEFORE_SHOWING_LOADING_INDICATOR);
|
|
311
|
-
if (mounted.current) {
|
|
312
|
-
setShowModal(true);
|
|
313
|
-
}
|
|
314
|
-
} else {
|
|
315
|
-
setShowModal(true);
|
|
316
|
-
}
|
|
317
301
|
})();
|
|
318
302
|
|
|
319
303
|
return () => {
|
|
@@ -416,17 +400,6 @@ const Modal: React.FC<ModalProps> = (props) => {
|
|
|
416
400
|
animationClass = 'Modal-animating-pop';
|
|
417
401
|
}
|
|
418
402
|
|
|
419
|
-
// default to show close button when not loading and not show close button when loading
|
|
420
|
-
// unless downShowXButton or isLoadingCancelable
|
|
421
|
-
const showCloseButton = (
|
|
422
|
-
// The modal must have an onClose function
|
|
423
|
-
onClose
|
|
424
|
-
// ...and the close button is allowed to be visible
|
|
425
|
-
&& !dontShowXButton
|
|
426
|
-
// ...and should not be shown if the modal is loading and not cancelable
|
|
427
|
-
&& !(isLoading && !isLoadingCancelable)
|
|
428
|
-
);
|
|
429
|
-
|
|
430
403
|
// Render the modal
|
|
431
404
|
const contentToRender = (
|
|
432
405
|
<div
|
|
@@ -463,8 +436,6 @@ const Modal: React.FC<ModalProps> = (props) => {
|
|
|
463
436
|
handleClose(ModalButtonType.Cancel);
|
|
464
437
|
}}
|
|
465
438
|
/>
|
|
466
|
-
|
|
467
|
-
{showModal && (
|
|
468
439
|
<div
|
|
469
440
|
className={`modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`}
|
|
470
441
|
style={{
|
|
@@ -527,7 +498,7 @@ const Modal: React.FC<ModalProps> = (props) => {
|
|
|
527
498
|
{title}
|
|
528
499
|
</h5>
|
|
529
500
|
|
|
530
|
-
{
|
|
501
|
+
{(onClose && !dontShowXButton) && (
|
|
531
502
|
<button
|
|
532
503
|
type="button"
|
|
533
504
|
className="Modal-x-button btn-close"
|
|
@@ -547,34 +518,25 @@ const Modal: React.FC<ModalProps> = (props) => {
|
|
|
547
518
|
)}
|
|
548
519
|
</div>
|
|
549
520
|
)}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
<>
|
|
570
|
-
<LoadingSpinner />
|
|
571
|
-
<span className="sr-only">Content loading</span>
|
|
572
|
-
</>
|
|
573
|
-
)
|
|
574
|
-
: children
|
|
575
|
-
}
|
|
576
|
-
</div>
|
|
577
|
-
|
|
521
|
+
{children && (
|
|
522
|
+
<div
|
|
523
|
+
className="modal-body"
|
|
524
|
+
style={{
|
|
525
|
+
color: (
|
|
526
|
+
isDarkModeOn()
|
|
527
|
+
? 'white'
|
|
528
|
+
: undefined
|
|
529
|
+
),
|
|
530
|
+
backgroundColor: (
|
|
531
|
+
isDarkModeOn()
|
|
532
|
+
? '#444'
|
|
533
|
+
: undefined
|
|
534
|
+
),
|
|
535
|
+
}}
|
|
536
|
+
>
|
|
537
|
+
{children}
|
|
538
|
+
</div>
|
|
539
|
+
)}
|
|
578
540
|
{footer && (
|
|
579
541
|
<div
|
|
580
542
|
className="modal-footer pt-1 pb-1"
|
|
@@ -601,7 +563,6 @@ const Modal: React.FC<ModalProps> = (props) => {
|
|
|
601
563
|
)}
|
|
602
564
|
</div>
|
|
603
565
|
</div>
|
|
604
|
-
)}
|
|
605
566
|
</div>
|
|
606
567
|
);
|
|
607
568
|
|
|
@@ -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 ------------------------------- */
|
|
@@ -15,8 +15,6 @@ type Props = {
|
|
|
15
15
|
title: React.ReactNode,
|
|
16
16
|
// Children/contents inside the box
|
|
17
17
|
children: React.ReactNode,
|
|
18
|
-
// Children to display on the top right of the tab box
|
|
19
|
-
topRightChildren?: React.ReactNode,
|
|
20
18
|
// If true, don't add margin below the tab box
|
|
21
19
|
noBottomMargin?: boolean,
|
|
22
20
|
// If true, don't add padding to bottom of tab box
|
|
@@ -51,9 +49,7 @@ const style = `
|
|
|
51
49
|
|
|
52
50
|
/* Container for Title */
|
|
53
51
|
.TabBox-title-container {
|
|
54
|
-
|
|
55
|
-
justify-content: space-between;
|
|
56
|
-
align-items: center;
|
|
52
|
+
/* Place on Left */
|
|
57
53
|
position: relative;
|
|
58
54
|
left: 0;
|
|
59
55
|
text-align: left;
|
|
@@ -86,19 +82,6 @@ const style = `
|
|
|
86
82
|
background: #fdfdfd;
|
|
87
83
|
}
|
|
88
84
|
|
|
89
|
-
.TabBox-title-right-container {
|
|
90
|
-
display: flex;
|
|
91
|
-
flex-direction: row;
|
|
92
|
-
align-items: bottom;
|
|
93
|
-
height: 2.4rem;
|
|
94
|
-
overflow: visible;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.TabBox-title-right-contents {
|
|
98
|
-
margin-right: 0.5rem;
|
|
99
|
-
margin-bottom: 0.2rem;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
85
|
/* Make the TabBox's Children Appear Above Title if Overlap Occurs */
|
|
103
86
|
.TabBox-children {
|
|
104
87
|
position: relative;
|
|
@@ -115,10 +98,11 @@ const TabBox: React.FC<Props> = (props) => {
|
|
|
115
98
|
/* -------------------------------- Setup ------------------------------- */
|
|
116
99
|
/*------------------------------------------------------------------------*/
|
|
117
100
|
|
|
101
|
+
/* -------------- Props ------------- */
|
|
102
|
+
|
|
118
103
|
const {
|
|
119
104
|
title,
|
|
120
105
|
children,
|
|
121
|
-
topRightChildren,
|
|
122
106
|
noBottomPadding,
|
|
123
107
|
noBottomMargin,
|
|
124
108
|
} = props;
|
|
@@ -127,23 +111,21 @@ const TabBox: React.FC<Props> = (props) => {
|
|
|
127
111
|
/* ------------------------------- Render ------------------------------- */
|
|
128
112
|
/*------------------------------------------------------------------------*/
|
|
129
113
|
|
|
114
|
+
/*----------------------------------------*/
|
|
115
|
+
/* --------------- Main UI -------------- */
|
|
116
|
+
/*----------------------------------------*/
|
|
117
|
+
|
|
118
|
+
// Full UI
|
|
130
119
|
return (
|
|
131
120
|
<div className={`TabBox-container ${noBottomMargin ? '' : 'mb-2'}`}>
|
|
132
121
|
{/* Style */}
|
|
133
122
|
<style>{style}</style>
|
|
134
123
|
|
|
135
|
-
{/* Title
|
|
124
|
+
{/* Title */}
|
|
136
125
|
<div className="TabBox-title-container">
|
|
137
126
|
<div className="TabBox-title">
|
|
138
127
|
{title}
|
|
139
128
|
</div>
|
|
140
|
-
{topRightChildren && (
|
|
141
|
-
<div className="TabBox-title-right-container">
|
|
142
|
-
<div className="TabBox-title-right-contents">
|
|
143
|
-
{topRightChildren}
|
|
144
|
-
</div>
|
|
145
|
-
</div>
|
|
146
|
-
)}
|
|
147
129
|
</div>
|
|
148
130
|
|
|
149
131
|
{/* Contents */}
|
|
@@ -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
|
@@ -43,7 +43,7 @@ import DAY_IN_MS from './constants/DAY_IN_MS';
|
|
|
43
43
|
import DynamicWord from './dynamicConstants/DynamicWord';
|
|
44
44
|
|
|
45
45
|
// Import helpers
|
|
46
|
-
import initClient from './
|
|
46
|
+
import initClient from './helpers/initClient';
|
|
47
47
|
import abbreviate from './helpers/abbreviate';
|
|
48
48
|
import avg from './helpers/avg';
|
|
49
49
|
import ceilToNumDecimals from './helpers/ceilToNumDecimals';
|
|
@@ -55,10 +55,6 @@ import roundToNumDecimals from './helpers/roundToNumDecimals';
|
|
|
55
55
|
import sum from './helpers/sum';
|
|
56
56
|
import waitMs from './helpers/waitMs';
|
|
57
57
|
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
58
|
import getOrdinal from './helpers/getOrdinal';
|
|
63
59
|
import getTimeInfoInET from './helpers/getTimeInfoInET';
|
|
64
60
|
import stubServerEndpoint from './helpers/stubServerEndpoint';
|
|
@@ -69,7 +65,6 @@ import stringsToHumanReadableList from './helpers/stringsToHumanReadableList';
|
|
|
69
65
|
import onlyKeepLetters from './helpers/onlyKeepLetters';
|
|
70
66
|
import parallelLimit from './helpers/parallelLimit';
|
|
71
67
|
import logClientEvent, { setClientEventMetadataPopulator } from './helpers/logClientEvent';
|
|
72
|
-
import initLogCollection from './server/initLogCollection';
|
|
73
68
|
import getMonthName from './helpers/getMonthName';
|
|
74
69
|
import genCSV from './helpers/genCSV';
|
|
75
70
|
import canReviewLogs from './helpers/canReviewLogs';
|
|
@@ -77,7 +72,6 @@ import isMobileOrTablet from './helpers/isMobileOrTablet';
|
|
|
77
72
|
import extractProp from './helpers/extractProp';
|
|
78
73
|
import compareArraysByProp from './helpers/compareArraysByProp';
|
|
79
74
|
import getLocalTimeInfo from './helpers/getLocalTimeInfo';
|
|
80
|
-
import addDBEditorEndpoints from './helpers/addDBEditorEndpoints';
|
|
81
75
|
import genCommaList from './helpers/genCommaList';
|
|
82
76
|
import validateEmail from './helpers/validators/validateEmail';
|
|
83
77
|
import validatePhoneNumber from './helpers/validators/validatePhoneNumber';
|
|
@@ -94,16 +88,13 @@ import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
|
|
|
94
88
|
import someAsync from './helpers/asyncArrayFunctions/someAsync';
|
|
95
89
|
import capitalize from './helpers/capitalize';
|
|
96
90
|
import shuffleArray from './helpers/shuffleArray';
|
|
97
|
-
import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
|
|
98
|
-
import getWordCount from './helpers/getWordCount';
|
|
99
91
|
|
|
100
92
|
// Import types
|
|
93
|
+
import ParamType from './types/ParamType';
|
|
101
94
|
import ModalButtonType from './types/ModalButtonType';
|
|
102
95
|
import ModalSize from './types/ModalSize';
|
|
103
96
|
import ModalType from './types/ModalType';
|
|
104
|
-
import ReactKitErrorCode from './types/ReactKitErrorCode';
|
|
105
97
|
import Variant from './types/Variant';
|
|
106
|
-
import ParamType from './types/ParamType';
|
|
107
98
|
import DayOfWeek from './types/DayOfWeek';
|
|
108
99
|
import Log from './types/Log';
|
|
109
100
|
import LogType from './types/LogType';
|
|
@@ -112,8 +103,13 @@ import LogAction from './types/LogAction';
|
|
|
112
103
|
import LogBuiltInMetadata from './types/LogBuiltInMetadata';
|
|
113
104
|
import LogMetadataType from './types/LogMetadataType';
|
|
114
105
|
import LogFunction from './types/LogFunction';
|
|
106
|
+
import LogTypeSpecificInfo from './types/Log/LogTypeSpecificInfo';
|
|
107
|
+
import LogMainInfo from './types/Log/LogMainInfo';
|
|
108
|
+
import LogSourceSpecificInfo from './types/Log/LogSourceSpecificInfo';
|
|
109
|
+
import LogLevel from './types/LogLevel';
|
|
115
110
|
import IntelliTableColumn from './types/IntelliTableColumn';
|
|
116
111
|
import DropdownItemType from './types/DropdownItemType';
|
|
112
|
+
import ReactKitErrorCode from './types/ReactKitErrorCode';
|
|
117
113
|
|
|
118
114
|
// Component-specific-types
|
|
119
115
|
import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
@@ -202,7 +198,6 @@ export {
|
|
|
202
198
|
someAsync,
|
|
203
199
|
capitalize,
|
|
204
200
|
shuffleArray,
|
|
205
|
-
getWordCount,
|
|
206
201
|
// Client helpers
|
|
207
202
|
initClient,
|
|
208
203
|
visitServerEndpoint,
|
|
@@ -212,15 +207,8 @@ export {
|
|
|
212
207
|
combineClassNames,
|
|
213
208
|
useForceRender,
|
|
214
209
|
setClientEventMetadataPopulator,
|
|
215
|
-
// Server helpers
|
|
216
|
-
initServer,
|
|
217
|
-
genRouteHandler,
|
|
218
|
-
handleError,
|
|
219
|
-
handleSuccess,
|
|
220
|
-
initLogCollection,
|
|
221
|
-
addDBEditorEndpoints,
|
|
222
|
-
visitEndpointOnAnotherServer,
|
|
223
210
|
// Types
|
|
211
|
+
ParamType,
|
|
224
212
|
ModalButtonType,
|
|
225
213
|
ModalSize,
|
|
226
214
|
ModalType,
|
|
@@ -234,6 +222,10 @@ export {
|
|
|
234
222
|
LogBuiltInMetadata,
|
|
235
223
|
LogMetadataType,
|
|
236
224
|
LogFunction,
|
|
225
|
+
LogTypeSpecificInfo,
|
|
226
|
+
LogMainInfo,
|
|
227
|
+
LogSourceSpecificInfo,
|
|
228
|
+
LogLevel,
|
|
237
229
|
IntelliTableColumn,
|
|
238
230
|
DropdownItemType,
|
|
239
231
|
// Component-specific-types
|
|
@@ -241,6 +233,4 @@ export {
|
|
|
241
233
|
DBEntry,
|
|
242
234
|
DBEntryField,
|
|
243
235
|
DBEntryFieldType,
|
|
244
|
-
// Server types
|
|
245
|
-
ParamType,
|
|
246
236
|
};
|
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;
|