Migrate paths dashboard widget to react and add storage metrics

This commit is contained in:
Bill Thornton
2025-06-03 16:28:22 -04:00
parent a938650ded
commit 09063d3376
11 changed files with 322 additions and 81 deletions
@@ -0,0 +1,28 @@
import type { Api } from '@jellyfin/sdk';
import { getSystemApi } from '@jellyfin/sdk/lib/utils/api/system-api';
import { queryOptions, useQuery } from '@tanstack/react-query';
import type { AxiosRequestConfig } from 'axios';
import { useApi } from 'hooks/useApi';
const fetchSystemStorage = async (
api: Api,
options?: AxiosRequestConfig
) => {
const response = await getSystemApi(api)
.getSystemStorage(options);
return response.data;
};
const getSystemStorageQuery = (
api?: Api
) => queryOptions({
queryKey: [ 'SystemStorage' ],
queryFn: ({ signal }) => fetchSystemStorage(api!, { signal }),
enabled: !!api
});
export const useSystemStorage = () => {
const { api } = useApi();
return useQuery(getSystemStorageQuery(api));
};