dce-reactkit 3.9.4-beta-logreviewer.1 → 3.9.4-beta-prompt.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/dist/cjs/index.js +120 -29
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/AppWrapper.d.ts +24 -0
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/cjs/types/types/ModalType.d.ts +1 -0
- package/dist/esm/index.js +120 -30
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/AppWrapper.d.ts +24 -0
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/types/types/ModalType.d.ts +1 -0
- package/dist/index.d.ts +26 -1
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +216 -0
- package/src/components/LogReviewer.tsx +4 -17
- package/src/components/Modal/index.tsx +3 -0
- package/src/index.ts +2 -0
- package/src/server/initServer.ts +5 -11
- package/src/types/ModalType.tsx +1 -0
|
@@ -44,6 +44,30 @@ export declare const confirm: (title: string, text: string, opts?: {
|
|
|
44
44
|
cancelButtonText?: string;
|
|
45
45
|
cancelButtonVariant?: Variant;
|
|
46
46
|
}) => Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Show a prompt modal asking the user for input
|
|
49
|
+
* @author Yuen Ler Chow
|
|
50
|
+
* @param title the title text to display at the top of the prompt
|
|
51
|
+
* @param text the text to display in the prompt
|
|
52
|
+
* @param [opts={}] additional options for the prompt dialog
|
|
53
|
+
* @param [opts.placeholder] the placeholder text for the input field
|
|
54
|
+
* @param [opts.defaultText] the default text for the input field
|
|
55
|
+
* @param [opts.confirmButtonText=Okay] the text of the confirm button
|
|
56
|
+
* @param [opts.confirmButtonVariant=Variant.Dark] the variant of the confirm button
|
|
57
|
+
* @param [opts.cancelButtonText=Cancel] the text of the cancel button
|
|
58
|
+
* @param [opts.cancelButtonVariant=Variant.Secondary] the variant of the cancel button
|
|
59
|
+
* @returns Promise that resolves with the input string or null if canceled
|
|
60
|
+
*/
|
|
61
|
+
export declare const prompt: (title: string, text: string, opts?: {
|
|
62
|
+
defaultText?: string | undefined;
|
|
63
|
+
placeholder?: string | undefined;
|
|
64
|
+
confirmButtonText?: string | undefined;
|
|
65
|
+
confirmButtonVariant?: Variant | undefined;
|
|
66
|
+
cancelButtonText?: string | undefined;
|
|
67
|
+
cancelButtonVariant?: Variant | undefined;
|
|
68
|
+
minNumChars?: number | undefined;
|
|
69
|
+
findValidationError?: ((text: string) => string | undefined) | undefined;
|
|
70
|
+
} | undefined) => Promise<string | null>;
|
|
47
71
|
/**
|
|
48
72
|
* Show a fatal error message
|
|
49
73
|
* @author Gabe Abrams
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AppWrapper, { alert, confirm, showFatalError, addFatalErrorHandler, leaveToURL } from './components/AppWrapper';
|
|
1
|
+
import AppWrapper, { alert, prompt, confirm, showFatalError, addFatalErrorHandler, leaveToURL } from './components/AppWrapper';
|
|
2
2
|
import LoadingSpinner from './components/LoadingSpinner';
|
|
3
3
|
import ErrorBox from './components/ErrorBox';
|
|
4
4
|
import Modal from './components/Modal';
|
|
@@ -99,4 +99,4 @@ import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
|
99
99
|
import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
|
|
100
100
|
import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
|
|
101
101
|
import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
|
|
102
|
-
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, visitEndpointOnAnotherServer, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
|
|
102
|
+
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, visitEndpointOnAnotherServer, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
|
package/dist/index.d.ts
CHANGED
|
@@ -63,6 +63,30 @@ declare const confirm: (title: string, text: string, opts?: {
|
|
|
63
63
|
cancelButtonText?: string;
|
|
64
64
|
cancelButtonVariant?: Variant;
|
|
65
65
|
}) => Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Show a prompt modal asking the user for input
|
|
68
|
+
* @author Yuen Ler Chow
|
|
69
|
+
* @param title the title text to display at the top of the prompt
|
|
70
|
+
* @param text the text to display in the prompt
|
|
71
|
+
* @param [opts={}] additional options for the prompt dialog
|
|
72
|
+
* @param [opts.placeholder] the placeholder text for the input field
|
|
73
|
+
* @param [opts.defaultText] the default text for the input field
|
|
74
|
+
* @param [opts.confirmButtonText=Okay] the text of the confirm button
|
|
75
|
+
* @param [opts.confirmButtonVariant=Variant.Dark] the variant of the confirm button
|
|
76
|
+
* @param [opts.cancelButtonText=Cancel] the text of the cancel button
|
|
77
|
+
* @param [opts.cancelButtonVariant=Variant.Secondary] the variant of the cancel button
|
|
78
|
+
* @returns Promise that resolves with the input string or null if canceled
|
|
79
|
+
*/
|
|
80
|
+
declare const prompt: (title: string, text: string, opts?: {
|
|
81
|
+
defaultText?: string | undefined;
|
|
82
|
+
placeholder?: string | undefined;
|
|
83
|
+
confirmButtonText?: string | undefined;
|
|
84
|
+
confirmButtonVariant?: Variant | undefined;
|
|
85
|
+
cancelButtonText?: string | undefined;
|
|
86
|
+
cancelButtonVariant?: Variant | undefined;
|
|
87
|
+
minNumChars?: number | undefined;
|
|
88
|
+
findValidationError?: ((text: string) => string | undefined) | undefined;
|
|
89
|
+
} | undefined) => Promise<string | null>;
|
|
66
90
|
/**
|
|
67
91
|
* Show a fatal error message
|
|
68
92
|
* @author Gabe Abrams
|
|
@@ -131,6 +155,7 @@ declare enum ModalSize {
|
|
|
131
155
|
*/
|
|
132
156
|
declare enum ModalType {
|
|
133
157
|
Okay = "okay",
|
|
158
|
+
Cancel = "cancel",
|
|
134
159
|
OkayCancel = "okay-cancel",
|
|
135
160
|
YesNo = "yes-no",
|
|
136
161
|
YesNoCancel = "yes-no-cancel",
|
|
@@ -1690,4 +1715,4 @@ declare const LogBuiltInMetadata: {
|
|
|
1690
1715
|
};
|
|
1691
1716
|
};
|
|
1692
1717
|
|
|
1693
|
-
export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, Dropdown, DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitEndpointOnAnotherServer, visitServerEndpoint, waitMs };
|
|
1718
|
+
export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, Dropdown, DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitEndpointOnAnotherServer, visitServerEndpoint, waitMs };
|
package/package.json
CHANGED
|
@@ -240,6 +240,123 @@ export const confirm = async (
|
|
|
240
240
|
});
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
+
/*----------------------------------------*/
|
|
244
|
+
/* --------------- Prompt -------------- */
|
|
245
|
+
/*----------------------------------------*/
|
|
246
|
+
|
|
247
|
+
// Stored copies of setters
|
|
248
|
+
let setPromptInfo: (
|
|
249
|
+
info:
|
|
250
|
+
| undefined
|
|
251
|
+
| {
|
|
252
|
+
title: string;
|
|
253
|
+
text: string;
|
|
254
|
+
currentInputFieldText: string,
|
|
255
|
+
opts: {
|
|
256
|
+
placeholder?: string,
|
|
257
|
+
defaultText?: string,
|
|
258
|
+
confirmButtonText?: string,
|
|
259
|
+
confirmButtonVariant?: Variant,
|
|
260
|
+
cancelButtonText?: string,
|
|
261
|
+
cancelButtonVariant?: Variant,
|
|
262
|
+
minNumChars?: number,
|
|
263
|
+
findValidationError?: (text: string) => string | undefined,
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
) => void;
|
|
267
|
+
|
|
268
|
+
// Function to call when prompt is closed
|
|
269
|
+
let onPromptClosed: (result: string | null) => void;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Show a prompt modal asking the user for input
|
|
273
|
+
* @author Yuen Ler Chow
|
|
274
|
+
* @param title the title text to display at the top of the prompt
|
|
275
|
+
* @param text the text to display in the prompt
|
|
276
|
+
* @param [opts={}] additional options for the prompt dialog
|
|
277
|
+
* @param [opts.placeholder] the placeholder text for the input field
|
|
278
|
+
* @param [opts.defaultText] the default text for the input field
|
|
279
|
+
* @param [opts.confirmButtonText=Okay] the text of the confirm button
|
|
280
|
+
* @param [opts.confirmButtonVariant=Variant.Dark] the variant of the confirm button
|
|
281
|
+
* @param [opts.cancelButtonText=Cancel] the text of the cancel button
|
|
282
|
+
* @param [opts.cancelButtonVariant=Variant.Secondary] the variant of the cancel button
|
|
283
|
+
* @returns Promise that resolves with the input string or null if canceled
|
|
284
|
+
*/
|
|
285
|
+
export const prompt = async (
|
|
286
|
+
title: string,
|
|
287
|
+
text: string,
|
|
288
|
+
opts?: {
|
|
289
|
+
defaultText?: string,
|
|
290
|
+
placeholder?: string,
|
|
291
|
+
confirmButtonText?: string,
|
|
292
|
+
confirmButtonVariant?: Variant,
|
|
293
|
+
cancelButtonText?: string,
|
|
294
|
+
cancelButtonVariant?: Variant,
|
|
295
|
+
minNumChars?: number,
|
|
296
|
+
findValidationError?: (text: string) => string | undefined,
|
|
297
|
+
},
|
|
298
|
+
): Promise<string | null> => {
|
|
299
|
+
// Wait for helper to exist
|
|
300
|
+
await waitForHelper(() => {
|
|
301
|
+
return !!setPromptInfo;
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// Fallback if prompt is not available
|
|
305
|
+
if (!setPromptInfo) {
|
|
306
|
+
const resultPassesValidation = false;
|
|
307
|
+
while (!resultPassesValidation) {
|
|
308
|
+
// eslint-disable-next-line no-alert
|
|
309
|
+
const result = window.prompt(
|
|
310
|
+
`${title}\n\n${text}`,
|
|
311
|
+
opts?.defaultText ?? '',
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
if (result === null) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Validate min num chars
|
|
319
|
+
const minNumCharsValidationError = (
|
|
320
|
+
(opts?.minNumChars && result.length < opts.minNumChars)
|
|
321
|
+
? `Please enter at least ${opts.minNumChars} characters.`
|
|
322
|
+
: undefined
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
// Run custom validation
|
|
326
|
+
const customValidationError = (
|
|
327
|
+
opts?.findValidationError
|
|
328
|
+
&& opts.findValidationError(result)
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
// Show validation issue
|
|
332
|
+
if (minNumCharsValidationError || customValidationError) {
|
|
333
|
+
alert(
|
|
334
|
+
'Invalid Input',
|
|
335
|
+
`${minNumCharsValidationError ?? ''} ${customValidationError ?? ''}`,
|
|
336
|
+
);
|
|
337
|
+
} else {
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Return promise that resolves with result of prompt
|
|
344
|
+
return new Promise((resolve) => {
|
|
345
|
+
// Setup handler
|
|
346
|
+
onPromptClosed = (result: string | null) => {
|
|
347
|
+
resolve(result);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// Show the prompt
|
|
351
|
+
setPromptInfo({
|
|
352
|
+
title,
|
|
353
|
+
text,
|
|
354
|
+
currentInputFieldText: (opts?.defaultText ?? ''),
|
|
355
|
+
opts: (opts ?? {}),
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
|
|
243
360
|
/*----------------------------------------*/
|
|
244
361
|
/* ------------- Fatal Error ------------ */
|
|
245
362
|
/*----------------------------------------*/
|
|
@@ -465,6 +582,27 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
465
582
|
>(undefined);
|
|
466
583
|
setConfirmInfo = setConfirmInfoInner;
|
|
467
584
|
|
|
585
|
+
// Prompt
|
|
586
|
+
const [promptInfo, setPromptInfoInner] = useState<
|
|
587
|
+
| undefined
|
|
588
|
+
| {
|
|
589
|
+
title: string,
|
|
590
|
+
text: string,
|
|
591
|
+
currentInputFieldText: string,
|
|
592
|
+
opts: {
|
|
593
|
+
placeholder?: string,
|
|
594
|
+
defaultText?: string,
|
|
595
|
+
confirmButtonText?: string,
|
|
596
|
+
confirmButtonVariant?: Variant,
|
|
597
|
+
cancelButtonText?: string,
|
|
598
|
+
cancelButtonVariant?: Variant,
|
|
599
|
+
minNumChars?: number,
|
|
600
|
+
findValidationError?: (text: string) => string | undefined,
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
>(undefined);
|
|
604
|
+
setPromptInfo = setPromptInfoInner;
|
|
605
|
+
|
|
468
606
|
// Session expired
|
|
469
607
|
const [
|
|
470
608
|
sessionHasExpired,
|
|
@@ -531,6 +669,84 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
531
669
|
);
|
|
532
670
|
}
|
|
533
671
|
|
|
672
|
+
/* ------------- Prompt ------------ */
|
|
673
|
+
|
|
674
|
+
if (promptInfo) {
|
|
675
|
+
// Run min char validation
|
|
676
|
+
const minNumCharsValidationError = (
|
|
677
|
+
(
|
|
678
|
+
promptInfo.opts.minNumChars
|
|
679
|
+
&& promptInfo.currentInputFieldText.length < promptInfo.opts.minNumChars
|
|
680
|
+
)
|
|
681
|
+
? `Please enter at least ${promptInfo.opts.minNumChars} characters.`
|
|
682
|
+
: undefined
|
|
683
|
+
);
|
|
684
|
+
|
|
685
|
+
// Run custom validation
|
|
686
|
+
const customValidationError = (
|
|
687
|
+
promptInfo.opts.findValidationError
|
|
688
|
+
&& promptInfo.opts.findValidationError(promptInfo.currentInputFieldText)
|
|
689
|
+
);
|
|
690
|
+
|
|
691
|
+
modal = (
|
|
692
|
+
<ModalForWrapper
|
|
693
|
+
key={`prompt-${promptInfo.title}-${promptInfo.text}`}
|
|
694
|
+
title={promptInfo.title}
|
|
695
|
+
// Don't show ok button if there is a validation error
|
|
696
|
+
type={(
|
|
697
|
+
(customValidationError || minNumCharsValidationError)
|
|
698
|
+
? ModalType.Cancel
|
|
699
|
+
: ModalType.OkayCancel
|
|
700
|
+
)}
|
|
701
|
+
okayLabel={promptInfo.opts.confirmButtonText}
|
|
702
|
+
okayVariant={promptInfo.opts.confirmButtonVariant}
|
|
703
|
+
cancelLabel={promptInfo.opts.cancelButtonText}
|
|
704
|
+
cancelVariant={promptInfo.opts.cancelButtonVariant}
|
|
705
|
+
onClose={(buttonType) => {
|
|
706
|
+
const result = (
|
|
707
|
+
buttonType === ModalButtonType.Okay
|
|
708
|
+
? promptInfo.currentInputFieldText
|
|
709
|
+
: null
|
|
710
|
+
);
|
|
711
|
+
|
|
712
|
+
setPromptInfo(undefined);
|
|
713
|
+
|
|
714
|
+
if (onPromptClosed) {
|
|
715
|
+
onPromptClosed(result);
|
|
716
|
+
}
|
|
717
|
+
}}
|
|
718
|
+
onTopOfOtherModals
|
|
719
|
+
dontAllowBackdropExit
|
|
720
|
+
>
|
|
721
|
+
<div className="p-3">
|
|
722
|
+
<p>{promptInfo.text}</p>
|
|
723
|
+
<input
|
|
724
|
+
type="text"
|
|
725
|
+
className="form-control mb-2"
|
|
726
|
+
placeholder={promptInfo.opts.placeholder}
|
|
727
|
+
value={promptInfo.currentInputFieldText}
|
|
728
|
+
onChange={(e) => {
|
|
729
|
+
return setPromptInfo({
|
|
730
|
+
...promptInfo,
|
|
731
|
+
currentInputFieldText: e.target.value,
|
|
732
|
+
});
|
|
733
|
+
}}
|
|
734
|
+
/>
|
|
735
|
+
{minNumCharsValidationError && (
|
|
736
|
+
<div className="text-danger fw-bold mt-2">
|
|
737
|
+
{minNumCharsValidationError}
|
|
738
|
+
</div>
|
|
739
|
+
)}
|
|
740
|
+
{customValidationError && (
|
|
741
|
+
<div className="text-danger fw-bold mt-2">
|
|
742
|
+
{customValidationError}
|
|
743
|
+
</div>
|
|
744
|
+
)}
|
|
745
|
+
</div>
|
|
746
|
+
</ModalForWrapper>
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
|
|
534
750
|
/* ------ Custom Modal Portals ------ */
|
|
535
751
|
|
|
536
752
|
// Custom modal portals
|
|
@@ -959,23 +959,10 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
959
959
|
const { year, month } = toLoad[i];
|
|
960
960
|
|
|
961
961
|
// Load
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
while (hasAnotherPage) {
|
|
967
|
-
const response = await visitServerEndpoint({
|
|
968
|
-
path: `${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/${year}/months/${month}`,
|
|
969
|
-
method: 'GET',
|
|
970
|
-
params: {
|
|
971
|
-
pageNumber,
|
|
972
|
-
},
|
|
973
|
-
});
|
|
974
|
-
|
|
975
|
-
logs = logs.concat(response.items);
|
|
976
|
-
hasAnotherPage = response.hasAnotherPage;
|
|
977
|
-
pageNumber += 1;
|
|
978
|
-
}
|
|
962
|
+
const logs = await visitServerEndpoint({
|
|
963
|
+
path: `${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/${year}/months/${month}`,
|
|
964
|
+
method: 'GET',
|
|
965
|
+
});
|
|
979
966
|
|
|
980
967
|
// Add to map
|
|
981
968
|
if (!logMap[year]) {
|
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,
|
|
@@ -148,6 +149,7 @@ export {
|
|
|
148
149
|
Dropdown,
|
|
149
150
|
// Global functions
|
|
150
151
|
alert,
|
|
152
|
+
prompt,
|
|
151
153
|
confirm,
|
|
152
154
|
showFatalError,
|
|
153
155
|
// Errors
|
package/src/server/initServer.ts
CHANGED
|
@@ -246,14 +246,12 @@ const initServer = (
|
|
|
246
246
|
paramTypes: {
|
|
247
247
|
year: ParamType.Int,
|
|
248
248
|
month: ParamType.Int,
|
|
249
|
-
pageNumber: ParamType.Int,
|
|
250
249
|
},
|
|
251
250
|
handler: async ({ params }) => {
|
|
252
251
|
// Get user info
|
|
253
252
|
const {
|
|
254
253
|
year,
|
|
255
254
|
month,
|
|
256
|
-
pageNumber,
|
|
257
255
|
userId,
|
|
258
256
|
isAdmin,
|
|
259
257
|
} = params;
|
|
@@ -268,17 +266,13 @@ const initServer = (
|
|
|
268
266
|
}
|
|
269
267
|
|
|
270
268
|
// Query for logs
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
month,
|
|
275
|
-
},
|
|
276
|
-
perPage: 1000,
|
|
277
|
-
pageNumber,
|
|
269
|
+
const logs: Log[] = await _logCollection.find({
|
|
270
|
+
year,
|
|
271
|
+
month,
|
|
278
272
|
});
|
|
279
273
|
|
|
280
|
-
// Return
|
|
281
|
-
return
|
|
274
|
+
// Return logs
|
|
275
|
+
return logs;
|
|
282
276
|
},
|
|
283
277
|
}),
|
|
284
278
|
);
|