diff --git a/react-ui/src/pages/Experiment/components/LogGroup/index.tsx b/react-ui/src/pages/Experiment/components/LogGroup/index.tsx index 655e0b92..5123fae1 100644 --- a/react-ui/src/pages/Experiment/components/LogGroup/index.tsx +++ b/react-ui/src/pages/Experiment/components/LogGroup/index.tsx @@ -17,7 +17,6 @@ import styles from './index.less'; export type LogGroupProps = ExperimentLog & { status?: ExperimentStatus; // 实验状态 - listId: string; }; type Log = { @@ -32,7 +31,6 @@ function LogGroup({ log_content = '', start_time, status, - listId, }: LogGroupProps) { const [collapse, setCollapse] = useState(true); const [logList, setLogList, logListRef] = useStateRef([]); @@ -42,6 +40,7 @@ function LogGroup({ const preStatusRef = useRef(undefined); const socketRef = useRef(undefined); const retryRef = useRef(2); // 等待 2 秒,重试 3 次 + const elementRef = useRef(null); useEffect(() => { scrollToBottom(false); @@ -124,7 +123,7 @@ function LogGroup({ const setupSockect = () => { let { host } = location; if (process.env.NODE_ENV === 'development') { - host = '172.20.32.181:31213'; + host = '172.20.32.197:31213'; } const socket = new WebSocket( `ws://${host}/newlog/realtimeLog?start=${start_time}&query={pod="${pod_name}"}`, @@ -150,7 +149,7 @@ function LogGroup({ }); socket.addEventListener('message', (event) => { - console.log('message received.', event); + // console.log('message received.', event); if (!event.data) { return; } @@ -201,15 +200,15 @@ function LogGroup({ // 滚动到底部 const scrollToBottom = (smooth: boolean = true) => { - const element = document.getElementById(listId); - if (element) { - const optons: ScrollToOptions = { - top: element.scrollHeight, - behavior: smooth ? 'smooth' : 'instant', - }; - - element.scrollTo(optons); - } + // const element = document.getElementById(listId); + // if (element) { + // const optons: ScrollToOptions = { + // top: element.scrollHeight, + // behavior: smooth ? 'smooth' : 'instant', + // }; + // element.scrollTo(optons); + // } + elementRef?.current?.scrollIntoView({ block: 'end', behavior: smooth ? 'smooth' : 'instant' }); }; const showLog = (log_type === 'resource' && !collapse) || log_type === 'normal'; @@ -217,7 +216,7 @@ function LogGroup({ const showMoreBtn = status !== ExperimentStatus.Running && showLog && !completed && logText !== ''; return ( -
+
{log_type === 'resource' && (
{pod_name}
diff --git a/react-ui/src/pages/Experiment/components/LogList/index.tsx b/react-ui/src/pages/Experiment/components/LogList/index.tsx index b45fdae4..86c97d15 100644 --- a/react-ui/src/pages/Experiment/components/LogList/index.tsx +++ b/react-ui/src/pages/Experiment/components/LogList/index.tsx @@ -1,8 +1,9 @@ import { ExperimentStatus } from '@/enums'; import { getQueryByExperimentLog } from '@/services/experiment/index.js'; import { to } from '@/utils/promise'; +import classNames from 'classnames'; import dayjs from 'dayjs'; -import { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import LogGroup from '../LogGroup'; import styles from './index.less'; @@ -14,23 +15,25 @@ export type ExperimentLog = { }; type LogListProps = { - idPrefix?: string; // 当一个页面有多个日志组件时,使用这个变量作为唯一性标识 instanceName: string; // 实验实例 name instanceNamespace: string; // 实验实例 namespace pipelineNodeId: string; // 流水线节点 id workflowId?: string; // 实验实例工作流 id instanceNodeStartTime?: string; // 实验实例节点开始运行时间 instanceNodeStatus?: ExperimentStatus; + className?: string; + style?: React.CSSProperties; }; function LogList({ - idPrefix, instanceName, instanceNamespace, pipelineNodeId, workflowId, instanceNodeStartTime, instanceNodeStatus, + className, + style, }: LogListProps) { const [logList, setLogList] = useState([]); const preStatusRef = useRef(undefined); @@ -88,15 +91,10 @@ function LogList({ } }; - // 当一个页面有多个日志组件时,使用这个变量作为唯一性标识 - const listId = idPrefix ? `${idPrefix}-log-list` : 'log-list'; - return ( -
+
{logList.length > 0 ? ( - logList.map((v) => ( - - )) + logList.map((v) => ) ) : (
暂无日志
)} diff --git a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.less b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.less index 04160e95..69ef78cc 100644 --- a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.less +++ b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.less @@ -38,8 +38,7 @@ .cell-index { position: relative; width: 100%; - padding-left: 20px; - text-align: left; + white-space: nowrap; &__best-tag { margin-left: 8px; @@ -47,8 +46,8 @@ color: @success-color; font-weight: normal; font-size: 13px; + white-space: nowrap; background-color: .addAlpha(@success-color, 0.1) []; - // border: 1px solid .addAlpha(@success-color, 0.5) []; border-radius: 2px; } } diff --git a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx index 0263bd69..3b3822d9 100644 --- a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx +++ b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx @@ -32,8 +32,7 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { title: '序号', dataIndex: 'index', key: 'index', - width: 120, - align: 'center', + width: 110, render: (_text, record, index: number) => { return (
diff --git a/react-ui/src/pages/HyperParameter/components/ExperimentLog/index.tsx b/react-ui/src/pages/HyperParameter/components/ExperimentLog/index.tsx index 90da4ff5..b27c20fe 100644 --- a/react-ui/src/pages/HyperParameter/components/ExperimentLog/index.tsx +++ b/react-ui/src/pages/HyperParameter/components/ExperimentLog/index.tsx @@ -46,7 +46,6 @@ function ExperimentLog({ instanceInfo, nodes }: ExperimentLogProps) {
{frameworkCloneNodeStatus && ( {trainCloneNodeStatus && ( {hpoNodeStatus && ( -
+
+
+
) } -function Component() { +function SubComponent() { return ( -
-
- +
+
)