Skip to content

Commit

Permalink
junhao review
Browse files Browse the repository at this point in the history
  • Loading branch information
davemarco committed Nov 27, 2024
1 parent 8855636 commit 8de0b4c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
28 changes: 16 additions & 12 deletions src/components/PopUps/PopUpMessageBox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import React, {
useContext,
useEffect,
useRef,
Expand Down Expand Up @@ -51,6 +51,11 @@ const PopUpMessageBox = ({message}: PopUpMessageProps) => {
handlePopUpMessageClose(id);
};

const handlePrimaryActionClick = (ev: React.MouseEvent<HTMLButtonElement>) => {
primaryAction?.onClick?.(ev);
handleCloseButtonClick();
};

useEffect(() => {
if (DO_NOT_TIMEOUT_VALUE === timeoutMillis) {
return () => {};
Expand Down Expand Up @@ -117,17 +122,16 @@ const PopUpMessageBox = ({message}: PopUpMessageProps) => {
{messageStr}
</Typography>
{primaryAction && (
<Button
color={color}
variant={"solid"}
{...primaryAction}
onClick={(event) => {
primaryAction.onClick?.(event);
handleCloseButtonClick();
}}
>
{primaryAction.children}
</Button>
<Box className={"pop-up-message-box-actions-container"}>
<Button
color={color}
variant={"solid"}
{...primaryAction}
onClick={handlePrimaryActionClick}
>
{primaryAction.children}
</Button>
</Box>
)}
</div>
</Alert>
Expand Down
7 changes: 6 additions & 1 deletion src/components/PopUps/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
display: flex;
flex-direction: column;
gap: 10px;
width: 300px;
width: 333px;
}

.pop-up-message-box-actions-container {
display: flex;
justify-content: flex-end;
}

.pop-up-message-box-title-container {
Expand Down
4 changes: 2 additions & 2 deletions src/components/modals/SettingsModal/SettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const CONFIG_FORM_FIELDS = [
\`{<field-name>[:<formatter-name>[:<formatter-options>]]}\`, where \`field-name\` is
required, while \`formatter-name\` and \`formatter-options\` are optional. For example,
the following placeholder would format a timestamp field with name \`@timestamp\`:
\`{@timestamp:timestamp:YYYY-MM-DD HH\\:mm\\:ss.SSS}\`. The default setting is
an empty string which will print all fields formatted as JSON.`,
\`{@timestamp:timestamp:YYYY-MM-DD HH\\:mm\\:ss.SSS}\`. Leave format string blank to
display the entire log event formatted as JSON.`,
initialValue: getConfig(CONFIG_KEY.DECODER_OPTIONS).formatString,
label: "Decoder: Format string",
name: LOCAL_STORAGE_KEY.DECODER_OPTIONS_FORMAT_STRING,
Expand Down
6 changes: 3 additions & 3 deletions src/contexts/StateContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ interface StateContextType {
loadFile: (fileSrc: FileSrcType, cursor: CursorType) => void,
loadPageByAction: (navAction: NavigationAction) => void,
setIsSettingsModalOpen: (isOpen: boolean) => void,
setLogLevelFilter: (newLogLevelFilter: LogLevelFilter) => void,
setLogLevelFilter: (filter: LogLevelFilter) => void,
startQuery: (queryString: string, isRegex: boolean, isCaseSensitive: boolean) => void,
}
const StateContext = createContext<StateContextType>({} as StateContextType);
Expand Down Expand Up @@ -446,14 +446,14 @@ const StateContextProvider = ({children}: StateContextProviderProps) => {
loadPageByCursor(mainWorkerRef.current, cursor);
}, []);

const setLogLevelFilter = useCallback((newLogLevelFilter: LogLevelFilter) => {
const setLogLevelFilter = useCallback((filter: LogLevelFilter) => {
if (null === mainWorkerRef.current) {
return;
}
setUiState(UI_STATE.FAST_LOADING);
workerPostReq(mainWorkerRef.current, WORKER_REQ_CODE.SET_FILTER, {
cursor: {code: CURSOR_CODE.EVENT_NUM, args: {eventNum: logEventNumRef.current ?? 1}},
logLevelFilter: newLogLevelFilter,
logLevelFilter: filter,
});
}, []);

Expand Down

0 comments on commit 8de0b4c

Please sign in to comment.