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.

Keep phone alert rows to one action row

rcourtmanca65247be0ff
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 7e3638ac2a..c4f89ec193 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -4000,6 +4000,22 @@ severity and the triggered-in-24h total; threshold override counts are
configuration and do not appear on the overview. None of this changes alert
lifecycle, acknowledgement, snooze, or delivery evaluation.
+### Phone alert rows keep one action row
+
+Below the `sm` breakpoint (640px) an active-alert row on the overview shows
+Acknowledge (or its reversal), Snooze (or Unsnooze) and More on one row; the
+Investigate split button moves into the More disclosure beside Timeline and
+the resource monitoring policy. From `sm` up the row is unchanged. Four
+actions had wrapped onto two rows under every alert, so a 375px phone showed
+about three alerts per screen (average row 208px on the mock estate). Snooze
+stays on the row at every width, so its dialog is never remounted when a
+phone rotates across `sm`; only Investigate moves, by the shared
+`useBreakpoint()` width, and renders once. The Acknowledged and Snoozed
+badges and the snoozed-until line stay on the row. More names its region
+through `aria-controls` only while that region is rendered. This is
+presentation only: acknowledgement, snooze, investigation and policy
+handlers are unchanged.
+
### Thresholds lead with each group's default limits
The Thresholds page answers "what will alert me, and at what limits" before
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index eaf7f1fa6c..2df7ba58df 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -8644,6 +8644,16 @@ active locale rather than the English-only `formatRelativeTime`. Proofs live
in `frontend-modern/src/i18n/__tests__/i18n.test.ts` and
`frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts`.
+### Alert overview rows place Investigate by the shared breakpoint
+
+`AlertOverviewAlertCard` reads the shared `useBreakpoint()` hook to decide
+where the Investigate split button renders: on the row from `sm` up, inside
+the More disclosure below it. It renders one instance rather than two
+CSS-hidden copies, so no menu id is duplicated, and it adds no resize
+listener of its own. Snooze never moves, so its dialog state survives a
+breakpoint crossing. The More button keeps its existing catalog labels and
+sets `aria-controls` only while its region is rendered.
+
### Alert groups use the shared localization boundary
Alert group disclosure and group acknowledgement copy routes through
diff --git a/frontend-modern/browser-verification/7815935c8acf14e9.json b/frontend-modern/browser-verification/7815935c8acf14e9.json
new file mode 100644
index 0000000000..e8f3f9051a
--- /dev/null
+++ b/frontend-modern/browser-verification/7815935c8acf14e9.json
@@ -0,0 +1,55 @@
+{
+ "version": 1,
+ "base_sha": "f9f27d67212a47a6769959862a7259606e86f56b",
+ "verified_at": "2026-10-12T07:05:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx": "db8b4665d2a583d596380f4fb6fab7ac661296d1a80c9a0c1ac709a05b2f36d1"
+ },
+ "routes": [
+ "/alerts/overview"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 1280,
+ "height": 800
+ },
+ {
+ "width": 812,
+ "height": 375
+ },
+ {
+ "width": 640,
+ "height": 900
+ },
+ {
+ "width": 639,
+ "height": 900
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "embedded production build of origin/main plus this change, private mock stack (PULSE_MOCK_MODE, 8 nodes), compared with an unchanged origin/main build",
+ "375px phone before: every active-alert row showed Acknowledge, Snooze, Have Patrol investigate and More on two rows; average row 208px over 17 alerts",
+ "375px phone after: Acknowledge, Snooze and More sit on one row; average row 159px over 16 alerts (the shared Snooze button keeps its 44px phone touch height)",
+ "375px collapsed More has aria-expanded=false and no aria-controls; expanded it names the rendered disclosure holding Have Patrol investigate (split menu), Timeline and Monitoring; Snooze stays on the row",
+ "639px: Acknowledge, Snooze, More; 640px and wider: Acknowledge, Snooze, Have Patrol investigate, More",
+ "1280px and 1440px desktop rows render as before (Timeline and Monitoring behind More)",
+ "no console errors"
+ ],
+ "interactions": [
+ "375px: real tap on Snooze opens the Snooze this alert dialog; resizing to 812x375 (phone rotated) keeps the dialog open while Investigate moves onto the row; Cancel closes it without snoozing",
+ "375px: More opens the disclosure and reads Less; aria-controls appears only while expanded",
+ "resize 375 -> 639 -> 640 -> 1280 with the page open: Investigate moves between the disclosure and the row"
+ ]
+}
diff --git a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
index cd8487f0c7..2dfac2e89c 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
@@ -35,6 +35,7 @@ import { ResourceMonitoringPolicyAction } from './ResourceMonitoringPolicyAction
import { AlertSnoozeAction } from './AlertSnoozeAction';
import { isAlertSnoozed } from './useAlertSnoozeState';
import { isPulseSystemAlert } from '@/utils/alertScope';
+import { useBreakpoint } from '@/hooks/useBreakpoint';
import { formatTemperature } from '@/utils/temperature';
import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import {
@@ -169,6 +170,35 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
Boolean(deliveryStatusLine()) ||
(isAlertSnoozed(props.alert) && Boolean(props.alert.operationalRecord?.suppression?.expiresAt));
const timelineOpen = () => props.timelineState.expandedIncidents().has(alertKey());
+ // Below sm the four actions wrapped onto two rows and took more height than
+ // the alert itself, so a phone showed about three alerts per screen. There,
+ // Investigate joins Timeline and the monitoring policy behind More. Snooze
+ // stays on the row in every width, so its dialog never remounts mid-use.
+ const { isBelow } = useBreakpoint();
+ const compactActions = () => isBelow('sm');
+ const moreActionsId = () => `alert-${alertKey()}-more`;
+ const snoozeAction = () => (
+ <Show when={!props.alert.acknowledged || isAlertSnoozed(props.alert)}>
+ <AlertSnoozeAction
+ alert={props.alert}
+ state={props.state}
+ timelineState={props.timelineState}
+ />
+ </Show>
+ );
+ const investigateAction = () => (
+ <InvestigateAlertButton
+ alert={props.alert}
+ resourceType={
+ typeof props.alert.metadata?.resourceType === 'string'
+ ? (props.alert.metadata.resourceType as string)
+ : undefined
+ }
+ variant="text"
+ size="sm"
+ patrolOption
+ />
+ );
// Incident alerts land on canonical agent/vm/storage/network resources, so
// the resource type alone cannot name the platform. Their metadata carries
@@ -400,28 +430,13 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
processing: processing(),
})}
</button>
- <Show when={!props.alert.acknowledged || isAlertSnoozed(props.alert)}>
- <AlertSnoozeAction
- alert={props.alert}
- state={props.state}
- timelineState={props.timelineState}
- />
- </Show>
- <InvestigateAlertButton
- alert={props.alert}
- resourceType={
- typeof props.alert.metadata?.resourceType === 'string'
- ? (props.alert.metadata.resourceType as string)
- : undefined
- }
- variant="text"
- size="sm"
- patrolOption
- />
+ {snoozeAction()}
+ <Show when={!compactActions()}>{investigateAction()}</Show>
<button
type="button"
class={getAlertOverviewSecondaryActionClass()}
aria-expanded={moreOpen() || timelineOpen()}
+ aria-controls={moreOpen() || timelineOpen() ? moreActionsId() : undefined}
onClick={() => {
if (moreOpen() || timelineOpen()) {
// Less closes everything the disclosure opened, timeline included.
@@ -443,7 +458,11 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
</div>
</div>
<Show when={moreOpen() || timelineOpen()}>
- <div class="mt-2 flex flex-wrap items-center justify-end gap-1.5 border-t border-border pt-2">
+ <div
+ id={moreActionsId()}
+ class="mt-2 flex flex-wrap items-center justify-end gap-1.5 border-t border-border pt-2"
+ >
+ <Show when={compactActions()}>{investigateAction()}</Show>
<button
class={getAlertOverviewSecondaryActionClass()}
onClick={() => {
diff --git a/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
index aae6143db3..41c70316c1 100644
--- a/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
-import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
import type { AlertOverviewState } from '../useAlertOverviewState';
import type { AlertIncidentTimelineState } from '../useAlertIncidentTimelineState';
import { makeSystemAlert, SYSTEM_ALERT_TYPES } from '../__fixtures__/systemAlerts';
@@ -13,14 +13,14 @@ vi.mock('@solidjs/router', () => ({
),
}));
vi.mock('@/components/Alerts/InvestigateAlertButton', () => ({
- InvestigateAlertButton: () => null,
+ InvestigateAlertButton: () => <button>Investigate</button>,
}));
vi.mock('../ResourceMonitoringPolicyAction', () => ({
ResourceMonitoringPolicyAction: (props: any) => (
<button data-platform-type={props.platformType}>Resource monitoring policy</button>
),
}));
-vi.mock('../AlertSnoozeAction', () => ({ AlertSnoozeAction: () => null }));
+vi.mock('../AlertSnoozeAction', () => ({ AlertSnoozeAction: () => <button>Snooze</button> }));
import { AlertOverviewAlertCard } from '../AlertOverviewAlertCard';
const acknowledge = vi.fn();
@@ -449,4 +449,88 @@ describe('Pulse system-alert overview scope', () => {
fireEvent.click(less);
expect(toggleTimeline).toHaveBeenCalledWith('open-timeline', 'open-timeline', alert.startTime);
});
+
+ describe('action placement by width', () => {
+ const desktopWidth = window.innerWidth;
+ const setWidth = (width: number) =>
+ Object.defineProperty(window, 'innerWidth', {
+ configurable: true,
+ writable: true,
+ value: width,
+ });
+ afterEach(() => setWidth(desktopWidth));
+
+ it('keeps Snooze and Investigate on the card from the sm breakpoint up', () => {
+ setWidth(640);
+ const alert = makeSystemAlert('cpu', {
+ id: 'wide-card',
+ resourceId: 'vm-pulse',
+ metadata: { resourceType: 'vm' },
+ });
+ render(() => (
+ <AlertOverviewAlertCard alert={alert} state={state} timelineState={timelineState} />
+ ));
+ expect(screen.getByRole('button', { name: 'Snooze' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Investigate' })).toBeInTheDocument();
+ fireEvent.click(screen.getByRole('button', { name: 'More' }));
+ expect(screen.getAllByRole('button', { name: 'Snooze' })).toHaveLength(1);
+ });
+
+ it('moves Investigate behind More on a phone and keeps Snooze on the row', () => {
+ // A 375px phone showed about three alerts per screen while four actions
+ // wrapped onto two rows under each one.
+ setWidth(375);
+ const alert = makeSystemAlert('cpu', {
+ id: 'phone-card',
+ resourceId: 'vm-pulse',
+ metadata: { resourceType: 'vm' },
+ });
+ render(() => (
+ <AlertOverviewAlertCard alert={alert} state={state} timelineState={timelineState} />
+ ));
+ expect(screen.getByRole('button', { name: 'Acknowledge' })).toBeInTheDocument();
+ const snooze = screen.getByRole('button', { name: 'Snooze' });
+ expect(screen.queryByRole('button', { name: 'Investigate' })).toBeNull();
+ const more = screen.getByRole('button', { name: 'More' });
+ expect(more).toHaveAttribute('aria-expanded', 'false');
+ // A collapsed disclosure renders no region, so it names none.
+ expect(more).not.toHaveAttribute('aria-controls');
+ fireEvent.click(more);
+ expect(more).toHaveAttribute('aria-expanded', 'true');
+ const panel = document.getElementById(more.getAttribute('aria-controls') ?? '');
+ expect(panel).not.toBeNull();
+ for (const name of ['Investigate', 'Timeline', 'Resource monitoring policy']) {
+ expect(panel).toContainElement(screen.getByRole('button', { name }));
+ }
+ expect(panel).not.toContainElement(snooze);
+ expect(screen.getAllByRole('button', { name: 'Snooze' })).toHaveLength(1);
+ });
+
+ it('moves the actions when a mounted card crosses the breakpoint', async () => {
+ // Rotating a phone crosses sm without remounting the overview.
+ setWidth(375);
+ const alert = makeSystemAlert('cpu', {
+ id: 'rotating-card',
+ resourceId: 'vm-pulse',
+ metadata: { resourceType: 'vm' },
+ });
+ render(() => (
+ <AlertOverviewAlertCard alert={alert} state={state} timelineState={timelineState} />
+ ));
+ expect(screen.queryByRole('button', { name: 'Investigate' })).toBeNull();
+ // Snooze owns its dialog state, so it must survive the crossing as the
+ // same element.
+ const snooze = screen.getByRole('button', { name: 'Snooze' });
+ setWidth(800);
+ window.dispatchEvent(new Event('resize'));
+ await waitFor(() =>
+ expect(screen.getByRole('button', { name: 'Investigate' })).toBeInTheDocument(),
+ );
+ expect(screen.getByRole('button', { name: 'Snooze' })).toBe(snooze);
+ setWidth(375);
+ window.dispatchEvent(new Event('resize'));
+ await waitFor(() => expect(screen.queryByRole('button', { name: 'Investigate' })).toBeNull());
+ expect(screen.getByRole('button', { name: 'Snooze' })).toBe(snooze);
+ });
+ });
});