feat: add context handlers to reset output preview log
This commit is contained in:
@@ -32,6 +32,8 @@ interface GlobalInfo {
|
|||||||
hasScreenshotAction: boolean;
|
hasScreenshotAction: boolean;
|
||||||
hasScrapeSchemaAction: boolean;
|
hasScrapeSchemaAction: boolean;
|
||||||
}) => void;
|
}) => void;
|
||||||
|
shouldResetInterpretationLog: boolean;
|
||||||
|
resetInterpretationLog: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GlobalInfoStore implements Partial<GlobalInfo> {
|
class GlobalInfoStore implements Partial<GlobalInfo> {
|
||||||
@@ -53,6 +55,7 @@ class GlobalInfoStore implements Partial<GlobalInfo> {
|
|||||||
hasScreenshotAction: false,
|
hasScreenshotAction: false,
|
||||||
hasScrapeSchemaAction: false,
|
hasScrapeSchemaAction: false,
|
||||||
};
|
};
|
||||||
|
shouldResetInterpretationLog = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const globalInfoStore = new GlobalInfoStore();
|
const globalInfoStore = new GlobalInfoStore();
|
||||||
@@ -71,6 +74,7 @@ export const GlobalInfoProvider = ({ children }: { children: JSX.Element }) => {
|
|||||||
const [recordingName, setRecordingName] = useState<string>(globalInfoStore.recordingName);
|
const [recordingName, setRecordingName] = useState<string>(globalInfoStore.recordingName);
|
||||||
const [recordingUrl, setRecordingUrl] = useState<string>(globalInfoStore.recordingUrl);
|
const [recordingUrl, setRecordingUrl] = useState<string>(globalInfoStore.recordingUrl);
|
||||||
const [currentWorkflowActionsState, setCurrentWorkflowActionsState] = useState(globalInfoStore.currentWorkflowActionsState);
|
const [currentWorkflowActionsState, setCurrentWorkflowActionsState] = useState(globalInfoStore.currentWorkflowActionsState);
|
||||||
|
const [shouldResetInterpretationLog, setShouldResetInterpretationLog] = useState<boolean>(globalInfoStore.shouldResetInterpretationLog);
|
||||||
|
|
||||||
const notify = (severity: 'error' | 'warning' | 'info' | 'success', message: string) => {
|
const notify = (severity: 'error' | 'warning' | 'info' | 'success', message: string) => {
|
||||||
setNotification({ severity, message, isOpen: true });
|
setNotification({ severity, message, isOpen: true });
|
||||||
@@ -87,6 +91,14 @@ export const GlobalInfoProvider = ({ children }: { children: JSX.Element }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resetInterpretationLog = () => {
|
||||||
|
setShouldResetInterpretationLog(true);
|
||||||
|
// Reset the flag after a short delay to allow components to respond
|
||||||
|
setTimeout(() => {
|
||||||
|
setShouldResetInterpretationLog(false);
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<globalInfoContext.Provider
|
<globalInfoContext.Provider
|
||||||
value={{
|
value={{
|
||||||
@@ -111,6 +123,8 @@ export const GlobalInfoProvider = ({ children }: { children: JSX.Element }) => {
|
|||||||
setRecordingUrl,
|
setRecordingUrl,
|
||||||
currentWorkflowActionsState,
|
currentWorkflowActionsState,
|
||||||
setCurrentWorkflowActionsState,
|
setCurrentWorkflowActionsState,
|
||||||
|
shouldResetInterpretationLog,
|
||||||
|
resetInterpretationLog,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user