A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
import { IconHeartRateMonitor, IconServerOff } from "@tabler/icons-react";
import {
getWidgetIntegrationConfig,
healthMonitoringClusterIntegrationKinds,
healthMonitoringSystemIntegrationKinds,
} from "@homarr/definitions";
import { createWidgetDefinition } from "../definition";
import { supportsStorageVolumeSelection } from "../filter-storage-volumes";
import { optionsBuilder } from "../options";
import { createStorageVolumeMultiSelectOptions } from "../storage-volume-options";
export const { definition, componentLoader } = createWidgetDefinition("healthMonitoring", {
icon: IconHeartRateMonitor,
supportsAdvancedFocus: true,
queryKeys: [[["integration", "byIds"]], [["widget", "healthMonitoring"]]],
refetchInterval: 10,
createOptions() {
return optionsBuilder.from(
(factory) => ({
fahrenheit: factory.switch({
defaultValue: false,
}),
cpu: factory.switch({
defaultValue: true,
}),
memory: factory.switch({
defaultValue: true,
}),
gpu: factory.switch({
defaultValue: true,
}),
showUptime: factory.switch({
defaultValue: true,
}),
fileSystem: factory.switch({
defaultValue: true,
}),
visibleStorageVolumes: factory.integrationMultiSelect(createStorageVolumeMultiSelectOptions()),
visibleClusterSections: factory.multiSelect({
options: [
{
value: "node",
label: (t) => t("widget.healthMonitoring.cluster.resource.node.name"),
},
{
value: "qemu",
label: (t) => t("widget.healthMonitoring.cluster.resource.qemu.name"),
},
{
value: "lxc",
label: (t) => t("widget.healthMonitoring.cluster.resource.lxc.name"),
},
{
value: "storage",
label: (t) => t("widget.healthMonitoring.cluster.resource.storage.name"),
},
] as const,
defaultValue: ["node", "qemu", "lxc", "storage"] as const,
}),
defaultTab: factory.select({
defaultValue: "system",
options: [
{ value: "system", label: "System" },
{ value: "cluster", label: "Cluster" },
] as const,
}),
tabOrder: factory.select({
defaultValue: "system-first",
options: [
{ value: "system-first", label: (t) => t("widget.healthMonitoring.option.tabOrder.systemFirst") },
{ value: "cluster-first", label: (t) => t("widget.healthMonitoring.option.tabOrder.clusterFirst") },
] as const,
}),
sectionIndicatorRequirement: factory.select({
defaultValue: "all",
options: [
{ value: "all", label: "All active" },
{ value: "any", label: "Any active" },
] as const,
}),
}),
{
fahrenheit: {
shouldHide(_, integrationKinds) {
// File system is only shown on system health tab
return integrationKinds.every((kind) => kind === "proxmox") || integrationKinds.length === 0;
},
},
fileSystem: {
shouldHide(_, integrationKinds) {
// File system is only shown on system health tab
return integrationKinds.every((kind) => kind === "proxmox") || integrationKinds.length === 0;
},
},
visibleStorageVolumes: {
shouldHide(_, integrationKinds) {
return !supportsStorageVolumeSelection(integrationKinds);
},
},
showUptime: {
shouldHide(_, integrationKinds) {
// Uptime is only shown on cluster health tab
return !integrationKinds.includes("proxmox");
},
},
sectionIndicatorRequirement: {
shouldHide(_, integrationKinds) {
// Section indicator requirement is only shown on cluster health tab
return !integrationKinds.includes("proxmox");
},
},
visibleClusterSections: {
shouldHide(_, integrationKinds) {
// Cluster sections are only shown on cluster health tab
return !integrationKinds.includes("proxmox");
},
},
tabOrder: {
shouldHide(_, integrationKinds) {
const hasSystem = healthMonitoringSystemIntegrationKinds.some((kind) => integrationKinds.includes(kind));
const hasCluster = healthMonitoringClusterIntegrationKinds.some((kind) => integrationKinds.includes(kind));
return !hasSystem || !hasCluster;
},
},
defaultTab: {
shouldHide(_, integrationKinds) {
// The system/cluster tabs only render for Proxmox, so the default tab choice does nothing otherwise
return !integrationKinds.includes("proxmox");
},
},
},
);
},
...getWidgetIntegrationConfig("healthMonitoring"),
errors: {
INTERNAL_SERVER_ERROR: {
icon: IconServerOff,
message: (t) => t("widget.healthMonitoring.error.internalServerError"),
},
},
}).withDynamicImport(() => import("./component"));