-
数据总数:{total} 个
-
+
+
+
+
+ 数据总数:{total} 个
setInputText(e.target.value)}
value={inputText}
/>
}
>
新建代码配置
-
- {dataList && dataList.length !== 0 && (
- <>
-
- {dataList.map((item) => (
-
- ))}
-
-
+
+ {dataList.map((item) => (
+
+ ))}
+
+
+ >
+ )}
+ {dataList && dataList.length === 0 && (
+
- >
- )}
- {dataList && dataList.length === 0 && (
-
- )}
+ )}
+
);
}
diff --git a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less
index c5d4abaa..41415a9a 100644
--- a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less
+++ b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less
@@ -2,51 +2,97 @@
position: relative;
width: calc(25% - 15px);
padding: 20px;
- background: white;
- border: 1px solid #eaeaea;
+ background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
+ border: 2px solid white;
border-radius: 4px;
+ box-shadow: 0px 3px 10px rgba(164, 169, 181, 0.13);
cursor: pointer;
+ &:hover {
+ border-color: @primary-color;
+ }
+
@media screen and (max-width: 1860px) {
& {
width: calc(33.33% - 13.33px);
}
}
- &__name {
+ &__icon {
+ flex: none;
+ width: 16px;
+ height: 16px;
margin-right: 10px;
+ }
+
+ &__name {
+ position: relative;
+ margin-right: 20px;
margin-bottom: 0 !important;
color: @text-color;
+ font-weight: 500;
font-size: 16px;
+
+ &::after {
+ position: absolute;
+ top: 14px;
+ left: 0;
+ width: 100%;
+ height: 6px;
+ background: linear-gradient(
+ to right,
+ .addAlpha(@primary-color, 0.4) [] 0,
+ .addAlpha(@primary-color, 0) [] 100%
+ );
+ content: '';
+ }
+ }
+
+ &:hover &__name {
+ color: @primary-color;
}
&__tag {
- padding: 2px 11px;
- font-size: 12px;
- border-radius: 1000px;
+ flex: none;
+ padding: 1px 10px;
+ font-size: 13px;
+ border-radius: 2px;
&--public {
color: @primary-color;
- background-color: .addAlpha(@primary-color, 0.08) [];
- border-color: .addAlpha(@primary-color, 0.5) [];
+ background-color: .addAlpha(@primary-color, 0.1) [];
+ border: 1px solid .addAlpha(@primary-color, 0.5) [];
}
&--private {
color: @warning-color;
- background-color: .addAlpha(@warning-color, 0.08) [];
- border-color: .addAlpha(@warning-color, 0.5) [];
+ background-color: .addAlpha(@warning-color, 0.1) [];
+ border: 1px solid .addAlpha(@warning-color, 0.5) [];
}
}
+ :global {
+ .ant-btn {
+ flex: none;
+ color: #808080;
+ }
+ }
+
+ &__url-box {
+ margin-bottom: 15px;
+ padding: 14px;
+ background-color: .addAlpha(@primary-color, 0.04) [];
+ border-radius: 4px;
+ }
+
&__url {
- margin-bottom: 10px !important;
- color: @text-color-secondary;
+ margin-bottom: 15px !important;
+ color: @text-color;
font-size: 14px;
}
&__branch {
- margin-bottom: 20px;
- color: @text-color-tertiary;
+ color: @text-color-secondary;
font-size: 14px;
}
@@ -59,13 +105,4 @@
color: #808080;
font-size: 13px;
}
-
- &:hover {
- border-color: @primary-color;
- box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.1);
- }
-
- &:hover &__name {
- color: @primary-color;
- }
}
diff --git a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.tsx b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.tsx
index fe062bac..de903f47 100644
--- a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.tsx
+++ b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.tsx
@@ -19,6 +19,11 @@ function CodeConfigItem({ item, onClick, onEdit, onRemove }: CodeConfigItemProps
return (
onClick?.(item)}>
+
-
- {item.git_url}
-
-
{item.git_branch}
+
+
+ {item.git_url}
+
+
{item.git_branch}
+
{
+ const handleTableChange: TableProps['onChange'] = (
+ pagination,
+ _filters,
+ _sorter,
+ { action },
+ ) => {
if (action === 'paginate') {
setPagination(pagination);
}
diff --git a/react-ui/src/pages/Experiment/Comparison/index.less b/react-ui/src/pages/Experiment/Comparison/index.less
index b9198e74..3be69ed9 100644
--- a/react-ui/src/pages/Experiment/Comparison/index.less
+++ b/react-ui/src/pages/Experiment/Comparison/index.less
@@ -18,6 +18,26 @@
background-color: white;
border-radius: 10px;
+ &__footer {
+ display: flex;
+ align-items: center;
+ padding-top: 20px;
+ color: @text-color-secondary;
+ font-size: 12px;
+ background-color: white;
+
+ div {
+ flex: 1;
+ height: 1px;
+ background-color: @border-color-base;
+ }
+
+ p {
+ flex: none;
+ margin: 0 8px;
+ }
+ }
+
:global {
.ant-table-container {
border: none !important;
@@ -34,6 +54,13 @@
border-left: none !important;
}
}
+ .ant-table-tbody-virtual::after {
+ border-bottom: none !important;
+ }
+ .ant-table-footer {
+ padding: 0;
+ border: none !important;
+ }
}
}
}
diff --git a/react-ui/src/pages/Experiment/Comparison/index.tsx b/react-ui/src/pages/Experiment/Comparison/index.tsx
index fe09198b..b900842c 100644
--- a/react-ui/src/pages/Experiment/Comparison/index.tsx
+++ b/react-ui/src/pages/Experiment/Comparison/index.tsx
@@ -1,13 +1,19 @@
-// import { useCacheState } from '@/hooks/pageCacheState';
+/*
+ * @Author: 赵伟
+ * @Date: 2024-10-10 09:55:12
+ * @Description: 实验对比
+ */
+
import {
getExpEvaluateInfosReq,
getExpMetricsReq,
getExpTrainInfosReq,
} from '@/services/experiment';
+import { tableSorter } from '@/utils';
import { to } from '@/utils/promise';
import tableCellRender, { TableCellValueType } from '@/utils/table';
import { useSearchParams } from '@umijs/max';
-import { App, Button, Table, /* TablePaginationConfig,*/ TableProps, Tooltip } from 'antd';
+import { App, Button, Table, TablePaginationConfig, TableProps, Tooltip } from 'antd';
import classNames from 'classnames';
import { useEffect, useMemo, useState } from 'react';
import ExperimentStatusCell from '../components/ExperimentStatusCell';
@@ -20,10 +26,10 @@ type TableData = {
dataset: string[];
start_time: string;
status: string;
- metrics_names: string[];
- metrics: Record;
- params_names: string[];
- params: Record;
+ metrics_names?: string[];
+ metrics?: Record;
+ params_names?: string[];
+ params?: Record;
};
function ExperimentComparison() {
@@ -31,18 +37,15 @@ function ExperimentComparison() {
const comparisonType = searchParams.get('type') as ComparisonType;
const experimentId = searchParams.get('id');
const [tableData, setTableData] = useState([]);
- // const [cacheState, setCacheState] = useCacheState();
- // const [total, setTotal] = useState(0);
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
- // const [loading, setLoading] = useState(false);
+ const [total, setTotal] = useState(0);
+ const [pagination, setPagination] = useState({
+ current: 1,
+ pageSize: 10,
+ });
+
const { message } = App.useApp();
const config = useMemo(() => comparisonConfig[comparisonType], [comparisonType]);
- // const [pagination, setPagination] = useState(
- // cacheState?.pagination ?? {
- // current: 1,
- // pageSize: 10,
- // },
- // );
useEffect(() => {
getComparisonData();
@@ -50,15 +53,17 @@ function ExperimentComparison() {
// 获取对比数据列表
const getComparisonData = async () => {
- // setLoading(true);
const request =
comparisonType === ComparisonType.Train ? getExpTrainInfosReq : getExpEvaluateInfosReq;
- const [res] = await to(request(experimentId, { offset: '', limit: 50 }));
- // setLoading(false);
+ const params = {
+ page: pagination.current! - 1,
+ size: pagination.pageSize,
+ };
+ const [res] = await to(request(experimentId, params));
if (res && res.data) {
- // const { content = [], totalElements = 0 } = res.data;
- setTableData(res.data);
- // setTotal(totalElements);
+ const { content = [], totalElements = 0 } = res.data;
+ setTableData(content);
+ setTotal(totalElements);
}
};
@@ -80,17 +85,10 @@ function ExperimentComparison() {
getExpMetrics();
};
- // 分页切换
- // const handleTableChange: TableProps['onChange'] = (pagination, filters, sorter, { action }) => {
- // if (action === 'paginate') {
- // setPagination(pagination);
- // }
- // // console.log(pagination, filters, sorter, action);
- // };
-
// 选择行
- const rowSelection: TableProps['rowSelection'] = {
+ const rowSelection: TableProps['rowSelection'] = {
type: 'checkbox',
+ columnWidth: 48,
fixed: 'left',
selectedRowKeys,
onChange: (selectedRowKeys: React.Key[]) => {
@@ -98,8 +96,24 @@ function ExperimentComparison() {
},
};
+ // 分页切换
+ const handleTableChange: TableProps['onChange'] = (
+ pagination,
+ _filters,
+ _sorter,
+ { action },
+ ) => {
+ if (action === 'paginate') {
+ setPagination(pagination);
+ }
+ };
+
const columns: TableProps['columns'] = useMemo(() => {
- const first: TableData | undefined = tableData[0];
+ const first: TableData | undefined = tableData.find(
+ (item) => item.metrics_names && item.metrics_names.length > 0,
+ );
+ const metricsNames = first?.metrics_names ?? [];
+ const paramsNames = first?.params_names ?? [];
return [
{
title: '基本信息',
@@ -147,7 +161,7 @@ function ExperimentComparison() {
{
title: `${config.title}参数`,
align: 'center',
- children: first?.params_names.map((name) => ({
+ children: paramsNames.map((name) => ({
title: (
{name}
@@ -159,14 +173,14 @@ function ExperimentComparison() {
align: 'center',
render: tableCellRender(true),
ellipsis: { showTitle: false },
- sorter: (a, b) => a.params[name] - b.params[name],
+ sorter: (a, b) => tableSorter(a.params?.[name], b.params?.[name]),
showSorterTooltip: false,
})),
},
{
title: `${config.title}指标`,
align: 'center',
- children: first?.metrics_names.map((name) => ({
+ children: metricsNames.map((name) => ({
title: (
{name}
@@ -178,7 +192,7 @@ function ExperimentComparison() {
align: 'center',
render: tableCellRender(true),
ellipsis: { showTitle: false },
- sorter: (a, b) => a.metrics[name] - b.metrics[name],
+ sorter: (a, b) => tableSorter(a.metrics?.[name], b.metrics?.[name]),
showSorterTooltip: false,
})),
},
@@ -192,30 +206,21 @@ function ExperimentComparison() {
可视化对比
-
+
record.run_id || record.experiment_ins_id}
/>
diff --git a/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx b/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx
index 4758a165..2b7e80c5 100644
--- a/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx
+++ b/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx
@@ -126,7 +126,7 @@ function AddExperimentModal({
,
-