refactor: list watch trigger

This commit is contained in:
jialin
2026-02-13 16:12:56 +08:00
parent af9890b16c
commit 88aafbaf7b
6 changed files with 79 additions and 88 deletions
+6 -3
View File
@@ -4,7 +4,7 @@ import { TABLE_SORT_DIRECTIONS } from '@/config/settings';
import useTableFetch from '@/hooks/use-table-fetch';
import NoResult from '@/pages/_components/no-result';
import PageBox from '@/pages/_components/page-box';
import { queryClusterList } from '@/pages/cluster-management/apis';
import { useQueryClusterList } from '@/pages/cluster-management/services/use-query-cluster-list';
import { useIntl, useSearchParams } from '@umijs/max';
import { ConfigProvider, Table } from 'antd';
import _ from 'lodash';
@@ -41,11 +41,14 @@ const GPUList: React.FC<{ clusterId?: number; widths?: { input: number } }> = ({
const [clusterList, setClusterList] = useState<Global.BaseOption<number>[]>(
[]
);
const { fetchClusterList } = useQueryClusterList({
useStateData: false
});
const getClusterList = async () => {
try {
const res = await queryClusterList({ page: -1 });
const list = res.items?.map((item) => ({
const items = await fetchClusterList({ page: -1 });
const list = items?.map((item) => ({
label: item.name,
value: item.id
}));