Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

feat(alerts): click-through from alert card to affected resource

rcourtman58d0dd8c29a8
diff --git a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
index 25afeb8e1b..0745d52c38 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
@@ -1,4 +1,5 @@
import { Show } from 'solid-js';
+import { A } from '@solidjs/router';
import { InvestigateAlertButton } from '@/components/Alerts/InvestigateAlertButton';
import { IncidentTimelinePanel } from '@/components/Alerts/IncidentTimelinePanel';
@@ -36,6 +37,17 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
props.state.processingAlerts().has(alertKey()),
);
+ const resourceLink = (): string => {
+ const rid = props.alert.resourceId ?? '';
+ const resourceType = typeof props.alert.metadata?.resourceType === 'string'
+ ? props.alert.metadata.resourceType as string
+ : '';
+ if (rid.startsWith('agent:') || resourceType === 'agent') return '/machines';
+ if (rid.includes('docker') || resourceType === 'docker-container' || resourceType === 'docker-host') return '/docker/overview';
+ if (resourceType === 'kubernetes' || resourceType.startsWith('k8s-')) return '/kubernetes/overview';
+ return '/proxmox/overview';
+ };
+
return (
<div id={`alert-${alertKey()}`} class={alertCardPresentation().cardClassName}>
<div class="flex flex-col sm:flex-row sm:items-start">
@@ -63,9 +75,13 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
</div>
<div class="flex-1 min-w-0">
<div class="flex flex-wrap items-center gap-2">
- <span class={alertCardPresentation().resourceClassName}>
+ <A
+ href={resourceLink()}
+ class={`${alertCardPresentation().resourceClassName} hover:underline cursor-pointer`}
+ title="View resource"
+ >
{props.alert.resourceName}
- </span>
+ </A>
<span class="text-xs text-muted">({alertTypeDisplayLabel(props.alert.type)})</span>
<Show when={!props.alert.acknowledged}>
<span
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
index fb373367c8..b1df95e286 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
@@ -4,6 +4,7 @@ import { DEFAULT_LOCALE, setActiveLocale } from '@/i18n';
vi.mock('@solidjs/router', () => ({
useLocation: () => ({ hash: '', pathname: '/alerts', search: '', query: {} }),
+ A: (props: Record<string, unknown>) => props.children,
}));
vi.mock('@/api/alerts', () => ({
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
index affb211097..92090a4f67 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
@@ -7,6 +7,7 @@ const mockGetIncidentTimeline = vi.fn();
vi.mock('@solidjs/router', () => ({
useLocation: () => ({ hash: '', pathname: '/alerts', search: '', query: {} }),
+ A: (props: Record<string, unknown>) => props.children,
}));
vi.mock('@/api/alerts', () => ({
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
index 25b650aa1e..f0b19d4526 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
@@ -5,6 +5,7 @@ import type { Alert } from '@/types/api';
vi.mock('@solidjs/router', () => ({
useLocation: () => ({ hash: '', pathname: '/alerts', search: '', query: {} }),
+ A: (props: Record<string, unknown>) => props.children,
}));
vi.mock('@/api/alerts', () => ({