From 411dee0ebf51808a9650a90cf8fca2b98265061b Mon Sep 17 00:00:00 2001 From: zhaowei Date: Sat, 10 May 2025 10:29:32 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=20=E8=87=AA=E5=8A=A8=E6=9C=BA?= =?UTF-8?q?=E5=99=A8=E5=AD=A6=E4=B9=A0=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/hooks/useSSE.ts | 5 +++-- react-ui/src/hooks/useServerTime.ts | 2 +- .../components/ExperimentInstanceList/index.less | 10 ++++++---- .../AutoML/components/ExperimentList/index.tsx | 7 ++++--- .../Dataset/components/ResourceItem/index.less | 1 + .../pages/Dataset/components/ResourceItem/index.tsx | 13 +++++++------ .../pages/ModelDeployment/CreateVersion/index.less | 7 +++++++ .../pages/ModelDeployment/CreateVersion/index.tsx | 6 +++++- 8 files changed, 34 insertions(+), 17 deletions(-) diff --git a/react-ui/src/hooks/useSSE.ts b/react-ui/src/hooks/useSSE.ts index 9f364f68..4ed9d7f2 100644 --- a/react-ui/src/hooks/useSSE.ts +++ b/react-ui/src/hooks/useSSE.ts @@ -5,8 +5,9 @@ import { NodeStatus } from '@/types'; export type MessageHandler = (experimentInsId: number, status: string, finishedAt: string, nodes: Record) => void export const useSSE = (experimentInsId: number, status: ExperimentStatus, name: string, namespace: string, onMessage: MessageHandler) => { + const isRunning = status === ExperimentStatus.Pending || status === ExperimentStatus.Running useEffect(() => { - if (status === ExperimentStatus.Pending || status === ExperimentStatus.Running) { + if (isRunning) { const { origin } = location; const params = encodeURIComponent(`metadata.namespace=${namespace},metadata.name=${name}`); const evtSource = new EventSource( @@ -35,5 +36,5 @@ export const useSSE = (experimentInsId: number, status: ExperimentStatus, name: } } - }, [experimentInsId, status, name, namespace, onMessage]); + }, [experimentInsId, isRunning, name, namespace, onMessage]); }; diff --git a/react-ui/src/hooks/useServerTime.ts b/react-ui/src/hooks/useServerTime.ts index 89b39775..45eeea06 100644 --- a/react-ui/src/hooks/useServerTime.ts +++ b/react-ui/src/hooks/useServerTime.ts @@ -17,7 +17,7 @@ export const globalGetSeverTime = async () => { const requestDuration = (requestEndTime - requestStartTime) / 2; if (res && res.data) { const serverDate = new Date(res.data); - const timeOffset = serverDate.getTime() + requestDuration - requestEndTime ; + const timeOffset = serverDate.getTime() + requestDuration - requestEndTime; globalTimeOffset = timeOffset; return timeOffset } diff --git a/react-ui/src/pages/AutoML/components/ExperimentInstanceList/index.less b/react-ui/src/pages/AutoML/components/ExperimentInstanceList/index.less index 833ced06..94258c7f 100644 --- a/react-ui/src/pages/AutoML/components/ExperimentInstanceList/index.less +++ b/react-ui/src/pages/AutoML/components/ExperimentInstanceList/index.less @@ -1,3 +1,5 @@ +@cellWidth: calc(100% + 32px + 33px - 48px - 200px - 344px); + .tableExpandBox { display: flex; align-items: center; @@ -11,22 +13,22 @@ } .check { - width: calc((100% + 32px + 33px) / 5 / 2); + width: calc(@cellWidth * 3 / 20); // 15% } .index { - width: calc((100% + 32px + 33px) / 5 / 2); + width: calc(@cellWidth * 3 / 20); // 15% } .description { display: flex; - flex: 1; align-items: center; + width: calc(@cellWidth / 2); // 50% } .startTime { .singleLine(); - width: 200px; + width: calc(@cellWidth / 5); // 20% } .status { diff --git a/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx b/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx index b71952b2..15846f9c 100644 --- a/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx +++ b/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx @@ -302,7 +302,7 @@ function ExperimentList({ type }: ExperimentListProps) { title: '类型', dataIndex: 'type', key: 'type', - width: '10%', + width: '15%', render: tableCellRender(false, TableCellValueType.Enum, { options: autoMLTypeOptions, }), @@ -316,7 +316,7 @@ function ExperimentList({ type }: ExperimentListProps) { title: '实验名称', dataIndex: config.nameProperty, key: 'name', - width: '20%', + width: '30%', render: tableCellRender(false, TableCellValueType.Link, { onClick: gotoDetail, }), @@ -326,13 +326,14 @@ function ExperimentList({ type }: ExperimentListProps) { dataIndex: config.descProperty, key: 'description', render: tableCellRender(true), + width: type === ExperimentListType.AutoML ? '35%' : '50%', }, ...diffColumns, { title: '创建时间', dataIndex: 'update_time', key: 'update_time', - width: 200, + width: '20%', render: tableCellRender(false, TableCellValueType.Date), }, { diff --git a/react-ui/src/pages/Dataset/components/ResourceItem/index.less b/react-ui/src/pages/Dataset/components/ResourceItem/index.less index 58b5be62..618423e1 100644 --- a/react-ui/src/pages/Dataset/components/ResourceItem/index.less +++ b/react-ui/src/pages/Dataset/components/ResourceItem/index.less @@ -58,5 +58,6 @@ align-items: center; color: #808080; font-size: 13px; + min-width: 0; } } diff --git a/react-ui/src/pages/Dataset/components/ResourceItem/index.tsx b/react-ui/src/pages/Dataset/components/ResourceItem/index.tsx index a8cabfe9..22078902 100644 --- a/react-ui/src/pages/Dataset/components/ResourceItem/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourceItem/index.tsx @@ -14,6 +14,10 @@ type ResourceItemProps = { }; function ResourceItem({ item, isPublic, onClick, onRemove }: ResourceItemProps) { + const timeAgo = + '最近更新: ' + + (item.update_time ? formatDate(item.update_time, 'YYYY-MM-DD') : item.time_ago ?? ''); + const create_by = item.create_by ?? ''; return (
onClick(item)}> @@ -37,7 +41,7 @@ function ResourceItem({ item, isPublic, onClick, onRemove }: ResourceItemProps) )}
{item.description}
- +
- {item.create_by ?? ''} + {create_by}
- - {'最近更新: '} - {item.update_time ? formatDate(item.update_time, 'YYYY-MM-DD') : item.time_ago ?? ''} - + {timeAgo}
diff --git a/react-ui/src/pages/ModelDeployment/CreateVersion/index.less b/react-ui/src/pages/ModelDeployment/CreateVersion/index.less index bf7f7f9d..9186a023 100644 --- a/react-ui/src/pages/ModelDeployment/CreateVersion/index.less +++ b/react-ui/src/pages/ModelDeployment/CreateVersion/index.less @@ -36,6 +36,13 @@ .ant-btn-variant-text { color: #565658; } + + .anticon-question-circle { + margin-top: -12px; + margin-left: 1px !important; + color: @text-color-tertiary !important; + font-size: 12px !important; + } } } } diff --git a/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx b/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx index 6a6ecc0b..324b77a8 100644 --- a/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx +++ b/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx @@ -337,7 +337,11 @@ function CreateServiceVersion() { - +