Browse Source

fix: 模型类型没有选中展示

pull/131/head
cp3hnu 1 year ago
parent
commit
39e93b563f
5 changed files with 14 additions and 19 deletions
  1. +1
    -1
      react-ui/src/components/KFSpin/index.less
  2. +4
    -9
      react-ui/src/pages/Dataset/components/CategoryList/index.tsx
  3. +2
    -2
      react-ui/src/pages/Dataset/components/ResourceList/index.tsx
  4. +3
    -3
      react-ui/src/pages/Dataset/config.tsx
  5. +4
    -4
      react-ui/src/pages/Experiment/Comparison/index.tsx

+ 1
- 1
react-ui/src/components/KFSpin/index.less View File

@@ -9,7 +9,7 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: rgba(255, 255, 255, 0.5);
background-color: rgba(255, 255, 255, 0.3);


&__label { &__label {
margin-top: 20px; margin-top: 20px;


+ 4
- 9
react-ui/src/pages/Dataset/components/CategoryList/index.tsx View File

@@ -3,17 +3,12 @@ import { CategoryData, ResourceType, resourceConfig } from '../../config';
import CategoryItem from '../CategoryItem'; import CategoryItem from '../CategoryItem';
import styles from './index.less'; import styles from './index.less';


export type CategoryValue = {
dataType: number | undefined;
dataTag: number | undefined;
};

type CategoryProps = { type CategoryProps = {
resourceType: ResourceType; // 资源类型,数据集还是模型 resourceType: ResourceType; // 资源类型,数据集还是模型
typeList: CategoryData[]; typeList: CategoryData[];
tagList: CategoryData[]; tagList: CategoryData[];
activeType?: number;
activeTag?: number;
activeType?: string;
activeTag?: string;
onTypeSelect: (value: CategoryData) => void; onTypeSelect: (value: CategoryData) => void;
onTagSelect: (value: CategoryData) => void; onTagSelect: (value: CategoryData) => void;
onSearch: (value: string) => void; onSearch: (value: string) => void;
@@ -44,7 +39,7 @@ function CategoryList({
resourceType={resourceType} resourceType={resourceType}
item={item} item={item}
onClick={onTypeSelect} onClick={onTypeSelect}
isSelected={item.id === activeType}
isSelected={item.name === activeType}
></CategoryItem> ></CategoryItem>
))} ))}
</Flex> </Flex>
@@ -58,7 +53,7 @@ function CategoryList({
resourceType={resourceType} resourceType={resourceType}
item={item} item={item}
onClick={onTagSelect} onClick={onTagSelect}
isSelected={item.id === activeTag}
isSelected={item.name === activeTag}
></CategoryItem> ></CategoryItem>
))} ))}
</Flex> </Flex>


+ 2
- 2
react-ui/src/pages/Dataset/components/ResourceList/index.tsx View File

@@ -20,8 +20,8 @@ export type ResourceListRef = {


type ResourceListProps = { type ResourceListProps = {
resourceType: ResourceType; resourceType: ResourceType;
dataType?: number;
dataTag?: number;
dataType?: string;
dataTag?: string;
isPublic: boolean; isPublic: boolean;
typeList: CategoryData[]; typeList: CategoryData[];
tagList: CategoryData[]; tagList: CategoryData[];


+ 3
- 3
react-ui/src/pages/Dataset/config.tsx View File

@@ -29,9 +29,9 @@ type ResourceTypeInfo = {
deleteVersion: (params: any) => Promise<any>; // 删除版本 deleteVersion: (params: any) => Promise<any>; // 删除版本
getInfo: (params: any) => Promise<any>; // 获取详情 getInfo: (params: any) => Promise<any>; // 获取详情
name: string; // 名称 name: string; // 名称
typeParamKey: string; // 类型参数名称,获取资源列表接口使用
tagParamKey: string; // 标签参数名称,获取资源列表接口使用
filePropKey: string;
typeParamKey: 'data_type' | 'model_type'; // 类型参数名称,获取资源列表接口使用
tagParamKey: 'data_tag' | 'model_tag'; // 标签参数名称,获取资源列表接口使用
filePropKey: 'dataset_version_vos' | 'model_version_vos'; // 文件列表属性
tabItems: TabsProps['items']; // tab 列表 tabItems: TabsProps['items']; // tab 列表
typeTitle: string; // 类型标题 typeTitle: string; // 类型标题
tagTitle: string; // 标签标题 tagTitle: string; // 标签标题


+ 4
- 4
react-ui/src/pages/Experiment/Comparison/index.tsx View File

@@ -34,7 +34,7 @@ function ExperimentComparison() {
// const [cacheState, setCacheState] = useCacheState(); // const [cacheState, setCacheState] = useCacheState();
// const [total, setTotal] = useState(0); // const [total, setTotal] = useState(0);
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]); const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const [loading, setLoading] = useState(false);
// const [loading, setLoading] = useState(false);
const { message } = App.useApp(); const { message } = App.useApp();
const config = useMemo(() => comparisonConfig[comparisonType], [comparisonType]); const config = useMemo(() => comparisonConfig[comparisonType], [comparisonType]);
// const [pagination, setPagination] = useState<TablePaginationConfig>( // const [pagination, setPagination] = useState<TablePaginationConfig>(
@@ -50,11 +50,11 @@ function ExperimentComparison() {


// 获取对比数据列表 // 获取对比数据列表
const getComparisonData = async () => { const getComparisonData = async () => {
setLoading(true);
// setLoading(true);
const request = const request =
comparisonType === ComparisonType.Train ? getExpTrainInfosReq : getExpEvaluateInfosReq; comparisonType === ComparisonType.Train ? getExpTrainInfosReq : getExpEvaluateInfosReq;
const [res] = await to(request(experimentId)); const [res] = await to(request(experimentId));
setLoading(false);
// setLoading(false);
if (res && res.data) { if (res && res.data) {
// const { content = [], totalElements = 0 } = res.data; // const { content = [], totalElements = 0 } = res.data;
setTableData(res.data); setTableData(res.data);
@@ -204,7 +204,7 @@ function ExperimentComparison() {
scroll={{ y: 'calc(100% - 55px)', x: '100%' }} scroll={{ y: 'calc(100% - 55px)', x: '100%' }}
pagination={false} pagination={false}
bordered={true} bordered={true}
loading={loading}
// loading={loading}
// pagination={{ // pagination={{
// ...pagination, // ...pagination,
// total: total, // total: total,


Loading…
Cancel
Save