Browse Source

fix: 列表运行时长和详情运行时长不一致

pull/226/head
cp3hnu 10 months ago
parent
commit
e92ac40694
1 changed files with 24 additions and 18 deletions
  1. +24
    -18
      react-ui/src/pages/AutoML/components/ExperimentList/index.tsx

+ 24
- 18
react-ui/src/pages/AutoML/components/ExperimentList/index.tsx View File

@@ -63,20 +63,23 @@ function ExperimentList({ type }: ExperimentListProps) {
const timerRef = useRef<ReturnType<typeof window.setTimeout> | undefined>(); const timerRef = useRef<ReturnType<typeof window.setTimeout> | undefined>();


// 获取自主机器学习或超参数自动优化列表 // 获取自主机器学习或超参数自动优化列表
const getAutoMLList = useCallback(async () => {
const params: Record<string, any> = {
page: pagination.current! - 1,
size: pagination.pageSize,
[config.nameProperty]: searchText || undefined,
};
const request = config.getListReq;
const [res] = await to(request(params));
if (res && res.data) {
const { content = [], totalElements = 0 } = res.data;
setTableData(content);
setTotal(totalElements);
}
}, [pagination, searchText, config]);
const getAutoMLList = useCallback(
async (skipLoading: boolean = false) => {
const params: Record<string, any> = {
page: pagination.current! - 1,
size: pagination.pageSize,
[config.nameProperty]: searchText || undefined,
};
const request = config.getListReq;
const [res] = await to(request(params, skipLoading));
if (res && res.data) {
const { content = [], totalElements = 0 } = res.data;
setTableData(content);
setTotal(totalElements);
}
},
[pagination, searchText, config],
);


useEffect(() => { useEffect(() => {
getAutoMLList(); getAutoMLList();
@@ -111,9 +114,12 @@ function ExperimentList({ type }: ExperimentListProps) {


// 刷新实验列表状态, // 刷新实验列表状态,
// TODO: 目前是直接刷新实验列表,后续需要优化,只刷新状态 // TODO: 目前是直接刷新实验列表,后续需要优化,只刷新状态
const refreshExperimentList = useCallback(() => {
getAutoMLList();
}, [getAutoMLList]);
const refreshExperimentList = useCallback(
(skipLoading: boolean = false) => {
getAutoMLList(skipLoading);
},
[getAutoMLList],
);


// 刷新实验实例列表 // 刷新实验实例列表
const refreshExperimentIns = useCallback( const refreshExperimentIns = useCallback(
@@ -150,7 +156,7 @@ function ExperimentList({ type }: ExperimentListProps) {
} }


timerRef.current = setTimeout(() => { timerRef.current = setTimeout(() => {
refreshExperimentList();
refreshExperimentList(true);
}, 10000); }, 10000);
} }
}; };


Loading…
Cancel
Save