fixes and improvements
This commit is contained in:
@@ -7,28 +7,28 @@ import {
|
||||
runJob,
|
||||
} from "../api/client";
|
||||
|
||||
export function useDirectoryListing(path: string) {
|
||||
export function useDirectoryListing(path: string, machineId?: string) {
|
||||
return useQuery({
|
||||
queryKey: ["files", "list", path],
|
||||
queryFn: () => fetchDirectoryListing(path),
|
||||
queryKey: ["files", "list", path, machineId ?? "default"],
|
||||
queryFn: () => fetchDirectoryListing(path, machineId),
|
||||
enabled: !!path,
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useFfprobe(path: string, enabled = false) {
|
||||
export function useFfprobe(path: string, enabled = false, machineId?: string) {
|
||||
return useQuery({
|
||||
queryKey: ["files", "ffprobe", path],
|
||||
queryFn: () => fetchFfprobe(path),
|
||||
queryKey: ["files", "ffprobe", path, machineId ?? "default"],
|
||||
queryFn: () => fetchFfprobe(path, machineId),
|
||||
enabled: enabled && !!path,
|
||||
staleTime: 5 * 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useStat(path: string, enabled = false) {
|
||||
export function useStat(path: string, enabled = false, machineId?: string) {
|
||||
return useQuery({
|
||||
queryKey: ["files", "stat", path],
|
||||
queryFn: () => fetchStat(path),
|
||||
queryKey: ["files", "stat", path, machineId ?? "default"],
|
||||
queryFn: () => fetchStat(path, machineId),
|
||||
enabled: enabled && !!path,
|
||||
});
|
||||
}
|
||||
@@ -41,9 +41,9 @@ export function useJobTemplates() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useRunJob() {
|
||||
export function useRunJob(machineId?: string) {
|
||||
return useMutation({
|
||||
mutationFn: ({ jobKey, path }: { jobKey: string; path: string }) =>
|
||||
runJob(jobKey, path),
|
||||
runJob(jobKey, path, machineId),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user