Add configurable water-softener diagram to Dashboard

Per-asset diagram_config (JSONB) maps live MQTT field_keys to brine/resin
tank roles, editable on the Assets page with dropdowns populated from that
asset's actual telemetry. Dashboard renders brine + 1-2 resin tanks with
color-coded fill levels, an "in service" tank indicator, and an animated
flow/regen indicator when regeneration is active.
This commit is contained in:
jtricerolph 2026-07-30 09:02:12 +00:00
parent eca07750d2
commit 4f048a9629
9 changed files with 4779 additions and 11 deletions

View file

@ -1,5 +1,5 @@
import type {
PlantAsset, AssetStatus, AssetPhoto, AlertRule, PlantAlert, AppSetting, PhotoType,
PlantAsset, AssetStatus, AssetPhoto, AlertRule, PlantAlert, AppSetting, PhotoType, TelemetryField,
} from './types'
const BASE = '/plant/api'
@ -31,6 +31,9 @@ export function createAsset(body: Partial<PlantAsset>): Promise<PlantAsset> {
export function updateAsset(id: number, body: Partial<PlantAsset>): Promise<PlantAsset> {
return request(`/assets/${id}`, { method: 'PATCH', body: JSON.stringify(body) })
}
export function fetchAssetLatest(id: number): Promise<TelemetryField[]> {
return request(`/assets/${id}/latest`)
}
// Asset photos — multipart, so no JSON content-type header
export async function uploadAssetPhoto(assetId: number, file: File, photoType: PhotoType): Promise<AssetPhoto> {