test(ocp): more work on the dashboard

This commit is contained in:
2025-03-19 17:11:00 -05:00
parent 354f3260a5
commit 8324fffeb6
12 changed files with 814 additions and 11 deletions

View File

@@ -0,0 +1,20 @@
import {queryOptions} from "@tanstack/react-query";
import axios from "axios";
export function getlabels(hours: string) {
return queryOptions({
queryKey: ["labels"],
queryFn: () => fetchSettings(hours),
staleTime: 1000,
refetchInterval: 2500,
refetchOnWindowFocus: true,
});
}
const fetchSettings = async (hours: string) => {
const {data} = await axios.get(`/api/v1/ocp/labels?hours=${hours}`);
// if we are not localhost ignore the devDir setting.
//const url: string = window.location.host.split(":")[0];
return data.data;
};

View File

@@ -0,0 +1,21 @@
import {queryOptions} from "@tanstack/react-query";
import axios from "axios";
export function getlots() {
return queryOptions({
queryKey: ["lots"],
queryFn: () => fetchSettings(),
staleTime: 10 * 1000,
refetchInterval: 10 * 1000,
refetchOnWindowFocus: true,
});
}
const fetchSettings = async () => {
const {data} = await axios.get("/api/v1/ocp/lots");
// if we are not localhost ignore the devDir setting.
//const url: string = window.location.host.split(":")[0];
let lotData = data.data;
return lotData;
};