feat(valve): resolve supplier+type from asset registry, reject legacy asset fields

Mirrors the rotatingMachine cutover: assetResolver derives supplier/type/
units from the model id; nodeClass throws a clear "re-select model and
save" error if the saved node still carries denormalized supplier/
category/assetType strings. valve.html defaults trimmed accordingly.

14/14 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
znetsixe
2026-05-12 17:12:47 +02:00
parent 95ccc77b25
commit 68ebe4ebce
3 changed files with 36 additions and 7 deletions

View File

@@ -25,11 +25,11 @@
processOutputFormat: { value: "process" },
dbaseOutputFormat: { value: "influxdb" },
//define asset properties
// Asset identifier surface. supplier/category/assetType are derived
// at runtime via assetResolver.resolveAssetMetadata(model). Do NOT
// add them back here. See generalFunctions/src/registry/README.md.
uuid: { value: "" },
supplier: { value: "" },
category: { value: "" },
assetType: { value: "" },
assetTagNumber: { value: "" },
model: { value: "" },
unit: { value: "" },
@@ -54,7 +54,10 @@
icon: "font-awesome/fa-toggle-on",
label: function () {
return (this.positionIcon || "") + " " + (this.category ? this.category.slice(0, -1) : "Valve");
// No more `this.category` on the node — derive from the model if needed,
// else fall back to a generic name.
const stem = this.model ? this.model : "Valve";
return (this.positionIcon || "") + " " + stem;
},
oneditprepare: function() {