feat: file explorer (#1)

* feat: list volume files backend

* feat: file tree component

* feat: load sub folders

* fix: filetree wrong opening order

* temp: open / close icons

* chore: remove all hc files when cleaning

* chore: file-tree optimizations
This commit is contained in:
Nico
2025-10-06 19:46:49 +02:00
committed by GitHub
parent a5e0fb6aa2
commit 1e3419c250
10 changed files with 707 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ import {
mountVolume,
unmountVolume,
healthCheckVolume,
listFiles,
} from "../sdk.gen";
import { queryOptions, type UseMutationOptions, type DefaultError } from "@tanstack/react-query";
import type {
@@ -45,6 +46,7 @@ import type {
UnmountVolumeResponse,
HealthCheckVolumeData,
HealthCheckVolumeResponse,
ListFilesData,
} from "../types.gen";
import { client as _heyApiClient } from "../client.gen";
@@ -539,3 +541,23 @@ export const healthCheckVolumeMutation = (
};
return mutationOptions;
};
export const listFilesQueryKey = (options: Options<ListFilesData>) => createQueryKey("listFiles", options);
/**
* List files in a volume directory
*/
export const listFilesOptions = (options: Options<ListFilesData>) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await listFiles({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: listFilesQueryKey(options),
});
};