From 91d3758691fe711009ded9d38936efec7773b6b4 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Tue, 20 Jan 2026 15:59:55 +0800 Subject: [PATCH] feat(web): agent and multi_agent handleSave function add promise resolve result --- web/src/views/ApplicationConfig/Agent.tsx | 6 ++---- web/src/views/ApplicationConfig/Cluster.tsx | 6 ++---- .../views/ApplicationConfig/components/ConfigHeader.tsx | 8 ++++---- web/src/views/ApplicationConfig/index.tsx | 3 ++- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/web/src/views/ApplicationConfig/Agent.tsx b/web/src/views/ApplicationConfig/Agent.tsx index 92170d55..4d410338 100644 --- a/web/src/views/ApplicationConfig/Agent.tsx +++ b/web/src/views/ApplicationConfig/Agent.tsx @@ -311,17 +311,15 @@ const Agent = forwardRef((_props, ref) => { enabled: vo.enabled })) } - - console.log('params', rest, params) return new Promise((resolve, reject) => { saveAgentConfig(data.app_id, params) - .then(() => { + .then((res) => { if (flag) { message.success(t('common.saveSuccess')) } setIsSave(false) - resolve(true) + resolve(res) }).catch(error => { reject(error) }) diff --git a/web/src/views/ApplicationConfig/Cluster.tsx b/web/src/views/ApplicationConfig/Cluster.tsx index 714c1c49..3081aa04 100644 --- a/web/src/views/ApplicationConfig/Cluster.tsx +++ b/web/src/views/ApplicationConfig/Cluster.tsx @@ -58,16 +58,14 @@ const Cluster = forwardRef((_props, ref) => { })) } - console.log('params', params) - return new Promise((resolve, reject) => { form.validateFields().then(() => { saveMultiAgentConfig(id as string, params) - .then(() => { + .then((res) => { if (flag) { message.success(t('common.saveSuccess')) } - resolve(true) + resolve(res) }) .catch(error => { reject(error) diff --git a/web/src/views/ApplicationConfig/components/ConfigHeader.tsx b/web/src/views/ApplicationConfig/components/ConfigHeader.tsx index 1837b696..94ef0ef7 100644 --- a/web/src/views/ApplicationConfig/components/ConfigHeader.tsx +++ b/web/src/views/ApplicationConfig/components/ConfigHeader.tsx @@ -11,7 +11,7 @@ import exportIcon from '@/assets/images/export_hover.svg' import deleteIcon from '@/assets/images/delete_hover.svg' import type { Application, ApplicationModalRef } from '@/views/ApplicationManagement/types'; import ApplicationModal from '@/views/ApplicationManagement/components/ApplicationModal' -import type { CopyModalRef, WorkflowRef } from '../types' +import type { CopyModalRef, AgentRef, ClusterRef, WorkflowRef } from '../types' import { deleteApplication } from '@/api/application' import CopyModal from './CopyModal' @@ -30,10 +30,11 @@ interface ConfigHeaderProps { handleChangeTab: (key: string) => void; refresh: () => void; workflowRef: React.RefObject + appRef?: React.RefObject } const ConfigHeader: FC = ({ application, activeTab, handleChangeTab, refresh, - workflowRef + workflowRef, }) => { const { t } = useTranslation(); const navigate = useNavigate(); @@ -48,7 +49,7 @@ const ConfigHeader: FC = ({ })) } const formatMenuItems = () => { - const items = ['edit', 'copy', 'delete'].map(key => ({ + const items = ['edit', 'copy', 'export', 'delete'].map(key => ({ key, icon: , label: t(`common.${key}`), @@ -59,7 +60,6 @@ const ConfigHeader: FC = ({ } } const handleClick: MenuProps['onClick'] = ({ key }) => { - console.log('key', key) switch (key) { case 'edit': applicationModalRef.current?.handleOpen(application as Application) diff --git a/web/src/views/ApplicationConfig/index.tsx b/web/src/views/ApplicationConfig/index.tsx index 23f3e434..7d5d5950 100644 --- a/web/src/views/ApplicationConfig/index.tsx +++ b/web/src/views/ApplicationConfig/index.tsx @@ -60,10 +60,11 @@ const ApplicationConfig: React.FC = () => { handleChangeTab={handleChangeTab} application={application as Application} refresh={getApplicationInfo} + appRef={application?.type === 'agent' ? agentRef : application?.type === 'multi_agent' ? clusterRef : application?.type === 'workflow' ? workflowRef : undefined} workflowRef={workflowRef} /> {activeTab === 'arrangement' && application?.type === 'agent' && } - {activeTab === 'arrangement' && application?.type === 'multi_agent' && } + {activeTab === 'arrangement' && application?.type === 'multi_agent' && } {activeTab === 'arrangement' && application?.type === 'workflow' && } {activeTab === 'api' && } {activeTab === 'release' && }