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.

fix(alerts): stop clipping the alert card monitoring policy menu

rcourtman6372b2886202
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 92fac4cff2..cce098059a 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,29 +1,16 @@
{
"version": 1,
- "base_sha": "3f32148b50c460320349fbadff5652ba5a8f4391",
- "verified_at": "2026-08-17T22:38:49Z",
+ "base_sha": "316657b5e859850e98b0db15ec5c42fa5696f561",
+ "verified_at": "2026-08-18T05:59:05Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx",
- "frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx",
- "frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx",
- "frontend-modern/src/features/patrol/PatrolObjectivesPanel.tsx",
- "frontend-modern/src/features/patrol/PatrolRecentWorkPanel.tsx",
- "frontend-modern/src/features/patrol/patrolHomePresentation.ts",
- "frontend-modern/src/utils/patrolPagePresentation.ts"
+ "frontend-modern/src/features/alerts/ResourceMonitoringPolicyAction.tsx"
],
"content_sha256": {
- "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx": "e9b9bf575863cfabb7b9f25818792882093313441c375c20174f8ccb695d749b",
- "frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx": "9adbd9fd4c9b5ae1e22c768a8034c570d5bc3b5f382bae002afffd82798022f0",
- "frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx": "b974431efa5fc4e4c7b8837d8678f99708ed63b22d268c76d9cf1409df56c64e",
- "frontend-modern/src/features/patrol/PatrolObjectivesPanel.tsx": "c9dc90ac77b57dc69718beed2ada4b47127a92900b229a5ae3e8dbf389c2461d",
- "frontend-modern/src/features/patrol/PatrolRecentWorkPanel.tsx": "b9fea954dc881a07d0bc97ec1401fefd5777aaef623bf7c1ce07f96d5f5b033b",
- "frontend-modern/src/features/patrol/patrolHomePresentation.ts": "724ca2540acad8ab5b154008ce4c066bd84f1e4354c5da3198c5b580f2f9c38b",
- "frontend-modern/src/utils/patrolPagePresentation.ts": "142505e839feed425ae0163adda1bf829d5b71075abf684898012f990f0f6326"
+ "frontend-modern/src/features/alerts/ResourceMonitoringPolicyAction.tsx": "14082de06f6135b3442a941b1edc3768f6d2f42ae71ff3c9810cd7b6f18b3cdb"
},
"routes": [
- "/patrol",
- "/patrol?attention=<attention-id>"
+ "/alerts"
],
"viewports": [
{
@@ -36,21 +23,15 @@
}
],
"states": [
- "Watch only with 12 current attention items and one governed action awaiting approval",
- "decision queue before selection with critical items sorted ahead of warnings",
- "selected attention item with impact, recommended next step, lifecycle controls and evidence",
- "empty protected-outcomes setup state",
- "empty verified-outcomes receipt state",
- "collapsed mode-and-automation disclosure",
- "collapsed findings-and-run-records disclosure",
- "mobile queue and selected decision context"
+ "Active Alerts list on the Alerts overview with 12 mock alerts",
+ "Monitoring policy menu open on the last visible alert card, previously the clipped case",
+ "Menu measured fully on-screen at both viewports via getBoundingClientRect against window.innerWidth/innerHeight",
+ "Menu closed after outside pointerdown"
],
"interactions": [
- "opened Patrol from the authenticated runtime and confirmed current work precedes outcome configuration and history",
- "selected the highest-severity attention item and confirmed the decision-context route state",
- "confirmed the selected mobile decision scrolls into view and receives keyboard focus",
- "confirmed the 390px layout has no horizontal page overflow",
- "confirmed the primary Check now and secondary Settings controls remain visible at both viewports",
- "confirmed Actions and approvals and Findings and run records remain available as subordinate review paths"
+ "Clicked the last alert card's Monitoring trigger at 1280x720, menu portaled to body, rect top 427 bottom 712 fully on-screen, screenshot shows all four choices incl. Retire from monitoring floating over subsequent cards",
+ "Clicked the last alert card's Monitoring trigger at 390x844, rect top 551 bottom 836 fully on-screen",
+ "Dispatched outside pointerdown, menu closed",
+ "vitest ResourceMonitoringPolicyAction 3 tests pass incl. new body-portal assertion, tsc --noEmit clean"
]
-}
+}
\ No newline at end of file
diff --git a/frontend-modern/src/features/alerts/ResourceMonitoringPolicyAction.tsx b/frontend-modern/src/features/alerts/ResourceMonitoringPolicyAction.tsx
index 3b92c2b9ab..8546bfffac 100644
--- a/frontend-modern/src/features/alerts/ResourceMonitoringPolicyAction.tsx
+++ b/frontend-modern/src/features/alerts/ResourceMonitoringPolicyAction.tsx
@@ -1,4 +1,5 @@
-import { For, createSignal } from 'solid-js';
+import { For, Show, createEffect, createSignal, onCleanup } from 'solid-js';
+import { Portal } from 'solid-js/web';
import {
type ResourceLifecycleState,
@@ -24,9 +25,51 @@ interface PolicyChoice {
lifecycleState?: ResourceLifecycleState;
}
+const MENU_WIDTH = 288;
+const ESTIMATED_MENU_HEIGHT = 240;
+
export function ResourceMonitoringPolicyAction(props: ResourceMonitoringPolicyActionProps) {
const [saving, setSaving] = createSignal(false);
- let detailsRef: HTMLDetailsElement | undefined;
+ const [menuOpen, setMenuOpen] = createSignal(false);
+ const [menuPosition, setMenuPosition] = createSignal({ left: 0, top: 0 });
+ let triggerRef: HTMLButtonElement | undefined;
+ let menuRef: HTMLDivElement | undefined;
+
+ // The menu renders through a portal with fixed positioning so it can extend
+ // past the alert card's scroll container: rendered in place, the last card's
+ // menu is clipped at the container edge (#1737). The rendered height is
+ // measured once mounted because the choice descriptions wrap, so a fixed
+ // estimate under-clamps at the viewport bottom.
+ const updateMenuPosition = () => {
+ if (!triggerRef || typeof window === 'undefined') return;
+ const rect = triggerRef.getBoundingClientRect();
+ const menuHeight = menuRef?.offsetHeight || ESTIMATED_MENU_HEIGHT;
+ setMenuPosition({
+ left: Math.max(8, Math.min(window.innerWidth - MENU_WIDTH - 8, rect.right - MENU_WIDTH)),
+ top: Math.max(8, Math.min(window.innerHeight - menuHeight - 8, rect.bottom + 4)),
+ });
+ };
+
+ createEffect(() => {
+ if (!menuOpen() || typeof window === 'undefined') return;
+ updateMenuPosition();
+ const closeOnOutsidePointer = (event: PointerEvent) => {
+ const target = event.target;
+ if (target instanceof Element && target.closest('[data-monitoring-policy-menu-root]')) {
+ return;
+ }
+ setMenuOpen(false);
+ };
+ window.addEventListener('resize', updateMenuPosition);
+ window.addEventListener('scroll', updateMenuPosition, true);
+ document.addEventListener('pointerdown', closeOnOutsidePointer);
+ onCleanup(() => {
+ window.removeEventListener('resize', updateMenuPosition);
+ window.removeEventListener('scroll', updateMenuPosition, true);
+ document.removeEventListener('pointerdown', closeOnOutsidePointer);
+ });
+ });
+
const ownership = () =>
describeResourceInventoryOwnership(props.resourceType, props.platformType);
const choices = (): PolicyChoice[] => [
@@ -81,7 +124,7 @@ export function ResourceMonitoringPolicyAction(props: ResourceMonitoringPolicyAc
note: current?.note,
};
await setResourceOperatorState(props.resourceId, input);
- if (detailsRef) detailsRef.open = false;
+ setMenuOpen(false);
notificationStore.success(`${choice.label} saved for ${props.resourceName}`);
} catch (error) {
notificationStore.error(
@@ -93,30 +136,59 @@ export function ResourceMonitoringPolicyAction(props: ResourceMonitoringPolicyAc
};
return (
- <details ref={detailsRef} class="relative" onClick={(event) => event.stopPropagation()}>
- <summary class="inline-flex min-h-9 cursor-pointer list-none items-center rounded-md border border-border bg-surface px-2.5 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover">
+ <div
+ class="relative"
+ data-monitoring-policy-menu-root
+ onClick={(event) => event.stopPropagation()}
+ >
+ <button
+ type="button"
+ ref={triggerRef}
+ class="inline-flex min-h-9 cursor-pointer items-center rounded-md border border-border bg-surface px-2.5 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover"
+ onClick={(event) => {
+ event.stopPropagation();
+ updateMenuPosition();
+ setMenuOpen((open) => !open);
+ }}
+ >
{saving() ? 'Saving…' : 'Monitoring'}
- </summary>
- <div class="absolute right-0 z-30 mt-1 w-72 rounded-md border border-border bg-surface p-1.5 shadow-lg">
- <p class="px-2 pb-1.5 text-[11px] text-muted">
- This changes Pulse policy only. {ownership().ownerLabel} remains the inventory owner.
- </p>
- <For each={choices()}>
- {(choice) => (
- <button
- type="button"
- disabled={saving()}
- class="block w-full rounded px-2 py-2 text-left hover:bg-surface-hover disabled:opacity-50"
- onClick={() => void applyChoice(choice)}
- >
- <span class="block text-xs font-medium text-base-content">{choice.label}</span>
- <span class="mt-0.5 block text-[11px] leading-tight text-muted">
- {choice.description}
- </span>
- </button>
- )}
- </For>
- </div>
- </details>
+ </button>
+ <Show when={menuOpen()}>
+ <Portal mount={document.body}>
+ <div
+ ref={menuRef}
+ data-monitoring-policy-menu-root
+ role="menu"
+ class="fixed z-[9999] w-72 rounded-md border border-border bg-surface p-1.5 shadow-lg"
+ style={{ left: `${menuPosition().left}px`, top: `${menuPosition().top}px` }}
+ onMouseDown={(event) => event.stopPropagation()}
+ onClick={(event) => event.stopPropagation()}
+ onKeyDown={(event) => {
+ event.stopPropagation();
+ if (event.key === 'Escape') setMenuOpen(false);
+ }}
+ >
+ <p class="px-2 pb-1.5 text-[11px] text-muted">
+ This changes Pulse policy only. {ownership().ownerLabel} remains the inventory owner.
+ </p>
+ <For each={choices()}>
+ {(choice) => (
+ <button
+ type="button"
+ disabled={saving()}
+ class="block w-full rounded px-2 py-2 text-left hover:bg-surface-hover disabled:opacity-50"
+ onClick={() => void applyChoice(choice)}
+ >
+ <span class="block text-xs font-medium text-base-content">{choice.label}</span>
+ <span class="mt-0.5 block text-[11px] leading-tight text-muted">
+ {choice.description}
+ </span>
+ </button>
+ )}
+ </For>
+ </div>
+ </Portal>
+ </Show>
+ </div>
);
}
diff --git a/frontend-modern/src/features/alerts/__tests__/ResourceMonitoringPolicyAction.test.tsx b/frontend-modern/src/features/alerts/__tests__/ResourceMonitoringPolicyAction.test.tsx
index a67fee7cda..0b69340087 100644
--- a/frontend-modern/src/features/alerts/__tests__/ResourceMonitoringPolicyAction.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/ResourceMonitoringPolicyAction.test.tsx
@@ -54,6 +54,24 @@ describe('ResourceMonitoringPolicyAction', () => {
});
});
+ it('renders the policy menu through a body portal so scroll containers cannot clip it', () => {
+ operatorStateMock.get.mockResolvedValue(null);
+ render(() => (
+ <ResourceMonitoringPolicyAction
+ resourceId="vm:101"
+ resourceName="legacy-lxc"
+ resourceType="system-container"
+ />
+ ));
+
+ const trigger = screen.getByText('Monitoring');
+ fireEvent.click(trigger);
+ const menu = screen.getByRole('menu');
+ expect(trigger.parentElement?.contains(menu)).toBe(false);
+ expect(document.body.contains(menu)).toBe(true);
+ expect(menu.className).toContain('fixed');
+ });
+
it('retires provider inventory without changing its previous monitoring mode', async () => {
operatorStateMock.get.mockResolvedValue({
canonicalId: 'vm:101',