From 43efbd0771ea92c4eed87074fa6754bf9d0796f0 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Fri, 24 May 2024 15:08:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B2=A1=E6=9C=89=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E4=B8=8D=E8=AF=B7=E6=B1=82=E6=97=A5=E5=BF=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ExperimentResult/index.less | 5 ++ .../components/ExperimentResult/index.tsx | 56 ++++++++++--------- .../Experiment/components/LogGroup/index.tsx | 22 +++++++- .../Experiment/components/LogList/index.less | 10 ++++ .../Experiment/components/LogList/index.tsx | 8 ++- .../src/pages/Experiment/training/props.tsx | 3 +- 6 files changed, 73 insertions(+), 31 deletions(-) diff --git a/react-ui/src/pages/Experiment/components/ExperimentResult/index.less b/react-ui/src/pages/Experiment/components/ExperimentResult/index.less index 4a99e254..241e9713 100644 --- a/react-ui/src/pages/Experiment/components/ExperimentResult/index.less +++ b/react-ui/src/pages/Experiment/components/ExperimentResult/index.less @@ -35,4 +35,9 @@ } } } + + &__empty { + margin-top: 10px; + text-align: center; + } } diff --git a/react-ui/src/pages/Experiment/components/ExperimentResult/index.tsx b/react-ui/src/pages/Experiment/components/ExperimentResult/index.tsx index e010edeb..845d684f 100644 --- a/react-ui/src/pages/Experiment/components/ExperimentResult/index.tsx +++ b/react-ui/src/pages/Experiment/components/ExperimentResult/index.tsx @@ -23,34 +23,38 @@ function ExperimentResult({ results }: ExperimentResultProps) { return (
- {results?.map((item) => ( -
-
- {item.name} - - {/* 导出到模型库 + {results && results.length > 0 ? ( + results.map((item) => ( +
+
+ {item.name} + + {/* 导出到模型库 导出到数据集 */} -
-
- 文件名称 - 文件大小 -
- {item.value?.map((ele) => ( -
- {ele.name} - {ele.size}
- ))} -
- ))} +
+ 文件名称 + 文件大小 +
+ {item.value?.map((ele) => ( +
+ {ele.name} + {ele.size} +
+ ))} +
+ )) + ) : ( +
暂无结果
+ )}
); diff --git a/react-ui/src/pages/Experiment/components/LogGroup/index.tsx b/react-ui/src/pages/Experiment/components/LogGroup/index.tsx index f87d1d09..00cea44b 100644 --- a/react-ui/src/pages/Experiment/components/LogGroup/index.tsx +++ b/react-ui/src/pages/Experiment/components/LogGroup/index.tsx @@ -22,6 +22,20 @@ type Log = { log_content: string; // 日志内容 }; +const scrollToBottom = (smooth: boolean = true) => { + const element = document.getElementsByClassName('ant-tabs-content-holder')?.[0]; + if (element) { + if (smooth) { + element.scrollTo({ + top: element.scrollHeight, + behavior: 'smooth', + }); + } else { + element.scrollTo({ top: element.scrollHeight }); + } + } +}; + function LogGroup({ log_type = 'normal', pod_name = '', @@ -34,6 +48,7 @@ function LogGroup({ const [completed, setCompleted] = useState(false); useEffect(() => { + scrollToBottom(false); if (status === ExperimentStatus.Running) { const timerId = setInterval(() => { requestExperimentPodsLog(); @@ -56,6 +71,9 @@ function LogGroup({ const { log_detail } = res.data; if (log_detail && log_detail.log_content) { setLogList((oldList) => oldList.concat(log_detail)); + setTimeout(() => { + scrollToBottom(); + }, 100); } else { setCompleted(true); } @@ -96,7 +114,9 @@ function LogGroup({ {collapse ? : }
)} - {showLog &&
{logText}
} + {showLog && ( +
{logText ? logText : '暂无日志'}
+ )}
{showMoreBtn && (
); } diff --git a/react-ui/src/pages/Experiment/training/props.tsx b/react-ui/src/pages/Experiment/training/props.tsx index ccd51997..48d72c0d 100644 --- a/react-ui/src/pages/Experiment/training/props.tsx +++ b/react-ui/src/pages/Experiment/training/props.tsx @@ -109,7 +109,8 @@ const Props = forwardRef((_, ref) => { // 获取实验日志和实验结果 setExperimentLogList([]); setExperimentResults([]); - if (e.item && e.item.getModel()) { + // 如果已经运行到了 + if (e.item?.getModel()?.component_id) { const model = e.item.getModel(); const start_time = dayjs(model.experimentStartTime).valueOf() * 1.0e6; const params = {