webui: calibrate CSV export, trigger threshold and unit display

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino Ferrari
2026-08-17 00:55:07 +02:00
co-authored by Claude Sonnet 4.6
parent 4908c039a5
commit 3cb998c5da
3 changed files with 43 additions and 10 deletions
+3 -1
View File
@@ -40,7 +40,9 @@
var offset = obj.offset === undefined ? 0 : obj.offset;
if (!isFiniteNum(scale) || scale === 0) return null;
if (!isFiniteNum(offset)) return null;
var unit = String(obj.unit == null ? '' : obj.unit).trim();
// Commas and quotes would corrupt the CSV export header; drop them here so
// every consumer sees an already-safe unit.
var unit = String(obj.unit == null ? '' : obj.unit).replace(/[",]/g, '').trim();
// Cap at MAX_UNIT_LEN UTF-8 bytes, matching both hubs' Normalise() exactly.
// TextEncoder/TextDecoder are available natively in all modern browsers and
// Node v11+; no build step or bundler is needed.