* feat(widget): add proxmox integration * fix: broken lock file * fix: ci issues * fix: ci issues * fix: ci issues * chore: debug temporary * fix: name is not used correctly for nodes and storage in proxmox * fix: remove temporary debu logs * fix: job runs for both cluster and system health and throws error * fix: ts-expect-error is unnecessary * fix: remove unused import
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import dayjs from "dayjs";
|
|
|
|
import type { IntegrationKindByCategory } from "@homarr/definitions";
|
|
import { integrationCreator } from "@homarr/integrations";
|
|
import type { HealthMonitoring, ProxmoxClusterInfo } from "@homarr/integrations/types";
|
|
|
|
import { createCachedIntegrationRequestHandler } from "./lib/cached-integration-request-handler";
|
|
|
|
export const systemInfoRequestHandler = createCachedIntegrationRequestHandler<
|
|
HealthMonitoring,
|
|
Exclude<IntegrationKindByCategory<"healthMonitoring">, "proxmox">,
|
|
Record<string, never>
|
|
>({
|
|
async requestAsync(integration, _input) {
|
|
const integrationInstance = integrationCreator(integration);
|
|
return await integrationInstance.getSystemInfoAsync();
|
|
},
|
|
cacheDuration: dayjs.duration(5, "seconds"),
|
|
queryKey: "systemInfo",
|
|
});
|
|
|
|
export const clusterInfoRequestHandler = createCachedIntegrationRequestHandler<
|
|
ProxmoxClusterInfo,
|
|
"proxmox",
|
|
Record<string, never>
|
|
>({
|
|
async requestAsync(integration, _input) {
|
|
const integrationInstance = integrationCreator(integration);
|
|
return await integrationInstance.getClusterInfoAsync();
|
|
},
|
|
cacheDuration: dayjs.duration(5, "seconds"),
|
|
queryKey: "clusterInfo",
|
|
});
|