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:
@@ -5,7 +5,7 @@
|
||||
// the logic; this file wires them together and preserves the public surface
|
||||
// the test suite + parents (VGC, MGC, pumpingStation) depend on.
|
||||
|
||||
const { BaseDomain, UnitPolicy, state } = require('generalFunctions');
|
||||
const { BaseDomain, UnitPolicy, state, assetResolver } = require('generalFunctions');
|
||||
const { ValveHydraulicModel, normalizeServiceType } = require('./hydraulicModel');
|
||||
const { FluidCompatibility, normalizeOptional } = require('./fluid/fluidCompatibility');
|
||||
const { SupplierCurvePredictor } = require('./curve/supplierCurve');
|
||||
@@ -67,6 +67,12 @@ class Valve extends BaseDomain {
|
||||
});
|
||||
|
||||
this.model = this.config.asset?.model;
|
||||
// Derived asset metadata (supplier, type, allowed units) — null if the
|
||||
// model isn't in the registry. Valve tolerates a null model + inline
|
||||
// configCurve, so we don't hard-fail here; the curve predictor logs.
|
||||
this.assetMetadata = this.model
|
||||
? assetResolver.resolveAssetMetadata('valve', this.model)
|
||||
: null;
|
||||
this.curvePredictor = new SupplierCurvePredictor({
|
||||
logger: this.logger,
|
||||
model: this.model,
|
||||
|
||||
Reference in New Issue
Block a user