Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

refactor(truenas): canonicalize frontend system resources

rcourtman2812abcfa339
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 5ace94203b..0f858d3918 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -215,6 +215,12 @@ management, and fleet control surfaces.
available for optional later agent augmentation on TrueNAS, but first-run
copy, alternative CTAs, and install-profile lists must not imply that an
agent install is the required bootstrap for TrueNAS support in Pulse.
+11. Keep first-session and lifecycle-adjacent frontend resource handling on the
+ canonical unified-resource boundary. Top-level TrueNAS appliances may reach
+ setup-completion or infrastructure lifecycle surfaces only as canonical
+ `agent` resources with `platformType: 'truenas'`; any legacy raw
+ `resource.type === 'truenas'` compatibility collapse belongs in the shared
+ frontend resource adapters, not in setup or lifecycle-local UI branching.
## Current State
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index f1d359b8dc..fb4666c3ec 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -219,6 +219,11 @@ override toggles now route through
while powered-off/connectivity state transitions plus alert-removal side
effects now route through
`frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsAvailabilityMutations.ts`.
+That same thresholds host-data boundary now treats top-level TrueNAS appliances
+as canonical `agent` resources with `platformType: 'truenas'`. System-disk
+group headers must use agent-owned header metadata instead of guest/node-
+friendly header metadata, so appliance labels like `TrueNAS Main` do not
+collapse to vendor-only `TrueNAS` inside thresholds or override surfaces.
The thresholds tab adapter contract now lives in
`frontend-modern/src/features/alerts/thresholds/thresholdsTabModel.ts`, so
`frontend-modern/src/features/alerts/tabs/ThresholdsTab.tsx` stays a shell
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index fce6fca536..d547aac258 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -172,6 +172,12 @@ Own canonical runtime payload shapes between backend and frontend.
20. Keep hosted billing-state quickstart payload fields on the shared API contract: `internal/api/hosted_entitlement_refresh.go`, `internal/api/subscription_state_handlers.go`, and `internal/api/contract_test.go` must preserve `quickstart_credits_granted`, `quickstart_credits_used`, and `quickstart_credits_granted_at` through hosted signup, hosted lease refresh, and billing-state reads instead of letting lease rewrites silently erase seeded quickstart inventory.
21. Keep hosted AI settings bootstrap on the shared API contract: `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handlers.go`, `internal/api/ai_handler.go`, and `internal/api/contract_test.go` must treat a missing `ai.enc` in hosted mode as a canonical bootstrap condition, persist one machine-owned quickstart-backed AI config when hosted entitlements grant AI capability, and preserve that configured settings payload as the same public contract that Chat, Patrol, and AI Settings consume.
22. Keep post-boot AI enablement contract-backed on the shared AI/mobile approval surface: `internal/api/ai_handler.go`, `internal/api/ai_handlers.go`, `internal/api/router_routes_ai_relay.go`, and `internal/api/contract_test.go` must turn the governed approvals-list API into the canonical empty-list payload as soon as settings-driven AI enablement succeeds, rather than leaving that surface on `503 Approval store not initialized` until some separate startup-only side effect happens.
+23. Keep legacy top-level TrueNAS compatibility on the shared frontend resource
+ adapters only. Frontend API consumers may accept a raw `truenas` payload
+ only through shared compatibility normalization that rewrites it to a
+ canonical `agent` resource with `platformType: 'truenas'`; API-backed
+ settings surfaces such as token management must not branch on
+ `resource.type === 'truenas'` as a second runtime contract.
## Forbidden Paths
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 304e80a952..008016958d 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -218,19 +218,24 @@ work extends shared components instead of creating new local variants.
destination chips to render, but canonical href, label, dedupe, and
infrastructure-fallback truth must stay in
`frontend-modern/src/routing/resourceLinks.ts` instead of freezing raw
-14. Keep shared feature-shell Patrol run fixtures on the canonical run-record
+ route strings or provider-local link builders inside feature panels.
+14. Keep shared infrastructure/resource selectors on the canonical agent-facet
+ truth. Shared primitives and settings-facing selector helpers must treat
+ top-level TrueNAS appliances as agent-facet infrastructure via shared
+ helper ownership instead of reviving a direct `resource.type === 'truenas'`
+ branch inside page shells, selectors, or reporting-resource type helpers.
+15. Keep shared feature-shell Patrol run fixtures on the canonical run-record
contract. When `frontend-modern/src/features/patrol/` consumes Patrol run
history, the shared normalized record must preserve provider-backed counts
such as `truenas_checked` instead of letting feature-local fixtures or
fallback objects collapse API-backed TrueNAS systems back into generic
agent-host presentation.
- route strings or provider-local link builders inside feature panels.
-14. Keep the authenticated app root aligned with that same first-session path.
+16. Keep the authenticated app root aligned with that same first-session path.
`frontend-modern/src/App.tsx` must land `/` on the dashboard shell and let
the governed dashboard empty state route first-time operators into
Infrastructure Install, instead of preserving a separate root-only jump to
`/infrastructure` that drifts from the rest of the onboarding contract.
-15. Keep relay settings shell copy on the shared presentation owner in
+17. Keep relay settings shell copy on the shared presentation owner in
`frontend-modern/src/utils/relayPresentation.ts`. The route metadata in
`settingsHeaderMeta.ts` and the leading `SettingsPanel` in
`RelaySettingsPanel.tsx` must reuse the same description and availability
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index f9213985f0..b0eb94f32b 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -192,6 +192,12 @@ The dashboard workload selector path and the dashboard runtime that consumes it
are now part of the protected performance surface rather than proof-only
context. Future hot-path filter/group/sort/windowing changes must route through
the explicit dashboard performance proof policy in the subsystem registry.
+That same hot-path rule now applies to infrastructure summary resource
+filtering: `frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts`
+must include API-backed systems such as top-level TrueNAS appliances through
+the shared `isAgentFacetInfrastructureResource(...)` helper instead of a local
+`resource.type` branch, so the summary poll/cache path stays on one canonical
+infrastructure selector contract.
That same dashboard shell boundary also owns empty-state action routing in
`frontend-modern/src/components/Dashboard/DashboardStateCards.tsx`. When the
dashboard has no connected infrastructure, the CTA must hand operators
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 8cb934c521..0ba98cc192 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -119,6 +119,12 @@ That shared token-management boundary now also includes
`frontend-modern/src/utils/apiTokenPresentation.ts`, so API-token load,
generate, and revoke errors stay on one governed customer-facing wording path
instead of drifting back into hook-local notification strings.
+That same token-management boundary must also treat top-level TrueNAS
+appliances as canonical agent-scope resources through the shared agent-facet
+helper. Security surfaces may consume compatibility-normalized
+`platformType: 'truenas'` resources, but they must not reintroduce a separate
+`resource.type === 'truenas'` trust path when calculating token usage,
+revocation targets, or operator-facing token ownership.
Telemetry/privacy disclosures now also route through the shipped frontend docs
boundary: `frontend-modern/src/utils/docsLinks.ts` is the canonical frontend
owner for privacy-document URLs, while `frontend-modern/public/docs/PRIVACY.md`
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 9bd22a8b72..4d3fa2228f 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -144,6 +144,12 @@ they do not own the timeline store itself. The canonical resource-change
history now lives in `internal/unifiedresources/store.go` and is surfaced
through the shared API/resource wiring, which keeps storage and recovery focused
on presentation and query shape rather than re-implementing change persistence.
+That same shared-resource dependency now also assumes frontend compatibility
+normalization collapses any legacy top-level `truenas` payload into canonical
+`agent` plus `platformType: 'truenas'` before shared route or filter logic
+runs. Storage and recovery links may consume that normalized platform truth,
+but they must not preserve a second top-level `truenas` type contract in
+storage/recovery-local route, handoff, or filter code.
That same storage ownership also includes the shared storage-source presentation
contract in `frontend-modern/src/utils/storageSources.ts`: storage pages and
cross-surface storage links must reuse one canonical ordering, label, tone, and
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 302db15ec4..2c7eb713f5 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -195,6 +195,11 @@ provider-local host surface. API-backed `reporting.realtime` telemetry must
project onto that same canonical `agent` contract as live metrics and metrics
targets, using the shared `agent:<id>` in-memory key and `agent` history store
path instead of adding a TrueNAS-only host history lane.
+That same rule applies at the frontend boundary. Shared compatibility adapters
+such as `frontend-modern/src/hooks/useUnifiedResources.ts` and
+`frontend-modern/src/utils/resourceTypeCompat.ts` must collapse any legacy raw
+`truenas` top-level type payloads back onto canonical `agent` before route
+helpers, dashboard summaries, alert context, or selector models consume them.
API-backed TrueNAS CPU temperature now follows that same canonical host rule.
TrueNAS system records must project `cputemp` readings into the shared
`agent.temperature` and `agent.sensors.temperatureCelsius` fields instead of
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index 5e4d9586e7..a94195d769 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -25,6 +25,7 @@ import type { Resource } from '@/types/resource';
import { isAppContainerDiscoveryResourceType } from '@/utils/discoveryTarget';
import {
getActionableAgentIdFromResource,
+ isAgentFacetInfrastructureResource,
hasAgentFacet as resourceHasAgentFacet,
} from '@/utils/agentResources';
import { normalizeChatMentionKeyPart } from '@/utils/chatIdentifiers';
@@ -453,13 +454,8 @@ export const AIChat: Component<AIChatProps> = (props) => {
const containers = [...byType('system-container'), ...byType('oci-container')];
const dockerHosts = byType('docker-host');
const appContainers = byType('app-container');
- const agentResources = allResources().filter(
- (resource) =>
- (resource.type === 'agent' ||
- resource.type === 'pbs' ||
- resource.type === 'pmg' ||
- resource.type === 'truenas') &&
- hasAgentFacet(resource),
+ const agentResources = allResources().filter((resource) =>
+ isAgentFacetInfrastructureResource(resource),
);
const mentionCandidates: MentionResource[] = [];
diff --git a/frontend-modern/src/components/Alerts/ThresholdsTableAgentDisksSection.tsx b/frontend-modern/src/components/Alerts/ThresholdsTableAgentDisksSection.tsx
index cac784f4ff..5f893b086e 100644
--- a/frontend-modern/src/components/Alerts/ThresholdsTableAgentDisksSection.tsx
+++ b/frontend-modern/src/components/Alerts/ThresholdsTableAgentDisksSection.tsx
@@ -25,7 +25,7 @@ export function ThresholdsTableAgentDisksSection(props: ThresholdsTableSectionPr
<ResourceTable
title=""
groupedResources={state.agentDisksGroupedByAgent()}
- groupHeaderMeta={state.guestGroupHeaderMeta()}
+ groupHeaderMeta={state.agentGroupHeaderMeta()}
columns={['Disk %']}
activeAlerts={tableProps.activeAlerts}
emptyMessage={state.AGENT_DISKS_FILTER_EMPTY_STATE}
diff --git a/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx b/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx
index 5a0d6dd150..5c3797570d 100644
--- a/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx
+++ b/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx
@@ -375,11 +375,12 @@ describe('ThresholdsTable Resource Rendering', () => {
setPathname('/alerts/thresholds/systems');
const truenasSystem = {
id: 'truenas-resource',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
status: 'online',
lastSeen: 123,
+ platformType: 'truenas',
platformData: {
agent: {
agentId: 'truenas-main',
@@ -394,6 +395,7 @@ describe('ThresholdsTable Resource Rendering', () => {
expect(screen.getByTestId('resource-name-truenas-main')).toHaveTextContent('TrueNAS Main');
});
+ expect(screen.getByTestId('group-header-0')).toHaveTextContent('TrueNAS Main');
expect(
screen.getByTestId('resource-row-agent:truenas-main/disk:mnt-tank'),
).toBeInTheDocument();
@@ -572,7 +574,7 @@ describe('ThresholdsTable Resource Rendering', () => {
setPathname('/alerts/thresholds/containers');
const truenasRuntime = {
id: 'truenas-resource',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
diff --git a/frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx
index e3142c486c..6f46c03884 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx
+++ b/frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx
@@ -397,6 +397,7 @@ describe('DashboardFilter', () => {
]);
expect(screen.getByLabelText('Platform')).toHaveValue('truenas');
+ expect(screen.getByRole('option', { name: 'TrueNAS' })).toBeInTheDocument();
});
});
diff --git a/frontend-modern/src/components/Dashboard/__tests__/DashboardPanels.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/DashboardPanels.test.tsx
index a0aa0c672a..7c74fd26a7 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/DashboardPanels.test.tsx
+++ b/frontend-modern/src/components/Dashboard/__tests__/DashboardPanels.test.tsx
@@ -55,9 +55,10 @@ describe('Dashboard panels data contract', () => {
}),
createResource({
id: 'infra-5',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-epsilon',
displayName: 'TrueNAS Epsilon',
+ platformType: 'truenas',
status: 'degraded',
cpu: { current: 65 },
}),
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
index c23ab5e367..9950b92444 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
@@ -147,7 +147,7 @@ describe('resourceDetailDrawerOperationalModel', () => {
buildRelatedLinks(
baseResource({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
platformId: 'truenas-main',
platformType: 'truenas',
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/workloadsLink.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/workloadsLink.test.ts
index c5be2c012f..53581fa9f1 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/workloadsLink.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/workloadsLink.test.ts
@@ -361,7 +361,7 @@ describe('buildWorkloadsHref', () => {
it('routes top-level truenas resources to platform-scoped app workloads', () => {
const resource = makeResource({
- type: 'truenas',
+ type: 'agent',
platformType: 'truenas',
name: 'truenas-main',
});
@@ -376,14 +376,8 @@ describe('buildWorkloadsHref', () => {
describe('unsupported resource types', () => {
it.each([
- 'vm',
'container',
- 'system-container',
- 'app-container',
'docker-container',
- 'oci-container',
- 'pod',
- 'jail',
'docker-service',
'k8s-deployment',
'k8s-service',
diff --git a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts b/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
index 61da9d277e..2c772dbe5a 100644
--- a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
+++ b/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
@@ -5,7 +5,7 @@ import {
fetchInfrastructureSummaryAndCache,
readInfrastructureSummaryCache,
} from '@/utils/infrastructureSummaryCache';
-import { hasAgentFacet } from '@/utils/agentResources';
+import { isAgentFacetInfrastructureResource } from '@/utils/agentResources';
import { getOrgID } from '@/utils/apiClient';
import { normalizeOrgScope } from '@/utils/orgScope';
import { eventBus } from '@/stores/events';
@@ -65,14 +65,7 @@ export function useInfrastructureSummaryState(props: InfrastructureSummaryProps)
const { workloads, resources } = useResources();
const agentResources = createMemo(() =>
- resources().filter(
- (resource) =>
- (resource.type === 'agent' ||
- resource.type === 'pbs' ||
- resource.type === 'pmg' ||
- resource.type === 'truenas') &&
- hasAgentFacet(resource),
- ),
+ resources().filter((resource) => isAgentFacetInfrastructureResource(resource)),
);
const [orgVersion, setOrgVersion] = createSignal(0);
diff --git a/frontend-modern/src/components/Settings/__tests__/ResourcePicker.test.tsx b/frontend-modern/src/components/Settings/__tests__/ResourcePicker.test.tsx
index 575caf48a0..d3825e52de 100644
--- a/frontend-modern/src/components/Settings/__tests__/ResourcePicker.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ResourcePicker.test.tsx
@@ -84,14 +84,20 @@ describe('ResourcePicker', () => {
status: 'online',
}),
makeResource({ id: 'vm-1', type: 'vm', name: 'Alpha VM', displayName: 'Alpha VM' }),
- makeResource({ id: 'truenas-1', type: 'truenas', name: 'TrueNAS', displayName: 'TrueNAS' }),
+ makeResource({
+ id: 'truenas-1',
+ type: 'agent',
+ name: 'TrueNAS',
+ displayName: 'TrueNAS',
+ platformType: 'truenas',
+ }),
];
renderPicker();
expect(await screen.findByText('Node One')).toBeInTheDocument();
expect(screen.getByText('Alpha VM')).toBeInTheDocument();
- expect(screen.queryByText('TrueNAS')).not.toBeInTheDocument();
+ expect(screen.getByText('TrueNAS')).toBeInTheDocument();
});
it('renders governed resources with the safe display label', async () => {
diff --git a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts
index 8af0c98a11..f4df3eb969 100644
--- a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts
@@ -291,7 +291,7 @@ describe('monitored-system model guardrails', () => {
expect(apiTokenManagerModelSource).toContain("resource.type === 'agent'");
expect(apiTokenManagerModelSource).toContain("resource.type === 'pbs'");
expect(apiTokenManagerModelSource).toContain("resource.type === 'pmg'");
- expect(apiTokenManagerModelSource).toContain("resource.type === 'truenas'");
+ expect(apiTokenManagerModelSource).not.toContain("resource.type === 'truenas'");
expect(apiTokenManagerModelSource).toContain('resourceHasAgentFacet(resource)');
expect(apiTokenManagerModelSource).toContain(
'getActionableDockerRuntimeIdFromResource(resource)',
@@ -328,7 +328,9 @@ describe('monitored-system model guardrails', () => {
expect(infrastructureOperationsSource).toContain('@/utils/agentCapabilityPresentation');
expect(infrastructureOperationsSource).not.toContain('const getCapabilityLabel =');
expect(infrastructureOperationsSource).not.toContain('const getCapabilityBadgeClass =');
- expect(agentCapabilityPresentationSource).toContain("export type AgentCapability = 'agent'");
+ expect(agentCapabilityPresentationSource).toContain('export type AgentCapability =');
+ expect(agentCapabilityPresentationSource).toContain("| 'agent'");
+ expect(agentCapabilityPresentationSource).toContain("| 'truenas'");
expect(agentCapabilityPresentationSource).toContain('export function getAgentCapabilityLabel');
expect(agentCapabilityPresentationSource).toContain(
'export function getAgentCapabilityBadgeClass',
@@ -476,7 +478,7 @@ describe('monitored-system model guardrails', () => {
'Security configured. Save these first-run credentials now.',
);
expect(infrastructureInstallerSectionSource).toContain(
- 'Generate a scoped install token below before copying agent commands.',
+ 'Pulse generated the first scoped install token automatically. The install commands below are ready for the first host.',
);
expect(setupCompletionPanelSource).toContain('@/utils/relayPresentation');
expect(setupCompletionPanelSource).toContain('RELAY_ONBOARDING_SETUP_LABEL');
@@ -669,7 +671,8 @@ describe('monitored-system model guardrails', () => {
expect(patrolIntelligenceStateSource).toContain('updatePatrolAutonomySettings');
expect(patrolIntelligenceHeaderSource).toContain('buildPatrolScheduleOptions');
expect(patrolIntelligenceHeaderSource).toContain('getAIQuickstartCreditsPresentation');
- expect(patrolIntelligenceSummarySource).toContain('PATROL_NO_ISSUES_LABEL');
+ expect(patrolIntelligenceSummarySource).toContain('getPatrolAssessmentPresentation');
+ expect(patrolIntelligenceSummarySource).toContain('getPatrolSummaryMetricState');
expect(patrolIntelligenceSummarySource).toContain('getPatrolSummaryPresentation');
expect(patrolIntelligenceWorkspaceSource).toContain('ApprovalBanner');
expect(patrolIntelligenceWorkspaceSource).toContain('FindingsPanel');
@@ -917,7 +920,7 @@ describe('monitored-system model guardrails', () => {
"import { useThresholdsData } from './useThresholdsData';",
);
expect(thresholdsDataHookSource).toContain('useThresholdsHostData');
- expect(thresholdsHostDataHookSource).toContain("resourceType: 'Agent Disk'");
+ expect(thresholdsHostDataHookSource).toContain("resourceType: 'System Disk'");
expect(thresholdsHostDataHookSource).not.toContain("resourceType: 'Host Disk'");
expect(thresholdsHostDataHookSource).toContain('props.agentDefaults');
expect(thresholdsTableAgentsResourcesSectionSource).toContain('disableAllAgents');
@@ -945,7 +948,7 @@ describe('monitored-system model guardrails', () => {
expect(infrastructureSelectorSource).not.toContain("resource.type === 'truenas'");
expect(infrastructureSelectorStateSource).toContain('useResources');
expect(infrastructureSelectorModelSource).toContain('hasInfrastructureSelectorAgentFacet');
- expect(infrastructureSelectorModelSource).toContain("resource.type === 'truenas'");
+ expect(infrastructureSelectorModelSource).toContain('isAgentFacetInfrastructureResource');
expect(infrastructureSelectorModelSource).not.toContain('if (hostLikeResources.length === 0');
expect(guestRowCellsSource).toContain('getDashboardGuestBackupStatusPresentation');
expect(guestRowCellsSource).toContain('getDashboardGuestBackupTooltip');
@@ -988,7 +991,8 @@ describe('monitored-system model guardrails', () => {
it('keeps AI chat mention resources aware of agent facets beyond host type', () => {
expect(aiChatSource).toContain('const hasAgentFacet = (resource: Resource): boolean =>');
- expect(aiChatSource).toContain("resource.type === 'truenas'");
+ expect(aiChatSource).toContain('isAgentFacetInfrastructureResource');
+ expect(aiChatSource).not.toContain("resource.type === 'truenas'");
expect(aiChatSource).not.toContain("resource.type === 'host'");
expect(aiChatSource).toContain("type: 'agent'");
expect(aiChatSource).not.toContain("mention.type === 'agent'");
@@ -1033,9 +1037,8 @@ describe('monitored-system model guardrails', () => {
it('keeps dashboard and recovery type presentation on shared canonical helpers', () => {
expect(problemResourcesTableSource).toContain('getResourceTypeLabel(pr.resource.type)');
expect(problemResourcesTableSource).not.toContain('function formatType(');
- expect(recoveryTablePresentationSource).toContain(
- 'getResourceTypePresentation(normalizeRecoverySubjectTypeKey(raw))',
- );
+ expect(recoveryTablePresentationSource).toContain('getRecoveryItemTypeBadgeClass');
+ expect(recoveryTablePresentationSource).toContain('getRecoveryItemTypeLabel');
expect(recoverySource).not.toContain('SUBJECT_TYPE_LABELS');
expect(resourceBadgesSource).toContain('@/utils/resourceBadgePresentation');
expect(resourceBadgePresentationSource).toContain('getResourceTypePresentation');
@@ -1293,7 +1296,7 @@ describe('monitored-system model guardrails', () => {
"if (path.includes('/thresholds/containers')) return 'docker';",
);
expect(thresholdsTableStateSource).toContain('/thresholds/agents');
- expect(thresholdsHostDataHookSource).toContain("resourceType: 'Agent Disk'");
+ expect(thresholdsHostDataHookSource).toContain("resourceType: 'System Disk'");
expect(thresholdsTableStateSource).toContain('getAlertThresholdsSectionTitles');
expect(thresholdsTableAgentDisksSectionSource).toContain(
'title={state.sectionTitles.agentDisks}',
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 9e5200f338..7034bc10bb 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -1018,6 +1018,8 @@ describe('Settings architecture guardrails', () => {
expect(apiTokenManagerModelSource).toContain('export const hasAgentScopeResource =');
expect(apiTokenManagerModelSource).toContain('export const buildDockerTokenUsage =');
expect(apiTokenManagerModelSource).toContain('export const buildAgentTokenUsage =');
+ expect(apiTokenManagerModelSource).toContain('resourceHasAgentFacet(resource)');
+ expect(apiTokenManagerModelSource).not.toContain("resource.type === 'truenas'");
expect(apiTokenManagerModelSource).toContain(
'export const getAPITokenScopePresets = (): APITokenPreset[] => [',
);
diff --git a/frontend-modern/src/components/Settings/apiTokenManagerModel.ts b/frontend-modern/src/components/Settings/apiTokenManagerModel.ts
index 5029540a9e..ff67b72455 100644
--- a/frontend-modern/src/components/Settings/apiTokenManagerModel.ts
+++ b/frontend-modern/src/components/Settings/apiTokenManagerModel.ts
@@ -78,7 +78,6 @@ export const hasAgentScopeResource = (resource: Resource): boolean => {
resource.type === 'agent' ||
resource.type === 'pbs' ||
resource.type === 'pmg' ||
- resource.type === 'truenas' ||
resourceHasAgentFacet(resource)
);
};
diff --git a/frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx b/frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx
index c6378f611b..98236f78d5 100644
--- a/frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx
+++ b/frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx
@@ -18,6 +18,7 @@ import type { Resource } from '@/types/resource';
import { showSuccess, showError } from '@/utils/toast';
import {
getActionableAgentIdFromResource,
+ isAgentFacetInfrastructureResource,
hasAgentFacet as resourceHasAgentFacet,
} from '@/utils/agentResources';
import {
@@ -149,13 +150,8 @@ export const SetupCompletionPanel: Component<CompleteStepProps> = (props) => {
});
const resources = state.resources || [];
const nodeResources = resources.filter((resource) => resource.type === 'agent');
- const agentFacetResources = resources.filter(
- (resource) =>
- (resource.type === 'agent' ||
- resource.type === 'pbs' ||
- resource.type === 'pmg' ||
- resource.type === 'truenas') &&
- hasAgentFacet(resource),
+ const agentFacetResources = resources.filter((resource) =>
+ isAgentFacetInfrastructureResource(resource),
);
const nodes = nodeResources.map(toNodeSummaryShape);
diff --git a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.guardrails.test.ts b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.guardrails.test.ts
index aae99ed7ef..608d37ae29 100644
--- a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.guardrails.test.ts
+++ b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.guardrails.test.ts
@@ -50,7 +50,9 @@ describe('SetupCompletionPanel guardrails', () => {
});
it('keeps connected infrastructure labels on the canonical local identity helper', () => {
+ expect(setupCompletionPanelSource).toContain('isAgentFacetInfrastructureResource');
expect(setupCompletionPanelSource).toContain('getPreferredInfrastructureDisplayName');
+ expect(setupCompletionPanelSource).not.toContain("resource.type === 'truenas'");
expect(setupCompletionPanelSource).not.toContain('getPreferredResourceDisplayName(resource)');
});
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 356b1ac7e6..1ceedcd293 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -502,7 +502,7 @@ describe('shared primitive guardrails', () => {
expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorAgents');
expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorBackupCounts');
expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorUnifiedNodes');
- expect(infrastructureSelectorModelSource).toContain("resource.type === 'truenas'");
+ expect(infrastructureSelectorModelSource).toContain('isAgentFacetInfrastructureResource');
});
it('keeps interactive sparkline on shell, runtime, and model owners', () => {
diff --git a/frontend-modern/src/components/shared/__tests__/InfrastructureSelector.test.tsx b/frontend-modern/src/components/shared/__tests__/InfrastructureSelector.test.tsx
index bf52faa767..0436af8888 100644
--- a/frontend-modern/src/components/shared/__tests__/InfrastructureSelector.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/InfrastructureSelector.test.tsx
@@ -90,7 +90,7 @@ describe('InfrastructureSelector', () => {
expect(infrastructureSelectorModelSource).toContain(
'buildInfrastructureSelectorUnifiedNodes',
);
- expect(infrastructureSelectorModelSource).toContain("resource.type === 'truenas'");
+ expect(infrastructureSelectorModelSource).toContain('isAgentFacetInfrastructureResource');
});
it('toggles node selection and clears it on escape', async () => {
diff --git a/frontend-modern/src/components/shared/infrastructureSelectorModel.ts b/frontend-modern/src/components/shared/infrastructureSelectorModel.ts
index 9fcd3804fa..2b03954982 100644
--- a/frontend-modern/src/components/shared/infrastructureSelectorModel.ts
+++ b/frontend-modern/src/components/shared/infrastructureSelectorModel.ts
@@ -8,6 +8,7 @@ import {
} from '@/utils/resourceIdentity';
import {
getActionableAgentIdFromResource,
+ isAgentFacetInfrastructureResource,
hasAgentFacet as resourceHasAgentFacet,
} from '@/utils/agentResources';
@@ -63,13 +64,8 @@ export function buildInfrastructureSelectorCounts(
}
export function buildInfrastructureSelectorAgents(resources: Resource[]): Agent[] {
- const agentFacetResources = resources.filter(
- (resource) =>
- (resource.type === 'agent' ||
- resource.type === 'pbs' ||
- resource.type === 'pmg' ||
- resource.type === 'truenas') &&
- hasInfrastructureSelectorAgentFacet(resource),
+ const agentFacetResources = resources.filter((resource) =>
+ isAgentFacetInfrastructureResource(resource),
);
const agentsById = new Map<string, Agent>();
diff --git a/frontend-modern/src/features/alerts/__tests__/AlertResourceIncidentsPanel.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertResourceIncidentsPanel.test.tsx
index 7fa65d76f7..a97b5cfb6a 100644
--- a/frontend-modern/src/features/alerts/__tests__/AlertResourceIncidentsPanel.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/AlertResourceIncidentsPanel.test.tsx
@@ -46,7 +46,7 @@ describe('AlertResourceIncidentsPanel', () => {
resourceId === 'truenas-main'
? ({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
diff --git a/frontend-modern/src/features/alerts/__tests__/alertOverridesModel.test.ts b/frontend-modern/src/features/alerts/__tests__/alertOverridesModel.test.ts
index 4d935e71f9..4fc5be0ce0 100644
--- a/frontend-modern/src/features/alerts/__tests__/alertOverridesModel.test.ts
+++ b/frontend-modern/src/features/alerts/__tests__/alertOverridesModel.test.ts
@@ -77,8 +77,9 @@ describe('alertOverridesModel', () => {
it('derives canonical container runtimes from explicit docker hosts and TrueNAS app parents', () => {
const truenas = makeResource({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
+ platformType: 'truenas',
});
const dockerHost = makeResource({
id: 'docker-main',
@@ -103,9 +104,10 @@ describe('alertOverridesModel', () => {
it('projects TrueNAS app overrides through the canonical container runtime surface', () => {
const truenas = makeResource({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
+ platformType: 'truenas',
});
const app = makeResource({
id: 'ix-nextcloud',
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx
index fa49b5d277..4b2de24656 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx
@@ -121,7 +121,8 @@ describe('useAlertOverridesState', () => {
id: 'truenas-main',
name: 'truenas-main',
displayName: 'TrueNAS Main',
- type: 'truenas',
+ type: 'agent',
+ platformType: 'truenas',
platformData: {
agent: {
agentId: 'truenas-main',
@@ -150,7 +151,8 @@ describe('useAlertOverridesState', () => {
await waitFor(() => expect(result.containerRuntimeResources()).toHaveLength(1));
expect(result.containerRuntimeResources()[0]).toMatchObject({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
+ platformType: 'truenas',
});
});
});
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertsConfigurationState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertsConfigurationState.test.tsx
index 498e44d138..f09a43ec63 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertsConfigurationState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertsConfigurationState.test.tsx
@@ -8,7 +8,8 @@ const containerRuntimeResources = () =>
[
{
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
+ platformType: 'truenas',
},
] as any[];
@@ -81,7 +82,8 @@ describe('useAlertsConfigurationState', () => {
expect(result.containerRuntimeResources()).toEqual([
expect.objectContaining({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
+ platformType: 'truenas',
}),
]);
});
diff --git a/frontend-modern/src/features/alerts/alertOverridesModel.ts b/frontend-modern/src/features/alerts/alertOverridesModel.ts
index 767c7d6983..ce3b5af0a4 100644
--- a/frontend-modern/src/features/alerts/alertOverridesModel.ts
+++ b/frontend-modern/src/features/alerts/alertOverridesModel.ts
@@ -1,7 +1,7 @@
import type { PBSInstance } from '@/types/api';
import type { RawOverrideConfig } from '@/types/alerts';
import type { Resource } from '@/types/resource';
-import { getActionableAgentIdFromResource } from '@/utils/agentResources';
+import { getActionableAgentIdFromResource, isTrueNASSystemResource } from '@/utils/agentResources';
import { isAppContainerDiscoveryResourceType } from '@/utils/discoveryTarget';
import {
@@ -111,7 +111,7 @@ export const buildContainerRuntimeResources = ({
dockerHostResources.forEach(addRuntime);
allResources.forEach((resource) => {
- if (resource.type === 'truenas') {
+ if (isTrueNASSystemResource(resource)) {
addRuntime(resource);
}
});
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
index 89922ab2ef..9b5ae410c5 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
@@ -28,6 +28,7 @@ vi.mock('@/components/Alerts/Thresholds/hooks/useCollapsedSections', () => ({
vi.mock('../useThresholdsData', () => ({
useThresholdsData: () => ({
agentDisksGroupedByAgent: () => ({}),
+ agentGroupHeaderMeta: () => ({}),
agentDisksWithOverrides: () => [],
agentsWithOverrides: () => [],
dockerContainersFlat: () => [],
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts
index 3d0c7e0bf5..243b911be9 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts
@@ -2,10 +2,11 @@ import { createMemo } from 'solid-js';
import { getAlertResourceDisplayLabel } from '@/features/alerts/helpers';
-import type { Resource as TableResource } from '../tableTypes';
+import type { GroupHeaderMeta, Resource as TableResource } from '../tableTypes';
import { ThresholdsDataInputs } from '../thresholdsResourceModel';
import {
agentDiskResourceId,
+ buildAgentHeaderMeta,
createOverridesMap,
findOverrideByCandidates,
getFriendlyAlertNodeName,
@@ -268,10 +269,22 @@ export function useThresholdsHostData(inputs: ThresholdsDataInputs) {
return grouped;
});
+ const agentGroupHeaderMeta = createMemo<Record<string, GroupHeaderMeta>>(() => {
+ const meta: Record<string, GroupHeaderMeta> = {};
+ (props.agents ?? []).forEach((agent) => {
+ const { headerMeta, keys } = buildAgentHeaderMeta(agent);
+ keys.forEach((key: string) => {
+ meta[key] = headerMeta;
+ });
+ });
+ return meta;
+ });
+
return {
nodesWithOverrides,
agentsWithOverrides,
agentDisksWithOverrides,
agentDisksGroupedByAgent,
+ agentGroupHeaderMeta,
};
}
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
index 201f7d116f..efda2a03d5 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
@@ -198,6 +198,7 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {
agentsWithOverrides,
agentDisksWithOverrides,
agentDisksGroupedByAgent,
+ agentGroupHeaderMeta,
dockerHostsWithOverrides,
dockerContainersGroupedByHost,
dockerContainersFlat,
@@ -507,6 +508,7 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {
return {
activeTab,
agentDisksGroupedByAgent,
+ agentGroupHeaderMeta,
agentDisksWithOverrides,
agentsWithOverrides,
alertsEnabled,
diff --git a/frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts b/frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts
index ba7c4934f9..2bcc491b94 100644
--- a/frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts
+++ b/frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts
@@ -1,4 +1,5 @@
import { unwrap } from 'solid-js/store';
+import { getPreferredResourceHostname } from '@/utils/resourceIdentity';
import { requiresGovernedResourceDisplay } from '@/types/resource';
import type { Resource } from '@/types/resource';
@@ -195,6 +196,27 @@ export function buildNodeHeaderMeta(node: Resource) {
return { headerMeta, keys };
}
+export function buildAgentHeaderMeta(agent: Resource) {
+ const displayName = getAlertResourceDisplayLabel(agent);
+ const rawName = getPreferredResourceHostname(agent) || agent.name || agent.id;
+
+ const headerMeta: GroupHeaderMeta = {
+ type: 'agent',
+ displayName,
+ rawName,
+ status: agent.status,
+ };
+
+ const keys = new Set<string>();
+ [displayName, rawName, agent.id].forEach((value) => {
+ if (value && value.trim()) {
+ keys.add(value.trim());
+ }
+ });
+
+ return { headerMeta, keys };
+}
+
export const agentDiskResourceId = (agentId: string, mountpoint: string, device?: string): string => {
let label = (mountpoint?.trim() || device?.trim() || 'disk').toLowerCase();
label = label
diff --git a/frontend-modern/src/features/alerts/useAlertOverridesState.ts b/frontend-modern/src/features/alerts/useAlertOverridesState.ts
index 426707bd09..6ad77d7874 100644
--- a/frontend-modern/src/features/alerts/useAlertOverridesState.ts
+++ b/frontend-modern/src/features/alerts/useAlertOverridesState.ts
@@ -3,7 +3,7 @@ import { createEffect, createMemo, createSignal, type Accessor } from 'solid-js'
import type { PBSInstance, PMGInstance } from '@/types/api';
import type { RawOverrideConfig } from '@/types/alerts';
import type { Resource, ResourceType } from '@/types/resource';
-import { hasAgentFacet } from '@/utils/agentResources';
+import { isAgentFacetInfrastructureResource } from '@/utils/agentResources';
import { pbsInstanceFromResource, pmgInstanceFromResource } from '@/utils/resourceStateAdapters';
import {
@@ -45,14 +45,7 @@ export function useAlertOverridesState(props: AlertOverridesStateProps) {
);
const agentResources = createMemo(() =>
- props.allResources().filter(
- (resource) =>
- (resource.type === 'agent' ||
- resource.type === 'pbs' ||
- resource.type === 'pmg' ||
- resource.type === 'truenas') &&
- hasAgentFacet(resource),
- ),
+ props.allResources().filter((resource) => isAgentFacetInfrastructureResource(resource)),
);
const pbsInstances = createMemo<PBSInstance[]>(() =>
diff --git a/frontend-modern/src/hooks/__tests__/useDashboardOverview.test.ts b/frontend-modern/src/hooks/__tests__/useDashboardOverview.test.ts
index 610247a195..966dce835f 100644
--- a/frontend-modern/src/hooks/__tests__/useDashboardOverview.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useDashboardOverview.test.ts
@@ -113,8 +113,9 @@ describe('computeDashboardOverview', () => {
}),
createResource({
id: 'infra-5',
- type: 'truenas',
+ type: 'agent',
displayName: 'NAS 5',
+ platformType: 'truenas',
status: 'online',
cpu: { current: 70 },
memory: { current: 50 },
@@ -133,10 +134,9 @@ describe('computeDashboardOverview', () => {
expect(overview.infrastructure.total).toBe(6);
expect(overview.infrastructure.byType).toEqual({
- agent: 2,
+ agent: 3,
'k8s-node': 1,
'docker-host': 1,
- truenas: 1,
'k8s-cluster': 1,
});
expect(overview.infrastructure.byStatus.online).toBe(4);
diff --git a/frontend-modern/src/hooks/useDashboardTrends.ts b/frontend-modern/src/hooks/useDashboardTrends.ts
index 02633739a2..0c355ec427 100644
--- a/frontend-modern/src/hooks/useDashboardTrends.ts
+++ b/frontend-modern/src/hooks/useDashboardTrends.ts
@@ -11,7 +11,7 @@ import {
buildInfrastructureSummarySeries,
} from '@/components/Infrastructure/infrastructureSummaryModel';
import type { DashboardOverview } from '@/hooks/useDashboardOverview';
-import { hasAgentFacet } from '@/utils/agentResources';
+import { isAgentFacetInfrastructureResource } from '@/utils/agentResources';
import { fetchInfrastructureSummaryAndCache } from '@/utils/infrastructureSummaryCache';
import { isInfrastructure, isStorage, type Resource } from '@/types/resource';
@@ -133,13 +133,8 @@ async function fetchInfrastructureTrendSnapshot(
};
}
- const agentFacetResources = resources.filter(
- (resource) =>
- (resource.type === 'agent' ||
- resource.type === 'pbs' ||
- resource.type === 'pmg' ||
- resource.type === 'truenas') &&
- hasAgentFacet(resource),
+ const agentFacetResources = resources.filter((resource) =>
+ isAgentFacetInfrastructureResource(resource),
);
const { map, oldestDataTimestamp } = await fetchInfrastructureSummaryAndCache(
diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.ts
index 4e18aea3f3..824430e99d 100644
--- a/frontend-modern/src/hooks/useUnifiedResources.ts
+++ b/frontend-modern/src/hooks/useUnifiedResources.ts
@@ -433,7 +433,7 @@ const resolveType = (value?: string): ResourceType => {
case 'k8s-node':
return 'k8s-node';
case 'truenas':
- return 'truenas';
+ return 'agent';
case 'vm':
return 'vm';
case 'system-container':
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index b8953c9eca..1156a29462 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -178,7 +178,7 @@ describe('resource link routing contract', () => {
expect(
buildWorkloadsHrefForResource({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
@@ -309,7 +309,7 @@ describe('resource link routing contract', () => {
it('builds storage deep links for top-level TrueNAS systems', () => {
const href = buildStorageHrefForResource({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
@@ -344,7 +344,7 @@ describe('resource link routing contract', () => {
it('builds recovery deep links for top-level TrueNAS systems', () => {
const href = buildRecoveryHrefForResource({
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
@@ -381,7 +381,7 @@ describe('resource link routing contract', () => {
buildResourceSurfaceLinksForResource(
{
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts
index d719ae3db2..8115ca2ccc 100644
--- a/frontend-modern/src/routing/resourceLinks.ts
+++ b/frontend-modern/src/routing/resourceLinks.ts
@@ -15,6 +15,7 @@ import {
getActionableDockerRuntimeIdFromResource,
getPlatformDataRecord,
hasDockerWorkloadsScope,
+ isTrueNASSystemResource,
} from '@/utils/agentResources';
import {
getPreferredInfrastructureDisplayName,
@@ -314,11 +315,6 @@ export const buildWorkloadsHrefForResource = (resource: Resource): string | null
return buildWorkloadsPath({ type: 'app-container', platform: 'docker', agent });
}
- if (resource.type === 'truenas') {
- const agent = resolveHostHintForResource(resource);
- return buildWorkloadsPath({ type: 'app-container', platform: 'truenas', agent });
- }
-
if (resource.type === 'agent') {
const agent = resolveHostHintForResource(resource);
if (resource.platformType === 'truenas' || hasMergedSource(resource, 'truenas')) {
@@ -455,14 +451,14 @@ export const buildStorageHrefForResource = (resource: Resource): string | null =
});
}
- if (resource.type === 'truenas' || resource.type === 'pbs') {
+ if (resource.type === 'pbs') {
return buildStoragePath({
source,
node: resource.id,
});
}
- if (resource.type === 'agent' && source === 'truenas') {
+ if (isTrueNASSystemResource(resource)) {
return buildStoragePath({
source,
node: resource.id,
@@ -507,7 +503,7 @@ export const buildRecoveryHrefForResource = (resource: Resource): string | null
resource.storage?.platform || mergedPlatform || resource.platformType || resource.type,
);
- if (platform === 'truenas' && (resource.type === 'truenas' || resource.type === 'agent')) {
+ if (platform === 'truenas' && isTrueNASSystemResource(resource)) {
return buildRecoveryPath({
platform: 'truenas',
node: resource.id,
diff --git a/frontend-modern/src/types/__tests__/resource.test.ts b/frontend-modern/src/types/__tests__/resource.test.ts
index 1cfd7d35ad..01b2956e3a 100644
--- a/frontend-modern/src/types/__tests__/resource.test.ts
+++ b/frontend-modern/src/types/__tests__/resource.test.ts
@@ -34,7 +34,7 @@ function createResource(overrides: Partial<Resource> = {}): Resource {
describe('Resource Type Guards', () => {
describe('isInfrastructure', () => {
- const infrastructureTypes: ResourceType[] = ['agent', 'docker-host', 'k8s-node', 'truenas'];
+ const infrastructureTypes: ResourceType[] = ['agent', 'docker-host', 'k8s-node', 'k8s-cluster'];
const nonInfrastructureTypes: ResourceType[] = [
'vm',
'system-container',
@@ -262,7 +262,6 @@ describe('Resource Interface', () => {
'docker-host',
'k8s-cluster',
'k8s-node',
- 'truenas',
'vm',
'system-container',
'app-container',
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index 184077a8cf..d8b109c3d9 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -21,7 +21,6 @@ export type ResourceType =
| 'docker-host' // Docker/Podman host
| 'k8s-cluster' // Kubernetes cluster
| 'k8s-node' // Kubernetes node
- | 'truenas' // TrueNAS system
| 'vm' // Proxmox VM
| 'system-container' // System container (LXC, Incus, BSD jail)
| 'app-container' // Application container (Docker, Podman)
@@ -482,7 +481,7 @@ export interface Resource {
* Helper type guards
*/
export function isInfrastructure(r: Resource): boolean {
- return ['agent', 'docker-host', 'k8s-cluster', 'k8s-node', 'truenas'].includes(r.type);
+ return ['agent', 'docker-host', 'k8s-cluster', 'k8s-node'].includes(r.type);
}
export function isWorkload(r: Resource): boolean {
diff --git a/frontend-modern/src/utils/__tests__/agentResources.test.ts b/frontend-modern/src/utils/__tests__/agentResources.test.ts
index 5f5cefe0f3..c2693e4cf5 100644
--- a/frontend-modern/src/utils/__tests__/agentResources.test.ts
+++ b/frontend-modern/src/utils/__tests__/agentResources.test.ts
@@ -11,6 +11,7 @@ import {
hasAgentFacet,
isAgentFacetInfrastructureResource,
isAgentProfileAssignableResource,
+ isTrueNASSystemResource,
} from '@/utils/agentResources';
const makeResource = (overrides: Partial<Resource> = {}): Resource =>
@@ -311,4 +312,35 @@ describe('agentResources', () => {
),
).toBe(false);
});
+
+ it('recognizes canonical TrueNAS systems through agent typing and platform ownership', () => {
+ expect(
+ isTrueNASSystemResource(
+ makeResource({
+ type: 'agent',
+ platformType: 'truenas',
+ }),
+ ),
+ ).toBe(true);
+
+ expect(
+ isTrueNASSystemResource(
+ makeResource({
+ type: 'agent',
+ platformData: {
+ sources: ['agent', 'truenas'],
+ },
+ }),
+ ),
+ ).toBe(true);
+
+ expect(
+ isTrueNASSystemResource(
+ makeResource({
+ type: 'agent',
+ platformType: 'agent',
+ }),
+ ),
+ ).toBe(false);
+ });
});
diff --git a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
index 1efbfa5e02..3e5dba776c 100644
--- a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
@@ -543,7 +543,7 @@ describe('resourceIdentity', () => {
expect(
getPreferredWorkloadsAgentHint(
makeResource({
- type: 'truenas',
+ type: 'agent',
platformType: 'truenas',
id: 'truenas-id',
identity: { hostname: 'identity-host' },
diff --git a/frontend-modern/src/utils/__tests__/resourceTypeCompat.test.ts b/frontend-modern/src/utils/__tests__/resourceTypeCompat.test.ts
index b366c8f190..73f1785d58 100644
--- a/frontend-modern/src/utils/__tests__/resourceTypeCompat.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceTypeCompat.test.ts
@@ -10,6 +10,7 @@ describe('resourceTypeCompat', () => {
expect(canonicalizeFrontendResourceType('kubernetes')).toBe('pod');
expect(canonicalizeFrontendResourceType('kubernetes_cluster')).toBe('k8s-cluster');
expect(canonicalizeFrontendResourceType('kubernetes-node')).toBe('k8s-node');
+ expect(canonicalizeFrontendResourceType('truenas')).toBe('agent');
});
it('does not silently canonicalize removed non-canonical workload aliases', () => {
diff --git a/frontend-modern/src/utils/__tests__/resourceTypePresentation.test.ts b/frontend-modern/src/utils/__tests__/resourceTypePresentation.test.ts
index ce03ce4325..8feef688a1 100644
--- a/frontend-modern/src/utils/__tests__/resourceTypePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceTypePresentation.test.ts
@@ -8,7 +8,7 @@ describe('resourceTypePresentation', () => {
it('returns canonical labels for unified resource types', () => {
expect(getResourceTypeLabel('docker-host')).toBe('Container Runtime');
expect(getResourceTypeLabel('k8s-cluster')).toBe('K8s Cluster');
- expect(getResourceTypeLabel('truenas')).toBe('TrueNAS');
+ expect(getResourceTypeLabel('truenas')).toBe('Agent');
});
it('returns shared presentations for external recovery subject aliases', () => {
diff --git a/frontend-modern/src/utils/agentResources.ts b/frontend-modern/src/utils/agentResources.ts
index 559665088a..ee7a823138 100644
--- a/frontend-modern/src/utils/agentResources.ts
+++ b/frontend-modern/src/utils/agentResources.ts
@@ -4,15 +4,15 @@ import {
isAgentDiscoveryResourceType,
isAppContainerDiscoveryResourceType,
} from '@/utils/discoveryTarget';
+import { normalizeSourcePlatformKey } from '@/utils/sourcePlatforms';
import { asTrimmedString } from '@/utils/stringUtils';
-const AGENT_FACET_INFRASTRUCTURE_TYPES = new Set<ResourceType>(['agent', 'pbs', 'pmg', 'truenas']);
+const AGENT_FACET_INFRASTRUCTURE_TYPES = new Set<ResourceType>(['agent', 'pbs', 'pmg']);
const AGENT_PROFILE_ASSIGNABLE_TYPES = new Set<ResourceType>([
'docker-host',
'agent',
'pbs',
'pmg',
- 'truenas',
'k8s-cluster',
]);
@@ -58,9 +58,19 @@ type ResourceClusterNameLike = KubernetesContextLike & {
export const getPlatformDataRecord = (resource: Resource): Record<string, unknown> | undefined =>
resource.platformData ? (resource.platformData as Record<string, unknown>) : undefined;
+const hasPlatformSource = (resource: Resource, source: string): boolean => {
+ const sources = getPlatformDataRecord(resource)?.sources;
+ if (!Array.isArray(sources)) return false;
+ return sources.some((value) => normalizeSourcePlatformKey(value) === source);
+};
+
export const getPlatformAgentRecord = (resource: Resource): Record<string, unknown> | undefined =>
asRecord(getPlatformDataRecord(resource)?.agent);
+export const isTrueNASSystemResource = (resource: Resource): boolean =>
+ resource.type === 'agent' &&
+ (resource.platformType === 'truenas' || hasPlatformSource(resource, 'truenas'));
+
export const getExplicitAgentIdFromResource = (resource: Resource): string | undefined => {
const platformData = getPlatformDataRecord(resource);
const platformAgent = getPlatformAgentRecord(resource);
diff --git a/frontend-modern/src/utils/canonicalResourceTypes.ts b/frontend-modern/src/utils/canonicalResourceTypes.ts
index d47a0d7c55..5f1a3d4b48 100644
--- a/frontend-modern/src/utils/canonicalResourceTypes.ts
+++ b/frontend-modern/src/utils/canonicalResourceTypes.ts
@@ -5,7 +5,6 @@ export const CANONICAL_RESOURCE_TYPES = [
'docker-host',
'k8s-cluster',
'k8s-node',
- 'truenas',
'vm',
'system-container',
'app-container',
diff --git a/frontend-modern/src/utils/reportingResourceTypes.ts b/frontend-modern/src/utils/reportingResourceTypes.ts
index 383ec80498..547ef0364b 100644
--- a/frontend-modern/src/utils/reportingResourceTypes.ts
+++ b/frontend-modern/src/utils/reportingResourceTypes.ts
@@ -19,8 +19,6 @@ export type ReportingResourceType =
export function toReportingResourceType(resourceType: ResourceType): ReportingResourceType {
switch (resourceType) {
- case 'truenas':
- return 'agent';
case 'jail':
return 'system-container';
case 'docker-service':
diff --git a/frontend-modern/src/utils/resourceIdentity.ts b/frontend-modern/src/utils/resourceIdentity.ts
index affe51f870..538b7b02e4 100644
--- a/frontend-modern/src/utils/resourceIdentity.ts
+++ b/frontend-modern/src/utils/resourceIdentity.ts
@@ -12,6 +12,7 @@ import {
getActionableKubernetesClusterIdFromResource,
getPreferredResourceClusterName,
getPreferredResourceKubernetesContext,
+ isTrueNASSystemResource,
getPlatformAgentRecord,
getPlatformDataRecord,
} from '@/utils/agentResources';
@@ -374,7 +375,7 @@ export const getPreferredWorkloadsAgentHint = (resource: Resource): string | und
);
}
- if (resource.type === 'truenas') {
+ if (isTrueNASSystemResource(resource)) {
return (
asTrimmedString(truenas?.hostname) || getPreferredResourceHostname(resource) || resource.id
);
diff --git a/frontend-modern/src/utils/resourceTypeCompat.ts b/frontend-modern/src/utils/resourceTypeCompat.ts
index ce043bc9fd..351de1f965 100644
--- a/frontend-modern/src/utils/resourceTypeCompat.ts
+++ b/frontend-modern/src/utils/resourceTypeCompat.ts
@@ -30,6 +30,7 @@ export const canonicalizeFrontendResourceType = (
switch (normalized) {
case 'host':
case 'hosts':
+ case 'truenas':
return 'agent';
case 'docker':
return 'app-container';
diff --git a/frontend-modern/src/utils/resourceTypePresentation.ts b/frontend-modern/src/utils/resourceTypePresentation.ts
index f69470d8e5..6c0908fe94 100644
--- a/frontend-modern/src/utils/resourceTypePresentation.ts
+++ b/frontend-modern/src/utils/resourceTypePresentation.ts
@@ -26,10 +26,6 @@ const RESOURCE_TYPE_PRESENTATION: Partial<Record<ResourceType | string, Resource
label: 'K8s Node',
badgeClasses: DEFAULT_BADGE_CLASSES,
},
- truenas: {
- label: 'TrueNAS',
- badgeClasses: DEFAULT_BADGE_CLASSES,
- },
vm: {
label: 'VM',
badgeClasses: DEFAULT_BADGE_CLASSES,
diff --git a/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts b/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts
index 3484028c61..05b64334d7 100644
--- a/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts
+++ b/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts
@@ -52,7 +52,7 @@ test.describe('TrueNAS infrastructure storage and recovery links', () => {
data: [
{
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
diff --git a/tests/integration/tests/25-truenas-recovery-route-filter.spec.ts b/tests/integration/tests/25-truenas-recovery-route-filter.spec.ts
index 4f8f233fce..739996d875 100644
--- a/tests/integration/tests/25-truenas-recovery-route-filter.spec.ts
+++ b/tests/integration/tests/25-truenas-recovery-route-filter.spec.ts
@@ -55,7 +55,7 @@ test.describe('TrueNAS recovery route filters', () => {
data: [
{
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'tower',
displayName: 'TrueNAS Tower',
platformId: 'truenas-main',
diff --git a/tests/integration/tests/26-truenas-alert-thresholds.spec.ts b/tests/integration/tests/26-truenas-alert-thresholds.spec.ts
index ba85a7ecfb..a9c5928c75 100644
--- a/tests/integration/tests/26-truenas-alert-thresholds.spec.ts
+++ b/tests/integration/tests/26-truenas-alert-thresholds.spec.ts
@@ -55,7 +55,7 @@ test.describe('TrueNAS alert thresholds', () => {
data: [
{
id: 'truenas-resource',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
diff --git a/tests/integration/tests/28-truenas-alert-resource-links.spec.ts b/tests/integration/tests/28-truenas-alert-resource-links.spec.ts
index 40a39c22d6..91262b64dc 100644
--- a/tests/integration/tests/28-truenas-alert-resource-links.spec.ts
+++ b/tests/integration/tests/28-truenas-alert-resource-links.spec.ts
@@ -55,7 +55,7 @@ test.describe('TrueNAS alert resource links', () => {
data: [
{
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
@@ -122,7 +122,7 @@ test.describe('TrueNAS alert resource links', () => {
node: 'truenas-main',
nodeDisplayName: 'TrueNAS Main',
metadata: {
- resourceType: 'truenas',
+ resourceType: 'agent',
},
},
]),
diff --git a/tests/integration/tests/29-truenas-patrol-finding-links.spec.ts b/tests/integration/tests/29-truenas-patrol-finding-links.spec.ts
index a00c34249d..6e13d95f6b 100644
--- a/tests/integration/tests/29-truenas-patrol-finding-links.spec.ts
+++ b/tests/integration/tests/29-truenas-patrol-finding-links.spec.ts
@@ -54,7 +54,7 @@ test.describe('TrueNAS patrol finding links', () => {
data: [
{
id: 'truenas-main',
- type: 'truenas',
+ type: 'agent',
name: 'truenas-main',
displayName: 'TrueNAS Main',
platformId: 'truenas-main',
@@ -211,7 +211,7 @@ test.describe('TrueNAS patrol finding links', () => {
category: 'availability',
resource_id: 'truenas-main',
resource_name: 'TrueNAS Main',
- resource_type: 'truenas',
+ resource_type: 'agent',
title: 'TrueNAS system offline',
description: 'Pulse Patrol detected that the TrueNAS appliance stopped reporting.',
detected_at: '2026-03-30T09:10:00Z',