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.

Centralize infrastructure resource links

rcourtman100cff33d0f3
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index f074207fc1..c270984a3f 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -85,6 +85,7 @@ Own canonical runtime payload shapes between backend and frontend.
and the shared `frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx` card, so the AI summary page and resource drawer render the same governed policy-posture counts instead of carrying duplicate posture UI loops
and the shared `frontend-modern/src/components/Infrastructure/ResourceGraphSummary.tsx` card, so learned correlations and graph context stay rendered through one governed frontend card instead of separate page-local list loops
and the same shared graph card's ordering and truncation rule, so callers pass raw correlations instead of encoding their own top-N sort behavior
+ and the shared `frontend-modern/src/routing/resourceLinks.ts` infrastructure resource-link helper, so resource-only links in the summary page, resource drawer, and problem-resource dashboard panels stay on the same canonical path-construction rule instead of rebuilding infrastructure URLs inline
8. Route frontend API-client parsed error propagation, API-error-status fallback handling, allowed-status handling, custom status-specific error handling, command-trigger success envelope handling, shared response parsing pipelines, missing-resource lookup handling, metadata CRUD routing, stream event consumption, response status, collection normalization, scalar payload coercion, and structured error normalization through canonical shared helpers under `frontend-modern/src/api/`
9. Add or change API token scope, assignment, and revocation presentation through `frontend-modern/src/components/Settings/APITokenManager.tsx`
10. Add or change infrastructure operations token generation, lookup, assignment, and reporting/install presentation through `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 603cd85eda..e60df9f719 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -117,6 +117,11 @@ That same store now owns the Patrol dashboard load bundle as well, so the
page refresh path stays aligned on a single orchestrated AI bundle instead of
repeating the individual summary, findings, approval, and correlation fetches
inline.
+Resource-only Infrastructure links on the Patrol page, resource drawer, and
+problem-resource dashboard panels now resolve through the shared
+`frontend-modern/src/routing/resourceLinks.ts` helper, so canonical resource
+href construction stays in the routing boundary instead of being rebuilt as
+local wrappers in each surface.
The Patrol intelligence page and resource drawer now also share the canonical
`frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx`
card, so the data-governance posture counts stay rendered from one governed
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 3b8c13af0f..e68e9e0030 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -269,6 +269,11 @@ Relationship cards in that drawer also surface `lastSeenAt` freshness and
optional metadata blocks, and timeline cards surface change metadata when it
is present, so the graph history view preserves the richer provenance already
carried by the unified-resource model instead of flattening those fields away.
+The same Infrastructure resource-only links now also resolve through the
+shared `frontend-modern/src/routing/resourceLinks.ts` helper from the Patrol
+page, resource drawer, and problem-resource dashboard panels, so the canonical
+resource-filter path construction stays owned by the routing boundary rather
+than being duplicated per surface.
The same timeline and facet-bundle reads now also accept governed `kind` and
`sourceType` filters, plus a governed `sourceAdapter` filter for adapter-level
provenance drill-down, so history can narrow by canonical change class and
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index fec3da7ffc..e8b3bf2a99 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -45,7 +45,6 @@ import { SwarmServicesDrawer } from '@/components/Docker/SwarmServicesDrawer';
import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';
import { getServiceHealthPresentation } from '@/utils/serviceHealthPresentation';
import { ResourceAPI } from '@/api/resources';
-import { buildInfrastructurePath } from '@/routing/resourceLinks';
import {
getResourcePolicyBadges,
getResourcePolicyRedactionLabels,
@@ -58,6 +57,7 @@ import { ResourceChangeSummary } from './ResourceChangeSummary';
import { ResourceFacetSummary } from './ResourceFacetSummary';
import { ResourcePolicySummary } from './ResourcePolicySummary';
import type { ResourceIntelligence } from '@/types/aiIntelligence';
+import { buildInfrastructureResourceHref } from '@/routing/resourceLinks';
interface ResourceDetailDrawerProps {
resource: Resource;
@@ -78,11 +78,6 @@ import {
formatSourceType,
} from './resourceDetailMappers';
-const buildInfrastructureResourceHref = (resourceId: string): string | null => {
- const trimmed = resourceId.trim();
- return trimmed ? buildInfrastructurePath({ resource: trimmed }) : null;
-};
-
const hasMetadataEntries = (value?: Record<string, unknown> | null): boolean =>
Boolean(value && Object.keys(value).length > 0);
diff --git a/frontend-modern/src/pages/AIIntelligence.tsx b/frontend-modern/src/pages/AIIntelligence.tsx
index 06263a36f0..b121e43c14 100644
--- a/frontend-modern/src/pages/AIIntelligence.tsx
+++ b/frontend-modern/src/pages/AIIntelligence.tsx
@@ -98,12 +98,9 @@ import {
getTrialStartErrorMessage,
getTrialTryAgainLaterMessage,
} from '@/utils/upgradePresentation';
-import { buildInfrastructurePath } from '@/routing/resourceLinks';
-
-const buildInfrastructureResourceHref = (resourceId: string): string | null => {
- const trimmed = resourceId.trim();
- return trimmed ? buildInfrastructurePath({ resource: trimmed }) : null;
-};
+import {
+ buildInfrastructureResourceHref,
+} from '@/routing/resourceLinks';
type PatrolTab = 'findings' | 'history';
export function AIIntelligence() {
@@ -1335,14 +1332,12 @@ export function AIIntelligence() {
</div>
<Show when={(aiIntelligenceStore.correlations?.correlations?.length ?? 0) > 0}>
- <ResourceGraphSummary
- title="Learned correlations"
- correlations={aiIntelligenceStore.correlations?.correlations ?? []}
- summaryText={`${correlationTotal()} total`}
- buildResourceHref={(resourceId) =>
- buildInfrastructurePath({ resource: resourceId })
- }
- />
+ <ResourceGraphSummary
+ title="Learned correlations"
+ correlations={aiIntelligenceStore.correlations?.correlations ?? []}
+ summaryText={`${correlationTotal()} total`}
+ buildResourceHref={buildInfrastructureResourceHref}
+ />
</Show>
<ResourcePolicySummary posture={policyPosture()} title="Data Governance" />
diff --git a/frontend-modern/src/pages/DashboardPanels/ProblemResourcesTable.tsx b/frontend-modern/src/pages/DashboardPanels/ProblemResourcesTable.tsx
index 51be8a9711..2036131603 100644
--- a/frontend-modern/src/pages/DashboardPanels/ProblemResourcesTable.tsx
+++ b/frontend-modern/src/pages/DashboardPanels/ProblemResourcesTable.tsx
@@ -13,7 +13,7 @@ import type { ProblemResource } from '@/hooks/useDashboardOverview';
import { isInfrastructure, isStorage } from '@/types/resource';
import {
INFRASTRUCTURE_PATH,
- buildInfrastructurePath,
+ buildInfrastructureResourceHref,
buildWorkloadsPath,
buildStoragePath,
} from '@/routing/resourceLinks';
@@ -29,7 +29,7 @@ interface ProblemResourcesTableProps {
function resourceLink(pr: ProblemResource): string {
if (isInfrastructure(pr.resource)) {
- return buildInfrastructurePath({ resource: pr.resource.id });
+ return buildInfrastructureResourceHref(pr.resource.id) ?? INFRASTRUCTURE_PATH;
}
if (isStorage(pr.resource)) {
return buildStoragePath();
diff --git a/frontend-modern/src/pages/DashboardPanels/__tests__/ProblemResourcesTable.test.tsx b/frontend-modern/src/pages/DashboardPanels/__tests__/ProblemResourcesTable.test.tsx
index 190fdd5d44..511688f4cd 100644
--- a/frontend-modern/src/pages/DashboardPanels/__tests__/ProblemResourcesTable.test.tsx
+++ b/frontend-modern/src/pages/DashboardPanels/__tests__/ProblemResourcesTable.test.tsx
@@ -38,6 +38,10 @@ describe('ProblemResourcesTable', () => {
it('renders overflow footer with Infrastructure, Workloads, and Storage links when 8+ problems', () => {
render(() => <ProblemResourcesTable problems={makeProblems(8)} />);
+ const resourceLink = screen.getByText('Resource 0');
+ expect(resourceLink.tagName).toBe('A');
+ expect(resourceLink.getAttribute('href')).toBe('/infrastructure?resource=res-0');
+
const infraLink = screen.getByText('Infrastructure');
expect(infraLink.tagName).toBe('A');
expect(infraLink.getAttribute('href')).toBe('/infrastructure');
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index eda91f320e..44e018dac7 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -3,6 +3,7 @@ import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-li
import { createSignal } from 'solid-js';
import { AIIntelligence } from '../AIIntelligence';
+import { buildInfrastructureResourceHref } from '@/routing/resourceLinks';
const { findingsPanelState, runHistoryState, intelligenceState } = vi.hoisted(() => ({
findingsPanelState: {
@@ -434,7 +435,10 @@ describe('AIIntelligence entitlement gating', () => {
const storage1Link = screen.getByRole('link', {
name: 'Open source resource Storage 1 in Infrastructure',
});
- expect(storage2Link).toHaveAttribute('href', '/infrastructure?resource=storage-2');
+ expect(storage2Link).toHaveAttribute(
+ 'href',
+ buildInfrastructureResourceHref('storage-2') ?? '',
+ );
expect(screen.getByRole('link', { name: 'Open target resource VM 200 in Infrastructure' }))
.toHaveAttribute('href', '/infrastructure?resource=vm-200');
expect(screen.getByRole('link', { name: 'Open target resource VM 100 in Infrastructure' }))
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index 3d78ef96cc..c706fa6392 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -4,6 +4,7 @@ import {
RECOVERY_QUERY_PARAMS,
buildRecoveryPath,
buildInfrastructurePath,
+ buildInfrastructureResourceHref,
buildStoragePath,
buildWorkloadsPath,
parseRecoveryLinkSearch,
@@ -85,6 +86,13 @@ describe('resource link routing contract', () => {
});
});
+ it('builds canonical infrastructure resource links', () => {
+ expect(buildInfrastructureResourceHref(' resource-123 ')).toBe(
+ '/infrastructure?resource=resource-123',
+ );
+ expect(buildInfrastructureResourceHref('')).toBeNull();
+ });
+
it('builds and parses storage query params', () => {
const href = buildStoragePath({
tab: 'disks',
diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts
index 904626bd5b..8ca116e93c 100644
--- a/frontend-modern/src/routing/resourceLinks.ts
+++ b/frontend-modern/src/routing/resourceLinks.ts
@@ -161,6 +161,11 @@ export const buildInfrastructurePath = (options: InfrastructureLinkOptions = {})
return serialized ? `${INFRASTRUCTURE_PATH}?${serialized}` : INFRASTRUCTURE_PATH;
};
+export const buildInfrastructureResourceHref = (resourceId: string): string | null => {
+ const trimmed = resourceId.trim();
+ return trimmed ? buildInfrastructurePath({ resource: trimmed }) : null;
+};
+
export const parseStorageLinkSearch = (search: string) => {
const params = new URLSearchParams(search);
return {