From e8af3945230b4a983aa5d2d213aaf8d84b60f5e7 Mon Sep 17 00:00:00 2001 From: zhaowei Date: Thu, 5 Jun 2025 15:32:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B6=85=E5=8F=82=E6=95=B0=E5=AF=BB?= =?UTF-8?q?=E4=BC=98=E6=B7=BB=E5=8A=A0=E5=8F=AF=E8=A7=86=E5=8C=96=E5=AF=B9?= =?UTF-8?q?=E6=AF=94iframe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/routes.ts | 31 ++++++++++++++----- .../src/pages/Experiment/Comparison/index.tsx | 2 +- .../src/pages/HyperParameter/Aim/index.tsx | 12 +++++++ .../components/ExperimentHistory/index.tsx | 6 +++- 4 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 react-ui/src/pages/HyperParameter/Aim/index.tsx diff --git a/react-ui/config/routes.ts b/react-ui/config/routes.ts index 8ec050ae..ec2d251f 100644 --- a/react-ui/config/routes.ts +++ b/react-ui/config/routes.ts @@ -141,12 +141,18 @@ export default [ { name: '实验对比', path: 'compare', - component: './Experiment/Comparison/index', - }, - { - name: '实验可视化对比', - path: 'compare-visual', - component: './Experiment/Aim/index', + routes: [ + { + name: '实验对比', + path: '', + component: './Experiment/Comparison/index', + }, + { + name: '可视化对比', + path: 'compare-visual', + component: './Experiment/Aim/index', + }, + ], }, { name: '可视化', @@ -223,7 +229,18 @@ export default [ { name: '实验实例详情', path: 'instance/:experimentId/:id', - component: './HyperParameter/Instance/index', + routes: [ + { + name: '实验实例详情', + path: '', + component: './HyperParameter/Instance/index', + }, + { + name: '可视化对比', + path: 'compare-visual', + component: './HyperParameter/Aim/index', + }, + ], }, ], }, diff --git a/react-ui/src/pages/Experiment/Comparison/index.tsx b/react-ui/src/pages/Experiment/Comparison/index.tsx index 200b4ba1..d10e8069 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.tsx +++ b/react-ui/src/pages/Experiment/Comparison/index.tsx @@ -77,7 +77,7 @@ function ExperimentComparison() { const url = res.data; // window.open(url, '_blank'); SessionStorage.setItem(SessionStorage.aimUrlKey, url); - navigate('../compare-visual'); + navigate('compare-visual'); } }; diff --git a/react-ui/src/pages/HyperParameter/Aim/index.tsx b/react-ui/src/pages/HyperParameter/Aim/index.tsx new file mode 100644 index 00000000..3a8d1d0d --- /dev/null +++ b/react-ui/src/pages/HyperParameter/Aim/index.tsx @@ -0,0 +1,12 @@ +/* + * @Author: 赵伟 + * @Date: 2025-03-31 16:38:59 + * @Description: 实验对比 Aim + */ + +import IframePage, { IframePageType } from '@/components/IFramePage'; + +function AimPage() { + return ; +} +export default AimPage; diff --git a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx index c9c9dce5..39ecebda 100644 --- a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx +++ b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx @@ -3,7 +3,9 @@ import TrialStatusCell from '@/pages/HyperParameter/components/TrialStatusCell'; import { HyperParameterTrial } from '@/pages/HyperParameter/types'; import { getExpMetricsReq } from '@/services/hyperParameter'; import { to } from '@/utils/promise'; +import SessionStorage from '@/utils/sessionStorage'; import tableCellRender, { TableCellValueType } from '@/utils/table'; +import { useNavigate } from '@umijs/max'; import { App, Button, Table, type TableProps } from 'antd'; import classNames from 'classnames'; import { useEffect, useState } from 'react'; @@ -36,6 +38,7 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { const metricAnalysis: Record = first?.metric_analysis ?? {}; const paramsNames = Object.keys(config); const metricNames = Object.keys(metricAnalysis); + const navigate = useNavigate(); const trialColumns: TableProps['columns'] = [ { @@ -160,7 +163,8 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { const [res] = await to(getExpMetricsReq(selectedRowKeys)); if (res && res.data) { const url = res.data; - window.open(url, '_blank'); + SessionStorage.setItem(SessionStorage.aimUrlKey, url); + navigate('compare-visual'); } };