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.

test(alerts): repin resource-incidents placement after a0113b964

rcourtmanb7651974260b
diff --git a/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts b/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts
index 2c62804cc6..c08945d9ef 100644
--- a/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts
+++ b/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts
@@ -426,13 +426,20 @@ describe('tab path helpers', () => {
expect(alertHistoryTabSource).toContain('useAlertHistoryState');
expect(alertHistoryTabSource).toContain('AlertHistoryFrequencyCard');
expect(alertHistoryTabSource).toContain('AlertHistoryFiltersCard');
- expect(alertHistoryTabSource).toContain('AlertResourceIncidentsPanel');
expect(alertHistoryTabSource).toContain('AlertHistoryTableSection');
expect(alertHistoryTabSource).toContain('AlertHistoryAdministrationCard');
expect(alertHistoryTabSource).toContain('historyState.alertData().length');
expect(alertHistoryTabSource).not.toContain('historyState.filteredAlerts().length');
- expect(alertHistoryTabSource).toContain(
- '<AlertResourceIncidentsPanel state={historyState} getResource={props.getResource} />',
+ // The resource incidents panel used to render as a page-level sibling here,
+ // which put it far above a reader scrolled into the history, so the per-row
+ // Resource button read as inert (#1687). It now mounts under the row that
+ // asked for it, gated on that row owning the open request.
+ expect(alertHistoryTabSource).not.toContain('AlertResourceIncidentsPanel');
+ expect(alertHistoryTableAlertRowSource).toContain(
+ '<AlertResourceIncidentsPanel state={props.state} />',
+ );
+ expect(alertHistoryTableAlertRowSource).toContain(
+ 'props.state.resourceIncidentPanel()?.rowKey === rowKey()',
);
expect(alertDestinationsTabSource).toContain('useAlertDestinationsTabState');
expect(alertDestinationsTabSource).toContain('AlertDestinationsLoadingState');
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index b898c6472b..d1f812f555 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -2793,10 +2793,13 @@ describe('frontend resource type boundaries', () => {
expect(alertHistoryTabSource).toContain('useAlertHistoryState');
expect(alertHistoryTabSource).toContain('AlertHistoryFrequencyCard');
expect(alertHistoryTabSource).toContain('AlertHistoryFiltersCard');
- expect(alertHistoryTabSource).toContain('AlertResourceIncidentsPanel');
expect(alertHistoryTabSource).toContain('AlertHistoryTableSection');
expect(alertHistoryTabSource).toContain('AlertHistoryAdministrationCard');
expect(alertsPageSource).toContain('getAlertsPageHeaderMeta');
+ // The resource incidents panel mounts under the row that asked for it, not
+ // as a page-level sibling here: at page level it opened far above a reader
+ // scrolled into the history, so the row button read as inert (#1687).
+ expect(alertHistoryTabSource).not.toContain('AlertResourceIncidentsPanel');
expect(alertHistoryTabSource).not.toContain('useAlertIncidentTimelineState');
expect(alertHistoryTabSource).not.toContain('AlertsAPI.getHistory');
expect(alertHistoryTabSource).not.toContain('AlertsAPI.getIncidentsForResource');
@@ -2840,6 +2843,12 @@ describe('frontend resource type boundaries', () => {
expect(alertHistoryTableAlertRowSource).toContain('getAlertHistoryResourceTypeBadgeClass');
expect(alertHistoryTableAlertRowSource).toContain('IncidentTimelinePanel');
expect(alertHistoryTableAlertRowSource).toContain('AlertHistoryItemActions');
+ expect(alertHistoryTableAlertRowSource).toContain('AlertResourceIncidentsPanel');
+ // Several alerts can share one resource, so the row renders the panel only
+ // when it owns the open request. That keeps exactly one panel open.
+ expect(alertHistoryTableAlertRowSource).toContain(
+ 'props.state.resourceIncidentPanel()?.rowKey === rowKey()',
+ );
expect(alertHistoryItemActionsSource).toContain('InvestigateAlertButton');
expect(alertHistoryAdministrationCardSource).toContain('getAlertAdministrationSectionTitle');
expect(alertHistoryAdministrationCardSource).toContain(