|
|
|
@@ -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 ? <DownOutlined /> : <UpOutlined />} |
|
|
|
</div> |
|
|
|
)} |
|
|
|
{showLog && <div className={styles['log-group__detail']}>{logText}</div>} |
|
|
|
{showLog && ( |
|
|
|
<div className={styles['log-group__detail']}>{logText ? logText : '暂无日志'}</div> |
|
|
|
)} |
|
|
|
<div className={styles['log-group__more-button']}> |
|
|
|
{showMoreBtn && ( |
|
|
|
<Button |
|
|
|
|