Compare commits
1 Commits
43f69066af
...
29b78a3f9b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29b78a3f9b |
@@ -1,3 +1,17 @@
|
|||||||
|
// Map a child's raw softwareType (the lowercased node name from
|
||||||
|
// buildConfig) to the "role" key that parent registerChild() handlers
|
||||||
|
// dispatch on. Without this, MGC/pumpingStation register-handlers (which
|
||||||
|
// branch on 'machine' / 'machinegroup' / 'pumpingstation' / 'measurement')
|
||||||
|
// silently miss every real production child because rotatingMachine
|
||||||
|
// reports softwareType='rotatingmachine' and machineGroupControl reports
|
||||||
|
// 'machinegroupcontrol'. Existing tests that pass already-aliased keys
|
||||||
|
// ('machine', 'machinegroup') stay green because those aren't in the
|
||||||
|
// alias map and pass through unchanged.
|
||||||
|
const SOFTWARE_TYPE_ALIASES = {
|
||||||
|
rotatingmachine: 'machine',
|
||||||
|
machinegroupcontrol: 'machinegroup',
|
||||||
|
};
|
||||||
|
|
||||||
class ChildRegistrationUtils {
|
class ChildRegistrationUtils {
|
||||||
constructor(mainClass) {
|
constructor(mainClass) {
|
||||||
this.mainClass = mainClass;
|
this.mainClass = mainClass;
|
||||||
@@ -15,7 +29,8 @@ class ChildRegistrationUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const softwareType = (child.config.functionality.softwareType || '').toLowerCase();
|
const rawSoftwareType = (child.config.functionality.softwareType || '').toLowerCase();
|
||||||
|
const softwareType = SOFTWARE_TYPE_ALIASES[rawSoftwareType] || rawSoftwareType;
|
||||||
const name = child.config.general.name || child.config.general.id || 'unknown';
|
const name = child.config.general.name || child.config.general.id || 'unknown';
|
||||||
const id = child.config.general.id || name;
|
const id = child.config.general.id || name;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user