Skip to content

armgit / Pulse

Public Imported from GitHub
0

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

Read TrueNAS dataset state through the shared helper

rcourtmand504f4f9bd68
diff --git a/frontend-modern/browser-verification/26310d16c7eb281c.json b/frontend-modern/browser-verification/26310d16c7eb281c.json
new file mode 100644
index 0000000000..f924cd129f
--- /dev/null
+++ b/frontend-modern/browser-verification/26310d16c7eb281c.json
@@ -0,0 +1,33 @@
+{
+ "version": 1,
+ "base_sha": "146595b8484aa742e22e218675ea141164b55d4a",
+ "verified_at": "2026-10-05T06:53:20Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/truenas/truenasPageModel.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/truenas/truenasPageModel.ts": "67c724aa3023666c689a06f5cc4b92f634ab632b0e8842ee6fc709f3a06ed9b6"
+ },
+ "routes": [
+ "/truenas/storage"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Storage Health cells after switching the dataset state reason to the shared util: the archive pool lists its volume alert and the copied SMART alert, archive/cold reads Dataset is read-only, sdc reads its SMART failure. Same text as before the switch, now from the mapping the drawer also uses",
+ "Phone at 390: the table keeps its dot-only projection, and tapping archive/cold opens a drawer that says Dataset is read-only"
+ ],
+ "interactions": [
+ "Read every Health cell title on the storage table",
+ "Tapped archive/cold on a 390 phone"
+ ]
+}
diff --git a/frontend-modern/src/features/truenas/truenasPageModel.ts b/frontend-modern/src/features/truenas/truenasPageModel.ts
index 09dfc3e2a7..8279c78afe 100644
--- a/frontend-modern/src/features/truenas/truenasPageModel.ts
+++ b/frontend-modern/src/features/truenas/truenasPageModel.ts
@@ -1,6 +1,7 @@
import { resolveResourcePlatformType } from '@/utils/sourcePlatforms';
import { asTrimmedString } from '@/utils/stringUtils';
import { hasImpairedResourceSource } from '@/utils/resourceSourceHealth';
+import { getTrueNASDatasetStateSummary } from '@/utils/truenasDatasetState';
import type {
Resource,
ResourceIncident,
@@ -734,16 +735,6 @@ const TRUENAS_STORAGE_ISSUE_LABELS: Record<TrueNASStorageIssue['status'], string
unknown: 'Unknown',
};
-// A read-only dataset raises no incident, so its state tag
-// (datasetStateTag in internal/truenas/provider.go) is the only place the
-// provider says why it is impaired. Locked and unmounted datasets also raise
-// incidents, which win when present.
-const TRUENAS_DATASET_STATE_REASONS: Record<string, string> = {
- 'state:locked': 'Dataset is locked',
- 'state:unmounted': 'Dataset is not mounted',
- 'state:readonly': 'Dataset is read-only',
-};
-
const TRUENAS_STORAGE_SILENT_REASONS: Record<TrueNASStorageIssue['status'], string> = {
attention: 'TrueNAS flagged this without a reason',
offline: 'Offline, and TrueNAS gave no reason',
@@ -785,8 +776,10 @@ export function getTrueNASStorageIssue(resource: Resource): TrueNASStorageIssue
for (const reason of resource.storage?.risk?.reasons ?? []) push(reason.summary);
for (const reason of resource.physicalDisk?.risk?.reasons ?? []) push(reason.summary);
}
- if (reasons.length === leading) {
- for (const tag of resource.tags ?? []) push(TRUENAS_DATASET_STATE_REASONS[normalize(tag)]);
+ // A read-only dataset raises no incident, so its state tag is the only
+ // reason the provider gives. The drawer reads the same shared mapping.
+ if (reasons.length === leading && resource.storage?.topology === 'dataset') {
+ push(getTrueNASDatasetStateSummary(resource.tags));
}
if (reasons.length === leading) {
const zfsState = asTrimmedString(resource.storage?.zfsPoolState);