Merge remote-tracking branch 'origin/production' into production

master
鱼星 3 weeks ago
commit bc02892413

@ -332,6 +332,7 @@ const validateBasicParams = (nodeData: any): string[] => {
// 检查输入参数的完整性 // 检查输入参数的完整性
if (nodeData.parameters?.dataIns) { if (nodeData.parameters?.dataIns) {
console.log("nodeData.parameters.dataIns", nodeData.parameters);
nodeData.parameters.dataIns.forEach((param: any, index: number) => { nodeData.parameters.dataIns.forEach((param: any, index: number) => {
if (!param.id) { if (!param.id) {
errors.push(`${index + 1}个输入参数的标识不能为空`); errors.push(`${index + 1}个输入参数的标识不能为空`);

@ -129,6 +129,10 @@ export const useFlowCallbacks = (
return getCurrentAppKey(currentAppData) || initialData?.appId; return getCurrentAppKey(currentAppData) || initialData?.appId;
}, [initialData]); }, [initialData]);
const refreshAppList = useCallback(() => {
document.dispatchEvent(new CustomEvent('refreshAppList'));
}, []);
// region 画布操作 // region 画布操作
// 节点变更处理,添加防抖机制 // 节点变更处理,添加防抖机制
const onNodesChange = useCallback( const onNodesChange = useCallback(
@ -548,8 +552,13 @@ export const useFlowCallbacks = (
// 实时更新 canvasDataMap // 实时更新 canvasDataMap
const updateCanvasDataMapEffect = useCallback(() => { const updateCanvasDataMapEffect = useCallback(() => {
const appKey = getCurrentFlowAppKey(); const appKey = getCurrentFlowAppKey();
const { appRuntimeData } = store.getState().ideContainer;
const isCurrentAppRunning =
appKey && appRuntimeData[appKey]?.isRunning;
if ( if (
appKey && appKey &&
!isCurrentAppRunning &&
shouldPersistCanvas({ nodes, edges }) shouldPersistCanvas({ nodes, edges })
) { ) {
updateCanvasDataMapDebounced( updateCanvasDataMapDebounced(
@ -1401,6 +1410,7 @@ export const useFlowCallbacks = (
// 更新运行ID // 更新运行ID
dispatch(updateRuntimeId(res.data)); dispatch(updateRuntimeId(res.data));
refreshAppList();
// 开始运行时动画 // 开始运行时动画
setEdges((eds) => setEdges((eds) =>
@ -1434,6 +1444,7 @@ export const useFlowCallbacks = (
// 更新运行ID // 更新运行ID
dispatch(updateRuntimeId(res.data)); dispatch(updateRuntimeId(res.data));
refreshAppList();
// 开始运行时动画 // 开始运行时动画
setEdges((eds) => setEdges((eds) =>
@ -1462,9 +1473,8 @@ export const useFlowCallbacks = (
} else { } else {
// 特殊停止逻辑,持久化运行的应用使用这里的入参 // 特殊停止逻辑,持久化运行的应用使用这里的入参
await stopApp(currentAppData.instanceId); await stopApp(currentAppData.instanceId);
// 特殊停止完成后触发事件,通知刷新应用列表
document.dispatchEvent(new CustomEvent('refreshAppList'));
} }
refreshAppList();
// 重置节点状态 // 重置节点状态
dispatch(resetNodeStatus()); dispatch(resetNodeStatus());
@ -1490,7 +1500,7 @@ export const useFlowCallbacks = (
} }
} }
}, },
[getCurrentFlowAppKey] [getCurrentFlowAppKey, refreshAppList]
); );
// 暂停/恢复应用 // 暂停/恢复应用

@ -61,7 +61,9 @@ export const useFlowEditorState = (initialData?: any, readOnly?: boolean) => {
Object.values(initialData.components).some((comp: any) => comp.status); Object.values(initialData.components).some((comp: any) => comp.status);
setNodes((prevNodes) => { setNodes((prevNodes) => {
return prevNodes.map((node) => { let hasChanges = false;
const nextNodes = prevNodes.map((node) => {
// 如果是只读模式(历史实例查看),优先使用节点自身的历史状态 // 如果是只读模式(历史实例查看),优先使用节点自身的历史状态
// 如果是正常运行模式,只使用运行时状态 // 如果是正常运行模式,只使用运行时状态
let nodeStatus = 'waiting'; let nodeStatus = 'waiting';
@ -80,6 +82,14 @@ export const useFlowEditorState = (initialData?: any, readOnly?: boolean) => {
showStatus = currentAppIsRunning; showStatus = currentAppIsRunning;
} }
if (
node.data.status === nodeStatus &&
node.data.isStatusVisible === showStatus
) {
return node;
}
hasChanges = true;
return { return {
...node, ...node,
data: { data: {
@ -89,6 +99,8 @@ export const useFlowEditorState = (initialData?: any, readOnly?: boolean) => {
}, },
}; };
}); });
return hasChanges ? nextNodes : prevNodes;
}); });
}, [ }, [
appRuntimeData, appRuntimeData,

@ -4,7 +4,6 @@ import {
updateSocketId, updateSocketId,
updateNodeStatus, updateNodeStatus,
updateEventListOld, updateEventListOld,
resetNodeStatus,
updateRuntimeId, updateRuntimeId,
updateIsRunning updateIsRunning
} from '@/store/ideContainer'; } from '@/store/ideContainer';
@ -149,7 +148,6 @@ function IDEContainer() {
const reconnectRuntime = async () => { const reconnectRuntime = async () => {
try { try {
dispatch(resetNodeStatus());
dispatch(updateRuntimeId(reconnectRequest.instanceId)); dispatch(updateRuntimeId(reconnectRequest.instanceId));
dispatch(updateIsRunning(true)); dispatch(updateIsRunning(true));

Loading…
Cancel
Save