From 3df2e62c0a87b0f6dbb03ba3856b9ae5dc72643f Mon Sep 17 00:00:00 2001 From: ZLY Date: Wed, 24 Dec 2025 16:45:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(ide):=20=E6=B7=BB=E5=8A=A0=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=88=97=E8=A1=A8=E5=88=B7=E6=96=B0=E7=9B=91=E5=90=AC?= =?UTF-8?q?=E5=92=8C=E8=BF=90=E8=A1=8C=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useFlowCallbacks.ts | 6 ++++ src/pages/ideContainer/index.tsx | 14 ++++++++++ src/pages/ideContainer/sideBar.tsx | 44 +++++++++++++++++++++--------- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/hooks/useFlowCallbacks.ts b/src/hooks/useFlowCallbacks.ts index 32f2eb8..f91c3e5 100644 --- a/src/hooks/useFlowCallbacks.ts +++ b/src/hooks/useFlowCallbacks.ts @@ -1396,6 +1396,12 @@ export const useFlowCallbacks = ( if (runId) { await stopApp(runId); } + else { + // 特殊停止逻辑,持久化运行的应用使用这里的入参 + await stopApp(currentAppData.instanceId); + // 特殊停止完成后触发事件,通知刷新应用列表 + document.dispatchEvent(new CustomEvent('refreshAppList')); + } // 更新运行ID dispatch(updateRuntimeId('')); diff --git a/src/pages/ideContainer/index.tsx b/src/pages/ideContainer/index.tsx index 1297edd..0860237 100644 --- a/src/pages/ideContainer/index.tsx +++ b/src/pages/ideContainer/index.tsx @@ -256,6 +256,20 @@ function IDEContainer() { } }, [urlParams.identity]); + // 监听刷新应用列表事件(特殊停止后触发) + useEffect(() => { + const handleRefreshAppList = () => { + if (urlParams.id) { + getAppList(); + } + }; + + document.addEventListener('refreshAppList', handleRefreshAppList); + return () => { + document.removeEventListener('refreshAppList', handleRefreshAppList); + }; + }, [urlParams.id]); + // 页面加载后默认选择第一个菜单项 useEffect(() => { if (urlParams.identity && menuData[urlParams.identity]?.length > 0 && !selected.key) { diff --git a/src/pages/ideContainer/sideBar.tsx b/src/pages/ideContainer/sideBar.tsx index 58c33f6..c6372c7 100644 --- a/src/pages/ideContainer/sideBar.tsx +++ b/src/pages/ideContainer/sideBar.tsx @@ -23,7 +23,8 @@ import { IconEyeInvisible, IconExpand, IconShrink, - IconLeft + IconLeft, + IconLoading } from '@arco-design/web-react/icon'; import { menuData1, menuData2 } from './config/menuData'; import { Selected } from '@/pages/ideContainer/types'; @@ -34,7 +35,8 @@ import { updateCanvasDataMap, updateCurrentAppData, updateEventListOld, - updateEventNodeList + updateEventNodeList, + updateIsRunning } from '@/store/ideContainer'; import { addApp, getProjectEnv, editApp, deleteApp } from '@/api/apps'; import _ from 'lodash'; @@ -728,21 +730,33 @@ const SideBar: React.FC = ({ ); return ( - - + {node?.dataRef?.scheduled === 1 &&
{ - e.stopPropagation(); - }} - /> - + > + +
} + + { + e.stopPropagation(); + }} + /> + + ); }; @@ -869,6 +883,10 @@ const SideBar: React.FC = ({ if (selected?.parentKey === 'appList') { await getProjectEnvData(originalData); + // 根据应用的 scheduled 状态更新画布的运行状态 + // scheduled === 1 表示应用正在运行中 + dispatch(updateIsRunning(originalData?.scheduled === 1)); + // 调用外部传入的菜单选择处理函数 originalData.key && onMenuSelect?.({ ...originalData } as Selected); }