From 1d60363a804967dede8ad7368364d44f79c93601 Mon Sep 17 00:00:00 2001 From: gaoyan Date: Wed, 27 Nov 2024 22:25:39 +0800 Subject: [PATCH] Fix web clear --- .../src/main/java/org/dinky/context/ConsoleContextHolder.java | 2 +- .../src/pages/DataStudio/Toolbar/Service/Output/index.tsx | 4 +++- dinky-web/src/pages/DataStudio/Toolbar/Service/index.tsx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java b/dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java index 9946af83ff..05939563ba 100644 --- a/dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java +++ b/dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java @@ -121,7 +121,7 @@ public boolean clearProcessLog(String processName) { if (FileUtil.exist(filePath)) { return FileUtil.del(filePath); } - return false; + return true; } /** diff --git a/dinky-web/src/pages/DataStudio/Toolbar/Service/Output/index.tsx b/dinky-web/src/pages/DataStudio/Toolbar/Service/Output/index.tsx index 0e957561af..539c7c6d1f 100644 --- a/dinky-web/src/pages/DataStudio/Toolbar/Service/Output/index.tsx +++ b/dinky-web/src/pages/DataStudio/Toolbar/Service/Output/index.tsx @@ -37,6 +37,7 @@ import { SseData, Topic } from '@/models/UseWebSocketModel'; const { Text } = Typography; export interface ProcessStep extends DataNode { + key: any; status: string; type: string; startTime: string; @@ -71,7 +72,7 @@ export default (props: { taskId: number }) => { subscribeTopic: model?.subscribeTopic })); - const onUpdate = (data: ProcessStep) => { + const onUpdate = (data?: ProcessStep) => { setProcessNode((prevState: any) => { //如果key不一致代表重新提交了任务,清空旧状态 if ((prevState && prevState?.key != data?.key) || !data) { @@ -97,6 +98,7 @@ export default (props: { taskId: number }) => { ); const refreshProcess = () => { + onUpdate(undefined) subscribeTopic(Topic.PROCESS_CONSOLE, [process], (data: SseData) => onUpdate(data?.data[process]) ); diff --git a/dinky-web/src/pages/DataStudio/Toolbar/Service/index.tsx b/dinky-web/src/pages/DataStudio/Toolbar/Service/index.tsx index 89d7d6f45e..85ed4e346b 100644 --- a/dinky-web/src/pages/DataStudio/Toolbar/Service/index.tsx +++ b/dinky-web/src/pages/DataStudio/Toolbar/Service/index.tsx @@ -296,7 +296,7 @@ const Service = (props: { showDesc: boolean; tabs: CenterTab[]; action: any }) = }, [tabs, selectedKey, props.action, tabActiveKey]); return ( - +