feat: move workflow socket
This commit is contained in:
@@ -61,6 +61,9 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
}, [workflow])
|
}, [workflow])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (socket) {
|
||||||
|
socket.on("workflow", workflowHandler);
|
||||||
|
}
|
||||||
// fetch the workflow every time the id changes
|
// fetch the workflow every time the id changes
|
||||||
if (id) {
|
if (id) {
|
||||||
fetchWorkflow(id, workflowHandler);
|
fetchWorkflow(id, workflowHandler);
|
||||||
@@ -71,7 +74,10 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
fetchWorkflow(id, workflowHandler);
|
fetchWorkflow(id, workflowHandler);
|
||||||
}
|
}
|
||||||
}, (1000 * 60 * 15));
|
}, (1000 * 60 * 15));
|
||||||
return () => clearInterval(interval)
|
return () => {
|
||||||
|
socket?.off("workflow", workflowHandler);
|
||||||
|
clearInterval(interval);
|
||||||
|
};
|
||||||
}, [id]);
|
}, [id]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -84,6 +90,13 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
}
|
}
|
||||||
}, [socket, workflowHandler]);
|
}, [socket, workflowHandler]);
|
||||||
|
|
||||||
|
const hasScrapeListAction = workflow.workflow.some(pair =>
|
||||||
|
pair.what.some(action => action.action === "scrapeList")
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(`Has Scrape List Action?`, hasScrapeListAction); // true if any pair contains scrapeList action
|
||||||
|
|
||||||
|
|
||||||
const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => {
|
const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => {
|
||||||
if (listId !== undefined && fieldKey !== undefined) {
|
if (listId !== undefined && fieldKey !== undefined) {
|
||||||
// Prevent editing if the field is confirmed
|
// Prevent editing if the field is confirmed
|
||||||
|
|||||||
Reference in New Issue
Block a user