test(ocme): cycle count intital improvements

This commit is contained in:
2025-03-19 21:45:10 -05:00
parent e17b8e7bbe
commit 7a22b52c91
19 changed files with 709 additions and 33 deletions

View File

@@ -7,7 +7,7 @@ export function getlabels(hours: string) {
queryFn: () => fetchSettings(hours),
staleTime: 1000,
refetchInterval: 2500,
//refetchInterval: 2500,
refetchOnWindowFocus: true,
});
}
@@ -16,5 +16,5 @@ 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;
return data.data ?? [];
};

View File

@@ -7,7 +7,7 @@ export function getlots() {
queryFn: () => fetchSettings(),
staleTime: 10 * 1000,
refetchInterval: 10 * 1000,
//refetchInterval: 10 * 1000,
refetchOnWindowFocus: true,
});
}
@@ -17,5 +17,5 @@ const fetchSettings = async () => {
// if we are not localhost ignore the devDir setting.
//const url: string = window.location.host.split(":")[0];
let lotData = data.data;
return lotData;
return lotData ?? [];
};

View File

@@ -13,15 +13,13 @@ export function hasAccess(user: User | null, moduleName: string | null, modules:
}
export function hasPageAccess(user: User | null, role: any, module_id: string): boolean {
if (role.length === 0) return true;
if (role.includes("viewer")) return true;
if (!user) return false;
// get only the module in the user profile
const userRole = user?.roles.filter((role) => role.module_id === module_id);
if (role.includes(userRole[0]?.role)) {
return true;
}
if (role.includes(userRole[0]?.role)) return true;
return false;
}