refactor: usage storage tab, split tables

This commit is contained in:
jialin
2026-06-16 22:28:46 +08:00
committed by jialin
parent df5cf0f4e5
commit 9f5163531c
8 changed files with 323 additions and 239 deletions
@@ -0,0 +1,29 @@
import { useQueryData } from '@/hooks/use-query-data-list';
import {
queryStorageBreakdown,
ResourceBreakdownRequest,
ResourceBreakdownResponse
} from '../../apis/resource';
/**
* Wraps the `queryStorageBreakdown` request with shared loading state and
* in-flight cancellation (previous request is cancelled on each new fetch and
* on unmount), so rapid filter/page/sort changes can't race a stale response
* onto the table.
*/
export default function useQueryStorageBreakdown(option?: { key?: string }) {
const { detailData, loading, cancelRequest, fetchData } = useQueryData<
ResourceBreakdownResponse,
ResourceBreakdownRequest
>({
fetchDetail: queryStorageBreakdown,
key: option?.key || 'storageBreakdownTable'
});
return {
detailData,
loading,
cancelRequest,
fetchData
};
}