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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Complete canonical web interface links
rcourtman478a9e933d9a
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.jsonindex ebd58d07dd..f57f3bd8da 100644--- a/docs/release-control/v6/internal/status.json+++ b/docs/release-control/v6/internal/status.json@@ -3836,7 +3836,7 @@},{"repo": "pulse",- "path": "frontend-modern/src/components/shared/WebInterfaceNameLink.tsx",+ "path": "frontend-modern/src/components/shared/WebInterfaceLink.tsx","kind": "file"},{diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex c111155a8c..2a31ea23fb 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -5134,6 +5134,13 @@ That handoff is lifecycle continuity only: it prevents post-reload agentreports and resource projection from observing an orphaned metadata cache, anddoes not add a report shape, credential, command, or remote-configurationauthority.+Web-interface URL continuity shares that handoff but does not widen lifecycle+ownership. Docker/Podman display-name updates must merge with the runtime host+metadata record so they cannot discard its URL or notes, and monitoring+projection may follow stable source identities across reconnect, rename,+recreation, or canonical alias migration. None of those navigation-metadata+operations may reverse a removal tombstone, re-enroll an agent, change report+identity, or authorize commands.### Proxmox install bootstrap and runtime-health authoritydiff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex f016ded8b0..901f9a5642 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -971,10 +971,12 @@ state, delay-row toggling, and inline metric-input focus live in`frontend-modern/src/components/Alerts/useAlertResourceTableState.ts`. Sharedweb-interface launch affordances inside alert resource rows and grouped agentheaders must compose-`frontend-modern/src/components/shared/WebInterfaceNameLink.tsx`; alerts own-only the alert/resource data and URL availability decision, not the external-anchor shell, new-tab safety attributes, row-click containment, or accessible-launch-label semantics.+`frontend-modern/src/components/shared/WebInterfaceLink.tsx`; alerts own only+the alert/resource data and URL availability decision, not URL safety+classification, the adjacent launch-control shell, new-tab safety attributes,+row-click containment, invalid-URL warnings, or accessible launch-label+semantics. Alert resource names remain inert row identity so opening a saved+web interface cannot also toggle selection or the thresholds editor.Resource-table empty states, badge labels, offline-state wording, noteplaceholders, and metric input titles now route through`frontend-modern/src/utils/alertResourceTablePresentation.ts` instead ofdiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex a6aedae572..23c8f0a1c1 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -7154,6 +7154,16 @@ The thin agent, docker, and guest metadata TypeScript models remain aliasesover `ResourceMetadataRecord`; they must not grow empty local interface shellsor imply a resource-specific wire shape until the backend payload actuallyadds one.+Metadata `PUT` routes are partial-update contracts, not record replacement.+`internal/api/metadata_handlers_shared.go` must decode a bounded object and+retain field-presence information so changing or clearing `customUrl` cannot+erase descriptions, tags, notes, commands-enabled state, display names, or+last-known resource identity. Guest, host, Docker host, and Docker container+handlers must merge into the active organization monitor's live store; an+identical metadata ID in another tenant is a separate record. Authored+web-interface URLs must accept only absolute HTTP(S) values. Empty or null+request bodies fail closed, and unsafe schemes must never be projected as+executable browser links.AI investigation and chat stream clients must now also route through one sharedSSE JSON event consumer in `frontend-modern/src/api/streaming.ts` rather thanduplicating reader lifecycle, timeout, chunk parsing, and event decoding logicdiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 130d807a34..d17cf96e1d 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -3326,14 +3326,20 @@ field must suppress "no suggested URL" warnings so Discovery does not make avalid manual endpoint look broken.Saved web-interface launch affordances must also stay on a shared primitiveinstead of page-local table columns or one-off external-link anchors.-`frontend-modern/src/components/shared/WebInterfaceNameLink.tsx` owns the-resource-name link shell, new-tab safety attributes, row-click/key propagation-containment, fallback text, and accessible launch labels. Workload guest rows,-grouped node headers, standalone machine rows, Proxmox node rows, and alert-resource rows/group headers compose that primitive so a saved or inferred URL-is opened by clicking the resource name on every comparable runtime table.-Runtime/platform tables must not add separate `Web` columns, page-local-external-link anchors, or duplicated new-tab safety handling for that launch+`frontend-modern/src/components/shared/WebInterfaceLink.tsx` owns URL+classification, the distinct adjacent launch control, new-tab safety+attributes, row-click/key propagation containment, invalid-URL presentation,+and accessible launch labels. The resource name remains inert identity text;+the launch control is a separate keyboard-focusable target with at least a+24-by-24 CSS-pixel hit area so activating it never doubles as row selection or+drawer navigation. Workload guest rows, grouped node headers, standalone+machine rows, Proxmox node rows, Docker/Podman rows, Kubernetes rows, unified+host/PBS/PMG rows, and alert resource rows/group headers compose that primitive+for every comparable overview surface. Missing URLs render no fake control.+Malformed or non-HTTP(S) saved values render a non-interactive accessible+warning rather than disappearing or becoming executable. Runtime/platform+tables must not add separate `Web` columns, page-local external-link anchors,+linked resource names, or duplicated new-tab safety handling for that launchaffordance.Shared-template drift enforcement is registry-backed:`frontend-modern/scripts/shared-template-registry.json` is the canonical list ofdiff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 3ba18f9601..6a86bb230d 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -1632,6 +1632,18 @@ observed. Runtime UIDs remain discovery and metrics coordinates. Every scopecomponent is required so a URL cannot cross cluster, namespace, or kindboundaries, and an existing empty stable record is an intentional clear thatmust block legacy fallback.+Unified resource projection must also hydrate saved host-level web-interface+URLs from the tenant monitor's canonical metadata stores for standalone+agents, Proxmox nodes, Docker/Podman runtimes, PBS and PMG instances, and+Kubernetes clusters and nodes. Stable provider/source identities take+precedence over display names, runtime registry IDs, or host labels; canonical+and superseded identity aliases may be consulted for migration continuity but+must not broaden tenant scope. A non-empty operator metadata value overrides a+configured source URL; absent or cleared host metadata preserves or reveals a+configured source fallback. Stable workload metadata is authoritative even+when empty so an explicit workload clear cannot revive a stale runtime-key or+projected URL. Projection must copy the resource snapshot rather than mutating+the ingest input.The monitor-owned guest, Docker, and host metadata stores are the livein-memory authority for projection and migration. API, config export/import,tenant usage, Assistant URL discovery, and reload paths must share those exactdiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 638d03e3cd..4a49698b47 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -255,11 +255,13 @@ change may globally weaken the Task 03 lifecycle-state idempotency invariant.`docker.uptimeSeconds`, `kubernetes.uptimeSeconds`); platforms whoseadapters only populate the canonical field — vSphere is the workingexample — would otherwise render blank uptime cells for every row.- Workload guest rows may compose the shared saved web-interface name-link- shell from `frontend-primitives`, but row rendering must receive any saved- URL from already-loaded row metadata and must not add per-row metadata- fetches, Discovery probes, or page-local external-link logic on the table- hot path.+ Workload guest rows may compose the shared saved web-interface adjacent+ launch control from `frontend-primitives`, but row rendering must receive+ any saved URL from already-loaded row metadata and must not add per-row+ metadata fetches, Discovery probes, URL validation copies, or page-local+ external-link logic on the table hot path. The inert resource name and the+ separate 24-by-24 CSS-pixel launch target must remain one bounded render+ composition rather than a new column or secondary lookup.Workload status filters remain URL-canonical. Scoped local persistence mayseed a missing `status` parameter when a platform page is revisited, but therestore path must write the URL once with `replace` and must not force rowdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 2eb55e5e7f..90ee291f38 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -2396,6 +2396,12 @@ storage/recovery authority. Guest metadata import must reload the activetenant monitor's live store so recovery and resource projections observe onepost-import state; it must not leave a parallel persistence cache or reload thedefault tenant on behalf of another organization.+Saved web-interface metadata is likewise adjacent navigation state, not+storage or recovery evidence. Storage/recovery consumers may inherit a safe+canonical resource URL after the tenant-scoped unified-resource projection+refreshes, but save/remove change events, metadata reloads, and browser launch+controls do not prove backup freshness, restore readiness, protection posture,+or provider reachability and must not create a storage-local URL authority.Host-agent removal tombstones in `internal/config/host_continuity.go` are anadjacent agent-lifecycle security journal, not storage or recovery inventory.diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 285828baca..f778fadb15 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -499,10 +499,15 @@ contract instead of a VMware-local row model or custom vSphere detail shell.The split also applies to web-interface launch affordances. Unified-resourcetables own whether a row has a saved, inferred, or source-native web-interfaceURL and how that URL is derived, but the visible launch affordance belongs on-the resource name through the shared `WebInterfaceNameLink` primitive. Proxmox-host table columns are governed by `proxmoxHostTableModel.ts`; that model must-not reintroduce a separate `Web` column or move the web-interface launch back-into a page-local icon cell.+an adjacent control through the shared `WebInterfaceLink` primitive. Resource+names remain inert identity text, while the separate accessible launch target+owns new-tab behavior and event containment. Proxmox host table columns are+governed by `proxmoxHostTableModel.ts`; that model must not reintroduce a+separate `Web` column, a linked row name, or a page-local launch implementation.+The same presentation contract applies to Docker/Podman hosts and containers,+standalone agents, PBS/PMG instances, Kubernetes clusters/nodes/workloads, and+card or mobile variants. An absent URL is honestly absent, while an invalid or+unsafe saved value remains visible as a non-interactive warning.Persisted workload URLs must also use the same stable identity in the workloadand infrastructure drawers. Docker app containers use`app-container:<host>:name:<normalized-name>`; Kubernetes pods, Deployments,diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.jsonindex f911c599a6..8f48ccd4be 100644--- a/frontend-modern/scripts/shared-template-registry.json+++ b/frontend-modern/scripts/shared-template-registry.json@@ -2,12 +2,12 @@"version": 1,"rules": [{- "id": "runtime-web-interface-name-link",+ "id": "runtime-web-interface-inline-link","category": "resource-launch",- "summary": "Runtime resource rows must launch saved or inferred web-interface URLs through the shared name-link template, not a page-local link or separate web column.",+ "summary": "Runtime resource rows keep names available for row selection and expose saved or inferred web-interface URLs through the shared adjacent-link template, not a page-local link or separate web column.","canonical": {- "path": "src/components/shared/WebInterfaceNameLink.tsx",- "export": "WebInterfaceNameLink"+ "path": "src/components/shared/WebInterfaceLink.tsx",+ "export": "ResourceNameWithWebInterfaceLink"},"requiredConsumers": [{@@ -27,6 +27,36 @@},{"path": "src/components/Alerts/AlertResourceTableRow.tsx"+ },+ {+ "path": "src/components/Infrastructure/UnifiedResourceHostTableCard.tsx"+ },+ {+ "path": "src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx"+ },+ {+ "path": "src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx"+ },+ {+ "path": "src/features/docker/DockerNativeTableShared.tsx"+ },+ {+ "path": "src/features/docker/DockerContainersTable.tsx"+ },+ {+ "path": "src/features/kubernetes/KubernetesClustersTable.tsx"+ },+ {+ "path": "src/features/kubernetes/KubernetesNodesTable.tsx"+ },+ {+ "path": "src/features/kubernetes/KubernetesPodsTable.tsx"+ },+ {+ "path": "src/features/kubernetes/KubernetesDeploymentsTable.tsx"+ },+ {+ "path": "src/features/kubernetes/KubernetesServicesTable.tsx"}],"forbiddenPatterns": [@@ -74,7 +104,7 @@],"proof": ["src/components/shared/SharedPrimitives.guardrails.test.ts",- "src/components/shared/WebInterfaceNameLink.test.tsx",+ "src/components/shared/WebInterfaceLink.test.tsx","src/components/shared/__tests__/NodeGroupHeader.test.tsx","src/features/standalone/__tests__/AgentsMachinesTable.test.tsx","src/components/Workloads/__tests__/GuestRow.test.tsx",diff --git a/frontend-modern/src/api/dockerHostMetadata.ts b/frontend-modern/src/api/dockerHostMetadata.tsnew file mode 100644index 0000000000..7ffa59b251--- /dev/null+++ b/frontend-modern/src/api/dockerHostMetadata.ts@@ -0,0 +1,26 @@+import { apiFetchJSON } from '@/utils/apiClient';++export interface DockerHostMetadata {+ customDisplayName?: string;+ customUrl?: string;+ notes?: string[];+}++const baseUrl = '/api/docker/runtimes/metadata';+const detailPath = (runtimeId: string): string => `${baseUrl}/${encodeURIComponent(runtimeId)}`;++export class DockerHostMetadataAPI {+ static async getMetadata(runtimeId: string): Promise<DockerHostMetadata> {+ return apiFetchJSON<DockerHostMetadata>(detailPath(runtimeId));+ }++ static async updateMetadata(+ runtimeId: string,+ metadata: Partial<DockerHostMetadata>,+ ): Promise<DockerHostMetadata> {+ return apiFetchJSON<DockerHostMetadata>(detailPath(runtimeId), {+ method: 'PUT',+ body: JSON.stringify(metadata),+ });+ }+}diff --git a/frontend-modern/src/components/Alerts/AlertResourceGroupHeader.tsx b/frontend-modern/src/components/Alerts/AlertResourceGroupHeader.tsxindex db9f479fb9..11964bd6ec 100644--- a/frontend-modern/src/components/Alerts/AlertResourceGroupHeader.tsx+++ b/frontend-modern/src/components/Alerts/AlertResourceGroupHeader.tsx@@ -1,10 +1,7 @@import { Show } from 'solid-js';import { GROUPED_TABLE_ROW_BADGE_CLASS } from '@/components/shared/groupedTableRowPresentation';-import {- WEB_INTERFACE_LINK_COLOR_CLASS,- WebInterfaceNameLink,-} from '@/components/shared/WebInterfaceNameLink';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import type { GroupHeaderMeta } from '@/features/alerts/thresholds/tableTypes';interface AlertResourceGroupHeaderProps {@@ -18,11 +15,9 @@ export function AlertResourceGroupHeader(props: AlertResourceGroupHeaderProps) {return (<Show when={props.meta?.type === 'agent'} fallback={<span>{groupLabel()}</span>}><div class="flex flex-wrap items-center gap-3">- <WebInterfaceNameLink+ <ResourceNameWithWebInterfaceLinkname={groupLabel()}url={props.meta?.host}- class={WEB_INTERFACE_LINK_COLOR_CLASS}- fallbackClass=""title={`Open ${groupLabel()} web interface`}/><Show when={props.meta?.clusterName}>diff --git a/frontend-modern/src/components/Alerts/AlertResourceTableRow.tsx b/frontend-modern/src/components/Alerts/AlertResourceTableRow.tsxindex fee125d9aa..32a5a80e18 100644--- a/frontend-modern/src/components/Alerts/AlertResourceTableRow.tsx+++ b/frontend-modern/src/components/Alerts/AlertResourceTableRow.tsx@@ -9,10 +9,7 @@ import { TogglePrimitive } from '@/components/shared/Toggle';import { StatusBadge } from '@/components/shared/StatusBadge';import { ThresholdSlider } from '@/components/Workloads/ThresholdSlider';import { TableCell, TableRow } from '@/components/shared/Table';-import {- WEB_INTERFACE_LINK_COLOR_CLASS,- WebInterfaceNameLink,-} from '@/components/shared/WebInterfaceNameLink';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { getPlatformTableCellClassForKind } from '@/features/platformPage/sharedPlatformPage';import {getAlertResourceTableCustomBadgeLabel,@@ -264,14 +261,12 @@ export function AlertResourceTableRow(props: AlertResourceTableRowProps) {}><div class="flex items-center gap-3 min-w-0" title={props.resource.status || undefined}>- <WebInterfaceNameLink+ <ResourceNameWithWebInterfaceLinkname={resourceLabel()}url={props.resource.host as string | null | undefined}- class={`text-sm font-medium truncate flex-nowrap ${- props.resource.disabled ? 'text-slate-500 ' : WEB_INTERFACE_LINK_COLOR_CLASS- }`}- fallbackClass={`text-sm font-medium truncate flex-nowrap ${- props.resource.disabled ? 'text-slate-500 ' : 'text-base-content'+ class="min-w-0"+ nameClass={`truncate text-sm font-medium ${+ props.resource.disabled ? 'text-slate-500' : 'text-base-content'}`}title={`Open ${resourceLabel()} web interface`}/>diff --git a/frontend-modern/src/components/Alerts/ResourceTable.test.tsx b/frontend-modern/src/components/Alerts/ResourceTable.test.tsxindex e8d117b585..2bf86f5c02 100644--- a/frontend-modern/src/components/Alerts/ResourceTable.test.tsx+++ b/frontend-modern/src/components/Alerts/ResourceTable.test.tsx@@ -324,14 +324,14 @@ describe('ResourceTable', () => {expect(alertResourceTableMobileSource).not.toContain(['<', 'textarea'].join(''));expect(alertResourceTableMobileSource).not.toContain(rawSvgTag);expect(alertResourceGroupHeaderSource).toContain('export function AlertResourceGroupHeader');- expect(alertResourceGroupHeaderSource).toContain('WebInterfaceNameLink');+ expect(alertResourceGroupHeaderSource).toContain('ResourceNameWithWebInterfaceLink');expect(alertResourceGroupHeaderSource).not.toContain('target="_blank"');expect(alertResourceGroupHeaderSource).not.toContain('rel="noopener noreferrer"');expect(alertResourceTableRowSource).toContain('export function AlertResourceTableRow');expect(alertResourceTableRowSource).toContain('alertResourceSupportsMetric');expect(alertResourceTableRowSource).toContain('FormTextarea');expect(alertResourceTableRowSource).toContain('ActionIconButton');- expect(alertResourceTableRowSource).toContain('WebInterfaceNameLink');+ expect(alertResourceTableRowSource).toContain('ResourceNameWithWebInterfaceLink');expect(alertResourceTableRowSource).not.toContain(['<', 'textarea'].join(''));expect(alertResourceTableRowSource).not.toContain('target="_blank"');expect(alertResourceTableRowSource).not.toContain('rel="noopener noreferrer"');@@ -810,8 +810,10 @@ describe('ResourceTable', () => {});render(() => <ResourceTable {...props} />);- const link = screen.getByText('PVE Node 1');- expect(link.tagName).toBe('A');+ expect(screen.getByText('PVE Node 1').tagName).toBe('SPAN');+ const link = screen.getByRole('link', {+ name: 'Open web interface for PVE Node 1',+ });expect(link).toHaveAttribute('href', 'https://pve1.example.com:8006');expect(link).toHaveAttribute('target', '_blank');});@@ -1063,8 +1065,10 @@ describe('ResourceTable', () => {});render(() => <ResourceTable {...props} />);- const link = screen.getByText('PVE Node 1');- expect(link.tagName).toBe('A');+ expect(screen.getByText('PVE Node 1').tagName).toBe('SPAN');+ const link = screen.getByRole('link', {+ name: 'Open web interface for PVE Node 1',+ });expect(link).toHaveAttribute('href', 'https://192.168.0.10:8006');expect(screen.getByLabelText('Edit thresholds for PVE Node 1')).toBeInTheDocument();});@@ -1082,8 +1086,10 @@ describe('ResourceTable', () => {});render(() => <ResourceTable {...props} />);- const link = screen.getByText('pve-node-1');- expect(link.tagName).toBe('A');+ expect(screen.getByText('pve-node-1').tagName).toBe('SPAN');+ const link = screen.getByRole('link', {+ name: 'Open web interface for pve-node-1',+ });expect(link).toHaveAttribute('href', 'https://192.168.0.10:8006');});diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsxindex a2af0e312b..7d983c1cf6 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx@@ -20,7 +20,10 @@ import { DiscoveryLoadingFallback } from '@/components/shared/DiscoveryLoadingFaimport { FormSelect } from '@/components/shared/FormSelect';import { InfoCardFrame } from '@/components/shared/InfoCardFrame';import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';-import { WEB_INTERFACE_LINK_COLOR_CLASS } from '@/components/shared/WebInterfaceNameLink';+import {+ WEB_INTERFACE_LINK_COLOR_CLASS,+ WebInterfaceLink,+} from '@/components/shared/WebInterfaceLink';import { getAllFilterOptionLabel } from '@/components/shared/filterOptionPresentation';import { getServiceHealthPresentation } from '@/utils/serviceHealthPresentation';import { ResourceCorrelationSummary } from './ResourceCorrelationSummary';@@ -235,17 +238,18 @@ const AccessDisclosure: Component<{headerExtra={<Show when={customUrl()}>{(href) => (- <a- href={href()}- target="_blank"- rel="noopener noreferrer"+ <WebInterfaceLink+ url={href()}+ ariaLabel={`Open web interface for ${props.resource.name}`}+ invalidAriaLabel={`Web interface URL for ${props.resource.name} is invalid`}class={`inline-flex min-w-0 max-w-[260px] items-center gap-1 text-[11px] font-medium ${WEB_INTERFACE_LINK_COLOR_CLASS}`}title={`Open ${href()}`}- data-testid="resource-access-open-url">- <span class="truncate">{href()}</span>- <ExternalLinkIcon class="h-3 w-3 shrink-0" />- </a>+ <span class="truncate" data-testid="resource-access-open-url">+ {href()}+ </span>+ <ExternalLinkIcon class="h-3 w-3 shrink-0" aria-hidden="true" />+ </WebInterfaceLink>)}</Show>}@@ -277,6 +281,7 @@ const AccessDisclosure: Component<{metadataId={config().metadataId}targetLabel={config().targetLabel}title="Web interface"+ customUrl={props.resource.customUrl}discoveryLoading={props.drawer.discoveryLoading()}suggestedUrl={props.drawer.discoveryIdentifiedSummary()?.suggestedUrl}suggestedUrlReasonText={diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsxindex aeea87f6d3..8f201b5486 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx@@ -52,6 +52,7 @@ import {createSummaryInteractiveRowPreviewHandlers,} from '@/components/shared/summaryInteractionA11y';import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import {type UnifiedResourceTableProps,type UnifiedResourceTableState,@@ -415,12 +416,12 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar/><div class="flex min-w-0 flex-1 flex-col"><div class="flex min-w-0 items-center gap-1">- <span- class="block min-w-0 flex-1 truncate font-medium text-[11px] text-base-content select-text"- title={displayName()}- >- {displayName()}- </span>+ <ResourceNameWithWebInterfaceLink+ name={displayName()}+ url={resource.customUrl}+ class="min-w-0 flex-1"+ nameClass="block min-w-0 flex-1 truncate font-medium text-[11px] text-base-content select-text"+ /><Show when={healthIssue()}>{(issue) => (<spandiff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsxindex e0496dc702..c2e6ab1a48 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx@@ -36,6 +36,7 @@ import {} from './useUnifiedResourceTableState';import { getPBSTableRow, isResourceOnline } from './unifiedResourceTableModel';import { buildServiceDetailLinks } from './serviceDetailLinks';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';interface UnifiedResourcePBSTableSectionProps {tableProps: UnifiedResourceTableProps;@@ -189,12 +190,12 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSeariaLabel={statusIndicator().label}size="xs"/>- <span- class="block min-w-0 flex-1 truncate font-medium text-[11px] text-base-content select-text"- title={displayName()}- >- {displayName()}- </span>+ <ResourceNameWithWebInterfaceLink+ name={displayName()}+ url={resource.customUrl}+ class="min-w-0 flex-1"+ nameClass="block min-w-0 flex-1 truncate font-medium text-[11px] text-base-content select-text"+ /><Show when={shouldShowResourceAlternateName(resource)}><span class="hidden min-w-0 max-w-[35%] shrink truncate text-[9px] text-muted lg:inline">({resource.name})diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsxindex 6f4ae3d6f1..84fb1e22ed 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx@@ -36,6 +36,7 @@ import {} from './useUnifiedResourceTableState';import { getPMGTableRow, isResourceOnline } from './unifiedResourceTableModel';import { buildServiceDetailLinks } from './serviceDetailLinks';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';interface UnifiedResourcePMGTableSectionProps {tableProps: UnifiedResourceTableProps;@@ -203,12 +204,12 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSeariaLabel={statusIndicator().label}size="xs"/>- <span- class="block min-w-0 flex-1 truncate font-medium text-[11px] text-base-content select-text"- title={displayName()}- >- {displayName()}- </span>+ <ResourceNameWithWebInterfaceLink+ name={displayName()}+ url={resource.customUrl}+ class="min-w-0 flex-1"+ nameClass="block min-w-0 flex-1 truncate font-medium text-[11px] text-base-content select-text"+ /><Show when={shouldShowResourceAlternateName(resource)}><span class="hidden min-w-0 max-w-[35%] shrink truncate text-[9px] text-muted lg:inline">({resource.name})diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.tsindex a4dc60b702..bfa830187a 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.ts+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.ts@@ -134,9 +134,9 @@ describe('toDiscoveryConfig', () => {agentId: 'docker-host-1',resourceId: 'docker-host-1',hostname: 'stale-hostname',- metadataKind: 'agent',+ metadataKind: 'docker-host',metadataId: 'docker-host-1',- targetLabel: 'agent',+ targetLabel: 'host',});});diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.workloads-link.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.workloads-link.test.tsxindex 44f1340b46..493b6e0a71 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.workloads-link.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.workloads-link.test.tsx@@ -1,5 +1,5 @@import { describe, expect, it, vi } from 'vitest';-import { fireEvent, render, within } from '@solidjs/testing-library';+import { fireEvent, render, screen, within } from '@solidjs/testing-library';import type { Resource } from '@/types/resource';import { UnifiedResourceTable } from '@/components/Infrastructure/UnifiedResourceTable';@@ -59,6 +59,7 @@ describe('UnifiedResourceTable workloads links', () => {displayName: 'Tower',platformType: 'docker',sourceType: 'agent',+ customUrl: 'https://tower.internal:9443',metricsTarget: {resourceType: 'docker-host',resourceId: 'docker-host-1',@@ -86,6 +87,11 @@ describe('UnifiedResourceTable workloads links', () => {([props]) => (props as { resourceId?: string }).resourceId === 'dockerHost:docker-host-1',),).toBe(true);+ expect(screen.getByText('Tower').tagName).toBe('SPAN');+ expect(screen.getByRole('link', { name: 'Open web interface for Tower' })).toHaveAttribute(+ 'href',+ 'https://tower.internal:9443',+ );});it('no longer renders host-row workloads cross-jump links in the platform-first layout', () => {@@ -138,6 +144,7 @@ describe('UnifiedResourceTable workloads links', () => {type: 'pbs',name: 'pbs-main',displayName: 'pbs-main',+ customUrl: 'https://pbs-main.internal:8007',platformType: 'proxmox-pbs',sourceType: 'api',platformData: {@@ -197,6 +204,7 @@ describe('UnifiedResourceTable workloads links', () => {type: 'pmg',name: 'pmg-main',displayName: 'pmg-main',+ customUrl: 'https://pmg-main.internal:8006',platformType: 'proxmox-pmg',sourceType: 'api',platformData: {@@ -241,6 +249,16 @@ describe('UnifiedResourceTable workloads links', () => {expect(getByText('Def')).toBeInTheDocument();expect(getByText('Hold')).toBeInTheDocument();expect(getByText('Nodes')).toBeInTheDocument();+ expect(getByText('pbs-main').tagName).toBe('SPAN');+ expect(getByText('pmg-main').tagName).toBe('SPAN');+ expect(getByRole('link', { name: 'Open web interface for pbs-main' })).toHaveAttribute(+ 'href',+ 'https://pbs-main.internal:8007',+ );+ expect(getByRole('link', { name: 'Open web interface for pmg-main' })).toHaveAttribute(+ 'href',+ 'https://pmg-main.internal:8006',+ );const pbsRow = getByText('pbs-main').closest('tr');expect(pbsRow).toBeTruthy();diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDiscoveryModel.branchcov.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDiscoveryModel.branchcov.test.tsindex b28e34bb3a..f3d8e0a85c 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDiscoveryModel.branchcov.test.ts+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDiscoveryModel.branchcov.test.ts@@ -387,17 +387,65 @@ describe('toDiscoveryConfig — main switch (no usable explicit target)', () =>const result = toDiscoveryConfig(resource);expect(result?.resourceType).toBe('agent');expect(result?.agentId).toBe('docker-1');- expect(result?.targetLabel).toBe('agent');+ expect(result?.metadataKind).toBe('docker-host');+ expect(result?.targetLabel).toBe('host');});it('maps a pbs resource through the shared agent case', () => {- const resource = baseResource({ type: 'pbs', name: 'pbs-1' });- expect(toDiscoveryConfig(resource)?.resourceType).toBe('agent');+ const resource = baseResource({+ type: 'pbs',+ name: 'pbs-renamed',+ pbs: { instanceId: 'pbs-stable' },+ });+ expect(toDiscoveryConfig(resource)).toMatchObject({+ resourceType: 'agent',+ metadataKind: 'agent',+ metadataId: 'pbs-stable',+ });+ });++ it('keys Proxmox node metadata by provider identity instead of the mutable node label', () => {+ const resource = baseResource({+ type: 'agent',+ name: 'pve-renamed',+ proxmox: {+ sourceId: 'pve-provider-stable',+ nodeName: 'pve-renamed',+ },+ });+ expect(toDiscoveryConfig(resource)).toMatchObject({+ metadataKind: 'agent',+ metadataId: 'pve-provider-stable',+ });});it('maps a k8s-cluster resource through the shared agent case', () => {- const resource = baseResource({ type: 'k8s-cluster', name: 'k8s-1' });- expect(toDiscoveryConfig(resource)?.resourceType).toBe('agent');+ const resource = baseResource({+ type: 'k8s-cluster',+ name: 'k8s-renamed',+ kubernetes: { clusterId: 'cluster-stable' },+ });+ expect(toDiscoveryConfig(resource)).toMatchObject({+ resourceType: 'agent',+ metadataKind: 'agent',+ metadataId: 'cluster-stable',+ });+ });++ it('scopes Kubernetes node metadata by stable cluster and node identity', () => {+ const resource = baseResource({+ id: 'node-runtime-id',+ type: 'k8s-node',+ name: 'worker-1',+ kubernetes: {+ clusterId: 'cluster-stable',+ nodeName: 'worker-1',+ },+ });+ expect(toDiscoveryConfig(resource)).toMatchObject({+ metadataKind: 'agent',+ metadataId: 'cluster-stable:node:worker-1',+ });});it("returns null when the agent lookup id is 'redacted by policy'", () => {diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailDiscoveryModel.ts b/frontend-modern/src/components/Infrastructure/resourceDetailDiscoveryModel.tsindex d3444f6324..c7c915a6e7 100644--- a/frontend-modern/src/components/Infrastructure/resourceDetailDiscoveryModel.ts+++ b/frontend-modern/src/components/Infrastructure/resourceDetailDiscoveryModel.ts@@ -25,12 +25,13 @@ export type DiscoveryConfig = {agentId: string;resourceId: string;hostname: string;- metadataKind: 'guest' | 'agent' | 'docker';+ metadataKind: 'guest' | 'agent' | 'docker' | 'docker-host';metadataId: string;targetLabel: string;};type ProxmoxPlatformData = {+ sourceId?: string;nodeName?: string;vmid?: number;};@@ -171,6 +172,58 @@ const getMetadataTarget = (};};+const getHostMetadataTarget = (+ resource: Resource,+ platformData: PlatformData | undefined,+ fallbackId: string,+): Pick<DiscoveryConfig, 'metadataKind' | 'metadataId'> => {+ const canonicalResourceType = canonicalDiscoveryResourceType(resource.type) || resource.type;+ const kubernetesPlatformData = platformData?.kubernetes;+ const kubernetesClusterId =+ asString(resource.kubernetes?.clusterId) || asString(kubernetesPlatformData?.clusterId);+ const kubernetesNodeName =+ asString(resource.kubernetes?.nodeName) ||+ asString((kubernetesPlatformData as { nodeName?: unknown } | undefined)?.nodeName) ||+ asString(resource.name);++ if (canonicalResourceType === 'docker-host') {+ return {+ metadataKind: 'docker-host',+ metadataId: getActionableDockerRuntimeIdFromResource(resource) || fallbackId,+ };+ }++ if (canonicalResourceType === 'k8s-node' && kubernetesClusterId && kubernetesNodeName) {+ return {+ metadataKind: 'agent',+ metadataId: `${kubernetesClusterId}:node:${kubernetesNodeName}`,+ };+ }++ if (canonicalResourceType === 'k8s-cluster' && kubernetesClusterId) {+ return { metadataKind: 'agent', metadataId: kubernetesClusterId };+ }++ if (canonicalResourceType === 'pbs' && asString(resource.pbs?.instanceId)) {+ return { metadataKind: 'agent', metadataId: asString(resource.pbs?.instanceId)! };+ }++ if (canonicalResourceType === 'pmg' && asString(resource.pmg?.instanceId)) {+ return { metadataKind: 'agent', metadataId: asString(resource.pmg?.instanceId)! };+ }++ const proxmoxSourceId =+ asString(resource.proxmox?.sourceId) || asString(platformData?.proxmox?.sourceId);+ if (canonicalResourceType === 'agent' && proxmoxSourceId) {+ return { metadataKind: 'agent', metadataId: proxmoxSourceId };+ }++ return {+ metadataKind: 'agent',+ metadataId: fallbackId,+ };+};+export const toDiscoveryConfig = (resource: Resource): DiscoveryConfig | null => {const platformData = resource.platformData as PlatformData | undefined;const explicitDiscoveryTarget = resource.discoveryTarget;@@ -208,7 +261,7 @@ export const toDiscoveryConfig = (resource: Resource): DiscoveryConfig | null =>const hostname = explicitDiscoveryTarget.hostname || getPreferredHostLabel(resource);const isHostDiscovery = isAgentDiscoveryResourceType(resourceType);const metadataTarget = isHostDiscovery- ? { metadataKind: 'agent' as const, metadataId: explicitDiscoveryAgentId }+ ? getHostMetadataTarget(resource, platformData, explicitDiscoveryAgentId): getMetadataTarget(resource, resourceType, platformData);const targetLabel = isHostDiscovery? 'agent'@@ -265,6 +318,8 @@ export const toDiscoveryConfig = (resource: Resource): DiscoveryConfig | null =>actionableDockerHostId ||actionableKubernetesId ||actionableAgentId ||+ asString(resource.pbs?.instanceId) ||+ asString(resource.pmg?.instanceId) ||proxmoxNodeName ||platformData?.agent?.hostname ||asString(dockerPlatformData?.hostname) ||@@ -284,6 +339,7 @@ export const toDiscoveryConfig = (resource: Resource): DiscoveryConfig | null =>resource.id;const hostname = getPreferredHostLabel(resource);const canonicalResourceType = canonicalDiscoveryResourceType(resource.type) || resource.type;+ const hostMetadataTarget = getHostMetadataTarget(resource, platformData, agentLookupId);switch (canonicalResourceType) {case 'agent':@@ -292,7 +348,7 @@ export const toDiscoveryConfig = (resource: Resource): DiscoveryConfig | null =>case 'pmg':case 'k8s-cluster':case 'k8s-node':- if (!isDiscoveryLookupValue(agentLookupId)) {+ if (!isDiscoveryLookupValue(hostMetadataTarget.metadataId)) {return null;}return {@@ -300,9 +356,9 @@ export const toDiscoveryConfig = (resource: Resource): DiscoveryConfig | null =>agentId: agentLookupId,resourceId: agentLookupId,hostname,- metadataKind: 'agent',- metadataId: agentLookupId,- targetLabel: 'agent',+ metadataKind: hostMetadataTarget.metadataKind,+ metadataId: hostMetadataTarget.metadataId,+ targetLabel: canonicalResourceType === 'agent' ? 'agent' : 'host',};case 'vm':if (hasVMwareScope(resource, platformData) && !(proxmoxNodeName && vmidResourceId)) {diff --git a/frontend-modern/src/components/Workloads/GuestRow.tsx b/frontend-modern/src/components/Workloads/GuestRow.tsxindex 68b40f82c2..ebc0c986a3 100644--- a/frontend-modern/src/components/Workloads/GuestRow.tsx+++ b/frontend-modern/src/components/Workloads/GuestRow.tsx@@ -28,10 +28,7 @@ import {import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';import { DiscoveryReadinessBadge } from '@/components/shared/DiscoveryReadinessBadge';import { getWorkloadGuestDiskStatusMessage } from '@/utils/workloadGuestPresentation';-import {- WEB_INTERFACE_LINK_COLOR_CLASS,- WebInterfaceNameLink,-} from '@/components/shared/WebInterfaceNameLink';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import type { GuestRowProps } from './guestRowModel';import { useGuestRowState } from './useGuestRowState';import type { WorkloadTableMetric } from './workloadMetricHistoryModel';@@ -204,11 +201,11 @@ export function GuestRow(props: GuestRowProps) {size="xs"/><div class="flex items-center gap-1.5 min-w-0 group/name">- <WebInterfaceNameLink+ <ResourceNameWithWebInterfaceLinkname={props.guest.name}url={customUrl()}- class={`text-[11px] font-medium select-none truncate ${WEB_INTERFACE_LINK_COLOR_CLASS}`}- fallbackClass="text-[11px] font-medium text-base-content select-none truncate"+ class="min-w-0"+ nameClass="truncate text-[11px] font-medium text-base-content select-none"/>{/* Show backup indicator in name cell only if backup column is hidden */}<Show when={!isColVisible('backup') && supportsBackup()}>diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsxindex 7219ce21ae..8dd15eb2ad 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx@@ -777,7 +777,7 @@ describe('GuestRow', () => {});describe('custom URL on the name cell', () => {- it('renders the workload name as the external link when customUrl is set', () => {+ it('renders an external link beside the workload name when customUrl is set', () => {const { container } = renderGuestRow({guest: makeGuest(),customUrl: 'https://example.com',@@ -788,7 +788,9 @@ describe('GuestRow', () => {expect(link?.getAttribute('target')).toBe('_blank');expect(link?.getAttribute('rel')).toBe('noopener noreferrer');expect(link?.getAttribute('aria-label')).toBe('Open web interface for test-vm');- expect(link?.textContent).toBe('test-vm');+ expect(link?.textContent).toBe('');+ expect(link?.closest('td')?.textContent).toContain('test-vm');+ expect(screen.getByText('test-vm').closest('a')).toBeNull();expect(container.querySelector('td[data-workload-col="link"]')).toBeNull();});diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsxindex ea53c597c4..06194c45a1 100644--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx@@ -1366,7 +1366,7 @@ describe('Workloads performance contract', () => {expect(guestRowSource).toContain('style={getGuestColumnStyle(');expect(guestRowSource).toContain('props.workloadTableLayoutMode');expect(guestRowSource).toContain('props.visibleColumnIds');- expect(guestRowSource).toContain('WebInterfaceNameLink');+ expect(guestRowSource).toContain('ResourceNameWithWebInterfaceLink');expect(guestRowSource).not.toContain('target="_blank"');expect(guestRowSource).not.toContain('data-workload-col="link"');expect(guestRowSource).not.toContain('Open related infrastructure');diff --git a/frontend-modern/src/components/shared/NodeGroupHeader.tsx b/frontend-modern/src/components/shared/NodeGroupHeader.tsxindex 35469383dc..eca6f48345 100644--- a/frontend-modern/src/components/shared/NodeGroupHeader.tsx+++ b/frontend-modern/src/components/shared/NodeGroupHeader.tsx@@ -12,7 +12,7 @@ import {getGroupedTableRowCellClass,getGroupedTableRowClass,} from './groupedTableRowPresentation';-import { WEB_INTERFACE_LINK_COLOR_CLASS, WebInterfaceNameLink } from './WebInterfaceNameLink';+import { ResourceNameWithWebInterfaceLink } from './WebInterfaceLink';interface NodeGroupHeaderProps {node: Node;@@ -54,10 +54,10 @@ export const NodeGroupHeader: Component<NodeGroupHeaderProps> = (props) => {ariaLabel={nodeStatus().label}size="xs"/>- <WebInterfaceNameLink+ <ResourceNameWithWebInterfaceLinkname={displayName()}url={nodeUrl()}- class={WEB_INTERFACE_LINK_COLOR_CLASS}+ nameClass="text-base-content"title={`Open ${props.node.name} web interface`}/><Show when={showActualName()}>diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 20730a741e..1312df10d2 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -119,7 +119,7 @@ import selectionCardGroupStateSource from '@/components/shared/useSelectionCardGimport webInterfaceUrlFieldSource from '@/components/shared/WebInterfaceUrlField.tsx?raw';import webInterfaceUrlFieldModelSource from '@/components/shared/webInterfaceUrlFieldModel.ts?raw';import webInterfaceUrlFieldStateSource from '@/components/shared/useWebInterfaceUrlFieldState.ts?raw';-import webInterfaceNameLinkSource from '@/components/shared/WebInterfaceNameLink.tsx?raw';+import webInterfaceLinkSource from '@/components/shared/WebInterfaceLink.tsx?raw';import inlineDetailTableRowSource from '@/components/shared/InlineDetailTableRow.tsx?raw';import toastSource from '@/components/Toast/Toast.tsx?raw';import sharedTemplateRegistrySource from '../../../scripts/shared-template-registry.json?raw';@@ -1522,8 +1522,8 @@ describe('shared primitive guardrails', () => {expect(storageGroupRowSource).not.toContain('kind="scope"');expect(unifiedResourceHostTableCardSource).not.toContain('kind="scope"');- expect(nodeGroupHeaderSource).toContain('WebInterfaceNameLink');- expect(webInterfaceNameLinkSource).toContain('event.stopPropagation()');+ expect(nodeGroupHeaderSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(webInterfaceLinkSource).toContain('event.stopPropagation()');});it('keeps upgrade navigation split across shell, runtime, and utility owners', () => {@@ -5118,7 +5118,7 @@ describe('shared primitive guardrails', () => {expect(webInterfaceUrlFieldModelSource).toContain('shouldShowWebInterfaceSuggestedUrl');});- it('keeps runtime web-interface launch on the shared resource-name template', () => {+ it('keeps runtime web-interface launch on the shared inline-link template', () => {const registry = JSON.parse(sharedTemplateRegistrySource) as {rules: Array<{id: string;@@ -5127,16 +5127,17 @@ describe('shared primitive guardrails', () => {}>;};const registeredRule = registry.rules.find(- (rule) => rule.id === 'runtime-web-interface-name-link',+ (rule) => rule.id === 'runtime-web-interface-inline-link',);- expect(registeredRule?.canonical?.path).toBe('src/components/shared/WebInterfaceNameLink.tsx');- expect(registeredRule?.canonical?.export).toBe('WebInterfaceNameLink');- expect(webInterfaceNameLinkSource).toContain('export const WebInterfaceNameLink');- expect(webInterfaceNameLinkSource).toContain('target="_blank"');- expect(webInterfaceNameLinkSource).toContain('rel="noopener noreferrer"');- expect(webInterfaceNameLinkSource).toContain('event.stopPropagation()');- expect(webInterfaceNameLinkSource).toContain('Open web interface for');+ expect(registeredRule?.canonical?.path).toBe('src/components/shared/WebInterfaceLink.tsx');+ expect(registeredRule?.canonical?.export).toBe('ResourceNameWithWebInterfaceLink');+ expect(webInterfaceLinkSource).toContain('export const ResourceNameWithWebInterfaceLink');+ expect(webInterfaceLinkSource).toContain('classifyWebInterfaceUrl');+ expect(webInterfaceLinkSource).toContain('target="_blank"');+ expect(webInterfaceLinkSource).toContain('rel="noopener noreferrer"');+ expect(webInterfaceLinkSource).toContain('event.stopPropagation()');+ expect(webInterfaceLinkSource).toContain('Open web interface for');expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(expect.arrayContaining(['src/components/shared/NodeGroupHeader.tsx',@@ -5145,15 +5146,28 @@ describe('shared primitive guardrails', () => {'src/features/proxmox/ProxmoxNodesTable.tsx','src/components/Alerts/AlertResourceGroupHeader.tsx','src/components/Alerts/AlertResourceTableRow.tsx',+ 'src/components/Infrastructure/UnifiedResourceHostTableCard.tsx',+ 'src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx',+ 'src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx',+ 'src/features/docker/DockerNativeTableShared.tsx',+ 'src/features/docker/DockerContainersTable.tsx',+ 'src/features/kubernetes/KubernetesClustersTable.tsx',+ 'src/features/kubernetes/KubernetesNodesTable.tsx',+ 'src/features/kubernetes/KubernetesPodsTable.tsx',+ 'src/features/kubernetes/KubernetesDeploymentsTable.tsx',+ 'src/features/kubernetes/KubernetesServicesTable.tsx',]),);- expect(nodeGroupHeaderSource).toContain('WebInterfaceNameLink');- expect(guestRowSource).toContain('WebInterfaceNameLink');- expect(agentsMachinesTableSource).toContain('WebInterfaceNameLink');- expect(proxmoxNodesTableSource).toContain('WebInterfaceNameLink');- expect(alertResourceGroupHeaderSource).toContain('WebInterfaceNameLink');- expect(alertResourceTableRowSource).toContain('WebInterfaceNameLink');+ expect(nodeGroupHeaderSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(guestRowSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(agentsMachinesTableSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(proxmoxNodesTableSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(alertResourceGroupHeaderSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(alertResourceTableRowSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(unifiedResourceHostTableCardSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(unifiedResourcePBSTableSectionSource).toContain('ResourceNameWithWebInterfaceLink');+ expect(unifiedResourcePMGTableSectionSource).toContain('ResourceNameWithWebInterfaceLink');expect(nodeGroupHeaderSource).not.toContain('target="_blank"');expect(guestRowSource).not.toContain('target="_blank"');expect(agentsMachinesTableSource).not.toContain('target="_blank"');diff --git a/frontend-modern/src/components/shared/WebInterfaceLink.test.tsx b/frontend-modern/src/components/shared/WebInterfaceLink.test.tsxnew file mode 100644index 0000000000..6aa741aaf0--- /dev/null+++ b/frontend-modern/src/components/shared/WebInterfaceLink.test.tsx@@ -0,0 +1,72 @@+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';++import { ResourceNameWithWebInterfaceLink } from './WebInterfaceLink';++describe('ResourceNameWithWebInterfaceLink', () => {+ afterEach(() => {+ cleanup();+ });++ it('keeps the name inert and exposes a separate safe launch control', () => {+ const onRowClick = vi.fn();++ render(() => (+ <div onClick={onRowClick}>+ <ResourceNameWithWebInterfaceLink name="node-a" url="https://node-a.example.local:8006" />+ </div>+ ));++ const name = screen.getByText('node-a');+ const link = screen.getByRole('link', { name: 'Open web interface for node-a' });++ expect(name.tagName).toBe('SPAN');+ expect(name.closest('a')).toBeNull();+ expect(link).toHaveAttribute('href', 'https://node-a.example.local:8006');+ expect(link).toHaveAttribute('target', '_blank');+ expect(link).toHaveAttribute('rel', 'noopener noreferrer');+ expect(link).toHaveAttribute('title', 'Open https://node-a.example.local:8006');+ expect(link).toHaveClass('min-h-6', 'min-w-6', 'shrink-0');++ fireEvent.click(link);+ fireEvent.keyDown(link, { key: 'Enter' });++ expect(onRowClick).not.toHaveBeenCalled();+ });++ it('renders only inert resource text when no URL is available', () => {+ render(() => (+ <ResourceNameWithWebInterfaceLink+ name="node-b"+ url=" "+ class="wrapper-class"+ nameClass="name-class"+ />+ ));++ const name = screen.getByText('node-b');++ expect(screen.queryByRole('link')).not.toBeInTheDocument();+ expect(screen.queryByRole('img')).not.toBeInTheDocument();+ expect(name).toHaveClass('name-class');+ expect(name.parentElement).toHaveClass('wrapper-class');+ expect(name).toHaveAttribute('title', 'node-b');+ });++ it.each([+ 'javascript:alert(document.domain)',+ 'data:text/html,<script>alert(1)</script>',+ 'ftp://node-b.example.local',+ 'not a URL',+ ])('refuses unsafe or malformed URL %s and communicates the invalid state', (url) => {+ render(() => <ResourceNameWithWebInterfaceLink name="node-b" url={url} />);++ expect(screen.queryByRole('link')).not.toBeInTheDocument();+ expect(+ screen.getByRole('img', {+ name: 'Web interface URL for node-b is invalid',+ }),+ ).toHaveAttribute('data-web-interface-url-state', 'invalid');+ expect(screen.getByText('node-b').closest('a')).toBeNull();+ });+});diff --git a/frontend-modern/src/components/shared/WebInterfaceLink.tsx b/frontend-modern/src/components/shared/WebInterfaceLink.tsxnew file mode 100644index 0000000000..f4a059e681--- /dev/null+++ b/frontend-modern/src/components/shared/WebInterfaceLink.tsx@@ -0,0 +1,99 @@+import { Match, Switch, type Component, type JSX } from 'solid-js';+import ExternalLinkIcon from 'lucide-solid/icons/external-link';+import TriangleAlertIcon from 'lucide-solid/icons/triangle-alert';+import { classifyWebInterfaceUrl } from './webInterfaceUrlFieldModel';++export const WEB_INTERFACE_LINK_COLOR_CLASS =+ 'text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300';++export interface WebInterfaceLinkProps {+ url?: string | null;+ ariaLabel: string;+ title?: string;+ class?: string;+ invalidAriaLabel?: string;+ invalidTitle?: string;+ invalidClass?: string;+ children: JSX.Element;+}++/**+ * Canonical external web-interface control.+ *+ * Persisted metadata is treated as untrusted at render time. Only absolute+ * HTTP(S) URLs become anchors; malformed and unsafe values remain visible as+ * an accessible warning, never as a navigable link.+ */+export const WebInterfaceLink: Component<WebInterfaceLinkProps> = (props) => {+ const classified = () => classifyWebInterfaceUrl(props.url);++ return (+ <Switch>+ <Match when={classified().status === 'valid' && classified()}>+ {(result) => (+ <a+ href={result().url}+ target="_blank"+ rel="noopener noreferrer"+ class={props.class}+ title={props.title ?? `Open ${result().url}`}+ aria-label={props.ariaLabel}+ onClick={(event) => event.stopPropagation()}+ onKeyDown={(event) => event.stopPropagation()}+ >+ {props.children}+ </a>+ )}+ </Match>+ <Match when={classified().status === 'invalid'}>+ <span+ role="img"+ class={+ props.invalidClass ??+ 'inline-flex min-h-6 min-w-6 shrink-0 items-center justify-center rounded text-amber-600 dark:text-amber-400'+ }+ title={props.invalidTitle ?? 'Invalid web interface URL. Pulse will not open it.'}+ aria-label={props.invalidAriaLabel ?? 'Invalid web interface URL'}+ data-web-interface-url-state="invalid"+ >+ <TriangleAlertIcon class="h-3.5 w-3.5" aria-hidden="true" />+ </span>+ </Match>+ </Switch>+ );+};++export interface ResourceNameWithWebInterfaceLinkProps {+ name: string;+ url?: string | null;+ class?: string;+ nameClass?: string;+ title?: string;+ ariaLabel?: string;+ children?: JSX.Element;+}++/**+ * Keeps the resource name inert so row selection and disclosure semantics are+ * unchanged, then exposes web access as a distinct adjacent control.+ */+export const ResourceNameWithWebInterfaceLink: Component<ResourceNameWithWebInterfaceLinkProps> = (+ props,+) => (+ <span class={`inline-flex min-w-0 max-w-full items-center gap-1 ${props.class ?? ''}`}>+ <span class={props.nameClass} title={props.name}>+ {props.children ?? props.name}+ </span>+ <WebInterfaceLink+ url={props.url}+ ariaLabel={props.ariaLabel ?? `Open web interface for ${props.name}`}+ title={props.title}+ invalidAriaLabel={`Web interface URL for ${props.name} is invalid`}+ class={`-my-1 inline-flex min-h-6 min-w-6 shrink-0 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 ${WEB_INTERFACE_LINK_COLOR_CLASS}`}+ >+ <ExternalLinkIcon class="h-3.5 w-3.5" aria-hidden="true" />+ </WebInterfaceLink>+ </span>+);++export default ResourceNameWithWebInterfaceLink;diff --git a/frontend-modern/src/components/shared/WebInterfaceNameLink.test.tsx b/frontend-modern/src/components/shared/WebInterfaceNameLink.test.tsxdeleted file mode 100644index 5e4d8ea9c6..0000000000--- a/frontend-modern/src/components/shared/WebInterfaceNameLink.test.tsx+++ /dev/null@@ -1,50 +0,0 @@-import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';-import { afterEach, describe, expect, it, vi } from 'vitest';--import { WebInterfaceNameLink } from './WebInterfaceNameLink';--describe('WebInterfaceNameLink', () => {- afterEach(() => {- cleanup();- });-- it('renders a safe web-interface launch link through the resource name', () => {- const onRowClick = vi.fn();-- render(() => (- <div onClick={onRowClick}>- <WebInterfaceNameLink name="node-a" url="https://node-a.example.local:8006" />- </div>- ));-- const link = screen.getByRole('link', { name: 'Open web interface for node-a' });-- expect(link).toHaveAttribute('href', 'https://node-a.example.local:8006');- expect(link).toHaveAttribute('target', '_blank');- expect(link).toHaveAttribute('rel', 'noopener noreferrer');- expect(link).toHaveAttribute('title', 'Open https://node-a.example.local:8006');-- fireEvent.click(link);-- expect(onRowClick).not.toHaveBeenCalled();- });-- it('falls back to inert resource text when no URL is available', () => {- render(() => (- <WebInterfaceNameLink- name="node-b"- url=" "- class="link-class"- fallbackClass="fallback-class"- />- ));-- const fallback = screen.getByText('node-b');-- expect(screen.queryByRole('link')).not.toBeInTheDocument();- expect(fallback.tagName).toBe('SPAN');- expect(fallback).toHaveClass('fallback-class');- expect(fallback).not.toHaveClass('link-class');- expect(fallback).toHaveAttribute('title', 'node-b');- });-});diff --git a/frontend-modern/src/components/shared/WebInterfaceNameLink.tsx b/frontend-modern/src/components/shared/WebInterfaceNameLink.tsxdeleted file mode 100644index faed45d43a..0000000000--- a/frontend-modern/src/components/shared/WebInterfaceNameLink.tsx+++ /dev/null@@ -1,55 +0,0 @@-import { Show, type Component, type JSX } from 'solid-js';-import { asTrimmedString } from '@/utils/stringUtils';--// Canonical link colors for resource names that open a web interface. Every-// table and header that renders a WebInterfaceNameLink composes these with its-// own sizing/layout classes so a saved URL always reads as a link.-export const WEB_INTERFACE_LINK_COLOR_CLASS =- 'text-blue-600 hover:text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300';--export interface WebInterfaceNameLinkProps {- name: string;- url?: string | null;- class?: string;- fallbackClass?: string;- title?: string;- ariaLabel?: string;- children?: JSX.Element;-}--export const WebInterfaceNameLink: Component<WebInterfaceNameLinkProps> = (props) => {- const url = () => asTrimmedString(props.url) ?? '';- const label = () => props.children ?? props.name;- const fallbackClass = () => props.fallbackClass ?? props.class ?? '';- const linkClass = () => props.class ?? '';- const linkTitle = () => props.title ?? `Open ${url()}`;- const ariaLabel = () => props.ariaLabel ?? `Open web interface for ${props.name}`;-- return (- <Show- when={url()}- fallback={- <span class={fallbackClass()} title={props.name}>- {label()}- </span>- }- >- {(href) => (- <a- href={href()}- target="_blank"- rel="noopener noreferrer"- class={linkClass()}- title={linkTitle()}- aria-label={ariaLabel()}- onClick={(event) => event.stopPropagation()}- onKeyDown={(event) => event.stopPropagation()}- >- {label()}- </a>- )}- </Show>- );-};--export default WebInterfaceNameLink;diff --git a/frontend-modern/src/components/shared/WebInterfaceUrlField.tsx b/frontend-modern/src/components/shared/WebInterfaceUrlField.tsxindex ea688ce629..1f81325c50 100644--- a/frontend-modern/src/components/shared/WebInterfaceUrlField.tsx+++ b/frontend-modern/src/components/shared/WebInterfaceUrlField.tsx@@ -5,6 +5,7 @@ import { DiscoveryProvenanceMarker } from './DiscoveryProvenanceMarker';import { getInfoCardFrameClass } from './InfoCardFrame';import { useWebInterfaceUrlFieldState } from './useWebInterfaceUrlFieldState';import type { WebInterfaceUrlFieldProps } from './webInterfaceUrlFieldModel';+import { WebInterfaceLink } from './WebInterfaceLink';export type { WebInterfaceUrlFieldProps } from './webInterfaceUrlFieldModel';@@ -43,16 +44,15 @@ export const WebInterfaceUrlField: Component<WebInterfaceUrlFieldProps> = (propsSave</Button><Show when={state.normalizedCurrentUrl()}>- <a- href={state.normalizedCurrentUrl()}- target="_blank"- rel="noopener noreferrer"+ <WebInterfaceLink+ url={state.normalizedCurrentUrl()}+ ariaLabel="Open saved web interface URL"class="inline-flex min-h-8 min-w-8 items-center justify-center rounded-md text-blue-600 transition-colors hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900"- title="Open URL"- aria-label="Open URL"+ title="Open saved web interface URL"+ invalidAriaLabel="Saved web interface URL is invalid">- <ExternalLinkIcon class="h-3.5 w-3.5" />- </a>+ <ExternalLinkIcon class="h-3.5 w-3.5" aria-hidden="true" />+ </WebInterfaceLink></Show><Show when={state.normalizedCurrentUrl()}><CopyValueButton@@ -96,6 +96,18 @@ export const WebInterfaceUrlField: Component<WebInterfaceUrlFieldProps> = (props</p></Show>+ <Show when={state.invalidSuggestedUrlError()}>+ {(error) => (+ <div+ role="alert"+ class="mt-2 rounded border border-amber-200 bg-amber-50 p-2 text-[11px] text-amber-800 dark:border-amber-800 dark:bg-amber-900 dark:text-amber-200"+ >+ <div class="font-medium">Suggested URL rejected</div>+ <p class="mt-0.5">{error()}</p>+ </div>+ )}+ </Show>+<Show when={state.showSuggestedDiagnostic()}><div class="mt-2 rounded border border-amber-200 bg-amber-50 p-2 text-[11px] text-amber-800 dark:border-amber-800 dark:bg-amber-900 dark:text-amber-200"><div class="flex items-center gap-1.5 font-medium">@@ -127,16 +139,14 @@ export const WebInterfaceUrlField: Component<WebInterfaceUrlFieldProps> = (props>{state.normalizedSuggestedUrl()}</code>- <a- href={state.normalizedSuggestedUrl()}- target="_blank"- rel="noopener noreferrer"+ <WebInterfaceLink+ url={state.normalizedSuggestedUrl()}+ ariaLabel="Open suggested URL"class="inline-flex min-h-7 min-w-7 shrink-0 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 dark:text-blue-200 dark:hover:bg-blue-950"title="Open suggested URL"- aria-label="Open suggested URL">- <ExternalLinkIcon class="h-3.5 w-3.5" />- </a>+ <ExternalLinkIcon class="h-3.5 w-3.5" aria-hidden="true" />+ </WebInterfaceLink><CopyValueButtonvalue={state.normalizedSuggestedUrl()}copied={state.copiedUrlValue() === state.normalizedSuggestedUrl()}diff --git a/frontend-modern/src/components/shared/__tests__/WebInterfaceUrlField.test.tsx b/frontend-modern/src/components/shared/__tests__/WebInterfaceUrlField.test.tsxindex dedf1ca078..b6a0b64c1c 100644--- a/frontend-modern/src/components/shared/__tests__/WebInterfaceUrlField.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/WebInterfaceUrlField.test.tsx@@ -28,12 +28,20 @@ vi.mock('@/api/dockerMetadata', () => ({},}));+vi.mock('@/api/dockerHostMetadata', () => ({+ DockerHostMetadataAPI: {+ getMetadata: vi.fn(async () => ({ customUrl: '' })),+ updateMetadata: vi.fn(async () => ({ customUrl: '' })),+ },+}));+vi.mock('@/utils/clipboard', () => ({copyToClipboard: vi.fn(async () => true),}));import { AgentMetadataAPI } from '@/api/agentMetadata';import { DockerMetadataAPI } from '@/api/dockerMetadata';+import { DockerHostMetadataAPI } from '@/api/dockerHostMetadata';import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';import { copyToClipboard } from '@/utils/clipboard';import { getDiscoveryProvenanceTitle } from '@/utils/discoveryPresentation';@@ -111,6 +119,26 @@ describe('WebInterfaceUrlField', () => {});});+ it('removes a saved URL through the same canonical metadata record', async () => {+ render(() => (+ <WebInterfaceUrlField+ metadataKind="agent"+ metadataId="host-1"+ targetLabel="agent"+ customUrl="https://pve1.local:8006"+ />+ ));++ fireEvent.click(await screen.findByRole('button', { name: 'Remove' }));++ await waitFor(() => {+ expect(AgentMetadataAPI.updateMetadata).toHaveBeenCalledWith('host-1', {+ customUrl: '',+ });+ expect(screen.queryByRole('button', { name: 'Remove' })).toBeNull();+ });+ });+it('saves a Docker container URL through Docker metadata API', async () => {render(() => (<WebInterfaceUrlField@@ -135,6 +163,27 @@ describe('WebInterfaceUrlField', () => {});});+ it('saves a Docker or Podman host URL through runtime metadata', async () => {+ render(() => (+ <WebInterfaceUrlField+ metadataKind="docker-host"+ metadataId="runtime-stable"+ targetLabel="host"+ customUrl=""+ />+ ));++ const input = await screen.findByPlaceholderText('https://198.51.100.100:8080');+ fireEvent.input(input, { target: { value: 'https://portainer.internal:9443' } });+ fireEvent.click(screen.getByRole('button', { name: 'Save' }));++ await waitFor(() => {+ expect(DockerHostMetadataAPI.updateMetadata).toHaveBeenCalledWith('runtime-stable', {+ customUrl: 'https://portainer.internal:9443',+ });+ });+ });+it('broadcasts saved URL changes for same-tab metadata consumers', async () => {const handler = vi.fn();window.addEventListener(RESOURCE_METADATA_CHANGED_EVENT, handler);@@ -236,4 +285,22 @@ describe('WebInterfaceUrlField', () => {'http://192.0.2.10:8123',);});++ it('rejects an unsafe discovered URL without rendering navigation', async () => {+ const unsafeUrl = ['javascript', 'alert(document.domain)'].join(':');+ const unsafeSuggestion = { suggestedUrl: unsafeUrl };++ render(() => (+ <WebInterfaceUrlField+ metadataKind="guest"+ metadataId="guest-1"+ customUrl=""+ {...unsafeSuggestion}+ />+ ));++ expect(await screen.findByText('Suggested URL rejected')).toBeInTheDocument();+ expect(screen.getByText('URL must start with http:// or https://.')).toBeInTheDocument();+ expect(screen.queryByRole('link', { name: 'Open suggested URL' })).toBeNull();+ });});diff --git a/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts b/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.tsindex 450595019a..84769d183f 100644--- a/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts+++ b/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts@@ -2,11 +2,13 @@ import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js';import { GuestMetadataAPI } from '@/api/guestMetadata';import { AgentMetadataAPI } from '@/api/agentMetadata';import { DockerMetadataAPI } from '@/api/dockerMetadata';+import { DockerHostMetadataAPI } from '@/api/dockerHostMetadata';import { copyToClipboard } from '@/utils/clipboard';import { dispatchResourceMetadataChanged } from '@/utils/resourceMetadataEvents';import {getWebInterfaceSuggestedUrlFallback,getWebInterfaceTargetLabel,+ classifyWebInterfaceUrl,normalizeWebInterfaceUrl,shouldShowWebInterfaceSuggestedDiagnostic,shouldShowWebInterfaceSuggestedUrl,@@ -16,7 +18,7 @@ import {export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {const [urlValue, setUrlValue] = createSignal(props.customUrl ?? '');- const [fetchedCustomUrl, setFetchedCustomUrl] = createSignal('');+ const [fetchedCustomUrl, setFetchedCustomUrl] = createSignal(props.customUrl ?? '');const [urlSaving, setUrlSaving] = createSignal(false);const [urlError, setUrlError] = createSignal<string | null>(null);const [urlSuccess, setUrlSuccess] = createSignal<string | null>(null);@@ -28,9 +30,13 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {const targetLabel = createMemo(() =>getWebInterfaceTargetLabel(props.metadataKind, props.targetLabel),);- const currentCustomUrl = createMemo(() => props.customUrl ?? fetchedCustomUrl());+ const currentCustomUrl = createMemo(() => fetchedCustomUrl());const normalizedCurrentUrl = createMemo(() => normalizeWebInterfaceUrl(currentCustomUrl()));const normalizedSuggestedUrl = createMemo(() => normalizeWebInterfaceUrl(props.suggestedUrl));+ const invalidSuggestedUrlError = createMemo(() => {+ const result = classifyWebInterfaceUrl(props.suggestedUrl);+ return result.status === 'invalid' ? result.error : null;+ });const showSuggestedDiagnostic = createMemo(() =>shouldShowWebInterfaceSuggestedDiagnostic({currentUrl: currentCustomUrl(),@@ -84,6 +90,10 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {const metadata = await DockerMetadataAPI.getMetadata(id);return metadata?.customUrl ?? '';}+ if (props.metadataKind === 'docker-host') {+ const metadata = await DockerHostMetadataAPI.getMetadata(id);+ return metadata?.customUrl ?? '';+ }const metadata = await GuestMetadataAPI.getMetadata(id);return metadata?.customUrl ?? '';};@@ -97,6 +107,10 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {await DockerMetadataAPI.updateMetadata(id, { customUrl: value });return;}+ if (props.metadataKind === 'docker-host') {+ await DockerHostMetadataAPI.updateMetadata(id, { customUrl: value });+ return;+ }await GuestMetadataAPI.updateMetadata(id, { customUrl: value });};@@ -123,6 +137,12 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {});});+ createEffect(() => {+ if (props.customUrl !== undefined) {+ setFetchedCustomUrl(props.customUrl);+ }+ });+createEffect(() => {setUrlValue(currentCustomUrl());});@@ -206,6 +226,7 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {handleCopyUrl,handleDeleteUrl,handleSaveUrl,+ invalidSuggestedUrlError,metadataId,normalizedCurrentUrl,normalizedSuggestedUrl,diff --git a/frontend-modern/src/components/shared/webInterfaceUrlFieldModel.ts b/frontend-modern/src/components/shared/webInterfaceUrlFieldModel.tsindex c71d20519e..7ad590cfc7 100644--- a/frontend-modern/src/components/shared/webInterfaceUrlFieldModel.ts+++ b/frontend-modern/src/components/shared/webInterfaceUrlFieldModel.ts@@ -1,7 +1,7 @@import { getDiscoverySuggestedURLFallback } from '@/utils/discoveryPresentation';export interface WebInterfaceUrlFieldProps {- metadataKind: 'guest' | 'agent' | 'docker';+ metadataKind: 'guest' | 'agent' | 'docker' | 'docker-host';metadataId?: string;targetLabel?: string;title?: string;@@ -20,25 +20,50 @@ export function normalizeWebInterfaceUrl(value?: string | null): string {return (value || '').trim();}-export function validateWebInterfaceCustomUrl(value: string): string | null {- if (!value) return null;+export type WebInterfaceUrlClassification =+ | { status: 'missing'; url: '' }+ | { status: 'invalid'; url: string; error: string }+ | { status: 'valid'; url: string };++export function classifyWebInterfaceUrl(value?: string | null): WebInterfaceUrlClassification {+ const url = normalizeWebInterfaceUrl(value);+ if (!url) {+ return { status: 'missing', url: '' };+ }let parsed: URL;try {- parsed = new URL(value);+ parsed = new URL(url);} catch {- return 'Enter a valid URL (for example: https://198.51.100.100:8080).';+ return {+ status: 'invalid',+ url,+ error: 'Enter a valid URL (for example: https://198.51.100.100:8080).',+ };}if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {- return 'URL must start with http:// or https://.';+ return {+ status: 'invalid',+ url,+ error: 'URL must start with http:// or https://.',+ };}if (!parsed.hostname) {- return 'URL is missing a hostname or IP address.';+ return {+ status: 'invalid',+ url,+ error: 'URL is missing a hostname or IP address.',+ };}- return null;+ return { status: 'valid', url };+}++export function validateWebInterfaceCustomUrl(value: string): string | null {+ const result = classifyWebInterfaceUrl(value);+ return result.status === 'invalid' ? result.error : null;}export function getWebInterfaceTargetLabel(@@ -69,7 +94,7 @@ export function shouldShowWebInterfaceSuggestedUrl(options: {suggestedUrl?: string;}): boolean {const suggested = normalizeWebInterfaceUrl(options.suggestedUrl);- if (!suggested) return false;+ if (classifyWebInterfaceUrl(suggested).status !== 'valid') return false;return suggested !== normalizeWebInterfaceUrl(options.currentUrl);}diff --git a/frontend-modern/src/features/docker/DockerContainersTable.tsx b/frontend-modern/src/features/docker/DockerContainersTable.tsxindex 7f7dcf31e5..b650e453e5 100644--- a/frontend-modern/src/features/docker/DockerContainersTable.tsx+++ b/frontend-modern/src/features/docker/DockerContainersTable.tsx@@ -13,10 +13,7 @@ import {} from '@/components/shared/groupedTableRowPresentation';import { ResponsiveMetricCell } from '@/components/shared/responsive';import { StatusDot } from '@/components/shared/StatusDot';-import {- WEB_INTERFACE_LINK_COLOR_CLASS,- WebInterfaceNameLink,-} from '@/components/shared/WebInterfaceNameLink';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { usePersistentSignal } from '@/hooks/usePersistentSignal';import { getSimpleStatusIndicator } from '@/utils/status';import { StackedMemoryBar } from '@/components/Workloads/StackedMemoryBar';@@ -666,11 +663,11 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro/>)}</Show>- <WebInterfaceNameLink+ <ResourceNameWithWebInterfaceLinkname={group.host}url={group.hostResource?.customUrl}- class={`truncate ${WEB_INTERFACE_LINK_COLOR_CLASS}`}- fallbackClass="truncate"+ class="min-w-0"+ nameClass="truncate"/><span class={GROUPED_TABLE_ROW_BADGE_CLASS}>{group.rows.length} {group.rows.length === 1 ? 'container' : 'containers'}diff --git a/frontend-modern/src/features/docker/DockerNativeTableShared.tsx b/frontend-modern/src/features/docker/DockerNativeTableShared.tsxindex bfce43269d..b1b98a88be 100644--- a/frontend-modern/src/features/docker/DockerNativeTableShared.tsx+++ b/frontend-modern/src/features/docker/DockerNativeTableShared.tsx@@ -1,10 +1,7 @@import { type Component, type JSX } from 'solid-js';import { StatusDot } from '@/components/shared/StatusDot';import { TableCell } from '@/components/shared/Table';-import {- WEB_INTERFACE_LINK_COLOR_CLASS,- WebInterfaceNameLink,-} from '@/components/shared/WebInterfaceNameLink';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { getSimpleStatusIndicator, type StatusIndicator } from '@/utils/status';import { asTrimmedString } from '@/utils/stringUtils';import {@@ -87,11 +84,11 @@ export const DockerResourceNameCell: Component<{title={resolvedIndicator().label}ariaHidden/>- <WebInterfaceNameLink+ <ResourceNameWithWebInterfaceLinkname={name()}url={props.resource.customUrl}- class={`truncate font-semibold ${WEB_INTERFACE_LINK_COLOR_CLASS}`}- fallbackClass="truncate font-semibold text-base-content"+ class="min-w-0"+ nameClass="truncate font-semibold text-base-content"/></div></TableCell>diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsxindex 7538a7b9f4..e98ef1d6ae 100644--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx@@ -478,7 +478,7 @@ describe('Docker native tables', () => {expect(container.querySelector('[data-docker-host-group]')).toBeNull();});- it('links the container name to its custom web interface URL', () => {+ it('renders a distinct container launch control without linking the name', () => {renderInRouter(() => (<DockerContainersTableresources={[@@ -498,8 +498,9 @@ describe('Docker native tables', () => {/>));- const nameLink = screen.getByRole('link', { name: 'Open web interface for edge-web' });- expect(nameLink).toHaveAttribute('href', 'http://edge-01.example:8080');+ const launchLink = screen.getByRole('link', { name: 'Open web interface for edge-web' });+ expect(launchLink).toHaveAttribute('href', 'http://edge-01.example:8080');+ expect(screen.getByText('edge-web').closest('a')).toBeNull();});it('applies the URL search filter, including -term exclusions, to container rows', () => {diff --git a/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsxindex 1d72f24a13..51feee4e4e 100644--- a/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx@@ -3,6 +3,7 @@ import { StatusDot } from '@/components/shared/StatusDot';import { ResponsiveMetricCell } from '@/components/shared/responsive';import { StackedMemoryBar } from '@/components/Workloads/StackedMemoryBar';import { TableCell, TableRow } from '@/components/shared/Table';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';import { getSimpleStatusIndicator } from '@/utils/status';import { asTrimmedString } from '@/utils/stringUtils';@@ -287,9 +288,12 @@ export const KubernetesClustersTable: Component<{title={cluster.status || 'unknown'}ariaHidden/>- <span class="truncate font-semibold text-base-content" title={name()}>- {name()}- </span>+ <ResourceNameWithWebInterfaceLink+ name={name()}+ url={cluster.customUrl}+ class="min-w-0"+ nameClass="truncate font-semibold text-base-content"+ /><Show when={cluster.kubernetes?.pendingUninstall === true}><span class="inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-900/40 dark:text-amber-300">Pending uninstalldiff --git a/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsxindex 61b2949abc..e0728d2525 100644--- a/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx@@ -1,6 +1,7 @@import { For, Show, createMemo, type Component, type JSX } from 'solid-js';import { StatusDot } from '@/components/shared/StatusDot';import { TableCell, TableRow } from '@/components/shared/Table';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { asTrimmedString } from '@/utils/stringUtils';import {PLATFORM_HEALTH_FILTER_OPTIONS,@@ -268,9 +269,12 @@ export const KubernetesDeploymentsTable: Component<{title={indicator().label}ariaHidden/>- <span class="truncate font-semibold text-base-content" title={name()}>- {name()}- </span>+ <ResourceNameWithWebInterfaceLink+ name={name()}+ url={deployment.customUrl}+ class="min-w-0"+ nameClass="truncate font-semibold text-base-content"+ /></div></TableCell><TableCelldiff --git a/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsxindex c996fd8136..decf8580b9 100644--- a/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx@@ -3,6 +3,7 @@ import { StatusDot } from '@/components/shared/StatusDot';import { ResponsiveMetricCell } from '@/components/shared/responsive';import { StackedMemoryBar } from '@/components/Workloads/StackedMemoryBar';import { TableCell, TableRow } from '@/components/shared/Table';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { asTrimmedString } from '@/utils/stringUtils';import { getAlertStyles } from '@/utils/alerts';import { useWebSocket } from '@/contexts/appRuntime';@@ -346,9 +347,12 @@ export const KubernetesNodesTable: Component<{title={indicator().label}ariaHidden/>- <span class="truncate font-semibold text-base-content" title={name()}>- {name()}- </span>+ <ResourceNameWithWebInterfaceLink+ name={name()}+ url={node.customUrl}+ class="min-w-0"+ nameClass="truncate font-semibold text-base-content"+ /></div></TableCell><TableCelldiff --git a/frontend-modern/src/features/kubernetes/KubernetesPodsTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesPodsTable.tsxindex 566480fd48..cc36f07848 100644--- a/frontend-modern/src/features/kubernetes/KubernetesPodsTable.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesPodsTable.tsx@@ -1,6 +1,7 @@import { For, Show, createMemo, type Component, type JSX } from 'solid-js';import { StatusDot } from '@/components/shared/StatusDot';import { TableCell, TableRow } from '@/components/shared/Table';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { asTrimmedString } from '@/utils/stringUtils';import {PLATFORM_HEALTH_FILTER_OPTIONS,@@ -312,9 +313,12 @@ export const KubernetesPodsTable: Component<{title={indicator().label}ariaHidden/>- <span class="truncate font-semibold text-base-content" title={name()}>- {name()}- </span>+ <ResourceNameWithWebInterfaceLink+ name={name()}+ url={resource.customUrl}+ class="min-w-0"+ nameClass="truncate font-semibold text-base-content"+ /></div></TableCell><TableCelldiff --git a/frontend-modern/src/features/kubernetes/KubernetesServicesTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesServicesTable.tsxindex 0444e8a274..0e9f6a0214 100644--- a/frontend-modern/src/features/kubernetes/KubernetesServicesTable.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesServicesTable.tsx@@ -1,6 +1,7 @@import { For, Show, createMemo, type Component, type JSX } from 'solid-js';import { StatusDot } from '@/components/shared/StatusDot';import { TableCell, TableRow } from '@/components/shared/Table';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { getSimpleStatusIndicator } from '@/utils/status';import { asTrimmedString } from '@/utils/stringUtils';import {@@ -247,9 +248,12 @@ export const KubernetesServicesTable: Component<{title={resource.status || 'unknown'}ariaHidden/>- <span class="truncate font-semibold text-base-content" title={name()}>- {name()}- </span>+ <ResourceNameWithWebInterfaceLink+ name={name()}+ url={resource.customUrl}+ class="min-w-0"+ nameClass="truncate font-semibold text-base-content"+ /></div></TableCell><TableCelldiff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesClustersTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesClustersTable.test.tsxindex 8cc347200c..e56d4370b8 100644--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesClustersTable.test.tsx+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesClustersTable.test.tsx@@ -41,7 +41,7 @@ afterEach(() => {describe('KubernetesClustersTable', () => {it('renders canonical CPU and memory metric primitives for cluster rows', () => {- const cluster = makeClusterResource();+ const cluster = makeClusterResource({ customUrl: 'https://kubernetes.internal' });render(() => (<KubernetesClustersTable@@ -71,6 +71,11 @@ describe('KubernetesClustersTable', () => {expect(screen.getByTestId('responsive-metric-cell')).toBeInTheDocument();expect(screen.getByTestId('stacked-memory-bar')).toBeInTheDocument();expect(screen.queryByText('Pending uninstall')).toBeNull();+ expect(screen.getByRole('link', { name: 'Open web interface for prod-west' })).toHaveAttribute(+ 'href',+ 'https://kubernetes.internal',+ );+ expect(screen.getByText('prod-west').closest('a')).toBeNull();});it('renders child counts through the shared count-ratio primitive', () => {diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesDeploymentsTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesDeploymentsTable.test.tsxindex 71471acabe..f6fcf250ce 100644--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesDeploymentsTable.test.tsx+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesDeploymentsTable.test.tsx@@ -37,6 +37,7 @@ describe('KubernetesDeploymentsTable', () => {resources={[makeResource({id: 'checkout-api',+ customUrl: 'https://checkout.internal',kubernetes: {clusterId: 'prod-euw1',clusterName: 'Production EUW1',@@ -82,6 +83,10 @@ describe('KubernetesDeploymentsTable', () => {expect(document.querySelector('[data-kubernetes-deployment-row="checkout-api"]'),).not.toBeNull();+ expect(+ screen.getByRole('link', { name: 'Open web interface for checkout-api' }),+ ).toHaveAttribute('href', 'https://checkout.internal');+ expect(screen.getByText('checkout-api').closest('a')).toBeNull();});it('maps Deployment status from replica progress and orders attention rows first', () => {diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesNodesTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesNodesTable.test.tsxnew file mode 100644index 0000000000..ad995f0451--- /dev/null+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesNodesTable.test.tsx@@ -0,0 +1,84 @@+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';++import type { Resource } from '@/types/resource';+import { KubernetesNodesTable } from '../KubernetesNodesTable';++vi.mock('@/components/shared/responsive', () => ({+ ResponsiveMetricCell: () => <div data-testid="responsive-metric-cell" />,+}));++vi.mock('@/components/Workloads/StackedMemoryBar', () => ({+ StackedMemoryBar: () => <div data-testid="stacked-memory-bar" />,+}));++vi.mock('@/contexts/appRuntime', () => ({+ useWebSocket: () => ({ activeAlerts: [] }),+}));++vi.mock('@/stores/alertsActivation', () => ({+ useAlertsActivation: () => ({ detectionEnabled: () => true }),+}));++const makeNodeResource = (overrides: Partial<Resource> = {}): Resource => ({+ id: 'k8s:prod-west:node:worker-01',+ name: 'worker-01',+ displayName: 'worker-01',+ platformId: 'prod-west',+ platformType: 'kubernetes',+ sourceType: 'hybrid',+ status: 'online',+ type: 'k8s-node',+ lastSeen: 1_700_000_000_000,+ uptime: 86_400,+ cpu: { current: 42 },+ memory: { total: 32_000, used: 20_000, free: 12_000, current: 62.5 },+ kubernetes: {+ clusterId: 'prod-west',+ clusterName: 'prod-west',+ nodeName: 'worker-01',+ ready: true,+ roles: ['worker'],+ kubeletVersion: 'v1.31.3',+ containerRuntimeVersion: 'containerd://1.7.20',+ capacityCpuCores: 8,+ capacityMemoryBytes: 32_000,+ capacityPods: 110,+ },+ ...overrides,+});++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe('KubernetesNodesTable', () => {+ it('keeps node identity inert and launches its web interface without expanding the row', () => {+ const node = makeNodeResource({ customUrl: 'https://worker-01.internal' });++ const { container } = render(() => (+ <KubernetesNodesTable+ resources={[node]}+ emptyIcon={<span />}+ emptyTitle="No nodes"+ emptyDescription="No nodes"+ showToolbar={false}+ />+ ));++ const row = container.querySelector('[data-kubernetes-node-row]') as HTMLElement;+ const launchLink = screen.getByRole('link', {+ name: 'Open web interface for worker-01',+ });++ expect(screen.getByText('worker-01').closest('a')).toBeNull();+ expect(launchLink).toHaveAttribute('href', 'https://worker-01.internal');+ expect(launchLink).toHaveAttribute('target', '_blank');+ expect(launchLink).toHaveAttribute('rel', 'noopener noreferrer');+ expect(row).toHaveAttribute('aria-expanded', 'false');++ fireEvent.click(launchLink);+ expect(row).toHaveAttribute('aria-expanded', 'false');+ });+});diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPodsTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPodsTable.test.tsxindex 5fdb491f0c..2fe150f114 100644--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPodsTable.test.tsx+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPodsTable.test.tsx@@ -33,6 +33,7 @@ describe('KubernetesPodsTable', () => {resources={[makeResource({id: 'checkout-api-6c746d5bcf-c7z2p',+ customUrl: 'https://checkout-pod.internal',kubernetes: {clusterId: 'prod-euw1',namespace: 'services',@@ -94,6 +95,12 @@ describe('KubernetesPodsTable', () => {expect(document.querySelector('[data-kubernetes-pod-row="checkout-api-6c746d5bcf-c7z2p"]'),).not.toBeNull();+ expect(+ screen.getByRole('link', {+ name: 'Open web interface for checkout-api-6c746d5bcf-c7z2p',+ }),+ ).toHaveAttribute('href', 'https://checkout-pod.internal');+ expect(screen.getByText('checkout-api-6c746d5bcf-c7z2p').closest('a')).toBeNull();});it('renders pod rows with status mapped from podPhase + container readiness, attention rows first', () => {diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesServicesTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesServicesTable.test.tsxindex f2b18efdb0..5f1d2a4e03 100644--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesServicesTable.test.tsx+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesServicesTable.test.tsx@@ -34,6 +34,7 @@ describe('KubernetesServicesTable', () => {makeResource({id: 'checkout-public',type: 'k8s-service',+ customUrl: 'https://checkout-service.internal',kubernetes: {clusterId: 'cluster-1',namespace: 'apps',@@ -74,5 +75,9 @@ describe('KubernetesServicesTable', () => {expect(screen.getByText('203.0.113.24')).toBeInTheDocument();expect(screen.getByText('443:8443/tcp node:30443')).toBeInTheDocument();expect(screen.getByText('app=checkout-web, tier=frontend')).toBeInTheDocument();+ expect(+ screen.getByRole('link', { name: 'Open web interface for checkout-public' }),+ ).toHaveAttribute('href', 'https://checkout-service.internal');+ expect(screen.getByText('checkout-public').closest('a')).toBeNull();});});diff --git a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsxindex 4a300a5a19..344690bd2c 100644--- a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx@@ -11,10 +11,7 @@ import { useWebSocket } from '@/contexts/appRuntime';import { useAlertsActivation } from '@/stores/alertsActivation';import { getAlertStyles } from '@/utils/alerts';import { StatusDot } from '@/components/shared/StatusDot';-import {- WEB_INTERFACE_LINK_COLOR_CLASS,- WebInterfaceNameLink,-} from '@/components/shared/WebInterfaceNameLink';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { InlineDetailTableRow } from '@/components/shared/InlineDetailTableRow';import { ResponsiveMetricCell } from '@/components/shared/responsive';import { NodeDrawer } from '@/components/Workloads/NodeDrawer';@@ -372,21 +369,21 @@ export const ProxmoxNodesTable: Component<{title={node.status || 'unknown'}ariaHidden/>- <WebInterfaceNameLink+ <ResourceNameWithWebInterfaceLinkname={name()}url={externalUrl()}- class={`truncate font-semibold ${WEB_INTERFACE_LINK_COLOR_CLASS}`}- fallbackClass="truncate font-semibold text-base-content"+ class="min-w-0"+ nameClass="truncate font-semibold text-base-content"title={`Open ${name()} web interface`}/><Show when={!isOnline()}>- <span class="rounded bg-surface-alt px-1.5 py-0.5 text-[10px] font-medium text-muted">+ <span class="hidden rounded bg-surface-alt px-1.5 py-0.5 text-[10px] font-medium text-muted sm:inline-flex">{availabilityLabel()}</span></Show><Show when={isOnline() && pendingUpdates() > 0}><span- class={`rounded px-1 py-0 text-[9px] font-medium whitespace-nowrap ${+ class={`hidden rounded px-1 py-0 text-[9px] font-medium whitespace-nowrap sm:inline-flex ${pendingUpdates() >= 10? 'bg-orange-100 text-orange-700 dark:bg-orange-900 dark:text-orange-400': 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-400'diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsxindex 8436754283..7b5302cec9 100644--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx@@ -122,7 +122,8 @@ describe('ProxmoxNodesTable', () => {const link = screen.getByRole('link', { name: 'Open web interface for pve-node-1' });expect(link).toHaveAttribute('href', 'https://pve.example.com:8006');expect(link).toHaveAttribute('target', '_blank');- expect(link).toHaveTextContent('pve-node-1');+ expect(link).toHaveTextContent('');+ expect(screen.getByText('pve-node-1').closest('a')).toBeNull();expect(screen.queryByRole('columnheader', { name: 'Web' })).not.toBeInTheDocument();expect(screen.queryByTestId('proxmox-host-web-link')).not.toBeInTheDocument();expect(screen.queryByTestId('node-drawer')).not.toBeInTheDocument();diff --git a/frontend-modern/src/features/proxmox/proxmoxHostTableModel.ts b/frontend-modern/src/features/proxmox/proxmoxHostTableModel.tsindex ab9fcf46f8..a49b566f77 100644--- a/frontend-modern/src/features/proxmox/proxmoxHostTableModel.ts+++ b/frontend-modern/src/features/proxmox/proxmoxHostTableModel.ts@@ -77,9 +77,9 @@ const HOST_COLUMN_RESPONSIVE_WEIGHTS: Record<// Column order follows the canonical recommended ordering documented in// columnAlignment.ts: identity → context → bars (CPU/Memory/Disk// contiguous) → diagnostic (Temp) → time (Uptime) → inventory counts-// → source context at end. Web-interface launches live on the node name so-// every runtime table uses the canonical shared name-link affordance instead-// of adding a separate action column.+// → source context at end. Web-interface launches live beside the inert node+// name so every runtime table uses the canonical shared adjacent control+// instead of adding a separate action column.export const PROXMOX_HOST_TABLE_COLUMNS: ProxmoxHostTableColumn[] = [{ id: 'node', label: 'Node', kind: 'name' },{ id: 'version', label: 'Version', kind: 'text' },diff --git a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsxindex de5cd224f5..b6e6237a44 100644--- a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx+++ b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx@@ -21,10 +21,7 @@ import { ActionIconButton } from '@/components/shared/Button';import { ColumnPicker } from '@/components/shared/ColumnPicker';import { StatusDot } from '@/components/shared/StatusDot';import { TemperatureGauge } from '@/components/shared/TemperatureGauge';-import {- WEB_INTERFACE_LINK_COLOR_CLASS,- WebInterfaceNameLink,-} from '@/components/shared/WebInterfaceNameLink';+import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { TableCell, TableHead, TableRow } from '@/components/shared/Table';import { TooltipPortal } from '@/components/shared/TooltipPortal';import { hostOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';@@ -1578,11 +1575,11 @@ export const AgentsMachinesTable: Component<{title={machine.status || 'unknown'}ariaHidden/>- <WebInterfaceNameLink+ <ResourceNameWithWebInterfaceLinkname={name()}url={savedWebInterfaceUrl()}- class={`truncate font-semibold ${WEB_INTERFACE_LINK_COLOR_CLASS}`}- fallbackClass="truncate font-semibold text-base-content"+ class="min-w-0"+ nameClass="truncate font-semibold text-base-content"/></div><Showdiff --git a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsxindex 2166bc89bc..cbabd55c44 100644--- a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx+++ b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx@@ -569,7 +569,7 @@ describe('AgentsMachinesTable', () => {});});- it('opens saved agent web interface URLs from the machine name', async () => {+ it('opens saved agent web interface URLs beside the machine name', async () => {getAllAgentMetadataMock.mockResolvedValueOnce({'web-host': { id: 'web-host', customUrl: 'https://web-host.local:9443' },});@@ -591,7 +591,8 @@ describe('AgentsMachinesTable', () => {const link = await screen.findByRole('link', { name: 'Open web interface for Web Host' });expect(link).toHaveAttribute('href', 'https://web-host.local:9443');- expect(link).toHaveTextContent('Web Host');+ expect(link).toHaveTextContent('');+ expect(screen.getByText('Web Host').closest('a')).toBeNull();expect(screen.queryByRole('columnheader', { name: 'Web' })).not.toBeInTheDocument();expect(screen.queryByRole('button', { name: 'Add web interface URL for Web Host' }),diff --git a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.tsindex b7f3ef0b6a..328db2dcf4 100644--- a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts+++ b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts@@ -5,6 +5,7 @@ import type { State } from '@/types/api';import type { Resource } from '@/types/resource';import useUnifiedResourcesSource from '../useUnifiedResources.ts?raw';import stringUtilsSource from '@/utils/stringUtils.ts?raw';+import { RESOURCE_METADATA_CHANGED_EVENT } from '@/utils/resourceMetadataEvents';type UseUnifiedResourcesModule = typeof import('@/hooks/useUnifiedResources');@@ -307,6 +308,41 @@ describe('useUnifiedResources', () => {dispose();});+ it('refetches the canonical tenant snapshot after same-tab metadata changes', async () => {+ apiFetchMock.mockResolvedValueOnce(resourceResponse([v2Resource])).mockResolvedValueOnce(+ resourceResponse([+ {+ ...v2Resource,+ customUrl: 'https://node-1.internal',+ },+ ]),+ );++ let dispose = () => {};+ let result: ReturnType<UseUnifiedResourcesModule['useUnifiedResources']> | undefined;+ createRoot((d) => {+ dispose = d;+ result = useUnifiedResources();+ });++ await waitForResourceCount(() => result!.resources().length);+ expect(apiFetchMock).toHaveBeenCalledTimes(1);++ window.dispatchEvent(+ new CustomEvent(RESOURCE_METADATA_CHANGED_EVENT, {+ detail: {+ metadataKind: 'agent',+ metadataId: 'host-1',+ customUrl: 'https://node-1.internal',+ },+ }),+ );+ await waitForValue(() => result!.resources()[0]?.customUrl, 'https://node-1.internal');++ expect(apiFetchMock).toHaveBeenCalledTimes(2);+ dispose();+ });+it('keeps an attached availability check distinct from its host across REST and websocket updates', async () => {const host = createWsResource({id: 'agent-core2026',@@ -812,6 +848,7 @@ describe('useUnifiedResources', () => {...v2Resource,type: 'vm',proxmox: {+ sourceId: 'site-a:pve1',nodeName: 'pve1',clusterName: 'cluster-b',instance: 'site-a',@@ -837,6 +874,7 @@ describe('useUnifiedResources', () => {expect(result!.resources()[0]?.clusterId).toBe('cluster-b');expect(result!.resources()[0]?.proxmox).toMatchObject({+ sourceId: 'site-a:pve1',node: 'pve1',nodeName: 'pve1',clusterName: 'cluster-b',diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.tsindex 1f5acf77e2..4b74b5ac1e 100644--- a/frontend-modern/src/hooks/useUnifiedResources.ts+++ b/frontend-modern/src/hooks/useUnifiedResources.ts@@ -37,6 +37,7 @@ import { canonicalizeFrontendResourceType } from '@/utils/resourceTypeCompat';import { getPreferredNormalizedPlatformId } from '@/utils/resourceIdentity';import { getExplicitResourceClusterName } from '@/utils/agentResources';import { mergeCanonicalResourceSnapshot } from '@/utils/resourceStateAdapters';+import { RESOURCE_METADATA_CHANGED_EVENT } from '@/utils/resourceMetadataEvents';import {normalizeSourcePlatformScopes,resolvePlatformTypeFromSources,@@ -181,6 +182,7 @@ type APIResource = {type?: string;name?: string;status?: string;+ customUrl?: string;uptime?: number;lastSeen?: string;parentName?: string;@@ -205,6 +207,7 @@ type APIResource = {parentId?: string;tags?: string[];proxmox?: {+ sourceId?: string;nodeName?: string;clusterName?: string;instance?: string;@@ -801,6 +804,7 @@ const toResource = (v2: APIResource): Resource => {ceph: v2.ceph as ResourceCephMeta | undefined,proxmox: v2.proxmox? {+ sourceId: v2.proxmox.sourceId,vmid: v2.proxmox.vmid,node: v2.proxmox.nodeName,nodeName: v2.proxmox.nodeName,@@ -855,6 +859,7 @@ const toResource = (v2: APIResource): Resource => {v2.docker?.temperature ??v2.kubernetes?.temperature ??v2.physicalDisk?.temperature,+ customUrl: asTrimmedString(v2.customUrl),tags: v2.tags,lastSeen: Number.isFinite(lastSeen) ? lastSeen : Date.now(),identity: {@@ -1571,8 +1576,31 @@ export function useUnifiedResources(options?: UseUnifiedResourcesOptions) {}});+ const handleResourceMetadataChanged = () => {+ if (!enabled()) {+ return;+ }+ const activeRequest = inFlightRefetch;+ void (async () => {+ // A save can land while the initial snapshot is still settling. Wait for+ // that request before forcing the post-save snapshot so the metadata+ // event cannot be swallowed by normal in-flight request coalescing.+ if (activeRequest) {+ await activeRequest.catch(() => undefined);+ }+ if (!enabled()) {+ return;+ }+ await runRefetch({ force: true, source: 'manual', background: true });+ })().catch((err) => {+ logger.debug('[useUnifiedResources] Metadata-triggered refetch failed', err);+ });+ };+ window.addEventListener(RESOURCE_METADATA_CHANGED_EVENT, handleResourceMetadataChanged);+onCleanup(() => {unsubscribeOrgSwitch();+ window.removeEventListener(RESOURCE_METADATA_CHANGED_EVENT, handleResourceMetadataChanged);clearInitialHydrationTimeout();clearCanonicalRevalidationTimeout();clearRefreshTimeout();diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.tsindex 7781d1d78e..026fea5fd3 100644--- a/frontend-modern/src/types/resource.ts+++ b/frontend-modern/src/types/resource.ts@@ -669,6 +669,8 @@ export interface ResourceAgentMeta {}export interface ResourceProxmoxMeta {+ /** Raw provider identity used for stable metadata lookup. */+ sourceId?: string;/** Proxmox-authored VM/LXC power state, kept separate from collection freshness. */runtimeStatus?: string;vmid?: number;diff --git a/frontend-modern/src/utils/__tests__/nodes.test.ts b/frontend-modern/src/utils/__tests__/nodes.test.tsindex 8ffb3f5c95..c1935f33ef 100644--- a/frontend-modern/src/utils/__tests__/nodes.test.ts+++ b/frontend-modern/src/utils/__tests__/nodes.test.ts@@ -7,6 +7,11 @@ describe('getNodeExternalUrl', () => {expect(getNodeExternalUrl(node)).toBe('https://pve.example.com:8006');});+ it('preserves an unsafe authored URL so the rendering boundary can reject it honestly', () => {+ const node = { name: 'pve1', guestURL: 'javascript:alert(document.domain)', host: 'pve1' };+ expect(getNodeExternalUrl(node)).toBe('javascript:alert(document.domain)');+ });+it('falls back to a URL-shaped host for legacy node payloads', () => {const node = { name: 'pve1', guestURL: '', host: 'https://192.168.0.5:8006' };expect(getNodeExternalUrl(node)).toBe('https://192.168.0.5:8006');diff --git a/frontend-modern/src/utils/nodes.ts b/frontend-modern/src/utils/nodes.tsindex 7bb7cb9350..10a540840b 100644--- a/frontend-modern/src/utils/nodes.ts+++ b/frontend-modern/src/utils/nodes.ts@@ -24,15 +24,17 @@ const HTTP_URL_PATTERN = /^https?:\/\//i;/*** Resolve the external management URL for a PVE node. `guestURL` carries the* operator-set link override (and, via the resource adapters, the PVE API- * connection URL). `host` is only honored when it is URL-shaped: on the- * unified-resource node shape it holds a bare hostname label for the drawer,- * which must not become a relative link target.+ * connection URL). Return an authored `guestURL` unchanged so the canonical+ * web-interface control can communicate malformed or unsafe persisted values+ * instead of silently replacing them with a hostname fallback. `host` is only+ * honored when it is URL-shaped: on the unified-resource node shape it holds a+ * bare hostname label for the drawer, which must not become a relative target.*/export function getNodeExternalUrl<T extends Pick<Node, 'name'> & Partial<Pick<Node, 'guestURL' | 'host'>>,>(node: T): string {const guestUrl = typeof node.guestURL === 'string' ? node.guestURL.trim() : '';- if (HTTP_URL_PATTERN.test(guestUrl)) return guestUrl;+ if (guestUrl) return guestUrl;const host = typeof node.host === 'string' ? node.host.trim() : '';if (HTTP_URL_PATTERN.test(host)) return host;const name = typeof node.name === 'string' ? node.name.trim() : '';diff --git a/frontend-modern/src/utils/resourceMetadataEvents.ts b/frontend-modern/src/utils/resourceMetadataEvents.tsindex 18d9841db1..d6f542b36f 100644--- a/frontend-modern/src/utils/resourceMetadataEvents.ts+++ b/frontend-modern/src/utils/resourceMetadataEvents.ts@@ -1,7 +1,7 @@export const RESOURCE_METADATA_CHANGED_EVENT = 'pulse:resource-metadata-changed';export type ResourceMetadataChangedDetail = {- metadataKind: 'agent' | 'guest' | 'docker';+ metadataKind: 'agent' | 'guest' | 'docker' | 'docker-host';metadataId: string;customUrl?: string;};diff --git a/internal/api/docker_metadata.go b/internal/api/docker_metadata.goindex 99890a54e8..2820761b82 100644--- a/internal/api/docker_metadata.go+++ b/internal/api/docker_metadata.go@@ -15,6 +15,34 @@ const (dockerRuntimeMetadataPathPrefix = "/api/docker/runtimes/metadata/")+func mergeDockerMetadataPatch(+ id string,+ existing,+ incoming *config.DockerMetadata,+ fields map[string]json.RawMessage,+) *config.DockerMetadata {+ result := &config.DockerMetadata{ID: id}+ if existing != nil {+ *result = *existing+ result.Tags = cloneStringSlice(existing.Tags)+ result.Notes = cloneStringSlice(existing.Notes)+ }+ result.ID = id+ if metadataPatchHasField(fields, "customUrl") {+ result.CustomURL = incoming.CustomURL+ }+ if metadataPatchHasField(fields, "description") {+ result.Description = incoming.Description+ }+ if metadataPatchHasField(fields, "tags") {+ result.Tags = cloneStringSlice(incoming.Tags)+ }+ if metadataPatchHasField(fields, "notes") {+ result.Notes = cloneStringSlice(incoming.Notes)+ }+ return result+}+// DockerMetadataHandler handles Docker resource metadata operationstype DockerMetadataHandler struct {mtPersistence *config.MultiTenantPersistence@@ -74,6 +102,10 @@ func (h *DockerMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *h"Failed to save Docker metadata","Updated Docker metadata",func(meta *config.DockerMetadata) string { return meta.CustomURL },+ func(ctx context.Context, id string) *config.DockerMetadata {+ return h.getStore(ctx).Get(id)+ },+ mergeDockerMetadataPatch,func(ctx context.Context, id string, meta *config.DockerMetadata) error {return h.getStore(ctx).Set(id, meta)},@@ -162,38 +194,32 @@ func (h *DockerMetadataHandler) HandleUpdateRuntimeMetadata(w http.ResponseWritereturn}- // Limit request body to 16KB to prevent memory exhaustion- r.Body = http.MaxBytesReader(w, r.Body, 16*1024)-- var meta config.DockerHostMetadata- if err := json.NewDecoder(r.Body).Decode(&meta); err != nil {- http.Error(w, "Invalid request body", http.StatusBadRequest)+ var incoming config.DockerHostMetadata+ fields, decoded := decodeBoundedMetadataPatch(w, r, &incoming)+ if !decoded {return}- // Validate URL if provided- if errMsg := validateCustomURL(meta.CustomURL); errMsg != "" {- http.Error(w, errMsg, http.StatusBadRequest)- return- }-- // Get existing metadata to merge with new datastore := h.getStore(r.Context())- existing := store.GetHostMetadata(runtimeID)- if existing != nil {- // Merge: only update fields that are provided- if meta.CustomDisplayName != "" || existing.CustomDisplayName != "" {- if meta.CustomDisplayName == "" {- meta.CustomDisplayName = existing.CustomDisplayName- }- }- // CustomURL can be explicitly cleared, so we don't merge it unless updating- if meta.Notes == nil && existing.Notes != nil {- meta.Notes = existing.Notes+ meta := store.GetHostMetadata(runtimeID)+ if meta == nil {+ meta = &config.DockerHostMetadata{}+ }+ if metadataPatchHasField(fields, "customDisplayName") {+ meta.CustomDisplayName = incoming.CustomDisplayName+ }+ if metadataPatchHasField(fields, "customUrl") {+ if errMsg := validateCustomURL(incoming.CustomURL); errMsg != "" {+ http.Error(w, errMsg, http.StatusBadRequest)+ return}+ meta.CustomURL = incoming.CustomURL+ }+ if metadataPatchHasField(fields, "notes") {+ meta.Notes = cloneStringSlice(incoming.Notes)}- if err := store.SetHostMetadata(runtimeID, &meta); err != nil {+ if err := store.SetHostMetadata(runtimeID, meta); err != nil {log.Error().Err(err).Str("runtimeID", runtimeID).Msg("Failed to save Docker / Podman host metadata")http.Error(w, metadataSaveErrorMessage(err), http.StatusInternalServerError)return@@ -202,7 +228,7 @@ func (h *DockerMetadataHandler) HandleUpdateRuntimeMetadata(w http.ResponseWritelog.Info().Str("runtimeID", runtimeID).Str("url", meta.CustomURL).Msg("Updated Docker / Podman host metadata")w.Header().Set("Content-Type", "application/json")- json.NewEncoder(w).Encode(&meta)+ json.NewEncoder(w).Encode(meta)}// HandleDeleteRuntimeMetadata removes metadata for a Docker / Podman host.diff --git a/internal/api/docker_metadata_additional_test.go b/internal/api/docker_metadata_additional_test.goindex f9e413966c..d3974d4343 100644--- a/internal/api/docker_metadata_additional_test.go+++ b/internal/api/docker_metadata_additional_test.go@@ -140,7 +140,11 @@ func TestDockerMetadataHandlers_RuntimeMetadata(t *testing.T) {})t.Run("merge-runtime-metadata", func(t *testing.T) {- req := httptest.NewRequest(http.MethodPut, "/api/docker/runtimes/metadata/host-1", bytes.NewReader([]byte(`{}`)))+ req := httptest.NewRequest(+ http.MethodPut,+ "/api/docker/runtimes/metadata/host-1",+ bytes.NewReader([]byte(`{"customUrl":"https://replacement.internal"}`)),+ )rec := httptest.NewRecorder()handler.HandleUpdateRuntimeMetadata(rec, req)@@ -161,6 +165,12 @@ func TestDockerMetadataHandlers_RuntimeMetadata(t *testing.T) {if got.CustomDisplayName != "Host A" {t.Fatalf("expected merged display name, got %q", got.CustomDisplayName)}+ if got.CustomURL != "https://replacement.internal" {+ t.Fatalf("expected patched URL, got %q", got.CustomURL)+ }+ if len(got.Notes) != 1 || got.Notes[0] != "note1" {+ t.Fatalf("expected notes to survive URL patch, got %#v", got.Notes)+ }})t.Run("delete-runtime-metadata", func(t *testing.T) {diff --git a/internal/api/guest_metadata.go b/internal/api/guest_metadata.goindex 07eafd8de7..6822b52de1 100644--- a/internal/api/guest_metadata.go+++ b/internal/api/guest_metadata.go@@ -2,6 +2,7 @@ package apiimport ("context"+ "encoding/json""net/http""strings"@@ -9,6 +10,40 @@ import ("github.com/rs/zerolog/log")+func mergeGuestMetadataPatch(+ id string,+ existing,+ incoming *config.GuestMetadata,+ fields map[string]json.RawMessage,+) *config.GuestMetadata {+ result := &config.GuestMetadata{ID: id}+ if existing != nil {+ *result = *existing+ result.Tags = cloneStringSlice(existing.Tags)+ result.Notes = cloneStringSlice(existing.Notes)+ }+ result.ID = id+ if metadataPatchHasField(fields, "customUrl") {+ result.CustomURL = incoming.CustomURL+ }+ if metadataPatchHasField(fields, "description") {+ result.Description = incoming.Description+ }+ if metadataPatchHasField(fields, "tags") {+ result.Tags = cloneStringSlice(incoming.Tags)+ }+ if metadataPatchHasField(fields, "notes") {+ result.Notes = cloneStringSlice(incoming.Notes)+ }+ if metadataPatchHasField(fields, "lastKnownName") {+ result.LastKnownName = incoming.LastKnownName+ }+ if metadataPatchHasField(fields, "lastKnownType") {+ result.LastKnownType = incoming.LastKnownType+ }+ return result+}+// GuestMetadataHandler handles guest metadata operationstype GuestMetadataHandler struct {mtPersistence *config.MultiTenantPersistence@@ -77,6 +112,10 @@ func (h *GuestMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *ht"Failed to save guest metadata","Updated guest metadata",func(meta *config.GuestMetadata) string { return meta.CustomURL },+ func(ctx context.Context, id string) *config.GuestMetadata {+ return h.getStore(ctx).Get(id)+ },+ mergeGuestMetadataPatch,func(ctx context.Context, id string, meta *config.GuestMetadata) error {return h.getStore(ctx).Set(id, meta)},diff --git a/internal/api/host_metadata.go b/internal/api/host_metadata.goindex 0096f3c317..66f46a67ff 100644--- a/internal/api/host_metadata.go+++ b/internal/api/host_metadata.go@@ -125,23 +125,39 @@ func (h *HostMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *httreturn}- // Limit request body to 16KB to prevent memory exhaustion- r.Body = http.MaxBytesReader(w, r.Body, 16*1024)-- var meta config.HostMetadata- if err := json.NewDecoder(r.Body).Decode(&meta); err != nil {- http.Error(w, "Invalid request body", http.StatusBadRequest)+ var incoming config.HostMetadata+ fields, decoded := decodeBoundedMetadataPatch(w, r, &incoming)+ if !decoded {return}- // Validate URL if provided- if errMsg := validateCustomURL(meta.CustomURL); errMsg != "" {- http.Error(w, errMsg, http.StatusBadRequest)- return+ store := h.getStore(r.Context())+ meta := store.Get(hostID)+ if meta == nil {+ meta = &config.HostMetadata{ID: hostID}+ }+ meta.ID = hostID+ if metadataPatchHasField(fields, "customUrl") {+ if errMsg := validateCustomURL(incoming.CustomURL); errMsg != "" {+ http.Error(w, errMsg, http.StatusBadRequest)+ return+ }+ meta.CustomURL = incoming.CustomURL+ }+ if metadataPatchHasField(fields, "description") {+ meta.Description = incoming.Description+ }+ if metadataPatchHasField(fields, "tags") {+ meta.Tags = cloneStringSlice(incoming.Tags)+ }+ if metadataPatchHasField(fields, "notes") {+ meta.Notes = cloneStringSlice(incoming.Notes)+ }+ if metadataPatchHasField(fields, "commandsEnabled") {+ meta.CommandsEnabled = incoming.CommandsEnabled}- store := h.getStore(r.Context())- if err := store.Set(hostID, &meta); err != nil {+ if err := store.Set(hostID, meta); err != nil {log.Error().Err(err).Str("hostID", hostID).Msg("Failed to save host metadata")http.Error(w, metadataSaveErrorMessage(err), http.StatusInternalServerError)return@@ -150,7 +166,7 @@ func (h *HostMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *httlog.Info().Str("hostID", hostID).Str("url", meta.CustomURL).Msg("Updated host metadata")w.Header().Set("Content-Type", "application/json")- json.NewEncoder(w).Encode(&meta)+ json.NewEncoder(w).Encode(meta)}// HandleDeleteMetadata removes metadata for an agent.diff --git a/internal/api/metadata_handlers_shared.go b/internal/api/metadata_handlers_shared.goindex 152e3cff3f..d5dc8e7c82 100644--- a/internal/api/metadata_handlers_shared.go+++ b/internal/api/metadata_handlers_shared.go@@ -3,12 +3,38 @@ package apiimport ("context""encoding/json"+ "io""net/http""strings""github.com/rs/zerolog/log")+func decodeBoundedMetadataPatch(+ w http.ResponseWriter,+ r *http.Request,+ target any,+) (map[string]json.RawMessage, bool) {+ r.Body = http.MaxBytesReader(w, r.Body, 16*1024)+ body, err := io.ReadAll(r.Body)+ if err != nil {+ http.Error(w, "Invalid request body", http.StatusBadRequest)+ return nil, false+ }++ var fields map[string]json.RawMessage+ if len(body) == 0 || json.Unmarshal(body, &fields) != nil || fields == nil || json.Unmarshal(body, target) != nil {+ http.Error(w, "Invalid request body", http.StatusBadRequest)+ return nil, false+ }+ return fields, true+}++func metadataPatchHasField(fields map[string]json.RawMessage, field string) bool {+ _, ok := fields[field]+ return ok+}+// handleMetadataGetRequest serves the GET flow shared by the guest and docker// metadata handlers: the bare route returns the full metadata map (an empty// object instead of null), a suffixed route returns that resource's metadata@@ -72,6 +98,8 @@ func handleMetadataUpdateRequest[M any](saveErrLogMsg string,updatedLogMsg string,customURL func(*M) string,+ get func(ctx context.Context, id string) *M,+ merge func(id string, existing, incoming *M, fields map[string]json.RawMessage) *M,set func(ctx context.Context, id string, meta *M) error,) {if r.Method != http.MethodPut && r.Method != http.MethodPost {@@ -85,29 +113,44 @@ func handleMetadataUpdateRequest[M any](return}- // Limit request body to 16KB to prevent memory exhaustion- r.Body = http.MaxBytesReader(w, r.Body, 16*1024)+ var incoming M+ fields, ok := decodeBoundedMetadataPatch(w, r, &incoming)+ if !ok {+ return+ }+ meta := merge(resourceID, get(r.Context(), resourceID), &incoming, fields)- var meta M- if err := json.NewDecoder(r.Body).Decode(&meta); err != nil {+ if meta == nil {http.Error(w, "Invalid request body", http.StatusBadRequest)return}- // Validate URL if provided- if errMsg := validateCustomURL(customURL(&meta)); errMsg != "" {- http.Error(w, errMsg, http.StatusBadRequest)- return+ // Existing legacy metadata must remain editable. Validate the URL only+ // when this patch actually authors customUrl.+ if metadataPatchHasField(fields, "customUrl") {+ if errMsg := validateCustomURL(customURL(meta)); errMsg != "" {+ http.Error(w, errMsg, http.StatusBadRequest)+ return+ }}- if err := set(r.Context(), resourceID, &meta); err != nil {+ if err := set(r.Context(), resourceID, meta); err != nil {log.Error().Err(err).Str(idLogKey, resourceID).Msg(saveErrLogMsg)http.Error(w, metadataSaveErrorMessage(err), http.StatusInternalServerError)return}- log.Info().Str(idLogKey, resourceID).Str("url", customURL(&meta)).Msg(updatedLogMsg)+ log.Info().Str(idLogKey, resourceID).Str("url", customURL(meta)).Msg(updatedLogMsg)w.Header().Set("Content-Type", "application/json")- json.NewEncoder(w).Encode(&meta)+ if err := json.NewEncoder(w).Encode(meta); err != nil {+ log.Debug().Err(err).Str(idLogKey, resourceID).Msg("Failed to encode metadata response")+ }+}++func cloneStringSlice(values []string) []string {+ if values == nil {+ return nil+ }+ return append([]string(nil), values...)}diff --git a/internal/api/metadata_handlers_test.go b/internal/api/metadata_handlers_test.goindex ed2841e454..9b2420f78c 100644--- a/internal/api/metadata_handlers_test.go+++ b/internal/api/metadata_handlers_test.go@@ -148,6 +148,121 @@ func TestHostMetadataHandler(t *testing.T) {}}+func TestMetadataURLPatchesPreserveUnrelatedFields(t *testing.T) {+ mtp := config.NewMultiTenantPersistence(t.TempDir())+ persistence, err := mtp.GetPersistence("default")+ if err != nil {+ t.Fatalf("get persistence: %v", err)+ }++ t.Run("guest", func(t *testing.T) {+ store := persistence.GetGuestMetadataStore()+ if err := store.Set("guest-1", &config.GuestMetadata{+ Description: "critical workload",+ Tags: []string{"production"},+ Notes: []string{"owned by operations"},+ LastKnownName: "web",+ LastKnownType: "qemu",+ }); err != nil {+ t.Fatalf("seed guest metadata: %v", err)+ }++ handler := NewGuestMetadataHandler(mtp)+ req := httptest.NewRequest(+ http.MethodPut,+ "/api/guests/metadata/guest-1",+ strings.NewReader(`{"customUrl":"https://guest.internal"}`),+ )+ resp := httptest.NewRecorder()+ handler.HandleUpdateMetadata(resp, req)+ if resp.Code != http.StatusOK {+ t.Fatalf("status = %d, body = %s", resp.Code, resp.Body.String())+ }++ got := store.Get("guest-1")+ if got == nil ||+ got.CustomURL != "https://guest.internal" ||+ got.Description != "critical workload" ||+ len(got.Tags) != 1 || got.Tags[0] != "production" ||+ len(got.Notes) != 1 || got.Notes[0] != "owned by operations" ||+ got.LastKnownName != "web" ||+ got.LastKnownType != "qemu" {+ t.Fatalf("guest metadata after URL patch = %#v", got)+ }+ })++ t.Run("host", func(t *testing.T) {+ commandsEnabled := true+ store := persistence.GetHostMetadataStore()+ if err := store.Set("host-1", &config.HostMetadata{+ Description: "edge host",+ Tags: []string{"edge"},+ Notes: []string{"maintenance Sunday"},+ CommandsEnabled: &commandsEnabled,+ }); err != nil {+ t.Fatalf("seed host metadata: %v", err)+ }++ handler := NewHostMetadataHandler(mtp)+ req := httptest.NewRequest(+ http.MethodPut,+ "/api/agents/metadata/host-1",+ strings.NewReader(`{"customUrl":"https://host.internal"}`),+ )+ resp := httptest.NewRecorder()+ handler.HandleUpdateMetadata(resp, req)+ if resp.Code != http.StatusOK {+ t.Fatalf("status = %d, body = %s", resp.Code, resp.Body.String())+ }++ got := store.Get("host-1")+ if got == nil ||+ got.CustomURL != "https://host.internal" ||+ got.Description != "edge host" ||+ len(got.Tags) != 1 || got.Tags[0] != "edge" ||+ len(got.Notes) != 1 || got.Notes[0] != "maintenance Sunday" ||+ got.CommandsEnabled == nil || !*got.CommandsEnabled {+ t.Fatalf("host metadata after URL patch = %#v", got)+ }+ })+}++func TestHostWebInterfaceMetadataIsTenantIsolated(t *testing.T) {+ mtp := config.NewMultiTenantPersistence(t.TempDir())+ handler := NewHostMetadataHandler(mtp)++ update := func(orgID, customURL string) {+ t.Helper()+ req := httptest.NewRequest(+ http.MethodPut,+ "/api/agents/metadata/shared-host-id",+ strings.NewReader(`{"customUrl":"`+customURL+`"}`),+ )+ req = req.WithContext(context.WithValue(req.Context(), OrgIDContextKey, orgID))+ resp := httptest.NewRecorder()+ handler.HandleUpdateMetadata(resp, req)+ if resp.Code != http.StatusOK {+ t.Fatalf("tenant %s update status = %d, body = %s", orgID, resp.Code, resp.Body.String())+ }+ }+ update("tenant-a", "https://tenant-a.internal")+ update("tenant-b", "https://tenant-b.internal")++ for orgID, want := range map[string]string{+ "tenant-a": "https://tenant-a.internal",+ "tenant-b": "https://tenant-b.internal",+ } {+ persistence, err := mtp.GetPersistence(orgID)+ if err != nil {+ t.Fatalf("get persistence for %s: %v", orgID, err)+ }+ got := persistence.GetHostMetadataStore().Get("shared-host-id")+ if got == nil || got.CustomURL != want {+ t.Fatalf("tenant %s metadata = %#v, want URL %q", orgID, got, want)+ }+ }+}+func TestMetadataHandlersUseLiveMonitorStoresForImmediateRoundTrips(t *testing.T) {fallbackPersistence := config.NewMultiTenantPersistence(t.TempDir())defaultPersistence, err := fallbackPersistence.GetPersistence("default")diff --git a/internal/config/docker_metadata.go b/internal/config/docker_metadata.goindex 7bdf2602aa..a57fa4777f 100644--- a/internal/config/docker_metadata.go+++ b/internal/config/docker_metadata.go@@ -26,6 +26,31 @@ type DockerHostMetadata struct {Notes []string `json:"notes,omitempty"` // User annotations for AI context}+func cloneDockerMetadata(meta *DockerMetadata) *DockerMetadata {+ if meta == nil {+ return nil+ }+ clone := *meta+ if meta.Tags != nil {+ clone.Tags = append([]string{}, meta.Tags...)+ }+ if meta.Notes != nil {+ clone.Notes = append([]string{}, meta.Notes...)+ }+ return &clone+}++func cloneDockerHostMetadata(meta *DockerHostMetadata) *DockerHostMetadata {+ if meta == nil {+ return nil+ }+ clone := *meta+ if meta.Notes != nil {+ clone.Notes = append([]string{}, meta.Notes...)+ }+ return &clone+}+// dockerMetadataFile represents the on-disk format for Docker metadatatype dockerMetadataFile struct {Containers map[string]*DockerMetadata `json:"containers,omitempty"` // Container/service metadata (legacy: may be top-level)@@ -164,7 +189,7 @@ func (s *DockerMetadataStore) Get(resourceID string) *DockerMetadata {defer s.mu.RUnlock()if meta, exists := s.metadata[resourceID]; exists {- return meta+ return cloneDockerMetadata(meta)}return nil}@@ -177,7 +202,7 @@ func (s *DockerMetadataStore) GetAll() map[string]*DockerMetadata {// Return a copy to prevent external modificationsresult := make(map[string]*DockerMetadata)for k, v := range s.metadata {- result[k] = v+ result[k] = cloneDockerMetadata(v)}return result}@@ -188,7 +213,7 @@ func (s *DockerMetadataStore) GetHostMetadata(hostID string) *DockerHostMetadatadefer s.mu.RUnlock()if meta, exists := s.hostMetadata[hostID]; exists {- return meta+ return cloneDockerHostMetadata(meta)}return nil}@@ -201,7 +226,7 @@ func (s *DockerMetadataStore) GetAllHostMetadata() map[string]*DockerHostMetadat// Return a copy to prevent external modificationsresult := make(map[string]*DockerHostMetadata)for k, v := range s.hostMetadata {- result[k] = v+ result[k] = cloneDockerHostMetadata(v)}return result}@@ -215,7 +240,7 @@ func (s *DockerMetadataStore) SetHostMetadata(hostID string, meta *DockerHostMetif meta == nil || (meta.CustomDisplayName == "" && meta.CustomURL == "" && len(meta.Notes) == 0) {delete(s.hostMetadata, hostID)} else {- s.hostMetadata[hostID] = meta+ s.hostMetadata[hostID] = cloneDockerHostMetadata(meta)}// Save to disk@@ -232,8 +257,9 @@ func (s *DockerMetadataStore) Set(resourceID string, meta *DockerMetadata) errorreturn fmt.Errorf("metadata cannot be nil")}- meta.ID = resourceID- s.metadata[resourceID] = meta+ clone := cloneDockerMetadata(meta)+ clone.ID = resourceID+ s.metadata[resourceID] = clone// Save to diskreturn s.save()@@ -262,13 +288,13 @@ func (s *DockerMetadataStore) ReplaceAll(metadata map[string]*DockerMetadata) ercontinue}- clone := *meta+ clone := cloneDockerMetadata(meta)clone.ID = resourceID// Ensure slice copy is not nil to allow JSON marshalling of empty tagsif clone.Tags == nil {clone.Tags = []string{}}- s.metadata[resourceID] = &clone+ s.metadata[resourceID] = clone}return s.save()diff --git a/internal/config/host_metadata.go b/internal/config/host_metadata.goindex 85f6aa3684..40eeae7be8 100644--- a/internal/config/host_metadata.go+++ b/internal/config/host_metadata.go@@ -20,6 +20,25 @@ type HostMetadata struct {CommandsEnabled *bool `json:"commandsEnabled"` // Remote override for AI command execution (nil = use agent default)}+func cloneHostMetadata(meta *HostMetadata) *HostMetadata {+ if meta == nil {+ return nil+ }++ clone := *meta+ if meta.Tags != nil {+ clone.Tags = append([]string{}, meta.Tags...)+ }+ if meta.Notes != nil {+ clone.Notes = append([]string{}, meta.Notes...)+ }+ if meta.CommandsEnabled != nil {+ commandsEnabled := *meta.CommandsEnabled+ clone.CommandsEnabled = &commandsEnabled+ }+ return &clone+}+// HostMetadataStore manages host metadatatype HostMetadataStore struct {mu sync.RWMutex@@ -107,7 +126,7 @@ func (s *HostMetadataStore) Get(hostID string) *HostMetadata {defer s.mu.RUnlock()if meta, exists := s.metadata[hostID]; exists {- return meta+ return cloneHostMetadata(meta)}return nil}@@ -120,7 +139,7 @@ func (s *HostMetadataStore) GetAll() map[string]*HostMetadata {// Return a copy to prevent external modificationsresult := make(map[string]*HostMetadata)for k, v := range s.metadata {- result[k] = v+ result[k] = cloneHostMetadata(v)}return result}@@ -134,8 +153,9 @@ func (s *HostMetadataStore) Set(hostID string, meta *HostMetadata) error {return fmt.Errorf("metadata cannot be nil")}- meta.ID = hostID- s.metadata[hostID] = meta+ clone := cloneHostMetadata(meta)+ clone.ID = hostID+ s.metadata[hostID] = clone// Save to diskreturn s.save()@@ -164,13 +184,13 @@ func (s *HostMetadataStore) ReplaceAll(metadata map[string]*HostMetadata) errorcontinue}- clone := *meta+ clone := cloneHostMetadata(meta)clone.ID = hostID// Ensure slice copy is not nil to allow JSON marshalling of empty tagsif clone.Tags == nil {clone.Tags = []string{}}- s.metadata[hostID] = &clone+ s.metadata[hostID] = clone}return s.save()diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.goindex a105904f6d..5cfe87bde5 100644--- a/internal/monitoring/monitor.go+++ b/internal/monitoring/monitor.go@@ -5427,11 +5427,8 @@ func (m *Monitor) applyPersistedMetadataToUnifiedResources(resources []unifiedrecopy(out, resources)for i := range out {resource := &out[i]- if strings.TrimSpace(resource.CustomURL) != "" {- continue- }- switch unifiedresources.CanonicalResourceType(resource.Type) {+ switch unifiedresources.ContractResourceType(*resource) {case unifiedresources.ResourceTypeAppContainer:if resource.Docker == nil {continue@@ -5442,12 +5439,24 @@ func (m *Monitor) applyPersistedMetadataToUnifiedResources(resources []unifiedrecontinue}if customURL, ok := m.dockerAppContainerCustomURL(*resource, hostID, containerID); ok {- resource.CustomURL = customURL+ // The metadata record is authoritative even when empty: an+ // explicit clear must remove a stale URL still carried by an+ // older unified-resource snapshot.+ resource.CustomURL = strings.TrimSpace(customURL)}case unifiedresources.ResourceTypePod,unifiedresources.ResourceTypeK8sDeployment,unifiedresources.ResourceTypeK8sService:if customURL, ok := m.kubernetesWorkloadCustomURL(*resource); ok {+ resource.CustomURL = strings.TrimSpace(customURL)+ }+ case unifiedresources.ResourceTypeAgent,+ unifiedresources.ResourceType("docker-host"),+ unifiedresources.ResourceTypePBS,+ unifiedresources.ResourceTypePMG,+ unifiedresources.ResourceTypeK8sCluster,+ unifiedresources.ResourceTypeK8sNode:+ if customURL, ok := m.hostResourceCustomURL(*resource); ok {resource.CustomURL = customURL}}@@ -5455,6 +5464,112 @@ func (m *Monitor) applyPersistedMetadataToUnifiedResources(resources []unifiedrereturn out}+func appendUniqueMetadataCandidate(candidates []string, seen map[string]struct{}, value string) []string {+ value = strings.TrimSpace(value)+ if value == "" {+ return candidates+ }+ if _, exists := seen[value]; exists {+ return candidates+ }+ seen[value] = struct{}{}+ return append(candidates, value)+}++func hostResourceMetadataCandidates(resource unifiedresources.Resource) []string {+ candidates := make([]string, 0, 20)+ seen := make(map[string]struct{}, 20)+ add := func(value string) {+ candidates = appendUniqueMetadataCandidate(candidates, seen, value)+ }++ if resource.Docker != nil {+ add(resource.Docker.HostSourceID)+ add(resource.Docker.AgentID)+ }+ if resource.Agent != nil {+ add(resource.Agent.AgentID)+ }+ if resource.PBS != nil {+ add(resource.PBS.InstanceID)+ }+ if resource.PMG != nil {+ add(resource.PMG.InstanceID)+ }+ if resource.Kubernetes != nil {+ if unifiedresources.ContractResourceType(resource) == unifiedresources.ResourceTypeK8sNode {+ clusterID := strings.TrimSpace(resource.Kubernetes.ClusterID)+ nodeName := strings.TrimSpace(resource.Kubernetes.NodeName)+ if nodeName == "" {+ nodeName = strings.TrimSpace(resource.Name)+ }+ if clusterID != "" && nodeName != "" {+ add(clusterID + ":node:" + nodeName)+ }+ add(resource.Kubernetes.NodeUID)+ }+ add(resource.Kubernetes.ClusterID)+ add(resource.Kubernetes.AgentID)+ }+ if resource.Proxmox != nil {+ add(resource.Proxmox.SourceID)+ add(resource.Proxmox.NodeName)+ }+ if resource.DiscoveryTarget != nil {+ add(resource.DiscoveryTarget.AgentID)+ add(resource.DiscoveryTarget.ResourceID)+ }+ if resource.MetricsTarget != nil {+ add(resource.MetricsTarget.ResourceID)+ }+ if resource.Canonical != nil {+ add(resource.Canonical.PrimaryID)+ if prefixAt := strings.IndexByte(resource.Canonical.PrimaryID, ':'); prefixAt >= 0 {+ add(resource.Canonical.PrimaryID[prefixAt+1:])+ }+ for _, alias := range resource.Canonical.Aliases {+ add(alias)+ }+ for _, supersededID := range resource.Canonical.SupersededIDs {+ add(supersededID)+ }+ }+ add(resource.Identity.MachineID)+ add(resource.ID)+ add(resource.Name)+ return candidates+}++func (m *Monitor) hostResourceCustomURL(resource unifiedresources.Resource) (string, bool) {+ if m == nil {+ return "", false+ }++ candidates := hostResourceMetadataCandidates(resource)+ if unifiedresources.ContractResourceType(resource) == unifiedresources.ResourceType("docker-host") &&+ m.dockerMetadataStore != nil {+ for _, candidate := range candidates {+ if meta := m.dockerMetadataStore.GetHostMetadata(candidate); meta != nil {+ if customURL := strings.TrimSpace(meta.CustomURL); customURL != "" {+ return customURL, true+ }+ }+ }+ return "", false+ }++ if m.hostMetadataStore != nil {+ for _, candidate := range candidates {+ if meta := m.hostMetadataStore.Get(candidate); meta != nil {+ if customURL := strings.TrimSpace(meta.CustomURL); customURL != "" {+ return customURL, true+ }+ }+ }+ }+ return "", false+}+func (m *Monitor) dockerAppContainerCustomURL(resource unifiedresources.Resource,hostID,diff --git a/internal/monitoring/monitor_agents.go b/internal/monitoring/monitor_agents.goindex ce34081d27..e0c9833a58 100644--- a/internal/monitoring/monitor_agents.go+++ b/internal/monitoring/monitor_agents.go@@ -983,13 +983,13 @@ func (m *Monitor) SetDockerHostCustomDisplayName(hostID string, customName strincustomName = strings.TrimSpace(customName)- // Persist to Docker metadata store first- var hostMeta *config.DockerHostMetadata- if customName != "" {- hostMeta = &config.DockerHostMetadata{- CustomDisplayName: customName,- }+ // Persist to Docker metadata store first without discarding independently+ // authored URL or notes metadata.+ hostMeta := m.dockerMetadataStore.GetHostMetadata(hostID)+ if hostMeta == nil {+ hostMeta = &config.DockerHostMetadata{}}+ hostMeta.CustomDisplayName = customNameif err := m.dockerMetadataStore.SetHostMetadata(hostID, hostMeta); err != nil {log.Error().Err(err).Str("hostID", hostID).Msg("failed to persist Docker host metadata")return models.DockerHost{}, fmt.Errorf("failed to persist custom display name: %w", err)diff --git a/internal/monitoring/monitor_docker_test.go b/internal/monitoring/monitor_docker_test.goindex afdfc60e88..8b947d2bd7 100644--- a/internal/monitoring/monitor_docker_test.go+++ b/internal/monitoring/monitor_docker_test.go@@ -909,7 +909,7 @@ func TestApplyDockerMetadataToUnifiedResourcesAddsContainerCustomURL(t *testing.}}-func TestApplyDockerMetadataToUnifiedResourcesKeepsResourceCustomURL(t *testing.T) {+func TestApplyDockerMetadataToUnifiedResourcesPrefersCanonicalMetadataOverStaleResourceURL(t *testing.T) {monitor := newTestMonitor(t)if err := monitor.dockerMetadataStore.Set("docker-host-1:container:container-new", &config.DockerMetadata{CustomURL: "https://metadata.internal",@@ -930,8 +930,8 @@ func TestApplyDockerMetadataToUnifiedResourcesKeepsResourceCustomURL(t *testing.}got := monitor.applyPersistedMetadataToUnifiedResources(resources)- if got[0].CustomURL != "https://resource.internal" {- t.Fatalf("CustomURL = %q, want existing resource URL to win", got[0].CustomURL)+ if got[0].CustomURL != "https://metadata.internal" {+ t.Fatalf("CustomURL = %q, want canonical metadata URL to win", got[0].CustomURL)}}diff --git a/internal/monitoring/monitor_web_interface_metadata_test.go b/internal/monitoring/monitor_web_interface_metadata_test.gonew file mode 100644index 0000000000..74b7c8264b--- /dev/null+++ b/internal/monitoring/monitor_web_interface_metadata_test.go@@ -0,0 +1,157 @@+package monitoring++import (+ "testing"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"+)++func TestApplyPersistedMetadataProjectsHostWebInterfacesAcrossPlatforms(t *testing.T) {+ monitor := newTestMonitor(t)+ monitor.hostMetadataStore = config.NewHostMetadataStore(t.TempDir(), nil)+ if monitor.dockerMetadataStore == nil {+ monitor.dockerMetadataStore = config.NewDockerMetadataStore(t.TempDir(), nil)+ }+ seedHost := func(id, url string) {+ t.Helper()+ if err := monitor.hostMetadataStore.Set(id, &config.HostMetadata{CustomURL: url}); err != nil {+ t.Fatalf("seed host metadata %q: %v", id, err)+ }+ }++ seedHost("agent-stable", "https://agent.internal")+ seedHost("pve-source", "https://pve.internal")+ seedHost("pbs-stable", "https://pbs-override.internal")+ seedHost("pmg-stable", "https://pmg.internal")+ seedHost("cluster-stable", "https://kubernetes.internal")+ seedHost("cluster-stable:node:worker-renamed", "https://worker.internal")+ seedHost("retired-agent-id", "https://migrated-agent.internal")+ if err := monitor.dockerMetadataStore.SetHostMetadata(+ "docker-runtime-stable",+ &config.DockerHostMetadata{+ CustomDisplayName: "Renamed Podman host",+ CustomURL: "https://podman.internal",+ Notes: []string{"retain me"},+ },+ ); err != nil {+ t.Fatalf("seed Docker host metadata: %v", err)+ }++ resources := []unifiedresources.Resource{+ {+ ID: "agent-row",+ Type: unifiedresources.ResourceTypeAgent,+ Name: "agent-renamed",+ Agent: &unifiedresources.AgentData{+ AgentID: "agent-stable",+ },+ },+ {+ ID: "pve-row",+ Type: unifiedresources.ResourceTypeAgent,+ Name: "pve-renamed",+ Proxmox: &unifiedresources.ProxmoxData{+ SourceID: "pve-source",+ NodeName: "pve-renamed",+ },+ },+ {+ ID: "docker-row",+ Type: unifiedresources.ResourceTypeAgent,+ Technology: "podman",+ Name: "podman-renamed",+ Docker: &unifiedresources.DockerData{+ HostSourceID: "docker-runtime-stable",+ Hostname: "podman-renamed",+ },+ },+ {+ ID: "pbs-row",+ Type: unifiedresources.ResourceTypePBS,+ Name: "pbs-renamed",+ CustomURL: "https://pbs-configured.internal",+ PBS: &unifiedresources.PBSData{+ InstanceID: "pbs-stable",+ },+ },+ {+ ID: "pmg-row",+ Type: unifiedresources.ResourceTypePMG,+ Name: "pmg-renamed",+ PMG: &unifiedresources.PMGData{+ InstanceID: "pmg-stable",+ },+ },+ {+ ID: "cluster-row",+ Type: unifiedresources.ResourceTypeK8sCluster,+ Name: "cluster-renamed",+ Kubernetes: &unifiedresources.K8sData{+ ClusterID: "cluster-stable",+ },+ },+ {+ ID: "node-row-after-recreation",+ Type: unifiedresources.ResourceTypeK8sNode,+ Name: "worker-renamed",+ Kubernetes: &unifiedresources.K8sData{+ ClusterID: "cluster-stable",+ NodeName: "worker-renamed",+ NodeUID: "new-node-uid",+ },+ },+ {+ ID: "agent-row-after-migration",+ Type: unifiedresources.ResourceTypeAgent,+ Name: "migrated-agent",+ Canonical: &unifiedresources.CanonicalIdentity{+ PrimaryID: "agent:current-agent-id",+ SupersededIDs: []string{"retired-agent-id"},+ },+ },+ }++ got := monitor.applyPersistedMetadataToUnifiedResources(resources)+ want := []string{+ "https://agent.internal",+ "https://pve.internal",+ "https://podman.internal",+ "https://pbs-override.internal",+ "https://pmg.internal",+ "https://kubernetes.internal",+ "https://worker.internal",+ "https://migrated-agent.internal",+ }+ for i := range want {+ if got[i].CustomURL != want[i] {+ t.Fatalf("resource %d (%s) CustomURL = %q, want %q", i, got[i].Name, got[i].CustomURL, want[i])+ }+ }++ if resources[0].CustomURL != "" {+ t.Fatalf("projection mutated input resources: %#v", resources[0])+ }+}++func TestApplyPersistedMetadataPreservesConfiguredHostURLWithoutManualOverride(t *testing.T) {+ monitor := newTestMonitor(t)+ monitor.hostMetadataStore = config.NewHostMetadataStore(t.TempDir(), nil)+ if err := monitor.hostMetadataStore.Set("pbs-stable", &config.HostMetadata{+ Description: "metadata without a URL",+ }); err != nil {+ t.Fatalf("seed non-URL host metadata: %v", err)+ }++ resource := unifiedresources.Resource{+ ID: "pbs-row",+ Type: unifiedresources.ResourceTypePBS,+ Name: "pbs",+ CustomURL: "https://pbs-configured.internal",+ PBS: &unifiedresources.PBSData{InstanceID: "pbs-stable"},+ }+ got := monitor.applyPersistedMetadataToUnifiedResources([]unifiedresources.Resource{resource})+ if got[0].CustomURL != "https://pbs-configured.internal" {+ t.Fatalf("configured CustomURL = %q", got[0].CustomURL)+ }+}diff --git a/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts b/tests/integration/tests/65-offline-proxmox-node-visibility.spec.tsindex a4575f943c..7e9ecce9c0 100644--- a/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts+++ b/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts@@ -40,6 +40,23 @@ const offlineNode = {},};+const unsafeUrlNode = {+ ...offlineNode,+ id: "proxmox:core-fabric:pve6",+ name: "pve6",+ customUrl: "javascript:alert(document.domain)",+ canonicalIdentity: {+ ...offlineNode.canonicalIdentity,+ displayName: "Unsafe Link Node",+ hostname: "pve6",+ },+ proxmox: {+ ...offlineNode.proxmox,+ nodeName: "pve6",+ host: "https://pve6:8006",+ },+};+async function routeOfflineProxmoxInventory(page: Page) {// The browser assertion owns presentation, while the Go lifecycle tests own// membership reconciliation. Suppress live websocket inventory here and@@ -56,8 +73,8 @@ async function routeOfflineProxmoxInventory(page: Page) {status: 200,contentType: "application/json",body: JSON.stringify({- data: [offlineNode],- meta: { page: 1, limit: 100, total: 1, totalPages: 1 },+ data: [offlineNode, unsafeUrlNode],+ meta: { page: 1, limit: 100, total: 2, totalPages: 1 },links: { next: null },}),});@@ -99,6 +116,13 @@ test.describe("Offline Proxmox node visibility", () => {test("keeps an offline Proxmox node visible on desktop and mobile surfaces", async ({page,}) => {+ await page.context().route("https://pve5:8006/**", async (route) => {+ await route.fulfill({+ status: 200,+ contentType: "text/html",+ body: "<title>Proxmox VE</title>",+ });+ });await routeOfflineProxmoxInventory(page);await page.goto("/proxmox", { waitUntil: "domcontentloaded" });await expect(page.getByTestId("proxmox-page")).toBeVisible();@@ -116,11 +140,59 @@ test.describe("Offline Proxmox node visibility", () => {await expect(offlineRow).toContainText("—");await expect(offlineRow).not.toContainText("71°C");await expect(offlineRow).not.toContainText("28d 0h");+ const webInterfaceLink = offlineRow.getByRole("link", {+ name: "Open web interface for Disaster Recovery B",+ });+ await expect(webInterfaceLink).toBeVisible();+ await expect(webInterfaceLink).toHaveAttribute("href", "https://pve5:8006");+ await expect(webInterfaceLink).toHaveAttribute("target", "_blank");+ await expect(webInterfaceLink).toHaveAttribute(+ "rel",+ "noopener noreferrer",+ );++ const linkBox = await webInterfaceLink.boundingBox();+ expect(+ linkBox,+ "Web-interface control should have a measurable hit target",+ ).not.toBeNull();+ expect(linkBox!.width).toBeGreaterThanOrEqual(24);+ expect(linkBox!.height).toBeGreaterThanOrEqual(24);++ // Opening the adjacent control must not bubble into the selectable row.+ await expect(offlineRow).toHaveAttribute("aria-expanded", "false");+ const popupPromise = page.context().waitForEvent("page");+ await webInterfaceLink.click();+ const popup = await popupPromise;+ await popup.waitForLoadState("domcontentloaded");+ expect(popup.url()).toBe("https://pve5:8006/");+ await popup.close();+ await expect(offlineRow).toHaveAttribute("aria-expanded", "false");++ const viewportContainment = await page.evaluate(() => ({+ clientWidth: document.documentElement.clientWidth,+ scrollWidth: document.documentElement.scrollWidth,+ }));+ expect(viewportContainment.scrollWidth).toBeLessThanOrEqual(+ viewportContainment.clientWidth + 1,+ );++ const unsafeRow = page+ .locator('[data-testid="proxmox-page"] tr')+ .filter({ hasText: "Unsafe Link Node" })+ .first();+ await expect(unsafeRow).toBeVisible();await expect(- offlineRow.getByRole("link", {- name: "Open web interface for Disaster Recovery B",+ unsafeRow.getByRole("img", {+ name: "Web interface URL for Unsafe Link Node is invalid",}),).toBeVisible();+ await expect(+ unsafeRow.getByRole("link", {+ name: "Open web interface for Unsafe Link Node",+ }),+ ).toHaveCount(0);+await expect(offlineRow.getByRole("button", {name: "Expand details for Disaster Recovery B",