mirror of
https://github.com/recklessop/zroc.git
synced 2026-07-03 13:23:15 -04:00
0500ac171c
- 61 files across zroc-ui/ and zroc-ova/ directories - Full content written for: config, auth, API layers, CSS, build files, OVA scripts, backend routes, charts, hooks, constants - Stubs in place for: page components, Sidebar, TopBar, docker-compose, authentik client, blueprint YAML, packer HCL, workflows, setup wizard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
461 B
JavaScript
19 lines
461 B
JavaScript
// src/hooks/useInstantQuery.js
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import { instantQuery } from '@/api/prometheus';
|
|
|
|
export function useInstantQuery(promql, {
|
|
refreshMs = 30_000,
|
|
enabled = true,
|
|
select,
|
|
} = {}) {
|
|
return useQuery({
|
|
queryKey: ['instant', promql],
|
|
queryFn: () => instantQuery(promql),
|
|
refetchInterval: refreshMs,
|
|
enabled: enabled && !!promql,
|
|
select,
|
|
staleTime: refreshMs / 2,
|
|
});
|
|
}
|