mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-09 16:00:59 +00:00
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:
parent
58d0dd8c29
commit
5fc30e2060
2 changed files with 9 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue