fix(alerts): surface node-level alerts on Proxmox node table

getAlertStyles now accepts an optional nodeMatch parameter. Node table
rows pass their node name so storage/topology/disk alerts (which have
a different resourceId than the node) correctly highlight the affected
node row. Previously ZFS pool errors on minipc were invisible on the
overview page.
This commit is contained in:
rcourtman 2026-06-27 12:25:47 +01:00
parent 58d0dd8c29
commit 5fc30e2060
2 changed files with 9 additions and 3 deletions

View file

@ -338,7 +338,7 @@ export const ProxmoxNodesTable: Component<{
};
const pendingUpdates = () => drawerNode()?.pendingUpdates ?? 0;
const alertStyles = createMemo(() =>
getAlertStyles(node.id, activeAlerts, alertsEnabled()),
getAlertStyles(node.id, activeAlerts, alertsEnabled(), node.name),
);
const alertAccentTone = createMemo<
'critical' | 'warning' | 'acknowledged' | undefined

View file

@ -16,18 +16,24 @@ const noAlertStyles = {
hasAcknowledgedOnlyAlert: false,
};
// Get alert highlighting styles based on active alerts for a resource
// Get alert highlighting styles based on active alerts for a resource.
// When nodeMatch is provided, also includes alerts whose `node` field matches
// (covers storage/topology/disk alerts that belong to a node but have a
// different resourceId than the node itself).
export const getAlertStyles = (
resourceId: string,
activeAlerts: Record<string, Alert>,
alertsEnabled: boolean | undefined = isAlertsActivationEnabled(),
nodeMatch?: string,
) => {
if (!alertsEnabled) {
return noAlertStyles;
}
const alertsForResource = Object.values(activeAlerts).filter(
(alert) => alert.resourceId === resourceId,
(alert) =>
alert.resourceId === resourceId ||
(nodeMatch !== undefined && alert.node === nodeMatch),
);
const unacknowledgedAlerts = alertsForResource.filter((alert) => !alert.acknowledged);