([]);
useEffect(() => {
diff --git a/react-ui/src/components/PageTitle/index.tsx b/react-ui/src/components/PageTitle/index.tsx
index ca192454..2703e032 100644
--- a/react-ui/src/components/PageTitle/index.tsx
+++ b/react-ui/src/components/PageTitle/index.tsx
@@ -8,10 +8,17 @@ import React from 'react';
import './index.less';
type PageTitleProps = {
- title: string;
+ /** 标题 */
+ title: React.ReactNode;
+ /** 自定义类名 */
className?: string;
+ /** 自定义样式 */
style?: React.CSSProperties;
};
+
+/**
+ * 页面标题
+ */
function PageTitle({ title, style, className = '' }: PageTitleProps) {
return (
diff --git a/react-ui/src/components/ParameterInput/index.tsx b/react-ui/src/components/ParameterInput/index.tsx
index aa0c7492..99bb78af 100644
--- a/react-ui/src/components/ParameterInput/index.tsx
+++ b/react-ui/src/components/ParameterInput/index.tsx
@@ -1,7 +1,7 @@
/*
* @Author: 赵伟
* @Date: 2024-04-16 08:42:57
- * @Description: 参数输入组件,支持手动输入,选择全局参数,选择数据集/模型/镜像
+ * @Description: 参数输入表单组件,支持手动输入,也支持选择全局参数
*/
import { CommonTabKeys } from '@/enums';
@@ -26,18 +26,34 @@ export type ParameterInputObject = {
export type ParameterInputValue = ParameterInputObject | string;
export interface ParameterInputProps {
+ /** 值,可以是字符串,也可以是 ParameterInputObject 对象 */
value?: ParameterInputValue;
+ /**
+ * 值变化时的回调
+ * @param value 值,可以是字符串,也可以是 ParameterInputObject 对象
+ */
onChange?: (value?: ParameterInputValue) => void;
+ /** 点击时的回调 */
onClick?: () => void;
+ /** 删除时的回调 */
onRemove?: () => void;
+ /** 是否可以手动输入 */
canInput?: boolean;
+ /** 是否是文本框 */
textArea?: boolean;
+ /** 占位符 */
placeholder?: string;
+ /** 是否允许清除 */
allowClear?: boolean;
+ /** 自定义类名 */
className?: string;
+ /** 自定义样式 */
style?: React.CSSProperties;
+ /** 大小 */
size?: 'middle' | 'small' | 'large';
+ /** 是否禁用 */
disabled?: boolean;
+ /** 元素 id */
id?: string;
}
diff --git a/react-ui/src/components/ResourceSelect/index.tsx b/react-ui/src/components/ResourceSelect/index.tsx
index 6e0179d4..718d571a 100644
--- a/react-ui/src/components/ResourceSelect/index.tsx
+++ b/react-ui/src/components/ResourceSelect/index.tsx
@@ -20,15 +20,17 @@ import './index.less';
export { requiredValidator, type ParameterInputObject } from '../ParameterInput';
export { ResourceSelectorType, selectorTypeConfig, type ResourceSelectorResponse };
-type ResourceSelectProps = {
+interface ResourceSelectProps extends ParameterInputProps {
+ /** 类型,数据集、模型、镜像 */
type: ResourceSelectorType;
-} & ParameterInputProps;
+}
-// 获取选择数据集、模型后面按钮 icon
+// 获取选择数据集、模型、镜像后面按钮 icon
const getSelectBtnIcon = (type: ResourceSelectorType) => {
return
;
};
+/** 数据集、模型、镜像选择表单组件 */
function ResourceSelect({ type, value, onChange, disabled, ...rest }: ResourceSelectProps) {
const [selectedResource, setSelectedResource] = useState
(
undefined,
diff --git a/react-ui/src/components/ResourceSelectorModal/index.tsx b/react-ui/src/components/ResourceSelectorModal/index.tsx
index 28beedd0..24e97a4d 100644
--- a/react-ui/src/components/ResourceSelectorModal/index.tsx
+++ b/react-ui/src/components/ResourceSelectorModal/index.tsx
@@ -4,11 +4,11 @@
* @Description: 选择数据集、模型、镜像
*/
+import KFIcon from '@/components/KFIcon';
import KFModal from '@/components/KFModal';
import { CommonTabKeys } from '@/enums';
import { ResourceFileData } from '@/pages/Dataset/config';
import { to } from '@/utils/promise';
-import { Icon } from '@umijs/max';
import type { GetRef, ModalProps, TreeDataNode, TreeProps } from 'antd';
import { Input, Tabs, Tree } from 'antd';
import React, { useEffect, useMemo, useRef, useState } from 'react';
@@ -16,7 +16,7 @@ import { ResourceSelectorType, selectorTypeConfig } from './config';
import styles from './index.less';
export { ResourceSelectorType, selectorTypeConfig };
-// 选择数据集\模型\镜像的返回类型
+// 选择数据集、模型、镜像的返回类型
export type ResourceSelectorResponse = {
activeTab: CommonTabKeys; // 是我的还是公开的
id: string; // 数据集\模型\镜像 id
@@ -28,10 +28,18 @@ export type ResourceSelectorResponse = {
};
export interface ResourceSelectorModalProps extends Omit {
- type: ResourceSelectorType; // 数据集\模型\镜像
+ /** 类型,数据集、模型、镜像 */
+ type: ResourceSelectorType;
+ /** 默认展开的节点 */
defaultExpandedKeys?: React.Key[];
+ /** 默认展开的节点 */
defaultCheckedKeys?: React.Key[];
+ /** 默认激活的 Tab */
defaultActiveTab?: CommonTabKeys;
+ /**
+ * 确认回调
+ * @param params 选择的数据
+ */
onOk?: (params: ResourceSelectorResponse | undefined) => void;
}
@@ -61,6 +69,7 @@ const getIdAndVersion = (versionKey: string) => {
};
};
+/** 选择数据集、模型、镜像的弹框,推荐使用函数的方式打开 */
function ResourceSelectorModal({
type,
defaultExpandedKeys = [],
@@ -267,7 +276,14 @@ function ResourceSelectorModal({
variant="borderless"
value={searchText}
onChange={(e) => setSearchText(e.target.value)}
- prefix={}
+ prefix={
+
+ }
+ // prefix={}
/>
{
- {/* */}
-
{/* */}
diff --git a/react-ui/src/components/SubAreaTitle/index.tsx b/react-ui/src/components/SubAreaTitle/index.tsx
index cd07b206..4c94deee 100644
--- a/react-ui/src/components/SubAreaTitle/index.tsx
+++ b/react-ui/src/components/SubAreaTitle/index.tsx
@@ -8,13 +8,20 @@ import classNames from 'classnames';
import './index.less';
type SubAreaTitleProps = {
+ /** 标题 */
title: string;
+ /** 图片 */
image?: string;
- style?: React.CSSProperties;
+ /** 自定义类名 */
className?: string;
+ /** 自定义样式 */
+ style?: React.CSSProperties;
};
-function SubAreaTitle({ title, image, style, className }: SubAreaTitleProps) {
+/**
+ * 表单或者详情页的分区标题
+ */
+function SubAreaTitle({ title, image, className, style }: SubAreaTitleProps) {
return (
{image && (
diff --git a/react-ui/src/global.less b/react-ui/src/global.less
index fbbfa34d..9944c70e 100644
--- a/react-ui/src/global.less
+++ b/react-ui/src/global.less
@@ -5,7 +5,7 @@ body,
height: 100%;
margin: 0;
padding: 0;
- overflow-y: hidden;
+ overflow-y: visible;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
diff --git a/react-ui/src/pages/404.tsx b/react-ui/src/pages/404.tsx
index dbacba53..d6f45451 100644
--- a/react-ui/src/pages/404.tsx
+++ b/react-ui/src/pages/404.tsx
@@ -12,7 +12,7 @@ const NoFoundPage = () => {
content={'很抱歉,您访问的页面地址有误,\n或者该页面不存在。'}
hasFooter={true}
buttonTitle="返回首页"
- onRefresh={() => navigate('/')}
+ onButtonClick={() => navigate('/')}
>
);
};
diff --git a/react-ui/src/pages/AutoML/components/AutoMLBasic/index.tsx b/react-ui/src/pages/AutoML/components/AutoMLBasic/index.tsx
index bb30e064..5f207b7d 100644
--- a/react-ui/src/pages/AutoML/components/AutoMLBasic/index.tsx
+++ b/react-ui/src/pages/AutoML/components/AutoMLBasic/index.tsx
@@ -1,3 +1,4 @@
+import ConfigInfo, { type BasicInfoData } from '@/components/ConfigInfo';
import { AutoMLTaskType, autoMLEnsembleClassOptions, autoMLTaskTypeOptions } from '@/enums';
import { AutoMLData } from '@/pages/AutoML/types';
import { experimentStatusInfo } from '@/pages/Experiment/status';
@@ -8,7 +9,6 @@ import { formatBoolean, formatDataset, formatDate, formatEnum } from '@/utils/fo
import { Flex } from 'antd';
import classNames from 'classnames';
import { useMemo } from 'react';
-import ConfigInfo, { type BasicInfoData } from '../ConfigInfo';
import styles from './index.less';
// 格式化优化方向
@@ -46,28 +46,23 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
{
label: '实验名称',
value: info.ml_name,
- ellipsis: true,
},
{
label: '实验描述',
value: info.ml_description,
- ellipsis: true,
},
{
label: '创建人',
value: info.create_by,
- ellipsis: true,
},
{
label: '创建时间',
value: info.create_time,
- ellipsis: true,
format: formatDate,
},
{
label: '更新时间',
value: info.update_time,
- ellipsis: true,
format: formatDate,
},
];
@@ -81,18 +76,15 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
{
label: '任务类型',
value: info.task_type,
- ellipsis: true,
format: formatEnum(autoMLTaskTypeOptions),
},
{
label: '特征预处理算法',
value: info.include_feature_preprocessor,
- ellipsis: true,
},
{
label: '排除的特征预处理算法',
value: info.exclude_feature_preprocessor,
- ellipsis: true,
},
{
label: info.task_type === AutoMLTaskType.Regression ? '回归算法' : '分类算法',
@@ -100,7 +92,6 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
info.task_type === AutoMLTaskType.Regression
? info.include_regressor
: info.include_classifier,
- ellipsis: true,
},
{
label: info.task_type === AutoMLTaskType.Regression ? '排除的回归算法' : '排除的分类算法',
@@ -108,91 +99,73 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
info.task_type === AutoMLTaskType.Regression
? info.exclude_regressor
: info.exclude_classifier,
- ellipsis: true,
},
{
label: '集成方式',
value: info.ensemble_class,
- ellipsis: true,
format: formatEnum(autoMLEnsembleClassOptions),
},
{
label: '集成模型数量',
value: info.ensemble_size,
- ellipsis: true,
},
{
label: '集成最佳模型数量',
value: info.ensemble_nbest,
- ellipsis: true,
},
{
label: '最大数量',
value: info.max_models_on_disc,
- ellipsis: true,
},
{
label: '内存限制(MB)',
value: info.memory_limit,
- ellipsis: true,
},
{
label: '单次时间限制(秒)',
value: info.per_run_time_limit,
- ellipsis: true,
},
{
label: '搜索时间限制(秒)',
value: info.time_left_for_this_task,
- ellipsis: true,
},
{
label: '重采样策略',
value: info.resampling_strategy,
- ellipsis: true,
},
{
label: '交叉验证折数',
value: info.folds,
- ellipsis: true,
},
{
label: '是否打乱',
value: info.shuffle,
- ellipsis: true,
format: formatBoolean,
},
{
label: '训练集比率',
value: info.train_size,
- ellipsis: true,
},
{
label: '测试集比率',
value: info.test_size,
- ellipsis: true,
},
{
label: '计算指标',
value: info.scoring_functions,
- ellipsis: true,
},
{
label: '随机种子',
value: info.seed,
- ellipsis: true,
},
-
{
label: '数据集',
value: info.dataset,
- ellipsis: true,
format: formatDataset,
},
{
label: '预测目标列',
value: info.target_columns,
- ellipsis: true,
},
];
}, [info]);
@@ -205,18 +178,15 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
{
label: '指标名称',
value: info.metric_name,
- ellipsis: true,
},
{
label: '优化方向',
value: info.greater_is_better,
- ellipsis: true,
format: formatOptimizeMode,
},
{
label: '指标权重',
value: info.metrics,
- ellipsis: true,
format: formatMetricsWeight,
},
];
@@ -231,12 +201,10 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
{
label: '启动时间',
value: formatDate(runStatus.startedAt),
- ellipsis: true,
},
{
label: '执行时长',
value: elapsedTime(runStatus.startedAt, runStatus.finishedAt),
- ellipsis: true,
},
{
label: '状态',
@@ -259,7 +227,6 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
),
- ellipsis: true,
},
];
}, [runStatus]);
@@ -269,7 +236,7 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
{isInstance && runStatus && (
@@ -277,18 +244,18 @@ function AutoMLBasic({ info, className, runStatus, isInstance = false }: AutoMLB
{!isInstance && (
)}
-
+