From 779dbdea26acc3842bac9857ca139930c5261490 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Mon, 16 Mar 2026 16:00:56 +0800 Subject: [PATCH 1/2] feat(web): app save before edit & export --- .../ApplicationConfig/components/ConfigHeader.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web/src/views/ApplicationConfig/components/ConfigHeader.tsx b/web/src/views/ApplicationConfig/components/ConfigHeader.tsx index 3350780c..755491be 100644 --- a/web/src/views/ApplicationConfig/components/ConfigHeader.tsx +++ b/web/src/views/ApplicationConfig/components/ConfigHeader.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 16:27:52 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-13 17:12:59 + * @Last Modified time: 2026-03-16 15:58:10 */ import { type FC, useRef, useMemo, useCallback } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; @@ -97,10 +97,16 @@ const ConfigHeader: FC = ({ applicationModalRef.current?.handleOpen(application) break; case 'copy': - copyModalRef.current?.handleOpen() + appRef?.current?.handleSave(false) + .then(() => { + copyModalRef.current?.handleOpen() + }) break; case 'export': - appExport(application.id, application.name) + appRef?.current?.handleSave(false) + .then(() => { + appExport(application.id, application.name) + }) break; case 'delete': handleDelete() From 3d91a9e92675703978e9adc7aa7fffd74fa3fa8d Mon Sep 17 00:00:00 2001 From: zhaoying Date: Mon, 16 Mar 2026 16:13:01 +0800 Subject: [PATCH 2/2] fix(web): copy node id update --- web/src/views/Workflow/components/Properties/index.tsx | 8 ++++---- web/src/views/Workflow/hooks/useWorkflowGraph.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/web/src/views/Workflow/components/Properties/index.tsx b/web/src/views/Workflow/components/Properties/index.tsx index bd5392cd..33e865a2 100644 --- a/web/src/views/Workflow/components/Properties/index.tsx +++ b/web/src/views/Workflow/components/Properties/index.tsx @@ -1,8 +1,8 @@ /* * @Author: ZhaoYing * @Date: 2026-02-03 15:39:59 - * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-02 17:06:41 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-03-16 16:11:28 */ import { type FC, useEffect, useState, useMemo } from "react"; import clsx from 'clsx' @@ -88,7 +88,7 @@ const Properties: FC = ({ useEffect(() => { if (selectedNode && form) { - const { type = 'default', name = '', config } = selectedNode.getData() || {} + const { type = 'default', name = '', config, id } = selectedNode.getData() || {} const initialValue: Record = {} Object.keys(config || {}).forEach(key => { if (config && config[key] && 'defaultValue' in config[key]) { @@ -98,7 +98,7 @@ const Properties: FC = ({ form.setFieldsValue({ type, - id: selectedNode.id, + id, name, ...initialValue, }) diff --git a/web/src/views/Workflow/hooks/useWorkflowGraph.ts b/web/src/views/Workflow/hooks/useWorkflowGraph.ts index db792c59..4bdf49b9 100644 --- a/web/src/views/Workflow/hooks/useWorkflowGraph.ts +++ b/web/src/views/Workflow/hooks/useWorkflowGraph.ts @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 15:17:48 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-07 15:23:39 + * @Last Modified time: 2026-03-16 16:11:01 */ import { useRef, useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; @@ -593,6 +593,13 @@ export const useWorkflowGraph = ({ if (!graphRef.current) return false; const selectedNodes = graphRef.current.getNodes().filter(node => node.getData()?.isSelected); if (selectedNodes.length) { + selectedNodes.forEach(node => { + const data = node.getData(); + node.setData({ + ...data, + id: `${(data.type as string).replace(/-/g, '_')}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, + }); + }); graphRef.current.copy(selectedNodes); } return false;