| @@ -0,0 +1,3 @@ | |||||
| .ant-table .ant-table-cell .kf-table-col-title { | |||||
| margin-bottom: 0; | |||||
| } | |||||
| @@ -0,0 +1,32 @@ | |||||
| /* | |||||
| * @Author: 赵伟 | |||||
| * @Date: 2025-03-11 10:52:23 | |||||
| * @Description: 用于内容可变的表格类标题 | |||||
| */ | |||||
| import { Typography } from 'antd'; | |||||
| import classNames from 'classnames'; | |||||
| import './index.less'; | |||||
| type TableColTitleProps = { | |||||
| /** 标题 */ | |||||
| title: string; | |||||
| /** 自定义类名 */ | |||||
| className?: string; | |||||
| /** 自定义样式 */ | |||||
| style?: React.CSSProperties; | |||||
| }; | |||||
| function TableColTitle({ title, className, style }: TableColTitleProps) { | |||||
| return ( | |||||
| <Typography.Paragraph | |||||
| ellipsis={{ tooltip: title }} | |||||
| className={classNames('kf-table-col-title', className)} | |||||
| style={style} | |||||
| > | |||||
| {title} | |||||
| </Typography.Paragraph> | |||||
| ); | |||||
| } | |||||
| export default TableColTitle; | |||||
| @@ -58,7 +58,7 @@ function ResourceVersion({ resourceType, info }: ResourceVersionProps) { | |||||
| title: '文件大小', | title: '文件大小', | ||||
| dataIndex: 'file_size', | dataIndex: 'file_size', | ||||
| key: 'file_size', | key: 'file_size', | ||||
| render: tableCellRender(), | |||||
| render: tableCellRender(false), | |||||
| }, | }, | ||||
| { | { | ||||
| title: '更新时间', | title: '更新时间', | ||||
| @@ -99,7 +99,13 @@ function ResourceVersion({ resourceType, info }: ResourceVersionProps) { | |||||
| </Button> | </Button> | ||||
| </Flex> | </Flex> | ||||
| </Flex> | </Flex> | ||||
| <Table columns={columns} dataSource={fileList} pagination={false} rowKey="url" /> | |||||
| <Table | |||||
| columns={columns} | |||||
| dataSource={fileList} | |||||
| pagination={false} | |||||
| rowKey="url" | |||||
| tableLayout="fixed" | |||||
| /> | |||||
| </div> | </div> | ||||
| ); | ); | ||||
| } | } | ||||
| @@ -34,13 +34,13 @@ | |||||
| border-left: none !important; | border-left: none !important; | ||||
| } | } | ||||
| } | } | ||||
| .ant-table-tbody-virtual::after { | |||||
| border-bottom: none !important; | |||||
| } | |||||
| .ant-table-footer { | .ant-table-footer { | ||||
| padding: 0; | padding: 0; | ||||
| border: none !important; | border: none !important; | ||||
| } | } | ||||
| .ant-table-column-title { | |||||
| min-width: 0; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -4,6 +4,7 @@ | |||||
| * @Description: 实验对比 | * @Description: 实验对比 | ||||
| */ | */ | ||||
| import TableColTitle from '@/components/TableColTitle'; | |||||
| import { | import { | ||||
| getExpEvaluateInfosReq, | getExpEvaluateInfosReq, | ||||
| getExpMetricsReq, | getExpMetricsReq, | ||||
| @@ -13,7 +14,7 @@ import { tableSorter } from '@/utils'; | |||||
| import { to } from '@/utils/promise'; | import { to } from '@/utils/promise'; | ||||
| import tableCellRender, { TableCellValueType } from '@/utils/table'; | import tableCellRender, { TableCellValueType } from '@/utils/table'; | ||||
| import { useSearchParams } from '@umijs/max'; | import { useSearchParams } from '@umijs/max'; | ||||
| import { App, Button, Table, TablePaginationConfig, TableProps, Tooltip } from 'antd'; | |||||
| import { App, Button, Table, TablePaginationConfig, TableProps } from 'antd'; | |||||
| import classNames from 'classnames'; | import classNames from 'classnames'; | ||||
| import { useEffect, useMemo, useState } from 'react'; | import { useEffect, useMemo, useState } from 'react'; | ||||
| import ExperimentStatusCell from '../components/ExperimentStatusCell'; | import ExperimentStatusCell from '../components/ExperimentStatusCell'; | ||||
| @@ -161,14 +162,10 @@ function ExperimentComparison() { | |||||
| title: `${config.title}参数`, | title: `${config.title}参数`, | ||||
| align: 'center', | align: 'center', | ||||
| children: paramsNames.map((name) => ({ | children: paramsNames.map((name) => ({ | ||||
| title: ( | |||||
| <Tooltip title={name}> | |||||
| <span>{name}</span> | |||||
| </Tooltip> | |||||
| ), | |||||
| title: <TableColTitle title={name} />, | |||||
| dataIndex: ['params', name], | dataIndex: ['params', name], | ||||
| key: name, | key: name, | ||||
| width: 120, | |||||
| width: 150, | |||||
| align: 'center', | align: 'center', | ||||
| render: tableCellRender(true), | render: tableCellRender(true), | ||||
| sorter: (a, b) => tableSorter(a.params?.[name], b.params?.[name]), | sorter: (a, b) => tableSorter(a.params?.[name], b.params?.[name]), | ||||
| @@ -179,14 +176,10 @@ function ExperimentComparison() { | |||||
| title: `${config.title}指标`, | title: `${config.title}指标`, | ||||
| align: 'center', | align: 'center', | ||||
| children: metricsNames.map((name) => ({ | children: metricsNames.map((name) => ({ | ||||
| title: ( | |||||
| <Tooltip title={name}> | |||||
| <span>{name}</span> | |||||
| </Tooltip> | |||||
| ), | |||||
| title: <TableColTitle title={name} />, | |||||
| dataIndex: ['metrics', name], | dataIndex: ['metrics', name], | ||||
| key: name, | key: name, | ||||
| width: 120, | |||||
| width: 150, | |||||
| align: 'center', | align: 'center', | ||||
| render: tableCellRender(true), | render: tableCellRender(true), | ||||
| sorter: (a, b) => tableSorter(a.metrics?.[name], b.metrics?.[name]), | sorter: (a, b) => tableSorter(a.metrics?.[name], b.metrics?.[name]), | ||||
| @@ -1,12 +1,13 @@ | |||||
| import InfoGroup from '@/components/InfoGroup'; | import InfoGroup from '@/components/InfoGroup'; | ||||
| import KFIcon from '@/components/KFIcon'; | import KFIcon from '@/components/KFIcon'; | ||||
| import TableColTitle from '@/components/TableColTitle'; | |||||
| import TrialStatusCell from '@/pages/HyperParameter/components/TrialStatusCell'; | import TrialStatusCell from '@/pages/HyperParameter/components/TrialStatusCell'; | ||||
| import { HyperParameterFile, HyperParameterTrial } from '@/pages/HyperParameter/types'; | import { HyperParameterFile, HyperParameterTrial } from '@/pages/HyperParameter/types'; | ||||
| import { getExpMetricsReq } from '@/services/hyperParameter'; | import { getExpMetricsReq } from '@/services/hyperParameter'; | ||||
| import { downLoadZip } from '@/utils/downloadfile'; | import { downLoadZip } from '@/utils/downloadfile'; | ||||
| import { to } from '@/utils/promise'; | import { to } from '@/utils/promise'; | ||||
| import tableCellRender, { TableCellValueType } from '@/utils/table'; | import tableCellRender, { TableCellValueType } from '@/utils/table'; | ||||
| import { App, Button, Table, Tooltip, Tree, type TableProps, type TreeDataNode } from 'antd'; | |||||
| import { App, Button, Table, Tree, type TableProps, type TreeDataNode } from 'antd'; | |||||
| import classNames from 'classnames'; | import classNames from 'classnames'; | ||||
| import { useEffect, useState } from 'react'; | import { useEffect, useState } from 'react'; | ||||
| import styles from './index.less'; | import styles from './index.less'; | ||||
| @@ -46,6 +47,7 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { | |||||
| dataIndex: 'index', | dataIndex: 'index', | ||||
| key: 'index', | key: 'index', | ||||
| width: 100, | width: 100, | ||||
| fixed: 'left', | |||||
| render: (_text, record, index: number) => { | render: (_text, record, index: number) => { | ||||
| return ( | return ( | ||||
| <div className={styles['cell-index']}> | <div className={styles['cell-index']}> | ||||
| @@ -56,27 +58,36 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| title: '运行次数', | |||||
| dataIndex: 'training_iteration', | |||||
| key: 'training_iteration', | |||||
| width: 120, | |||||
| render: tableCellRender(false), | |||||
| }, | |||||
| { | |||||
| title: '平均时长(秒)', | |||||
| dataIndex: 'time_avg', | |||||
| key: 'time_avg', | |||||
| width: 150, | |||||
| render: tableCellRender(false, TableCellValueType.Custom, { | |||||
| format: (value = 0) => Number(value).toFixed(2), | |||||
| }), | |||||
| }, | |||||
| { | |||||
| title: '状态', | |||||
| dataIndex: 'status', | |||||
| key: 'status', | |||||
| width: 120, | |||||
| render: TrialStatusCell, | |||||
| title: '基本信息', | |||||
| align: 'center', | |||||
| children: [ | |||||
| { | |||||
| title: '运行次数', | |||||
| dataIndex: 'training_iteration', | |||||
| key: 'training_iteration', | |||||
| width: 120, | |||||
| fixed: 'left', | |||||
| render: tableCellRender(false), | |||||
| }, | |||||
| { | |||||
| title: '平均时长(秒)', | |||||
| dataIndex: 'time_avg', | |||||
| key: 'time_avg', | |||||
| width: 150, | |||||
| fixed: 'left', | |||||
| render: tableCellRender(false, TableCellValueType.Custom, { | |||||
| format: (value = 0) => Number(value).toFixed(2), | |||||
| }), | |||||
| }, | |||||
| { | |||||
| title: '状态', | |||||
| dataIndex: 'status', | |||||
| key: 'status', | |||||
| width: 120, | |||||
| fixed: 'left', | |||||
| render: TrialStatusCell, | |||||
| }, | |||||
| ], | |||||
| }, | }, | ||||
| ]; | ]; | ||||
| @@ -87,11 +98,7 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { | |||||
| key: 'config', | key: 'config', | ||||
| align: 'center', | align: 'center', | ||||
| children: paramsNames.map((name) => ({ | children: paramsNames.map((name) => ({ | ||||
| title: ( | |||||
| <Tooltip title={name}> | |||||
| <span>{name}</span> | |||||
| </Tooltip> | |||||
| ), | |||||
| title: <TableColTitle title={name} />, | |||||
| dataIndex: ['config', name], | dataIndex: ['config', name], | ||||
| key: name, | key: name, | ||||
| width: 120, | width: 120, | ||||
| @@ -108,11 +115,7 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { | |||||
| key: 'metrics', | key: 'metrics', | ||||
| align: 'center', | align: 'center', | ||||
| children: metricNames.map((name) => ({ | children: metricNames.map((name) => ({ | ||||
| title: ( | |||||
| <Tooltip title={name}> | |||||
| <span>{name}</span> | |||||
| </Tooltip> | |||||
| ), | |||||
| title: <TableColTitle title={name} />, | |||||
| dataIndex: ['metric_analysis', name], | dataIndex: ['metric_analysis', name], | ||||
| key: name, | key: name, | ||||
| width: 120, | width: 120, | ||||
| @@ -1,10 +1,11 @@ | |||||
| import TableColTitle from '@/components/TableColTitle'; | |||||
| import { | import { | ||||
| getReqParamName, | getReqParamName, | ||||
| type FormParameter, | type FormParameter, | ||||
| } from '@/pages/HyperParameter/components/CreateForm/utils'; | } from '@/pages/HyperParameter/components/CreateForm/utils'; | ||||
| import { HyperParameterData } from '@/pages/HyperParameter/types'; | import { HyperParameterData } from '@/pages/HyperParameter/types'; | ||||
| import tableCellRender, { TableCellValueType } from '@/utils/table'; | import tableCellRender, { TableCellValueType } from '@/utils/table'; | ||||
| import { Table, Tooltip, type TableProps } from 'antd'; | |||||
| import { Table, type TableProps } from 'antd'; | |||||
| import { useMemo } from 'react'; | import { useMemo } from 'react'; | ||||
| import styles from './index.less'; | import styles from './index.less'; | ||||
| @@ -69,11 +70,7 @@ function ParameterInfo({ info }: ParameterInfoProps) { | |||||
| runParameters.length > 0 | runParameters.length > 0 | ||||
| ? parameters.map(({ name }) => { | ? parameters.map(({ name }) => { | ||||
| return { | return { | ||||
| title: ( | |||||
| <Tooltip title={name}> | |||||
| <span>{name}</span> | |||||
| </Tooltip> | |||||
| ), | |||||
| title: <TableColTitle title={name} />, | |||||
| dataIndex: name, | dataIndex: name, | ||||
| key: name, | key: name, | ||||
| width: 150, | width: 150, | ||||
| @@ -85,7 +82,14 @@ function ParameterInfo({ info }: ParameterInfoProps) { | |||||
| return ( | return ( | ||||
| <div className={styles['parameter-info']}> | <div className={styles['parameter-info']}> | ||||
| <div className={styles['parameter-info__title']}>超参数</div> | <div className={styles['parameter-info__title']}>超参数</div> | ||||
| <Table dataSource={parameters} columns={columns} rowKey="name" bordered pagination={false} /> | |||||
| <Table | |||||
| dataSource={parameters} | |||||
| columns={columns} | |||||
| rowKey="name" | |||||
| bordered | |||||
| pagination={false} | |||||
| tableLayout="fixed" | |||||
| /> | |||||
| <div className={styles['parameter-info__title']}>手动运行超参数</div> | <div className={styles['parameter-info__title']}>手动运行超参数</div> | ||||
| <Table | <Table | ||||
| dataSource={runParameters} | dataSource={runParameters} | ||||
| @@ -94,6 +98,7 @@ function ParameterInfo({ info }: ParameterInfoProps) { | |||||
| bordered | bordered | ||||
| pagination={false} | pagination={false} | ||||
| scroll={{ x: '100%' }} | scroll={{ x: '100%' }} | ||||
| tableLayout="fixed" | |||||
| /> | /> | ||||
| </div> | </div> | ||||
| ); | ); | ||||
| @@ -21,6 +21,9 @@ | |||||
| border-left: none !important; | border-left: none !important; | ||||
| } | } | ||||
| } | } | ||||
| .ant-table-column-title { | |||||
| min-width: 0; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,10 +1,11 @@ | |||||
| import SubAreaTitle from '@/components/SubAreaTitle'; | import SubAreaTitle from '@/components/SubAreaTitle'; | ||||
| import TableColTitle from '@/components/TableColTitle'; | |||||
| import { useCheck } from '@/hooks'; | import { useCheck } from '@/hooks'; | ||||
| import { getModelPageVersionsReq, getModelVersionsMetricsReq } from '@/services/dataset'; | import { getModelPageVersionsReq, getModelVersionsMetricsReq } from '@/services/dataset'; | ||||
| import { tableSorter } from '@/utils'; | import { tableSorter } from '@/utils'; | ||||
| import { to } from '@/utils/promise'; | import { to } from '@/utils/promise'; | ||||
| import tableCellRender from '@/utils/table'; | import tableCellRender from '@/utils/table'; | ||||
| import { Checkbox, Table, Tooltip, type TablePaginationConfig, type TableProps } from 'antd'; | |||||
| import { Checkbox, Flex, Table, type TablePaginationConfig, type TableProps } from 'antd'; | |||||
| import { useEffect, useMemo, useState } from 'react'; | import { useEffect, useMemo, useState } from 'react'; | ||||
| import MetricsChart, { MetricsChatData } from '../MetricsChart'; | import MetricsChart, { MetricsChatData } from '../MetricsChart'; | ||||
| import styles from './index.less'; | import styles from './index.less'; | ||||
| @@ -174,14 +175,10 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr | |||||
| title: `训练参数`, | title: `训练参数`, | ||||
| align: 'center', | align: 'center', | ||||
| children: paramsNames.map((name) => ({ | children: paramsNames.map((name) => ({ | ||||
| title: ( | |||||
| <Tooltip title={name}> | |||||
| <span>{name}</span> | |||||
| </Tooltip> | |||||
| ), | |||||
| title: <TableColTitle title={name} />, | |||||
| dataIndex: ['params', name], | dataIndex: ['params', name], | ||||
| key: name, | key: name, | ||||
| width: 120, | |||||
| width: 150, | |||||
| align: 'center', | align: 'center', | ||||
| render: tableCellRender(true), | render: tableCellRender(true), | ||||
| sorter: (a, b) => tableSorter(a.params?.[name], b.params?.[name]), | sorter: (a, b) => tableSorter(a.params?.[name], b.params?.[name]), | ||||
| @@ -196,14 +193,14 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr | |||||
| indeterminate={metricsIndeterminate} | indeterminate={metricsIndeterminate} | ||||
| onChange={checkAllMetrics} | onChange={checkAllMetrics} | ||||
| disabled={metricsNames.length === 0} | disabled={metricsNames.length === 0} | ||||
| ></Checkbox>{' '} | |||||
| <span>训练指标</span> | |||||
| ></Checkbox> | |||||
| <span style={{ marginLeft: 4 }}>训练指标</span> | |||||
| </div> | </div> | ||||
| ), | ), | ||||
| align: 'center', | align: 'center', | ||||
| children: metricsNames.map((name) => ({ | children: metricsNames.map((name) => ({ | ||||
| title: ( | title: ( | ||||
| <div> | |||||
| <Flex align="center"> | |||||
| <Checkbox | <Checkbox | ||||
| checked={isSingleMetricsChecked(name)} | checked={isSingleMetricsChecked(name)} | ||||
| onChange={(e) => { | onChange={(e) => { | ||||
| @@ -211,15 +208,13 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr | |||||
| checkSingleMetrics(name); | checkSingleMetrics(name); | ||||
| }} | }} | ||||
| onClick={(e) => e.stopPropagation()} | onClick={(e) => e.stopPropagation()} | ||||
| ></Checkbox>{' '} | |||||
| <Tooltip title={name}> | |||||
| <span>{name}</span> | |||||
| </Tooltip> | |||||
| </div> | |||||
| ></Checkbox> | |||||
| <TableColTitle style={{ marginLeft: 4 }} title={name} /> | |||||
| </Flex> | |||||
| ), | ), | ||||
| dataIndex: ['metrics', name], | dataIndex: ['metrics', name], | ||||
| key: name, | key: name, | ||||
| width: 120, | |||||
| width: 150, | |||||
| align: 'center', | align: 'center', | ||||
| render: tableCellRender(true), | render: tableCellRender(true), | ||||
| sorter: (a, b) => tableSorter(a.metrics?.[name], b.metrics?.[name]), | sorter: (a, b) => tableSorter(a.metrics?.[name], b.metrics?.[name]), | ||||
| @@ -251,6 +246,8 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr | |||||
| }} | }} | ||||
| onChange={handleTableChange} | onChange={handleTableChange} | ||||
| rowKey="name" | rowKey="name" | ||||
| tableLayout="fixed" | |||||
| scroll={{ x: '100%' }} | |||||
| /> | /> | ||||
| </div> | </div> | ||||
| <div className={styles['model-metrics__chart']}> | <div className={styles['model-metrics__chart']}> | ||||
| @@ -4,7 +4,7 @@ import * as BasicInfoStories from './BasicInfo.stories'; | |||||
| // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export | // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export | ||||
| const meta = { | const meta = { | ||||
| title: 'Components/BasicTableInfo 表格基本信息', | |||||
| title: 'Components/BasicTableInfo 基本信息表格版', | |||||
| component: BasicTableInfo, | component: BasicTableInfo, | ||||
| parameters: { | parameters: { | ||||
| // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout | // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout | ||||
| @@ -31,7 +31,7 @@ export const RightArrow = () => <svg | |||||
| <path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" /> | <path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" /> | ||||
| </svg> | </svg> | ||||
| <Meta title="Configure your project" /> | |||||
| <Meta title="Documentation/Storybook" /> | |||||
| <div className="sb-container"> | <div className="sb-container"> | ||||
| <div className='sb-section-title'> | <div className='sb-section-title'> | ||||