Migrate to new Gitea instance (gitea.wbd-rd.nl)
- Update all submodule URLs from gitea.centraal.wbd-rd.nl to gitea.wbd-rd.nl - Add settler as proper submodule in .gitmodules - Add agent skills, function anchors, decisions, and improvements - Add Docker configuration and scripts - Add manuals and third_party docs - Update .gitignore with secrets and build artifacts - Remove stale .tgz build artifact Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
36
scripts/fix-asset-selection.js
Normal file
36
scripts/fix-asset-selection.js
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Fix asset selection in demo-flow.json so editor dropdowns correctly
|
||||
* pre-select the configured supplier/type/model when a node is opened.
|
||||
*
|
||||
* Issues fixed:
|
||||
* 1. Pump nodes: supplier "Hidrostal" → "hidrostal" (matches machine.json id)
|
||||
* 2. demo_meas_flow: assetType "flow-electromagnetic" → "flow" (matches measurement.json type id)
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const flowPath = path.join(__dirname, '..', 'docker', 'demo-flow.json');
|
||||
const flow = JSON.parse(fs.readFileSync(flowPath, 'utf8'));
|
||||
|
||||
let changes = 0;
|
||||
|
||||
flow.forEach(node => {
|
||||
// Fix 1: Pump supplier id mismatch
|
||||
if (node.type === 'rotatingMachine' && node.supplier === 'Hidrostal') {
|
||||
node.supplier = 'hidrostal';
|
||||
changes++;
|
||||
console.log(`Fixed pump ${node.id}: supplier "Hidrostal" → "hidrostal"`);
|
||||
}
|
||||
|
||||
// Fix 2: Standardize flow measurement assetType
|
||||
if (node.type === 'measurement' && node.assetType === 'flow-electromagnetic') {
|
||||
node.assetType = 'flow';
|
||||
changes++;
|
||||
console.log(`Fixed ${node.id}: assetType "flow-electromagnetic" → "flow"`);
|
||||
}
|
||||
});
|
||||
|
||||
fs.writeFileSync(flowPath, JSON.stringify(flow, null, 2) + '\n');
|
||||
console.log(`\nDone. ${changes} node(s) updated.`);
|
||||
Reference in New Issue
Block a user