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
Add native TrueNAS network share inventory
rcourtman0801ede8c3fc
diff --git a/docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.json b/docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.jsonindex f4e9a571de..ad2ccbe2fd 100644--- a/docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.json+++ b/docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.json@@ -264,6 +264,7 @@"agent","vm","app-container",+ "network-share","storage","physical-disk"],diff --git a/docs/release-control/v6/internal/PLATFORM_SUPPORT_MODEL.md b/docs/release-control/v6/internal/PLATFORM_SUPPORT_MODEL.mdindex d279a8fee1..87bef88d95 100644--- a/docs/release-control/v6/internal/PLATFORM_SUPPORT_MODEL.md+++ b/docs/release-control/v6/internal/PLATFORM_SUPPORT_MODEL.md@@ -308,7 +308,7 @@ Support floor fields are recorded in this order: `setup`, `visibility`,| `proxmox-pve` | `platform` | `supported` | `supported` | `api-backed` | `platform-connections` | `agent`, `vm`, `system-container`, `storage`, `ceph`, `physical-disk` | `setup=supported`; `visibility=supported`; `workloads=supported`; `storage=supported`; `recovery=supported`; `alerts=supported`; `assistant_read=supported`; `assistant_control=augmentation-only` || `proxmox-pbs` | `platform` | `supported` | `supported` | `api-backed` | `platform-connections` | `pbs`, `storage` | `setup=supported`; `visibility=supported`; `workloads=n/a`; `storage=supported`; `recovery=supported`; `alerts=supported`; `assistant_read=supported`; `assistant_control=read-only` || `proxmox-pmg` | `platform` | `supported` | `supported` | `api-backed` | `platform-connections` | `pmg` | `setup=supported`; `visibility=supported`; `workloads=n/a`; `storage=n/a`; `recovery=n/a`; `alerts=supported`; `assistant_read=supported`; `assistant_control=read-only` |-| `truenas` | `platform` | `supported` | `supported` | `api-backed` | `platform-connections` | `agent`, `vm`, `app-container`, `storage`, `physical-disk` | `setup=supported`; `visibility=supported`; `workloads=supported`; `storage=supported`; `recovery=supported`; `alerts=supported`; `assistant_read=supported`; `assistant_control=supported` |+| `truenas` | `platform` | `supported` | `supported` | `api-backed` | `platform-connections` | `agent`, `vm`, `app-container`, `network-share`, `storage`, `physical-disk` | `setup=supported`; `visibility=supported`; `workloads=supported`; `storage=supported`; `recovery=supported`; `alerts=supported`; `assistant_read=supported`; `assistant_control=supported` || `vmware-vsphere` | `platform` | `supported` | `supported` | `api-backed` | `platform-connections` | `agent`, `vm`, `storage` | `setup=supported`; `visibility=supported`; `workloads=supported`; `storage=supported`; `recovery=n/a`; `alerts=supported`; `assistant_read=supported`; `assistant_control=read-only` |Presentation-only platform vocabulary uses `governance=presentation-only`,@@ -368,7 +368,7 @@ or runtime platform fallbacks that are not declared in this document.| `proxmox-pve` | platform | Proxmox | api-backed | host agent may augment into hybrid | `agent`, `vm`, `system-container`, `storage`, `ceph`, `physical-disk` || `proxmox-pbs` | platform | Proxmox | api-backed | host agent may augment into hybrid | `pbs`, `storage` || `proxmox-pmg` | platform | Proxmox | api-backed | none today | `pmg` |-| `truenas` | platform | TrueNAS | api-backed | host agent may augment into hybrid | `agent`, `vm`, `app-container`, `storage`, `physical-disk` |+| `truenas` | platform | TrueNAS | api-backed | host agent may augment into hybrid | `agent`, `vm`, `app-container`, `network-share`, `storage`, `physical-disk` || `vmware-vsphere` | platform | VMware | api-backed | host or guest agent later, not phase 1 | `agent`, `vm`, `storage` || Platform | Setup | Visibility | Workloads | Storage | Recovery | Alerts | Assistant read | Assistant control |diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex af5c5b9c97..5f5827d496 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -173,6 +173,13 @@ API, but they must not widen install tokens, agent profiles, or command grantsbecause a Discovery record exists. Mock-mode Discovery records are demopayloads for the same API contract and must not become a lifecycle-localfixture or an implicit permission to run commands.+Native provider resource types exposed through shared `internal/api/` resource+handlers are the same kind of read-only context for lifecycle surfaces. A+TrueNAS `network-share` resource may appear in resource pickers, connection+impact previews, or cross-organization sharing only through the API and+unified-resource contracts; lifecycle code must not treat that share as an+agent install target, a command-agent authority, or a reason to widen setup+tokens.The node setup modal boundary must keep guided setup and manual credentialsubmission separate. For new PVE/PBS setup, API Inventory and Host Telemetrydiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 550cce29e4..6138d9a762 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -387,6 +387,13 @@ the canonical monitored-system blocked payload.fleet state, or replace the shared connection projection with page-localplaceholders.3. Add dedicated contract tests for new stable payloads+ Unified resource type-filter and organization-share resource type additions+ must route through `internal/api/resources.go`, `internal/api/org_handlers.go`,+ frontend resource typing, and `internal/api/contract_test.go` together.+ Native provider projections such as TrueNAS `network-share` may be accepted+ by `/api/resources` filters and cross-organization share normalization only+ after the unified-resource contract defines the canonical resource type and+ payload facet.3a. Route diagnostics payload fields and user-facing diagnostics copy through`internal/api/diagnostics.go`,`internal/api/diagnostics_additional_test.go`, anddiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex fed43c651b..2e92282046 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -224,9 +224,9 @@ work extends shared components instead of creating new local variants.`docker` are not collapsed back into owning platform semantics.It must also preserve canonical projection lists from the governed manifestwithout page-local narrowing; for example, TrueNAS exposes both native- `vm` workloads and `app-container` workloads through the same generated- platform projection used by route helpers, badges, source filters, and- type unions.+ `vm`, `network-share`, and `app-container` workloads through the same+ generated platform projection used by route helpers, badges, source+ filters, reportable-resource pickers, and type unions.10. `frontend-modern/src/utils/sourcePlatforms.ts` shared with `unified-resources`: the source platform normalizer is both a canonical unified-resource source adapter boundary and a shared frontend source/platform vocabulary boundary.That shared boundary must preserve `availability` as the agentlessinfrastructure source for `network-endpoint` resources and settingsdiff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 4a6ec686fa..9bbe33c982 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -116,6 +116,12 @@ truth for live infrastructure data.through `TrueNASData.App` on the canonical `app-container` resource.Monitoring must not rebuild a second Docker-only TrueNAS app inventory ormake the Docker fallback the source of truth for the TrueNAS platform page.+ TrueNAS VMs and network shares follow the same provider-owned inventory+ boundary: `vm.query` data publishes native `TrueNASData.VM` on canonical+ `vm` resources, while SMB/NFS share data from `sharing.smb.query` and+ `sharing.nfs.query` publishes native `TrueNASData.Share` on canonical+ `network-share` resources parented to the owning dataset or pool when the+ API/path supplies that evidence.## Forbidden Paths@@ -155,6 +161,10 @@ truth for live infrastructure data.cross-runtime tooling, but platform-page app rows, source identity, andupdate posture must be carried by the TrueNAS app facet published intounified resources.+9. Keep TrueNAS network-share inventory native to the TrueNAS API projection.+ SMB/NFS shares must enter unified resources as `network-share` records with+ the TrueNAS share facet, not as generic storage rows or Docker/container+ compatibility records.## Current Statediff --git a/docs/release-control/v6/internal/subsystems/organization-settings.md b/docs/release-control/v6/internal/subsystems/organization-settings.mdindex 8c9c169382..8ca060b41e 100644--- a/docs/release-control/v6/internal/subsystems/organization-settings.md+++ b/docs/release-control/v6/internal/subsystems/organization-settings.md@@ -213,6 +213,12 @@ scope.The organization sharing surface now also sources resource quick-pick labelsfrom the shared preferred resource display helper, so governed resources donot fall back to raw names inside share creation.+Organization share resource-type normalization is API-contract-owned but+organization-settings consumes the resulting allowlist. Native provider+resource types such as TrueNAS `network-share` may be shared only after the+unified-resource and API contracts define them as canonical resource payloads;+organization settings must not invent a local alias or a separate share-only+taxonomy for those resources.Organization settings empty, unavailable, and load-error states are part ofthat same presentation boundary: the shared organization presentation helpersmust describe server capability and settings availability directly, rather thandiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex c6fa9e1521..6af8b05736 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -145,12 +145,13 @@ read-only evidence: it must not become a storage/recovery-owned command path,secret source, restore entitlement, or frontend-only fixture separate from thecanonical `/api/discovery` payload.Storage and recovery may also consume unified-resource TrueNAS app and VM-metadata as read-only workload context when explaining appliance-owned storage-or protected items. `TrueNASData.App` and `TrueNASData.VM` remain+metadata, plus TrueNAS network-share metadata, as read-only workload and+storage-access context when explaining appliance-owned storage or protected+items. `TrueNASData.App`, `TrueNASData.VM`, and `TrueNASData.Share` remainunified-resource/platform truth sourced from the TrueNAS API; storage/recovery-must not reinterpret app containers, VM device inventory, volumes, or update-posture as storage ownership, restore entitlement, or a separate Docker-only-or TrueNAS-local inventory path.+must not reinterpret app containers, VM device inventory, share paths, volumes,+or update posture as storage ownership, restore entitlement, or a separate+Docker-only or TrueNAS-local inventory path.1. Add or change recovery-point persistence, rollups, or series derivation through `internal/recovery/`2. Add or change recovery page UX through `frontend-modern/src/components/Recovery/` and keep canonical route/query/filter state ownership in `frontend-modern/src/features/recovery/useRecoverySurfaceState.ts`diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex a3ddf6c49c..54ed42034a 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -201,6 +201,14 @@ reintroduce false Swarm capability surfaces.runtime evidence, but the TrueNAS platform overview and otherTrueNAS-native consumers must read the native facet first instead oftreating TrueNAS apps as generic Docker rows.+ TrueNAS VM and network-share inventory use the same native-facet rule.+ TrueNAS API VMs publish `TrueNASData.VM` on canonical `vm` resources, and+ SMB/NFS shares publish `TrueNASData.Share` on canonical `network-share`+ resources. Share records must preserve protocol, path, dataset,+ enabled/read-only/access metadata, clone and merge through unified+ resources, redact filesystem paths through policy metadata, and derive+ storage-parent relationships without being flattened into generic Docker or+ storage rows.2. Add typed accessors and views in `internal/unifiedresources/views.go`3. Add source ingestion/adaptation in the adapter layer onlyFrontend resource platform contracts indiff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.truenas-details.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.truenas-details.test.tsxindex 488c535e62..b2ae537aee 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.truenas-details.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.truenas-details.test.tsx@@ -151,4 +151,42 @@ describe('ResourceDetailDrawer TrueNAS details', () => {expect(section.getByText('0.0.0.0:30443 -> 443/tcp')).toBeInTheDocument();expect(section.getByText('/mnt/tank/apps/nextcloud -> /data')).toBeInTheDocument();});++ it('renders native TrueNAS share detail from SMB and NFS inventory', () => {+ const resource = baseResource({+ id: 'truenas-share-1',+ type: 'network-share',+ displayName: 'Media',+ truenas: {+ share: {+ name: 'Media',+ protocol: 'SMB',+ dataset: 'tank/media',+ path: '/mnt/tank/media',+ enabled: true,+ readOnly: false,+ browsable: true,+ accessBasedEnumeration: true,+ auditEnabled: true,+ aliases: ['media'],+ },+ },+ });++ const { getByText, getByRole, getByTestId } = render(() => (+ <ResourceDetailDrawer resource={resource} />+ ));++ expect(getByText('SMB, Enabled, tank/media, Read/write')).toBeInTheDocument();++ fireEvent.click(getByRole('button', { name: 'Show TrueNAS' }));++ const section = within(getByTestId('resource-truenas-details-section'));+ expect(section.getByText('Share')).toBeInTheDocument();+ expect(section.getByText('Access')).toBeInTheDocument();+ expect(section.getByText('Clients')).toBeInTheDocument();+ expect(section.getByText('/mnt/tank/media')).toBeInTheDocument();+ expect(section.getByText('Read/write')).toBeInTheDocument();+ expect(section.getByText('media')).toBeInTheDocument();+ });});diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerTrueNASModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerTrueNASModel.test.tsindex 61d32d7b05..a6229b68d1 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerTrueNASModel.test.ts+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerTrueNASModel.test.ts@@ -84,4 +84,31 @@ describe('resourceDetailDrawerTrueNASModel', () => {'Storage',]);});++ it('summarizes native SMB and NFS share metadata for the detail drawer', () => {+ const resource = baseResource({+ type: 'network-share',+ truenas: {+ share: {+ name: 'Media',+ protocol: 'SMB',+ dataset: 'tank/media',+ path: '/mnt/tank/media',+ enabled: true,+ readOnly: false,+ browsable: true,+ accessBasedEnumeration: true,+ auditEnabled: true,+ aliases: ['media'],+ },+ },+ });++ expect(buildTrueNASDetailsSummary(resource)).toBe('SMB, Enabled, tank/media, Read/write');+ expect(buildTrueNASDetailSections(resource).map((section) => section.label)).toEqual([+ 'Share',+ 'Access',+ 'Clients',+ ]);+ });});diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerTrueNASModel.ts b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerTrueNASModel.tsindex 5d3e1068cf..31a67502bc 100644--- a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerTrueNASModel.ts+++ b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerTrueNASModel.ts@@ -2,6 +2,7 @@ import type {Resource,ResourceTrueNASAppMeta,ResourceTrueNASAppPort,+ ResourceTrueNASShareMeta,ResourceTrueNASVMMeta,} from '@/types/resource';@@ -266,15 +267,95 @@ const buildTrueNASVMSections = (]);};+const shareProtocolLabel = (share: ResourceTrueNASShareMeta): string | null =>+ asString(share.protocol)?.toUpperCase() ?? null;++const shareStateLabel = (share: ResourceTrueNASShareMeta): string => {+ if (share.enabled === false) return 'Disabled';+ if (share.locked) return 'Locked';+ return 'Enabled';+};++const shareStateTone = (share: ResourceTrueNASShareMeta): ResourceDetailDrawerTrueNASRowTone => {+ if (share.enabled === false || share.locked) return 'warning';+ return 'success';+};++const shareModeLabel = (share: ResourceTrueNASShareMeta): string | null => {+ if (share.readOnly === true) return 'Read-only';+ if (share.readOnly === false) return 'Read/write';+ return null;+};++const shareUserGroupLabel = (user?: string, group?: string): string | null => {+ const userLabel = asString(user);+ const groupLabel = asString(group);+ if (userLabel && groupLabel) return `${userLabel}:${groupLabel}`;+ return userLabel ?? groupLabel;+};++const buildTrueNASShareSections = (+ share: ResourceTrueNASShareMeta,+): ResourceDetailDrawerTrueNASSection[] => {+ const aliases = (share.aliases ?? []).map((value) => value.trim()).filter(Boolean);+ const hosts = (share.hosts ?? []).map((value) => value.trim()).filter(Boolean);+ const networks = (share.networks ?? []).map((value) => value.trim()).filter(Boolean);+ const security = (share.security ?? []).map((value) => value.trim()).filter(Boolean);+ const shareRows = compactRows([+ row('State', shareStateLabel(share), { tone: shareStateTone(share) }),+ row('Protocol', shareProtocolLabel(share)),+ row('Dataset', asString(share.dataset)),+ row('Path', asString(share.path)),+ row('Relative path', asString(share.relativePath)),+ row('Comment', asString(share.comment)),+ ]);++ const accessRows = compactRows([+ row('Mode', shareModeLabel(share)),+ row('Browsable', yesNoValue(share.browsable)),+ row('Locked', yesNoValue(share.locked)),+ row('Access enumeration', booleanValue(share.accessBasedEnumeration)),+ row('Audit', booleanValue(share.auditEnabled)),+ row('Snapshots', booleanValue(share.exposeSnapshots)),+ ]);++ const clientRows = compactRows([+ row('Aliases', summarizeList(aliases), { title: aliases.join(', ') }),+ row('Hosts', summarizeList(hosts), { title: hosts.join(', ') }),+ row('Networks', summarizeList(networks), { title: networks.join(', ') }),+ row('Security', summarizeList(security), { title: security.join(', ') }),+ row('Map root', shareUserGroupLabel(share.mapRootUser, share.mapRootGroup)),+ row('Map all', shareUserGroupLabel(share.mapAllUser, share.mapAllGroup)),+ ]);++ return compactSections([+ { label: 'Share', rows: shareRows },+ { label: 'Access', rows: accessRows },+ { label: 'Clients', rows: clientRows },+ ]);+};+export const buildTrueNASDetailSections = (resource: Resource,): ResourceDetailDrawerTrueNASSection[] => {+ if (resource.truenas?.share) return buildTrueNASShareSections(resource.truenas.share);if (resource.truenas?.vm) return buildTrueNASVMSections(resource.truenas.vm);if (resource.truenas?.app) return buildTrueNASAppSections(resource.truenas.app);return [];};export const buildTrueNASDetailsSummary = (resource: Resource): string | null => {+ const share = resource.truenas?.share;+ if (share) {+ const summary = [+ shareProtocolLabel(share),+ shareStateLabel(share),+ asString(share.dataset) ?? asString(share.path),+ shareModeLabel(share),+ ].filter((value): value is string => Boolean(value));+ return summary.length > 0 ? summary.join(', ') : null;+ }+const vm = resource.truenas?.vm;if (vm) {const deviceCount = asPositiveNumber(vm.deviceCount);diff --git a/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx b/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsxnew file mode 100644index 0000000000..3a24563a5c--- /dev/null+++ b/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx@@ -0,0 +1,313 @@+import { For, Show, createMemo, type Component, type JSX } from 'solid-js';+import { StatusDot } from '@/components/shared/StatusDot';+import { TableCard } from '@/components/shared/TableCard';+import { TableCardHeader } from '@/components/shared/TableCardHeader';+import {+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from '@/components/shared/Table';+import { getSimpleStatusIndicator } from '@/utils/status';+import { asTrimmedString } from '@/utils/stringUtils';+import {+ PLATFORM_TABLE_BODY_CLASS,+ PLATFORM_TABLE_CARD_CLASS,+ PLATFORM_TABLE_HEADER_ROW_CLASS,+ PlatformTableEmptyState,+ PlatformTableToolbar,+ createPlatformTableFilterState,+ getPlatformTableCellClassForKind,+ getPlatformTableHeadClassForKind,+ type PlatformTableFilterOption,+} from '@/features/platformPage/sharedPlatformPage';+import {+ PlatformResourceDetailTableRow,+ createPlatformResourceDetailState,+ createPlatformResourceLabelResolver,+ getPlatformResourceDetailRowClass,+} from '@/features/platformPage/PlatformResourceDetailTableRow';+import type { Resource, ResourceTrueNASShareMeta } from '@/types/resource';+import {+ filterTrueNASShares,+ mapTrueNASShareStatus,+ type TrueNASShareStatusFilter,+} from './truenasPageModel';++const TRUENAS_SHARE_STATUS_OPTIONS: PlatformTableFilterOption<TrueNASShareStatusFilter>[] = [+ { value: 'all', label: 'All' },+ { value: 'active', label: 'Active', tone: 'success' },+ { value: 'attention', label: 'Attention', tone: 'warning' },+ { value: 'disabled', label: 'Disabled', tone: 'danger' },+];++const shareMeta = (resource: Resource): ResourceTrueNASShareMeta | undefined =>+ resource.truenas?.share;++const titleCase = (value: string | undefined): string => {+ const normalized = asTrimmedString(value);+ if (!normalized) return 'Unknown';+ return normalized.charAt(0).toUpperCase() + normalized.slice(1).toLowerCase();+};++const formatProtocol = (share: ResourceTrueNASShareMeta | undefined): string =>+ asTrimmedString(share?.protocol)?.toUpperCase() || '-';++const compactList = (values: Array<string | undefined>): string[] =>+ values.map((value) => asTrimmedString(value)).filter((value): value is string => Boolean(value));++const summarizeValues = (+ values: string[],+ empty = '-',+ visibleCount = 2,+): { label: string; title: string } => {+ if (values.length === 0) return { label: empty, title: '' };+ const visible = values.slice(0, visibleCount);+ const suffix = values.length > visible.length ? ` +${values.length - visible.length}` : '';+ return { label: `${visible.join(', ')}${suffix}`, title: values.join(', ') };+};++const formatAccess = (+ share: ResourceTrueNASShareMeta | undefined,+): { label: string; title: string } => {+ const flags = compactList([+ share?.readOnly === true ? 'Read-only' : share?.readOnly === false ? 'Read/write' : undefined,+ share?.browsable === true ? 'Browsable' : share?.browsable === false ? 'Hidden' : undefined,+ share?.accessBasedEnumeration ? 'ABE' : undefined,+ share?.auditEnabled ? 'Audit' : undefined,+ share?.exposeSnapshots ? 'Snapshots' : undefined,+ ]);+ return summarizeValues(flags, '-', 3);+};++const formatClients = (+ share: ResourceTrueNASShareMeta | undefined,+): { label: string; title: string } => {+ const networks = compactList(share?.networks ?? []);+ const hosts = compactList(share?.hosts ?? []);+ const aliases = compactList(share?.aliases ?? []);+ const values = [+ ...networks.map((network) => `net:${network}`),+ ...hosts.map((host) => `host:${host}`),+ ...aliases.map((alias) => `alias:${alias}`),+ ];+ return summarizeValues(values);+};++const formatSecurity = (+ share: ResourceTrueNASShareMeta | undefined,+): { label: string; title: string } => {+ const values = [+ ...compactList(share?.security ?? []),+ ...compactList([+ share?.mapRootUser ? `root:${share.mapRootUser}` : undefined,+ share?.mapAllUser ? `all:${share.mapAllUser}` : undefined,+ ]),+ ];+ return summarizeValues(values);+};++const shareName = (resource: Resource, share: ResourceTrueNASShareMeta | undefined): string =>+ asTrimmedString(share?.name) ||+ asTrimmedString(resource.displayName) ||+ asTrimmedString(resource.name) ||+ resource.id;++export const TrueNASNetworkSharesTable: Component<{+ shares: Resource[];+ scope: Resource[];+ emptyIcon: JSX.Element;+ emptyTitle: string;+ emptyDescription: string;+ showToolbar?: boolean;+}> = (props) => {+ const tableState = createPlatformTableFilterState({+ resources: () => props.shares,+ initialStatus: 'all' as TrueNASShareStatusFilter,+ filter: filterTrueNASShares,+ });+ const drawer = createPlatformResourceDetailState({ idPrefix: 'truenas-share-drawer' });+ const resolveResourceLabel = createPlatformResourceLabelResolver(() => props.scope);++ return (+ <Show+ when={props.shares.length > 0}+ fallback={+ <PlatformTableEmptyState+ icon={props.emptyIcon}+ title={props.emptyTitle}+ description={props.emptyDescription}+ />+ }+ >+ <div class="space-y-3">+ <Show when={props.showToolbar !== false}>+ <PlatformTableToolbar+ search={tableState.search}+ onSearchChange={tableState.setSearch}+ searchPlaceholder="Search TrueNAS shares"+ status={tableState.status()}+ onStatusChange={tableState.setStatus}+ statusOptions={TRUENAS_SHARE_STATUS_OPTIONS}+ visible={tableState.visible()}+ total={tableState.total()}+ rowNoun="shares"+ />+ </Show>++ <Show+ when={tableState.filtered().length > 0}+ fallback={+ <PlatformTableEmptyState+ icon={props.emptyIcon}+ title="No shares match current filters"+ description="Adjust the search or status filter to see more TrueNAS shares."+ />+ }+ >+ <TableCard class={PLATFORM_TABLE_CARD_CLASS}>+ <TableCardHeader title="Network Shares" />+ <Table class="min-w-full table-fixed text-xs md:min-w-[1180px]">+ <TableHeader>+ <TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>+ <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[20%]`}>+ Share+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[8%]`}>+ Protocol+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden sm:table-cell md:w-[15%]`}+ >+ Dataset+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[23%]`}+ >+ Path+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[16%]`}>+ Access+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden lg:table-cell md:w-[12%]`}+ >+ Clients+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('badge')} md:w-[6%]`}>+ State+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody class={PLATFORM_TABLE_BODY_CLASS}>+ <For each={tableState.filtered()}>+ {(resource) => {+ const share = () => shareMeta(resource);+ const name = () => shareName(resource, share());+ const indicator = () => getSimpleStatusIndicator(resource.status);+ const access = createMemo(() => formatAccess(share()));+ const clients = createMemo(() => formatClients(share()));+ const security = createMemo(() => formatSecurity(share()));+ const stateLabel = () => titleCase(mapTrueNASShareStatus(resource));+ const detailRowId = () => drawer.detailRowId(resource);+ const isExpanded = () => drawer.isExpanded(resource);+ return (+ <>+ <TableRow+ class={`${getPlatformResourceDetailRowClass(isExpanded())} text-[11px] sm:text-xs`}+ aria-controls={isExpanded() ? detailRowId() : undefined}+ aria-expanded={isExpanded() ? 'true' : 'false'}+ data-truenas-share-row={resource.id}+ onClick={() => drawer.toggle(resource)}+ onKeyDown={drawer.handleActivationKey(resource)}+ tabIndex={0}+ >+ <TableCell class={getPlatformTableCellClassForKind('name')}>+ <div class="flex min-w-0 items-center gap-2">+ <StatusDot+ size="sm"+ variant={indicator().variant}+ title={indicator().label}+ />+ <div class="min-w-0">+ <div class="truncate font-medium text-base-content" title={name()}>+ {name()}+ </div>+ <div class="truncate text-[10px] text-muted">+ {share()?.dataset ||+ share()?.path ||+ resource.parentName ||+ 'TrueNAS'}+ </div>+ </div>+ </div>+ </TableCell>+ <TableCell class={getPlatformTableCellClassForKind('text')}>+ <span class="font-mono text-[11px] text-base-content">+ {formatProtocol(share())}+ </span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content sm:table-cell`}+ >+ <span class="block truncate" title={share()?.dataset}>+ {share()?.dataset || '-'}+ </span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}+ >+ <span+ class="block truncate font-mono text-[11px]"+ title={share()?.path}+ >+ {share()?.path || '-'}+ </span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} text-base-content`}+ title={[access().title, security().title].filter(Boolean).join(' | ')}+ >+ <span class="block truncate">{access().label}</span>+ <Show when={security().label !== '-'}>+ <span class="block truncate text-[10px] text-muted">+ {security().label}+ </span>+ </Show>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content lg:table-cell`}+ title={clients().title}+ >+ <span class="block truncate">{clients().label}</span>+ </TableCell>+ <TableCell class={getPlatformTableCellClassForKind('badge')}>+ <span class="text-[11px] font-medium text-base-content">+ {stateLabel()}+ </span>+ </TableCell>+ </TableRow>+ <PlatformResourceDetailTableRow+ resource={resource}+ open={isExpanded()}+ detailRowId={detailRowId()}+ colSpan={7}+ resolveResourceLabel={resolveResourceLabel}+ onClose={() => drawer.close(resource)}+ />+ </>+ );+ }}+ </For>+ </TableBody>+ </Table>+ </TableCard>+ </Show>+ </div>+ </Show>+ );+};++export default TrueNASNetworkSharesTable;diff --git a/frontend-modern/src/features/truenas/TrueNASPageSurface.tsx b/frontend-modern/src/features/truenas/TrueNASPageSurface.tsxindex c4a7e3dd48..0bd4ab4d2b 100644--- a/frontend-modern/src/features/truenas/TrueNASPageSurface.tsx+++ b/frontend-modern/src/features/truenas/TrueNASPageSurface.tsx@@ -10,6 +10,7 @@ import {PlatformTableLoadingState,} from '@/features/platformPage/sharedPlatformPage';import { TrueNASAppsTable } from './TrueNASAppsTable';+import { TrueNASNetworkSharesTable } from './TrueNASNetworkSharesTable';import { TrueNASSystemsTable } from './TrueNASSystemsTable';import { TrueNASVirtualMachinesTable } from './TrueNASVirtualMachinesTable';import {@@ -24,7 +25,7 @@ import {// first-class type tokens and including them triggers a 400 from// `/api/resources`. The page model still buckets by topology// client-side.-const TRUENAS_RESOURCE_QUERY = 'type=agent,vm,app-container,storage,physical_disk';+const TRUENAS_RESOURCE_QUERY = 'type=agent,vm,app-container,network-share,storage,physical_disk';const TRUENAS_PLATFORM_FILTER = 'truenas';const VALID_TABS = new Set<TrueNASPageTabId>(TRUENAS_TAB_SPECS.map((tab) => tab.id));@@ -117,6 +118,15 @@ function TrueNASOverview(props: TrueNASOverviewProps) {emptyDescription="TrueNAS systems appear here once a TrueNAS connection reports its top-level appliance."showToolbar={false}/>+ <Show when={props.model().shares.length > 0}>+ <TrueNASNetworkSharesTable+ shares={props.model().shares}+ scope={props.model().resources}+ emptyIcon={truenasIcon()}+ emptyTitle="No TrueNAS shares"+ emptyDescription="Shares appear here once the TrueNAS API reports SMB or NFS sharing inventory."+ />+ </Show><Show when={props.model().vms.length > 0}><TrueNASVirtualMachinesTablevms={props.model().vms}diff --git a/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx b/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsxindex 7d52f48588..8859de0135 100644--- a/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx+++ b/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx@@ -39,7 +39,7 @@ import type { Resource } from '@/types/resource';// TrueNAS systems are storage appliances, not generic compute hosts.// The generic infrastructure table's CPU / Memory / Disk columns are// helpful (the agent payload carries them), but operators also want at--// a-glance pool count, dataset count, app count, uptime, version, and+// a-glance pool count, dataset count, share count, app count, uptime, version, and// max-sensor temperature on the same row. This bespoke table reuses// canonical shared primitives (Card, Table, SearchInput,// FilterButtonGroup, StatusDot) and counts the per-system children@@ -120,9 +120,10 @@ export const TrueNASSystemsTable: Component<{const datasets = props.scope.filter((r) => r.type === 'dataset' || (r.type === 'storage' && r.storage?.topology === 'dataset'),).length;+ const shares = props.scope.filter((r) => r.type === 'network-share').length;const apps = props.scope.filter((r) => r.type === 'app-container').length;const disks = props.scope.filter((r) => r.type === 'physical_disk').length;- return { pools, datasets, apps, disks };+ return { pools, datasets, shares, apps, disks };});return (@@ -163,47 +164,66 @@ export const TrueNASSystemsTable: Component<{><TableCard class={PLATFORM_TABLE_CARD_CLASS}><TableCardHeader title={props.title ?? 'Systems'} />- <Table class="min-w-full table-fixed text-xs md:min-w-[1300px]">+ <Table class="min-w-full table-fixed text-xs md:min-w-[1380px]"><TableHeader><TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>{/*Desktop widths balance the bar-metric columns (CPU /Memory / Storage) against the short integer-count columns- (Pools / Datasets / Disks / Apps) and give Version the+ (Pools / Datasets / Shares / Disks / Apps) and give Version theroom it needs for full "TrueNAS-SCALE-24.10.2"-stylelabels. Mobile widths are unchanged.*/}- <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[14%]`}>+ <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[13%]`}>System</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[14%]`}>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[13%]`}+ >Version</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[11%]`}>+ <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[10%]`}>CPU</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[12%]`}>+ <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[11%]`}>Memory</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[13%]`}>+ <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[12%]`}>Storage</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}+ >Temp</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}+ >Uptime</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}+ >Pools</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[7%]`}>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[7%]`}+ >Datasets</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[5%]`}>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}+ >+ Shares+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[5%]`}+ >Disks</TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[5%]`}>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[5%]`}+ >Apps</TableHead></TableRow>@@ -323,6 +343,11 @@ export const TrueNASSystemsTable: Component<{>{c.datasets}</TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content tabular-nums md:table-cell`}+ >+ {c.shares}+ </TableCell><TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content tabular-nums md:table-cell`}>@@ -338,7 +363,7 @@ export const TrueNASSystemsTable: Component<{resource={system}open={isExpanded()}detailRowId={detailRowId()}- colSpan={11}+ colSpan={12}resolveResourceLabel={resolveResourceLabel}onClose={() => drawer.close(system)}/>diff --git a/frontend-modern/src/features/truenas/__tests__/truenasPageModel.test.ts b/frontend-modern/src/features/truenas/__tests__/truenasPageModel.test.tsindex bc580f0047..083d0068a2 100644--- a/frontend-modern/src/features/truenas/__tests__/truenasPageModel.test.ts+++ b/frontend-modern/src/features/truenas/__tests__/truenasPageModel.test.ts@@ -4,8 +4,10 @@ import {TRUENAS_TAB_SPECS,buildTrueNASPageModel,filterTrueNASApps,+ filterTrueNASShares,filterTrueNASVMs,mapTrueNASAppStatus,+ mapTrueNASShareStatus,mapTrueNASVMStatus,} from '../truenasPageModel';@@ -30,6 +32,7 @@ describe('truenasPageModel', () => {makeResource({ id: 'truenas-system', type: 'agent' }),makeResource({ id: 'truenas-vm', type: 'vm' }),makeResource({ id: 'truenas-app', type: 'app-container' }),+ makeResource({ id: 'truenas-share', type: 'network-share' }),makeResource({ id: 'truenas-pool', type: 'pool' }),makeResource({ id: 'truenas-disk', type: 'physical_disk' }),makeResource({ id: 'docker-host', type: 'agent', platformType: 'docker' }),@@ -37,10 +40,18 @@ describe('truenasPageModel', () => {]);expect(model.systems.map((r) => r.id)).toEqual(['truenas-system']);+ expect(model.shares.map((r) => r.id)).toEqual(['truenas-share']);expect(model.vms.map((r) => r.id)).toEqual(['truenas-vm']);expect(model.apps.map((r) => r.id)).toEqual(['truenas-app']);expect(model.resources.map((r) => r.id).sort()).toEqual(- ['truenas-app', 'truenas-disk', 'truenas-pool', 'truenas-system', 'truenas-vm'].sort(),+ [+ 'truenas-app',+ 'truenas-disk',+ 'truenas-pool',+ 'truenas-share',+ 'truenas-system',+ 'truenas-vm',+ ].sort(),);});@@ -132,4 +143,52 @@ describe('truenasPageModel', () => {'vm-ubuntu',]);});++ it('filters shares using native TrueNAS SMB and NFS metadata', () => {+ const media = makeResource({+ id: 'share-media',+ type: 'network-share',+ truenas: {+ hostname: 'truenas-main',+ share: {+ id: 'smb-1',+ name: 'Media',+ protocol: 'SMB',+ path: '/mnt/tank/media',+ dataset: 'tank/media',+ enabled: true,+ browsable: true,+ auditEnabled: true,+ aliases: ['media'],+ },+ },+ });+ const archive = makeResource({+ id: 'share-archive',+ type: 'network-share',+ status: 'offline',+ truenas: {+ share: {+ id: 'nfs-2',+ name: 'Archive',+ protocol: 'NFS',+ path: '/mnt/tank/archive',+ dataset: 'tank/archive',+ enabled: false,+ readOnly: true,+ networks: ['10.10.20.0/24'],+ security: ['SYS'],+ },+ },+ });++ expect(mapTrueNASShareStatus(media)).toBe('active');+ expect(mapTrueNASShareStatus(archive)).toBe('disabled');+ expect(filterTrueNASShares([media, archive], 'audit', 'active').map((r) => r.id)).toEqual([+ 'share-media',+ ]);+ expect(+ filterTrueNASShares([media, archive], '10.10.20.0/24', 'disabled').map((r) => r.id),+ ).toEqual(['share-archive']);+ });});diff --git a/frontend-modern/src/features/truenas/truenasPageModel.ts b/frontend-modern/src/features/truenas/truenasPageModel.tsindex 4b8f2e0b53..a796a20897 100644--- a/frontend-modern/src/features/truenas/truenasPageModel.ts+++ b/frontend-modern/src/features/truenas/truenasPageModel.ts@@ -4,6 +4,7 @@ import type { Resource, ResourceType } from '@/types/resource';export type TrueNASPageTabId = 'overview' | 'storage';export type TrueNASAppStatusFilter = 'all' | 'running' | 'attention' | 'stopped';export type TrueNASVMStatusFilter = 'all' | 'running' | 'attention' | 'stopped';+export type TrueNASShareStatusFilter = 'all' | 'active' | 'attention' | 'disabled';export type TrueNASTabSpec = {id: TrueNASPageTabId;@@ -25,6 +26,7 @@ const TRUENAS_RESOURCE_TYPES = new Set<ResourceType>(['agent','vm','app-container',+ 'network-share','storage','pool','dataset',@@ -37,6 +39,7 @@ const isTrueNASPlatform = (resource: Resource): boolean =>export type TrueNASPageModel = {resources: Resource[];systems: Resource[];+ shares: Resource[];vms: Resource[];apps: Resource[];};@@ -47,11 +50,13 @@ export function buildTrueNASPageModel(resources: Resource[]): TrueNASPageModel {);const systems = trueNasResources.filter((resource) => resource.type === 'agent');+ const shares = trueNasResources.filter((resource) => resource.type === 'network-share');const vms = trueNasResources.filter((resource) => resource.type === 'vm');const apps = trueNasResources.filter((resource) => resource.type === 'app-container');return {resources: trueNasResources,systems,+ shares,vms,apps,};@@ -87,6 +92,22 @@ export function mapTrueNASVMStatus(resource: Resource): Exclude<TrueNASVMStatusFreturn 'attention';}+export function mapTrueNASShareStatus(+ resource: Resource,+): Exclude<TrueNASShareStatusFilter, 'all'> {+ const share = resource.truenas?.share;+ if (share?.enabled === false || resource.status === 'offline' || resource.status === 'stopped') {+ return 'disabled';+ }+ if (share?.locked || resource.status === 'degraded' || resource.status === 'paused') {+ return 'attention';+ }+ if (share?.enabled === true || resource.status === 'online' || resource.status === 'running') {+ return 'active';+ }+ return 'attention';+}+const portSearchTokens = (resource: Resource): string[] => {const app = resource.truenas?.app;const tokens: string[] = [];@@ -202,3 +223,55 @@ export function filterTrueNASVMs(return vmSearchHaystack(vm).includes(needle);});}++const shareSearchHaystack = (resource: Resource): string => {+ const share = resource.truenas?.share;+ return [+ resource.name,+ resource.displayName,+ resource.id,+ resource.parentName,+ resource.platformId,+ resource.platformType,+ resource.truenas?.hostname,+ share?.id,+ share?.name,+ share?.protocol,+ share?.path,+ share?.dataset,+ share?.relativePath,+ share?.comment,+ share?.enabled === false ? 'disabled' : share?.enabled === true ? 'enabled active' : undefined,+ share?.readOnly === true+ ? 'read-only readonly'+ : share?.readOnly === false+ ? 'read-write'+ : undefined,+ share?.browsable ? 'browsable' : undefined,+ share?.locked ? 'locked' : undefined,+ share?.accessBasedEnumeration ? 'access based enumeration abe' : undefined,+ share?.auditEnabled ? 'audit audited' : undefined,+ share?.exposeSnapshots ? 'snapshots' : undefined,+ ...(share?.aliases ?? []),+ ...(share?.hosts ?? []),+ ...(share?.networks ?? []),+ ...(share?.security ?? []),+ ...(resource.tags ?? []),+ ]+ .filter((value): value is string => typeof value === 'string' && value.trim().length > 0)+ .join(' ')+ .toLowerCase();+};++export function filterTrueNASShares(+ shares: Resource[],+ search: string,+ status: TrueNASShareStatusFilter,+): Resource[] {+ const needle = normalize(search);+ return shares.filter((share) => {+ if (status !== 'all' && mapTrueNASShareStatus(share) !== status) return false;+ if (!needle) return true;+ return shareSearchHaystack(share).includes(needle);+ });+}diff --git a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.tsindex 2e463ae43a..3988ce478f 100644--- a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts+++ b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts@@ -1685,6 +1685,52 @@ describe('useUnifiedResources', () => {dispose();});+ it('preserves native TrueNAS network-share resources at ingest', async () => {+ apiFetchMock.mockResolvedValueOnce(+ resourceResponse([+ {+ ...v2Resource,+ id: 'share-smb-media',+ type: 'network-share',+ name: 'Media',+ status: 'online',+ sources: ['truenas'],+ parentName: 'tank/media',+ truenas: {+ hostname: 'truenas-main',+ share: {+ id: 'smb-1',+ name: 'Media',+ protocol: 'SMB',+ path: '/mnt/tank/media',+ dataset: 'tank/media',+ enabled: true,+ readOnly: false,+ },+ },+ },+ ]),+ );++ let dispose = () => {};+ let result: ReturnType<UseUnifiedResourcesModule['useUnifiedResources']> | undefined;+ createRoot((d) => {+ dispose = d;+ result = useUnifiedResources({+ query: 'type=network-share',+ cacheKey: 'network-share-ingest-test',+ initialHydration: 'immediate',+ });+ });++ await waitForValue(() => result!.resources()[0]?.type, 'network-share');++ expect(result!.resources()[0]?.platformType).toBe('truenas');+ expect(result!.resources()[0]?.truenas?.share?.dataset).toBe('tank/media');++ dispose();+ });+it('preserves resource facets from backend payloads', async () => {apiFetchMock.mockResolvedValueOnce({ok: true,diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.tsindex 904f9ae8f7..9ff406276b 100644--- a/frontend-modern/src/hooks/useUnifiedResources.ts+++ b/frontend-modern/src/hooks/useUnifiedResources.ts@@ -523,6 +523,7 @@ const resolveType = (value?: string): ResourceType => {case 'pbs':case 'pmg':case 'ceph':+ case 'network-share':case 'network-endpoint':return canonicalFrontendType;case 'disk':diff --git a/frontend-modern/src/types/__tests__/resource.test.ts b/frontend-modern/src/types/__tests__/resource.test.tsindex dfbbfc56c7..1ae3b38b11 100644--- a/frontend-modern/src/types/__tests__/resource.test.ts+++ b/frontend-modern/src/types/__tests__/resource.test.ts@@ -56,6 +56,7 @@ describe('Resource Type Guards', () => {'agent','vm','app-container',+ 'network-share','storage','physical-disk',]);@@ -117,7 +118,13 @@ describe('Resource Type Guards', () => {});describe('isStorage', () => {- const storageTypes: ResourceType[] = ['storage', 'datastore', 'pool', 'dataset'];+ const storageTypes: ResourceType[] = [+ 'storage',+ 'datastore',+ 'pool',+ 'dataset',+ 'network-share',+ ];const nonStorageTypes: ResourceType[] = ['vm','agent',diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.tsindex d968be2e63..5f6a22c58c 100644--- a/frontend-modern/src/types/resource.ts+++ b/frontend-modern/src/types/resource.ts@@ -47,6 +47,7 @@ export type ResourceType =| 'pbs' // Proxmox Backup Server| 'pmg' // Proxmox Mail Gateway| 'physical_disk' // Physical disk+ | 'network-share' // SMB/NFS network share| 'ceph' // Ceph cluster| 'network-endpoint'; // Agentless availability endpoint@@ -684,6 +685,31 @@ export interface ResourceTrueNASVMMeta {pciCount?: number;}+export interface ResourceTrueNASShareMeta {+ id?: string;+ name?: string;+ protocol?: string;+ path?: string;+ dataset?: string;+ relativePath?: string;+ comment?: string;+ enabled?: boolean;+ readOnly?: boolean;+ browsable?: boolean;+ locked?: boolean;+ accessBasedEnumeration?: boolean;+ auditEnabled?: boolean;+ exposeSnapshots?: boolean;+ aliases?: string[];+ hosts?: string[];+ networks?: string[];+ security?: string[];+ mapRootUser?: string;+ mapRootGroup?: string;+ mapAllUser?: string;+ mapAllGroup?: string;+}+export interface ResourceTrueNASMeta {hostname?: string;version?: string;@@ -697,6 +723,7 @@ export interface ResourceTrueNASMeta {rebuildSummary?: string;app?: ResourceTrueNASAppMeta;vm?: ResourceTrueNASVMMeta;+ share?: ResourceTrueNASShareMeta;}export interface ResourceKubernetesMetricCapabilities {@@ -941,7 +968,15 @@ export function isWorkload(r: Resource): boolean {}export function isStorage(r: Resource): boolean {- return ['storage', 'datastore', 'pool', 'dataset', 'physical_disk', 'ceph'].includes(r.type);+ return [+ 'storage',+ 'datastore',+ 'pool',+ 'dataset',+ 'physical_disk',+ 'network-share',+ 'ceph',+ ].includes(r.type);}/**diff --git a/frontend-modern/src/utils/__tests__/reportableResourceTypes.test.ts b/frontend-modern/src/utils/__tests__/reportableResourceTypes.test.tsindex 5f8518ed3b..ab18ed39fe 100644--- a/frontend-modern/src/utils/__tests__/reportableResourceTypes.test.ts+++ b/frontend-modern/src/utils/__tests__/reportableResourceTypes.test.ts@@ -13,6 +13,7 @@ describe('reportableResourceTypes', () => {it('exports the shared reportable resource set', () => {expect(REPORTABLE_RESOURCE_TYPES.has('agent')).toBe(true);expect(REPORTABLE_RESOURCE_TYPES.has('pbs')).toBe(true);+ expect(REPORTABLE_RESOURCE_TYPES.has('network-share')).toBe(true);expect(REPORTABLE_RESOURCE_TYPES.has('truenas' as any)).toBe(false);});@@ -26,6 +27,7 @@ describe('reportableResourceTypes', () => {expect(matchesReportableResourceTypeFilter({ type: 'agent' }, 'infrastructure')).toBe(true);expect(matchesReportableResourceTypeFilter({ type: 'vm' }, 'workloads')).toBe(true);expect(matchesReportableResourceTypeFilter({ type: 'storage' }, 'storage')).toBe(true);+ expect(matchesReportableResourceTypeFilter({ type: 'network-share' }, 'storage')).toBe(true);expect(matchesReportableResourceTypeFilter({ type: 'pbs' }, 'recovery')).toBe(true);expect(matchesReportableResourceTypeFilter({ type: 'pbs' }, 'storage')).toBe(false);});diff --git a/frontend-modern/src/utils/__tests__/reportingResourceTypes.test.ts b/frontend-modern/src/utils/__tests__/reportingResourceTypes.test.tsindex ecf8f3f45f..5d9957918f 100644--- a/frontend-modern/src/utils/__tests__/reportingResourceTypes.test.ts+++ b/frontend-modern/src/utils/__tests__/reportingResourceTypes.test.ts@@ -9,6 +9,7 @@ describe('toReportingResourceType', () => {expect(toReportingResourceType('app-container')).toBe('app-container');expect(toReportingResourceType('docker-host')).toBe('docker-host');expect(toReportingResourceType('network-endpoint')).toBe('network-endpoint');+ expect(toReportingResourceType('network-share')).toBe('network-share');expect(toReportingResourceType('storage')).toBe('storage');});diff --git a/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts b/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.tsindex cd89d1d13b..354e458d2c 100644--- a/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts+++ b/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts@@ -358,6 +358,51 @@ describe('resourceStateAdapters nodeFromResource', () => {expect((resource.platformData as Record<string, unknown>).sources).toEqual(['availability']);});+ it('canonicalizes native TrueNAS share resources with the TrueNAS facet intact', () => {+ const [resource] = mergeCanonicalResourceSnapshot(+ [+ {+ id: 'truenas-share-media',+ type: 'network-share',+ name: 'Media',+ displayName: 'SMB Media',+ platformId: 'truenas-main:smb:media',+ platformType: 'truenas',+ sourceType: 'api',+ status: 'online',+ lastSeen: Date.now(),+ truenas: {+ hostname: 'truenas-main.local',+ share: {+ id: 'smb-media',+ name: 'Media',+ protocol: 'SMB',+ path: '/mnt/tank/media',+ dataset: 'tank/media',+ enabled: true,+ readOnly: false,+ },+ },+ } as Resource,+ ],+ [],+ );++ expect(resource.platformType).toBe('truenas');+ expect(resource.sourceType).toBe('api');+ expect(resource.truenas?.share).toMatchObject({+ id: 'smb-media',+ protocol: 'SMB',+ dataset: 'tank/media',+ path: '/mnt/tank/media',+ });+ expect((resource.platformData as Record<string, unknown>).sources).toEqual(['truenas']);+ expect((resource.platformData as Record<string, unknown>).truenas).toMatchObject({+ hostname: 'truenas-main.local',+ share: { id: 'smb-media' },+ });+ });+it('canonicalizes top-level Proxmox and agent facets as one hybrid PVE resource', () => {const [resource] = mergeCanonicalResourceSnapshot([diff --git a/frontend-modern/src/utils/__tests__/resourceTypeCompat.test.ts b/frontend-modern/src/utils/__tests__/resourceTypeCompat.test.tsindex 97fa4c02fc..5cec8148ef 100644--- a/frontend-modern/src/utils/__tests__/resourceTypeCompat.test.ts+++ b/frontend-modern/src/utils/__tests__/resourceTypeCompat.test.ts@@ -14,6 +14,7 @@ describe('resourceTypeCompat', () => {expect(canonicalizeFrontendResourceType('truenas')).toBe('agent');expect(canonicalizeFrontendResourceType('availability')).toBe('network-endpoint');expect(canonicalizeFrontendResourceType('network_endpoint')).toBe('network-endpoint');+ expect(canonicalizeFrontendResourceType('network-share')).toBe('network-share');});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.tsindex 19d096d5e9..41d9eae560 100644--- a/frontend-modern/src/utils/__tests__/resourceTypePresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/resourceTypePresentation.test.ts@@ -9,6 +9,7 @@ describe('resourceTypePresentation', () => {expect(getResourceTypeLabel('docker-host')).toBe('Container Runtime');expect(getResourceTypeLabel('k8s-cluster')).toBe('K8s Cluster');expect(getResourceTypeLabel('network-endpoint')).toBe('Network Endpoint');+ expect(getResourceTypeLabel('network-share')).toBe('Network Share');expect(getResourceTypeLabel('truenas')).toBe('Agent');});diff --git a/frontend-modern/src/utils/canonicalResourceTypes.ts b/frontend-modern/src/utils/canonicalResourceTypes.tsindex 4370bb77e4..6b8806b307 100644--- a/frontend-modern/src/utils/canonicalResourceTypes.ts+++ b/frontend-modern/src/utils/canonicalResourceTypes.ts@@ -21,6 +21,7 @@ export const CANONICAL_RESOURCE_TYPES = ['pbs','pmg','physical_disk',+ 'network-share','ceph','network-endpoint',] as const satisfies readonly ResourceType[];diff --git a/frontend-modern/src/utils/platformSupportManifest.generated.ts b/frontend-modern/src/utils/platformSupportManifest.generated.tsindex 8c72c99803..5b0cc91d74 100644--- a/frontend-modern/src/utils/platformSupportManifest.generated.ts+++ b/frontend-modern/src/utils/platformSupportManifest.generated.ts@@ -1,11 +1,11 @@// This file is generated by scripts/release_control/generate_platform_support_frontend_module.py.// Do not edit by hand.// Source: docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.json-// Source SHA256: 921181082d41829ac4884d00175791157ac500a27888ca2b81f09a9e97989bda+// Source SHA256: 11c137eb7f586114e9f835bc5429f6cae81906e6ce8eb13413df1e51752f31a0export const PLATFORM_SUPPORT_MANIFEST_SOURCE = {path: 'docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.json',- sha256: '921181082d41829ac4884d00175791157ac500a27888ca2b81f09a9e97989bda',+ sha256: '11c137eb7f586114e9f835bc5429f6cae81906e6ce8eb13413df1e51752f31a0',} as const;export const PLATFORM_SUPPORT_MANIFEST = {schemaVersion: 2,@@ -199,7 +199,14 @@ export const PLATFORM_SUPPORT_MANIFEST = {readinessStage: 'supported',primaryMode: 'api-backed',onboardingPaths: ['platform-connections'],- canonicalProjections: ['agent', 'vm', 'app-container', 'storage', 'physical-disk'],+ canonicalProjections: [+ 'agent',+ 'vm',+ 'app-container',+ 'network-share',+ 'storage',+ 'physical-disk',+ ],supportFloor: {setup: 'supported',visibility: 'supported',@@ -625,7 +632,7 @@ export const SOURCE_PLATFORM_CANONICAL_PROJECTIONS = {'proxmox-pve': ['agent', 'vm', 'system-container', 'storage', 'ceph', 'physical-disk'],'proxmox-pbs': ['pbs', 'storage'],'proxmox-pmg': ['pmg'],- truenas: ['agent', 'vm', 'app-container', 'storage', 'physical-disk'],+ truenas: ['agent', 'vm', 'app-container', 'network-share', 'storage', 'physical-disk'],'vmware-vsphere': ['agent', 'vm', 'storage'],unraid: [],'synology-dsm': [],diff --git a/frontend-modern/src/utils/reportableResourceTypes.ts b/frontend-modern/src/utils/reportableResourceTypes.tsindex 8491ebeb59..14e07c63f0 100644--- a/frontend-modern/src/utils/reportableResourceTypes.ts+++ b/frontend-modern/src/utils/reportableResourceTypes.ts@@ -29,6 +29,7 @@ export const REPORTABLE_RESOURCE_TYPES = new Set<ResourceType>(['datastore','pool','dataset',+ 'network-share','pbs','pmg',]);@@ -50,7 +51,13 @@ const WORKLOAD_TYPES = new Set<ResourceType>(['pod',]);-const STORAGE_TYPES = new Set<ResourceType>(['storage', 'datastore', 'pool', 'dataset']);+const STORAGE_TYPES = new Set<ResourceType>([+ 'storage',+ 'datastore',+ 'pool',+ 'dataset',+ 'network-share',+]);const RECOVERY_TYPES = new Set<ResourceType>(['pbs', 'datastore']);@@ -68,6 +75,7 @@ const SORT_ORDER: Record<string, number> = {datastore: 10,pool: 11,dataset: 12,+ 'network-share': 13,};export const normalizeReportableResourceType = (type: ResourceType): string => {diff --git a/frontend-modern/src/utils/reportingResourceTypes.ts b/frontend-modern/src/utils/reportingResourceTypes.tsindex d798549d34..32f2886a50 100644--- a/frontend-modern/src/utils/reportingResourceTypes.ts+++ b/frontend-modern/src/utils/reportingResourceTypes.ts@@ -12,6 +12,7 @@ export type ReportingResourceType =| 'datastore'| 'pool'| 'dataset'+ | 'network-share'| 'network-endpoint'| 'pbs'| 'pmg'diff --git a/frontend-modern/src/utils/resourceStateAdapters.ts b/frontend-modern/src/utils/resourceStateAdapters.tsindex 7282f60273..cf2095ebc7 100644--- a/frontend-modern/src/utils/resourceStateAdapters.ts+++ b/frontend-modern/src/utils/resourceStateAdapters.ts@@ -139,6 +139,7 @@ const mergePlatformData = (['pmg', 'proxmox-pmg'],['kubernetes', 'kubernetes'],['vmware', 'vmware-vsphere'],+ ['truenas', 'truenas'],['availability', 'availability'],] as const) {if (!shouldKeepSourceFacet(incomingSources, ...sourceCandidates)) {@@ -202,6 +203,7 @@ const deriveLegacySourceList = (if (getFacetRecord(resource, platformData, 'pbs')) sources.push('pbs');if (getFacetRecord(resource, platformData, 'pmg')) sources.push('pmg');if (getFacetRecord(resource, platformData, 'vmware')) sources.push('vmware');+ if (getFacetRecord(resource, platformData, 'truenas')) sources.push('truenas');if (getFacetRecord(resource, platformData, 'kubernetes')) sources.push('kubernetes');if (getFacetRecord(resource, platformData, 'docker')) sources.push('docker');if (getFacetRecord(resource, platformData, 'availability')) sources.push('availability');@@ -275,6 +277,7 @@ const canonicalizeLegacyPlatformData = (resource: Resource): Resource['platformD['pmg', resourceRecord.pmg],['kubernetes', resourceRecord.kubernetes],['vmware', resourceRecord.vmware],+ ['truenas', resourceRecord.truenas],['storage', resourceRecord.storage],['availability', resourceRecord.availability],['physicalDisk', resourceRecord.physicalDisk],@@ -296,6 +299,7 @@ const canonicalizeLegacyPlatformData = (resource: Resource): Resource['platformD'pmg','kubernetes','vmware',+ 'truenas','storage','availability','physicalDisk',@@ -627,6 +631,7 @@ export const canonicalizeRealtimeResource = (pbs: resource.pbs ?? (platformRecord?.pbs as Resource['pbs']),kubernetes: resource.kubernetes ?? (platformRecord?.kubernetes as Resource['kubernetes']),vmware: resource.vmware ?? (platformRecord?.vmware as Resource['vmware']),+ truenas: resource.truenas ?? (platformRecord?.truenas as Resource['truenas']),storage: resource.storage ?? (platformRecord?.storage as Resource['storage']),availability:resource.availability ?? (platformRecord?.availability as Resource['availability']),@@ -714,6 +719,12 @@ export const mergeCanonicalResource = (incoming: Resource, existing?: Resource):incomingSources,'vmware-vsphere',) as Resource['vmware'],+ truenas: mergeCanonicalSourceFacet(+ incoming.truenas as JsonRecord | undefined,+ existingCanonical.truenas as JsonRecord | undefined,+ incomingSources,+ 'truenas',+ ) as Resource['truenas'],availability: mergeCanonicalSourceFacet(incoming.availability as JsonRecord | undefined,existingCanonical.availability as JsonRecord | undefined,diff --git a/frontend-modern/src/utils/resourceTypeCompat.ts b/frontend-modern/src/utils/resourceTypeCompat.tsindex 5352d7c301..30f47be004 100644--- a/frontend-modern/src/utils/resourceTypeCompat.ts+++ b/frontend-modern/src/utils/resourceTypeCompat.ts@@ -9,6 +9,7 @@ export type CanonicalFrontendResourceType =| 'storage'| 'disk'| 'docker-host'+ | 'network-share'| 'pbs'| 'pmg'| 'k8s-node'@@ -66,6 +67,7 @@ export const canonicalizeFrontendResourceType = (case 'storage':case 'disk':case 'docker-host':+ case 'network-share':case 'pbs':case 'pmg':case 'k8s-node':diff --git a/frontend-modern/src/utils/resourceTypePresentation.ts b/frontend-modern/src/utils/resourceTypePresentation.tsindex 2ab5bb4e76..7faf1f59e3 100644--- a/frontend-modern/src/utils/resourceTypePresentation.ts+++ b/frontend-modern/src/utils/resourceTypePresentation.ts@@ -90,6 +90,10 @@ const RESOURCE_TYPE_PRESENTATION: Partial<Record<ResourceType | string, Resourcelabel: 'Physical Disk',badgeClasses: DEFAULT_BADGE_CLASSES,},+ 'network-share': {+ label: 'Network Share',+ badgeClasses: DEFAULT_BADGE_CLASSES,+ },ceph: {label: 'Ceph',badgeClasses: DEFAULT_BADGE_CLASSES,diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 6433337b9b..97e7c61788 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -2422,6 +2422,7 @@ func TestContract_PlatformMockToggleRebindsRuntimeConnectionsAndResources(t *tes}assertResourceCount("/api/resources?source=truenas&type=app-container", len(truenas.DefaultFixtures().Apps))+ assertResourceCount("/api/resources?source=truenas&type=network-share", len(truenas.DefaultFixtures().Shares))assertResourceCount("/api/resources?source=vmware-vsphere&type=storage", len(vmware.DefaultFixtures().Datastores))}diff --git a/internal/api/org_handlers.go b/internal/api/org_handlers.goindex bf2f592e37..18e48efce5 100644--- a/internal/api/org_handlers.go+++ b/internal/api/org_handlers.go@@ -51,6 +51,7 @@ var supportedOrganizationShareResourceTypes = map[string]struct{}{"pbs": {},"pmg": {},"physical_disk": {},+ "network-share": {},"ceph": {},"view": {},}diff --git a/internal/api/org_handlers_test.go b/internal/api/org_handlers_test.goindex 8c78d929be..5f26de524e 100644--- a/internal/api/org_handlers_test.go+++ b/internal/api/org_handlers_test.go@@ -1236,6 +1236,7 @@ func TestIsUnsupportedOrganizationShareResourceType(t *testing.T) {{name: "mixed case host unsupported", in: " HoSt ", want: true},{name: "agent supported", in: "agent", want: false},{name: "docker host supported", in: "docker-host", want: false},+ {name: "network share supported", in: "network-share", want: false},}for _, tt := range tests {diff --git a/internal/api/resources.go b/internal/api/resources.goindex 7a7649b012..fdd448240f 100644--- a/internal/api/resources.go+++ b/internal/api/resources.go@@ -1811,6 +1811,8 @@ func resourceTypeFilterAdapter(token string) []unified.ResourceType {return []unified.ResourceType{unified.ResourceTypeCeph}case "physical_disk", "physical-disk", "physicaldisk", "disk":return []unified.ResourceType{unified.ResourceTypePhysicalDisk}+ case "network-share", "network-shares", "share", "shares":+ return []unified.ResourceType{unified.ResourceTypeNetworkShare}case "network-endpoint", "network-endpoints", "endpoint", "endpoints", "availability":return []unified.ResourceType{unified.ResourceTypeNetworkEndpoint}default:diff --git a/internal/api/resources_frontend_types_test.go b/internal/api/resources_frontend_types_test.goindex eec36ac5a2..4b319ba61f 100644--- a/internal/api/resources_frontend_types_test.go+++ b/internal/api/resources_frontend_types_test.go@@ -191,6 +191,7 @@ func TestParseResourceTypesNodeAlias(t *testing.T) {{name: "unsupported k8s-pod ignored by parser", input: "k8s-pod", want: map[unified.ResourceType]struct{}{}},{name: "unsupported deployment alias ignored by parser", input: "deployment", want: map[unified.ResourceType]struct{}{}},{name: "pool", input: "pool", want: map[unified.ResourceType]struct{}{unified.ResourceTypeCeph: {}}},+ {name: "network share", input: "network-share", want: map[unified.ResourceType]struct{}{unified.ResourceTypeNetworkShare: {}}},{name: "vm", input: "vm", want: map[unified.ResourceType]struct{}{unified.ResourceTypeVM: {}}},// CSV with multiple types{name: "csv node,vm", input: "node,vm", want: map[unified.ResourceType]struct{}{diff --git a/internal/truenas/client.go b/internal/truenas/client.goindex 8f065c7f86..77207d48d2 100644--- a/internal/truenas/client.go+++ b/internal/truenas/client.go@@ -558,6 +558,73 @@ func (c *Client) getVMsREST(ctx context.Context) ([]VirtualMachine, error) {return parseVirtualMachines(response), nil}+// GetNetworkShares returns the best-effort native TrueNAS SMB/NFS sharing+// inventory. TrueNAS exposes the modern API as JSON-RPC query methods; the+// legacy REST endpoints are kept as compatibility fallbacks for older SCALE+// deployments and tests.+func (c *Client) GetNetworkShares(ctx context.Context) ([]NetworkShare, error) {+ var shares []NetworkShare+ var errors []error++ smb, err := c.getNetworkSharesRPC(ctx, "sharing.smb.query", "SMB")+ if err != nil {+ smb, err = c.getNetworkSharesREST(ctx, "/sharing/smb", "SMB")+ }+ if err != nil {+ errors = append(errors, fmt.Errorf("smb: %w", err))+ } else {+ shares = append(shares, smb...)+ }++ nfs, err := c.getNetworkSharesRPC(ctx, "sharing.nfs.query", "NFS")+ if err != nil {+ nfs, err = c.getNetworkSharesREST(ctx, "/sharing/nfs", "NFS")+ }+ if err != nil {+ errors = append(errors, fmt.Errorf("nfs: %w", err))+ } else {+ shares = append(shares, nfs...)+ }++ if len(shares) == 0 && len(errors) > 0 {+ return nil, fmt.Errorf("fetch truenas network shares: %v", errors)+ }+ return shares, nil+}++func (c *Client) getNetworkSharesRPC(ctx context.Context, method, protocol string) ([]NetworkShare, error) {+ var response []map[string]any+ if err := c.queryRPC(ctx, method, &response); err != nil {+ return nil, err+ }+ return parseNetworkShares(response, protocol), nil+}++func (c *Client) getNetworkSharesREST(ctx context.Context, path, protocol string) ([]NetworkShare, error) {+ var response []map[string]any+ if err := c.getJSON(ctx, http.MethodGet, path, &response); err != nil {+ return nil, err+ }+ return parseNetworkShares(response, protocol), nil+}++func (c *Client) queryRPC(ctx context.Context, method string, result any) error {+ conn, err := c.dialRPC(ctx)+ if err != nil {+ return err+ }+ defer func() { _ = conn.Close() }()++ rpc := trueNASRPCClient{+ conn: conn,+ nextID: 1,+ }+ if err := rpc.authenticate(ctx, c.config); err != nil {+ return err+ }+ return rpc.call(ctx, method, []any{[]any{}, map[string]any{}}, result)+}+// GetApps returns the best-effort TrueNAS app inventory as canonical workload// candidates. The API surface varies across TrueNAS releases, so we parse the// documented app.query response shape loosely.@@ -887,6 +954,7 @@ func (c *Client) FetchSnapshot(ctx context.Context) (*FixtureSnapshot, error) {// Recovery artifacts are best-effort: do not fail monitoring if additional endpoints are unavailable.apps, _ := c.GetApps(ctx)vms, _ := c.GetVMs(ctx)+ shares, _ := c.GetNetworkShares(ctx)zfsSnapshots, _ := c.GetZFSSnapshots(ctx)replicationTasks, _ := c.GetReplicationTasks(ctx)@@ -899,6 +967,7 @@ func (c *Client) FetchSnapshot(ctx context.Context) (*FixtureSnapshot, error) {Alerts: alerts,Apps: apps,VMs: vms,+ Shares: shares,ZFSSnapshots: zfsSnapshots,ReplicationTasks: replicationTasks,}, nil@@ -2534,6 +2603,108 @@ func parseVirtualMachines(entries []map[string]any) []VirtualMachine {return vms}+func parseNetworkShares(entries []map[string]any, protocol string) []NetworkShare {+ if len(entries) == 0 {+ return nil+ }+ protocol = strings.ToUpper(strings.TrimSpace(protocol))+ shares := make([]NetworkShare, 0, len(entries))+ for _, item := range entries {+ if item == nil {+ continue+ }++ share := NetworkShare{+ ID: strings.TrimSpace(readStringAny(item, "id")),+ Name: strings.TrimSpace(readStringAny(item, "name")),+ Protocol: protocol,+ Path: strings.TrimSpace(readStringAny(item, "path")),+ Dataset: strings.TrimSpace(readStringAny(item, "dataset")),+ RelativePath: strings.TrimSpace(readStringAny(item, "relative_path", "relativePath")),+ Comment: strings.TrimSpace(readStringAny(item, "comment")),+ Enabled: readBoolAnyDefault(item, true, "enabled"),+ Locked: readBoolAny(item, "locked"),+ Aliases: dedupeStrings(readStringSliceAny(item, "aliases")),+ Hosts: dedupeStrings(readStringSliceAny(item, "hosts")),+ Networks: dedupeStrings(readStringSliceAny(item, "networks")),+ Security: dedupeStrings(readStringSliceAny(item, "security")),+ MapRootUser: strings.TrimSpace(readStringAny(item, "maproot_user", "maprootUser")),+ MapRootGroup: strings.TrimSpace(readStringAny(item, "maproot_group", "maprootGroup")),+ MapAllUser: strings.TrimSpace(readStringAny(item, "mapall_user", "mapallUser")),+ MapAllGroup: strings.TrimSpace(readStringAny(item, "mapall_group", "mapallGroup")),+ ExposeSnapshots: readBoolAny(item, "expose_snapshots", "exposeSnapshots"),+ AccessBasedEnumeration: readBoolAny(item, "access_based_share_enumeration", "accessBasedShareEnumeration"),+ }++ switch protocol {+ case "SMB":+ share.ReadOnly = readBoolAny(item, "readonly", "read_only", "readOnly")+ share.Browsable = readBoolAnyDefault(item, true, "browsable")+ share.AuditEnabled = readBoolAny(readMapAny(item, "audit"), "enable")+ case "NFS":+ share.ReadOnly = readBoolAny(item, "ro", "readonly", "read_only", "readOnly")+ }++ if share.Dataset == "" {+ share.Dataset = datasetFromSharePath(share.Path)+ }+ if share.Name == "" {+ share.Name = networkShareDisplayName(share)+ }+ if share.ID == "" {+ share.ID = share.Name+ }+ if share.ID == "" && share.Path == "" {+ continue+ }+ shares = append(shares, share)+ }+ if len(shares) == 0 {+ return nil+ }+ return shares+}++func readBoolAnyDefault(record map[string]any, defaultValue bool, keys ...string) bool {+ if record == nil {+ return defaultValue+ }+ for _, key := range keys {+ if value, ok := record[key]; ok && value != nil {+ return readBoolAny(map[string]any{"value": value}, "value")+ }+ }+ return defaultValue+}++func datasetFromSharePath(path string) string {+ path = strings.TrimSpace(path)+ if path == "" || strings.EqualFold(path, "EXTERNAL") {+ return ""+ }+ path = strings.TrimPrefix(path, "/mnt/")+ path = strings.Trim(path, "/")+ if path == "" {+ return ""+ }+ parts := strings.Split(path, "/")+ if len(parts) == 1 {+ return strings.TrimSpace(parts[0])+ }+ return strings.TrimSpace(parts[0] + "/" + parts[1])+}++func poolFromSharePath(path string) string {+ dataset := datasetFromSharePath(path)+ if dataset == "" {+ return ""+ }+ if idx := strings.Index(dataset, "/"); idx > 0 {+ return strings.TrimSpace(dataset[:idx])+ }+ return strings.TrimSpace(dataset)+}+type vmDeviceCounts struct {total intdisks intdiff --git a/internal/truenas/client_test.go b/internal/truenas/client_test.goindex b219b63bd6..dcc3eed97d 100644--- a/internal/truenas/client_test.go+++ b/internal/truenas/client_test.go@@ -134,6 +134,20 @@ func TestClientGetters(t *testing.T) {if len(apps[0].Volumes) != 2 || len(apps[0].Networks) != 1 {t.Fatalf("unexpected app volume/network mapping: volumes=%d networks=%d", len(apps[0].Volumes), len(apps[0].Networks))}++ shares, err := client.GetNetworkShares(ctx)+ if err != nil {+ t.Fatalf("GetNetworkShares() error = %v", err)+ }+ if len(shares) != 2 {+ t.Fatalf("expected 2 network shares, got %d", len(shares))+ }+ if shares[0].Name != "Media" || shares[0].Protocol != "SMB" || shares[0].Dataset != "tank/media" || !shares[0].AuditEnabled {+ t.Fatalf("unexpected SMB share mapping: %+v", shares[0])+ }+ if shares[1].Name != "tank/projects" || shares[1].Protocol != "NFS" || !shares[1].ReadOnly || len(shares[1].Networks) != 1 {+ t.Fatalf("unexpected NFS share mapping: %+v", shares[1])+ }}func TestClientAuthHeaderAPIKey(t *testing.T) {@@ -248,9 +262,9 @@ func TestFetchSnapshot(t *testing.T) {if snapshot.System.Hostname != "truenas-main" {t.Fatalf("unexpected snapshot system: %+v", snapshot.System)}- if len(snapshot.Pools) != 1 || len(snapshot.Datasets) != 1 || len(snapshot.Disks) != 2 || len(snapshot.Alerts) != 1 || len(snapshot.Apps) != 1 || len(snapshot.VMs) != 1 {- t.Fatalf("unexpected snapshot counts: pools=%d datasets=%d disks=%d alerts=%d apps=%d vms=%d",- len(snapshot.Pools), len(snapshot.Datasets), len(snapshot.Disks), len(snapshot.Alerts), len(snapshot.Apps), len(snapshot.VMs))+ if len(snapshot.Pools) != 1 || len(snapshot.Datasets) != 1 || len(snapshot.Disks) != 2 || len(snapshot.Alerts) != 1 || len(snapshot.Apps) != 1 || len(snapshot.VMs) != 1 || len(snapshot.Shares) != 2 {+ t.Fatalf("unexpected snapshot counts: pools=%d datasets=%d disks=%d alerts=%d apps=%d vms=%d shares=%d",+ len(snapshot.Pools), len(snapshot.Datasets), len(snapshot.Disks), len(snapshot.Alerts), len(snapshot.Apps), len(snapshot.VMs), len(snapshot.Shares))}if snapshot.Disks[0].Temperature != 34 || snapshot.Disks[1].Temperature != 49 {t.Fatalf("unexpected snapshot disk temperatures: %+v", snapshot.Disks)@@ -1253,6 +1267,12 @@ func defaultAPIResponses() map[string]apiResponse {"/api/v2.0/vm": {body: `[{"id":42,"name":"windows-lab","vcpus":4,"cores":2,"threads":2,"memory":8192,"bootloader":"UEFI","autostart":true,"status":{"state":"RUNNING","pid":1234,"domain_state":"RUNNING"},"devices":[{"id":1,"attributes":{"dtype":"DISK"}},{"id":2,"attributes":{"dtype":"NIC"}}]}]`,},+ "/api/v2.0/sharing/smb": {+ body: `[{"id":1,"name":"Media","path":"/mnt/tank/media","dataset":"tank/media","enabled":true,"comment":"Household media","readonly":false,"browsable":true,"access_based_share_enumeration":true,"locked":false,"audit":{"enable":true}}]`,+ },+ "/api/v2.0/sharing/nfs": {+ body: `[{"id":2,"path":"/mnt/tank/projects","dataset":"tank/projects","comment":"Linux exports","enabled":true,"ro":true,"networks":["10.10.20.0/24"],"hosts":[],"security":["SYS"],"locked":false}]`,+ },}}diff --git a/internal/truenas/contract_test.go b/internal/truenas/contract_test.goindex 7dfa033426..f85c245a80 100644--- a/internal/truenas/contract_test.go+++ b/internal/truenas/contract_test.go@@ -52,7 +52,7 @@ func TestRegistryIngestRecordsTreatsTrueNASAsGenericDataSource(t *testing.T) {registry.IngestRecords(unifiedresources.SourceTrueNAS, records)resources := registry.List()- wantCount := 1 + len(fixtures.Pools) + len(fixtures.Datasets) + len(fixtures.Disks) + len(fixtures.Apps) + len(fixtures.VMs)+ wantCount := 1 + len(fixtures.Pools) + len(fixtures.Datasets) + len(fixtures.Disks) + len(fixtures.Apps) + len(fixtures.VMs) + len(fixtures.Shares)if len(resources) != wantCount {t.Fatalf("expected %d resources, got %d", wantCount, len(resources))}@@ -194,6 +194,24 @@ func TestRegistryIngestRecordsTreatsTrueNASAsGenericDataSource(t *testing.T) {t.Fatalf("expected windows-lab status online, got %q", vm.Status)}+ share := requireResource(t, resources, unifiedresources.ResourceTypeNetworkShare, "Media")+ assertSourceTracking(t, *share, unifiedresources.SourceTrueNAS)+ if share.ParentID == nil || *share.ParentID != requireResource(t, resources, unifiedresources.ResourceTypeStorage, "tank/media").ID {+ t.Fatalf("expected share parent to be tank/media dataset, got %+v", share.ParentID)+ }+ if share.TrueNAS == nil || share.TrueNAS.Share == nil {+ t.Fatal("expected native TrueNAS share metadata on network-share resource")+ }+ if share.TrueNAS.Share.Protocol != "SMB" || share.TrueNAS.Share.Path != "/mnt/tank/media" {+ t.Fatalf("unexpected native TrueNAS share metadata: %+v", share.TrueNAS.Share)+ }+ if !share.TrueNAS.Share.Enabled || !share.TrueNAS.Share.Browsable || !share.TrueNAS.Share.AccessBasedEnumeration || !share.TrueNAS.Share.AuditEnabled {+ t.Fatalf("expected native SMB share flags, got %+v", share.TrueNAS.Share)+ }+ if share.Status != unifiedresources.StatusOnline {+ t.Fatalf("expected Media share status online, got %q", share.Status)+ }+disk := requireResource(t, resources, unifiedresources.ResourceTypePhysicalDisk, "sda")assertSourceTracking(t, *disk, unifiedresources.SourceTrueNAS)if disk.ParentID == nil || *disk.ParentID != pool.ID {@@ -264,7 +282,7 @@ func TestTrueNASResourcesFlowThroughUnifiedTypesWithoutSpecialCasing(t *testing.t.Fatalf("expected canonical render type, got truenas-specific type for %s", resource.ID)}switch resource.Type {- case unifiedresources.ResourceTypeAgent, unifiedresources.ResourceTypeStorage, unifiedresources.ResourceTypePhysicalDisk, unifiedresources.ResourceTypeAppContainer, unifiedresources.ResourceTypeVM:+ case unifiedresources.ResourceTypeAgent, unifiedresources.ResourceTypeStorage, unifiedresources.ResourceTypePhysicalDisk, unifiedresources.ResourceTypeAppContainer, unifiedresources.ResourceTypeVM, unifiedresources.ResourceTypeNetworkShare:default:t.Fatalf("unexpected unified type for truenas fixture resource: %s (%s)", resource.Type, resource.ID)}diff --git a/internal/truenas/fixtures.go b/internal/truenas/fixtures.goindex 7dc75fc8a4..b5fcbbe963 100644--- a/internal/truenas/fixtures.go+++ b/internal/truenas/fixtures.go@@ -768,6 +768,43 @@ func DefaultFixtures() FixtureSnapshot {DisplayCount: 1,},},+ Shares: []NetworkShare{+ {+ ID: "1",+ Name: "Media",+ Protocol: "SMB",+ Path: "/mnt/tank/media",+ Dataset: "tank/media",+ Comment: "Household media library",+ Enabled: true,+ Browsable: true,+ AccessBasedEnumeration: true,+ AuditEnabled: true,+ },+ {+ ID: "2",+ Name: "Projects",+ Protocol: "NFS",+ Path: "/mnt/tank/projects",+ Dataset: "tank/projects",+ Comment: "Linux build and lab exports",+ Enabled: true,+ Networks: []string{"10.10.20.0/24"},+ Security: []string{"SYS"},+ MapRootUser: "root",+ },+ {+ ID: "3",+ Name: "Compliance Archive",+ Protocol: "SMB",+ Path: "/mnt/vault/compliance",+ Dataset: "vault/compliance",+ Comment: "Read-only compliance evidence",+ Enabled: true,+ ReadOnly: true,+ Browsable: true,+ },+ },ZFSSnapshots: []ZFSSnapshot{{ID: "zfs-snapshot-tank-apps-20260331-0600",diff --git a/internal/truenas/provider.go b/internal/truenas/provider.goindex 3cb60bf725..99ba1d2f83 100644--- a/internal/truenas/provider.go+++ b/internal/truenas/provider.go@@ -457,7 +457,7 @@ func truenasRecordsFromSnapshot(snapshot *FixtureSnapshot, now func() time.Time)systemRisk := unifiedresources.StorageRiskFromAssessment(systemAssessment)_, protectionReduced, rebuildInProgress, protectionSummary, rebuildSummary := unifiedresources.StorageRiskSemantics(systemRisk)systemIncidents, poolIncidents, diskIncidents := buildIncidentAssignments(snapshot)- records := make([]unifiedresources.IngestRecord, 0, 1+len(snapshot.Pools)+len(snapshot.Datasets)+len(snapshot.Apps)+len(snapshot.VMs)+len(snapshot.Disks))+ records := make([]unifiedresources.IngestRecord, 0, 1+len(snapshot.Pools)+len(snapshot.Datasets)+len(snapshot.Apps)+len(snapshot.VMs)+len(snapshot.Shares)+len(snapshot.Disks))totalCapacity, totalUsed := aggregatePoolUsage(snapshot.Pools)systemAgent := agentDataFromTrueNASSystem(snapshot.System, systemRisk, protectionReduced, protectionSummary, rebuildInProgress, rebuildSummary)@@ -664,6 +664,37 @@ func truenasRecordsFromSnapshot(snapshot *FixtureSnapshot, now func() time.Time)})}+ for _, share := range snapshot.Shares {+ parentSourceID := systemSourceID+ if dataset := strings.TrimSpace(share.Dataset); dataset != "" {+ parentSourceID = datasetSourceID(dataset)+ } else if pool := poolFromSharePath(share.Path); pool != "" {+ parentSourceID = poolSourceID(pool)+ }+ records = append(records, unifiedresources.IngestRecord{+ SourceID: networkShareSourceID(share),+ ParentSourceID: parentSourceID,+ Resource: unifiedresources.Resource{+ Type: unifiedresources.ResourceTypeNetworkShare,+ Name: networkShareDisplayName(share),+ Status: statusFromNetworkShare(share),+ LastSeen: collectedAt,+ UpdatedAt: collectedAt,+ TrueNAS: &unifiedresources.TrueNASData{+ Hostname: strings.TrimSpace(snapshot.System.Hostname),+ Share: trueNASShareDataFromNetworkShare(share),+ },+ Tags: networkShareTags(share),+ },+ Identity: unifiedresources.ResourceIdentity{+ Hostnames: dedupeStrings([]string{+ strings.TrimSpace(snapshot.System.Hostname),+ networkShareDisplayName(share),+ }),+ },+ })+ }+for _, disk := range snapshot.Disks {assessment := assessDisk(disk)incidents := diskIncidents[strings.TrimSpace(disk.Name)]@@ -1242,6 +1273,21 @@ func virtualMachineSourceID(vm VirtualMachine) string {return "vm:" + virtualMachineDisplayName(vm)}+func networkShareSourceID(share NetworkShare) string {+ protocol := strings.ToLower(strings.TrimSpace(share.Protocol))+ if protocol == "" {+ protocol = "share"+ }+ stable := strings.TrimSpace(share.ID)+ if stable == "" {+ stable = networkShareDisplayName(share)+ }+ if stable == "" {+ stable = strings.TrimSpace(share.Path)+ }+ return "share:" + protocol + ":" + stable+}+func diskSourceID(name string) string {return "disk:" + strings.TrimSpace(name)}@@ -1267,6 +1313,26 @@ func virtualMachineDisplayName(vm VirtualMachine) string {return strings.TrimSpace(vm.ID)}+func networkShareDisplayName(share NetworkShare) string {+ if name := strings.TrimSpace(share.Name); name != "" {+ return name+ }+ if len(share.Aliases) > 0 {+ if alias := strings.TrimSpace(share.Aliases[0]); alias != "" {+ return alias+ }+ }+ if dataset := strings.TrimSpace(share.Dataset); dataset != "" {+ return dataset+ }+ path := strings.Trim(strings.TrimSpace(share.Path), "/")+ if path == "" {+ return strings.TrimSpace(share.ID)+ }+ parts := strings.Split(path, "/")+ return strings.TrimSpace(parts[len(parts)-1])+}+func findAppInSnapshot(snapshot *FixtureSnapshot, appID string) (*App, error) {if snapshot == nil {return nil, fmt.Errorf("truenas snapshot is unavailable")@@ -1545,6 +1611,33 @@ func trueNASVMDataFromVirtualMachine(vm VirtualMachine) *unifiedresources.TrueNA}}+func trueNASShareDataFromNetworkShare(share NetworkShare) *unifiedresources.TrueNASShare {+ return &unifiedresources.TrueNASShare{+ ID: strings.TrimSpace(share.ID),+ Name: networkShareDisplayName(share),+ Protocol: strings.ToUpper(strings.TrimSpace(share.Protocol)),+ Path: strings.TrimSpace(share.Path),+ Dataset: strings.TrimSpace(share.Dataset),+ RelativePath: strings.TrimSpace(share.RelativePath),+ Comment: strings.TrimSpace(share.Comment),+ Enabled: share.Enabled,+ ReadOnly: share.ReadOnly,+ Browsable: share.Browsable,+ Locked: share.Locked,+ AccessBasedEnumeration: share.AccessBasedEnumeration,+ AuditEnabled: share.AuditEnabled,+ ExposeSnapshots: share.ExposeSnapshots,+ Aliases: dedupeStrings(share.Aliases),+ Hosts: dedupeStrings(share.Hosts),+ Networks: dedupeStrings(share.Networks),+ Security: dedupeStrings(share.Security),+ MapRootUser: strings.TrimSpace(share.MapRootUser),+ MapRootGroup: strings.TrimSpace(share.MapRootGroup),+ MapAllUser: strings.TrimSpace(share.MapAllUser),+ MapAllGroup: strings.TrimSpace(share.MapAllGroup),+ }+}+func copyStringLabels(labels map[string]string) map[string]string {if len(labels) == 0 {return nil@@ -1603,6 +1696,16 @@ func statusFromVirtualMachine(vm VirtualMachine) unifiedresources.ResourceStatus}}+func statusFromNetworkShare(share NetworkShare) unifiedresources.ResourceStatus {+ if !share.Enabled {+ return unifiedresources.StatusOffline+ }+ if share.Locked {+ return unifiedresources.StatusWarning+ }+ return unifiedresources.StatusOnline+}+func virtualMachineTags(vm VirtualMachine) []string {tags := []string{"truenas", "vm"}if state := strings.ToLower(strings.TrimSpace(vm.State)); state != "" {@@ -1623,6 +1726,23 @@ func virtualMachineTags(vm VirtualMachine) []string {return dedupeStrings(tags)}+func networkShareTags(share NetworkShare) []string {+ tags := []string{"truenas", "share"}+ if protocol := strings.ToLower(strings.TrimSpace(share.Protocol)); protocol != "" {+ tags = append(tags, protocol)+ }+ if share.ReadOnly {+ tags = append(tags, "readonly")+ }+ if share.Locked {+ tags = append(tags, "locked")+ }+ if dataset := strings.TrimSpace(share.Dataset); dataset != "" {+ tags = append(tags, "dataset:"+dataset)+ }+ return dedupeStrings(tags)+}+func truenasAppCapabilities() []unifiedresources.ResourceCapability {return []unifiedresources.ResourceCapability{{@@ -1910,6 +2030,7 @@ func copyFixtureSnapshot(snapshot *FixtureSnapshot) *FixtureSnapshot {copied.Alerts = append([]Alert(nil), snapshot.Alerts...)copied.Apps = cloneApps(snapshot.Apps)copied.VMs = append([]VirtualMachine(nil), snapshot.VMs...)+ copied.Shares = cloneNetworkShares(snapshot.Shares)copied.ZFSSnapshots = append([]ZFSSnapshot(nil), snapshot.ZFSSnapshots...)copied.ReplicationTasks = append([]ReplicationTask(nil), snapshot.ReplicationTasks...)return &copied@@ -1948,6 +2069,21 @@ func cloneApps(apps []App) []App {return out}+func cloneNetworkShares(shares []NetworkShare) []NetworkShare {+ if len(shares) == 0 {+ return nil+ }+ out := make([]NetworkShare, len(shares))+ for i := range shares {+ out[i] = shares[i]+ out[i].Aliases = append([]string(nil), shares[i].Aliases...)+ out[i].Hosts = append([]string(nil), shares[i].Hosts...)+ out[i].Networks = append([]string(nil), shares[i].Networks...)+ out[i].Security = append([]string(nil), shares[i].Security...)+ }+ return out+}+func cloneAppPorts(ports []AppPort) []AppPort {if len(ports) == 0 {return nildiff --git a/internal/truenas/types.go b/internal/truenas/types.goindex b4a087cf28..a48329c6a6 100644--- a/internal/truenas/types.go+++ b/internal/truenas/types.go@@ -12,6 +12,7 @@ type FixtureSnapshot struct {Alerts []AlertApps []AppVMs []VirtualMachine+ Shares []NetworkShareZFSSnapshots []ZFSSnapshotReplicationTasks []ReplicationTask}@@ -252,6 +253,33 @@ type VirtualMachine struct {PCICount int}+// NetworkShare mirrors the subset of TrueNAS SMB/NFS sharing fields needed for+// canonical NAS share inventory.+type NetworkShare struct {+ ID string+ Name string+ Protocol string+ Path string+ Dataset string+ RelativePath string+ Comment string+ Enabled bool+ ReadOnly bool+ Browsable bool+ Locked bool+ AccessBasedEnumeration bool+ AuditEnabled bool+ ExposeSnapshots bool+ Aliases []string+ Hosts []string+ Networks []string+ Security []string+ MapRootUser string+ MapRootGroup string+ MapAllUser string+ MapAllGroup string+}+// ZFSSnapshot mirrors the subset of snapshot fields needed for recovery-point mapping.type ZFSSnapshot struct {ID stringdiff --git a/internal/unifiedresources/canonical_ids_types_test.go b/internal/unifiedresources/canonical_ids_types_test.goindex 967df6dddf..e3a2459389 100644--- a/internal/unifiedresources/canonical_ids_types_test.go+++ b/internal/unifiedresources/canonical_ids_types_test.go@@ -65,6 +65,16 @@ func TestContractResourceType(t *testing.T) {},want: ResourceTypeVM,},+ {+ name: "network share passthrough remains canonical",+ resource: Resource{+ Type: ResourceTypeNetworkShare,+ TrueNAS: &TrueNASData{+ Share: &TrueNASShare{ID: "smb-media", Protocol: "SMB"},+ },+ },+ want: ResourceTypeNetworkShare,+ },}for _, tt := range tests {diff --git a/internal/unifiedresources/clone.go b/internal/unifiedresources/clone.goindex 37f746d0d8..0c3138cb71 100644--- a/internal/unifiedresources/clone.go+++ b/internal/unifiedresources/clone.go@@ -359,6 +359,7 @@ func cloneTrueNASData(in *TrueNASData) *TrueNASData {out.StorageRisk = cloneStorageRisk(in.StorageRisk)out.App = cloneTrueNASApp(in.App)out.VM = cloneTrueNASVM(in.VM)+ out.Share = cloneTrueNASShare(in.Share)return &out}@@ -425,6 +426,18 @@ func cloneTrueNASVM(in *TrueNASVM) *TrueNASVM {return &out}+func cloneTrueNASShare(in *TrueNASShare) *TrueNASShare {+ if in == nil {+ return nil+ }+ out := *in+ out.Aliases = append([]string(nil), in.Aliases...)+ out.Hosts = append([]string(nil), in.Hosts...)+ out.Networks = append([]string(nil), in.Networks...)+ out.Security = append([]string(nil), in.Security...)+ return &out+}+func cloneCPUInfo(in *CPUInfo) *CPUInfo {if in == nil {return nildiff --git a/internal/unifiedresources/policy_metadata.go b/internal/unifiedresources/policy_metadata.goindex 8fcbd9e8fb..c0e2f781f4 100644--- a/internal/unifiedresources/policy_metadata.go+++ b/internal/unifiedresources/policy_metadata.go@@ -141,7 +141,8 @@ func classifyResourceSensitivity(resource Resource) ResourceSensitivity {ResourceTypeStorage,ResourceTypePBS,ResourceTypePhysicalDisk,- ResourceTypeCeph:+ ResourceTypeCeph,+ ResourceTypeNetworkShare:return ResourceSensitivitySensitive}@@ -279,6 +280,8 @@ func resourceSummaryType(resource Resource) string {return "ceph cluster"case ResourceTypePhysicalDisk:return "physical disk"+ case ResourceTypeNetworkShare:+ return "network share"default:if trimmed := strings.TrimSpace(string(CanonicalResourceType(resource.Type))); trimmed != "" {return trimmed@@ -320,6 +323,9 @@ func resourceHasFilesystemPath(resource Resource) bool {if resource.Storage != nil && strings.TrimSpace(resource.Storage.Path) != "" {return true}+ if resource.TrueNAS != nil && resource.TrueNAS.Share != nil && strings.TrimSpace(resource.TrueNAS.Share.Path) != "" {+ return true+ }return false}diff --git a/internal/unifiedresources/registry.go b/internal/unifiedresources/registry.goindex acf4d8ce5a..0300070922 100644--- a/internal/unifiedresources/registry.go+++ b/internal/unifiedresources/registry.go@@ -1562,6 +1562,9 @@ func mergeTrueNASData(existing *TrueNASData, incoming *TrueNASData) *TrueNASDataif incoming.VM != nil {merged.VM = cloneTrueNASVM(incoming.VM)}+ if incoming.Share != nil {+ merged.Share = cloneTrueNASShare(incoming.Share)+ }return &merged}diff --git a/internal/unifiedresources/registry_merge_policy_test.go b/internal/unifiedresources/registry_merge_policy_test.goindex efc1a51398..c04931be57 100644--- a/internal/unifiedresources/registry_merge_policy_test.go+++ b/internal/unifiedresources/registry_merge_policy_test.go@@ -1,6 +1,10 @@package unifiedresources-import "testing"+import (+ "strings"+ "testing"+ "time"+)func TestLinkedMergeAllowsOneSidedNodeHostLinkWhenHostnameCorroborates(t *testing.T) {registry := NewRegistry(NewMemoryStore())@@ -172,6 +176,18 @@ func TestMergeTrueNASDataPreservesNativeAppFacetAsClone(t *testing.T) {VCPUs: 4,MemoryBytes: 8 * 1024 * 1024 * 1024,},+ Share: &TrueNASShare{+ ID: "smb-media",+ Name: "Media",+ Protocol: "SMB",+ Path: "/mnt/tank/media",+ Dataset: "tank/media",+ Enabled: true,+ Aliases: []string{"media"},+ Hosts: []string{"media.lab"},+ Networks: []string{"10.10.20.0/24"},+ Security: []string{"SYS"},+ },}merged := mergeTrueNASData(existing, incoming)@@ -193,6 +209,12 @@ func TestMergeTrueNASDataPreservesNativeAppFacetAsClone(t *testing.T) {if merged.VM == incoming.VM {t.Fatal("expected merged TrueNAS VM facet to be cloned")}+ if merged.Share == nil || merged.Share.ID != "smb-media" || merged.Share.Dataset != "tank/media" {+ t.Fatalf("unexpected merged TrueNAS share facet: %+v", merged.Share)+ }+ if merged.Share == incoming.Share {+ t.Fatal("expected merged TrueNAS share facet to be cloned")+ }incoming.App.Images[0] = "mutated:latest"incoming.App.Volumes[0].Source = "mutated"@@ -200,6 +222,10 @@ func TestMergeTrueNASDataPreservesNativeAppFacetAsClone(t *testing.T) {incoming.App.UsedPorts[0].HostPorts[0].HostPort = 39999incoming.App.Containers[0].PortConfig[0].HostPorts[0].HostPort = 39999incoming.App.Containers[0].VolumeMounts[0].Source = "mutated"+ incoming.Share.Aliases[0] = "mutated"+ incoming.Share.Hosts[0] = "mutated"+ incoming.Share.Networks[0] = "mutated"+ incoming.Share.Security[0] = "mutated"if got := merged.App.Images[0]; got != "nextcloud:stable" {t.Fatalf("merged app image mutated through incoming slice: %q", got)@@ -219,6 +245,63 @@ func TestMergeTrueNASDataPreservesNativeAppFacetAsClone(t *testing.T) {if got := merged.App.Containers[0].VolumeMounts[0].Source; got != "ix-apps/nextcloud" {t.Fatalf("merged app container volume mount mutated through incoming slice: %q", got)}+ if got := merged.Share.Aliases[0]; got != "media" {+ t.Fatalf("merged share alias mutated through incoming slice: %q", got)+ }+ if got := merged.Share.Hosts[0]; got != "media.lab" {+ t.Fatalf("merged share host mutated through incoming slice: %q", got)+ }+ if got := merged.Share.Networks[0]; got != "10.10.20.0/24" {+ t.Fatalf("merged share network mutated through incoming slice: %q", got)+ }+ if got := merged.Share.Security[0]; got != "SYS" {+ t.Fatalf("merged share security mutated through incoming slice: %q", got)+ }+}++func TestTrueNASNetworkSharePolicyAndParentRelationship(t *testing.T) {+ parentID := "storage:truenas:tank/media"+ resource := Resource{+ ID: "network-share:truenas-main:smb:media",+ Type: ResourceTypeNetworkShare,+ Name: "SMB Media",+ ParentID: &parentID,+ Status: StatusOnline,+ LastSeen: time.Date(2026, 5, 20, 12, 0, 0, 0, time.UTC),+ Sources: []DataSource{SourceTrueNAS},+ TrueNAS: &TrueNASData{+ Share: &TrueNASShare{+ ID: "smb-media",+ Name: "Media",+ Protocol: "SMB",+ Path: "/mnt/tank/media",+ Dataset: "tank/media",+ Enabled: true,+ },+ },+ }++ RefreshPolicyMetadata(&resource)+ if resource.Policy == nil || resource.Policy.Sensitivity != ResourceSensitivitySensitive {+ t.Fatalf("network-share policy = %+v, want sensitive", resource.Policy)+ }+ if !containsRedactionHint(resource.Policy.Routing.Redact, ResourceRedactionPath) {+ t.Fatalf("network-share policy redactions = %+v, want path", resource.Policy.Routing.Redact)+ }+ if !strings.Contains(resource.AISafeSummary, "network share resource") {+ t.Fatalf("network-share AI safe summary = %q", resource.AISafeSummary)+ }++ relationships := ResourceRelationshipsWithCanonicalParent(resource)+ if len(relationships) != 1 {+ t.Fatalf("expected one parent relationship, got %#v", relationships)+ }+ if got := relationships[0].Type; got != RelMountedTo {+ t.Fatalf("network-share parent relationship = %q, want %q", got, RelMountedTo)+ }+ if relationships[0].TargetID != parentID {+ t.Fatalf("network-share parent target = %q, want %q", relationships[0].TargetID, parentID)+ }}func containsDataSource(sources []DataSource, want DataSource) bool {diff --git a/internal/unifiedresources/relationships.go b/internal/unifiedresources/relationships.goindex 54020a3e09..7bc4d0d85d 100644--- a/internal/unifiedresources/relationships.go+++ b/internal/unifiedresources/relationships.go@@ -88,7 +88,7 @@ func parentRelationshipType(resourceType ResourceType) RelationshipType {ResourceTypePMG,ResourceTypeCeph:return RelRunsOn- case ResourceTypeStorage, ResourceTypePhysicalDisk:+ case ResourceTypeStorage, ResourceTypePhysicalDisk, ResourceTypeNetworkShare:return RelMountedTocase ResourceTypeAgent, ResourceTypeK8sNode, ResourceTypePod, ResourceTypeK8sDeployment:return RelOwnedBydiff --git a/internal/unifiedresources/types.go b/internal/unifiedresources/types.goindex 574542ec17..46295914fe 100644--- a/internal/unifiedresources/types.go+++ b/internal/unifiedresources/types.go@@ -134,6 +134,7 @@ const (ResourceTypePMG ResourceType = "pmg"ResourceTypeCeph ResourceType = "ceph"ResourceTypePhysicalDisk ResourceType = "physical_disk"+ ResourceTypeNetworkShare ResourceType = "network-share"ResourceTypeNetworkEndpoint ResourceType = "network-endpoint")@@ -1029,18 +1030,19 @@ type VMwareData struct {// TrueNASData contains TrueNAS-specific metadata for TrueNAS resources.type TrueNASData struct {- Hostname string `json:"hostname,omitempty"`- Version string `json:"version,omitempty"`- UptimeSeconds int64 `json:"uptimeSeconds,omitempty"`- StorageRisk *StorageRisk `json:"storageRisk,omitempty"`- StorageRiskSummary string `json:"storageRiskSummary,omitempty"`- StoragePostureSummary string `json:"storagePostureSummary,omitempty"`- ProtectionReduced bool `json:"protectionReduced,omitempty"`- ProtectionSummary string `json:"protectionSummary,omitempty"`- RebuildInProgress bool `json:"rebuildInProgress,omitempty"`- RebuildSummary string `json:"rebuildSummary,omitempty"`- App *TrueNASApp `json:"app,omitempty"`- VM *TrueNASVM `json:"vm,omitempty"`+ Hostname string `json:"hostname,omitempty"`+ Version string `json:"version,omitempty"`+ UptimeSeconds int64 `json:"uptimeSeconds,omitempty"`+ StorageRisk *StorageRisk `json:"storageRisk,omitempty"`+ StorageRiskSummary string `json:"storageRiskSummary,omitempty"`+ StoragePostureSummary string `json:"storagePostureSummary,omitempty"`+ ProtectionReduced bool `json:"protectionReduced,omitempty"`+ ProtectionSummary string `json:"protectionSummary,omitempty"`+ RebuildInProgress bool `json:"rebuildInProgress,omitempty"`+ RebuildSummary string `json:"rebuildSummary,omitempty"`+ App *TrueNASApp `json:"app,omitempty"`+ VM *TrueNASVM `json:"vm,omitempty"`+ Share *TrueNASShare `json:"share,omitempty"`}// TrueNASApp contains app.query / active_workloads data for one TrueNAS app.@@ -1143,6 +1145,33 @@ type TrueNASVM struct {PCICount int `json:"pciCount,omitempty"`}+// TrueNASShare contains sharing.smb.query / sharing.nfs.query data for one+// native TrueNAS network share.+type TrueNASShare struct {+ ID string `json:"id,omitempty"`+ Name string `json:"name,omitempty"`+ Protocol string `json:"protocol,omitempty"`+ Path string `json:"path,omitempty"`+ Dataset string `json:"dataset,omitempty"`+ RelativePath string `json:"relativePath,omitempty"`+ Comment string `json:"comment,omitempty"`+ Enabled bool `json:"enabled"`+ ReadOnly bool `json:"readOnly"`+ Browsable bool `json:"browsable,omitempty"`+ Locked bool `json:"locked,omitempty"`+ AccessBasedEnumeration bool `json:"accessBasedEnumeration,omitempty"`+ AuditEnabled bool `json:"auditEnabled,omitempty"`+ ExposeSnapshots bool `json:"exposeSnapshots,omitempty"`+ Aliases []string `json:"aliases,omitempty"`+ Hosts []string `json:"hosts,omitempty"`+ Networks []string `json:"networks,omitempty"`+ Security []string `json:"security,omitempty"`+ MapRootUser string `json:"mapRootUser,omitempty"`+ MapRootGroup string `json:"mapRootGroup,omitempty"`+ MapAllUser string `json:"mapAllUser,omitempty"`+ MapAllGroup string `json:"mapAllGroup,omitempty"`+}+// AvailabilityData contains agentless endpoint probe metadata for a resource.type AvailabilityData struct {TargetID string `json:"targetId,omitempty"`