Compare commits

...

1 Commits

Author SHA1 Message Date
znetsixe
4a489acd89 some formatting 2025-11-06 16:47:17 +01:00
3 changed files with 1383 additions and 21 deletions

View File

@@ -83,6 +83,7 @@
{ {
"id": "hidrostal-pump-001", "id": "hidrostal-pump-001",
"name": "hidrostal-H05K-S03R", "name": "hidrostal-H05K-S03R",
"units": ["l/s"] "units": ["l/s"]
}, },
{ {

File diff suppressed because one or more lines are too long

View File

@@ -47,30 +47,30 @@ class ConfigManager {
return fs.existsSync(configPath); return fs.existsSync(configPath);
} }
createEndpoint(nodeName) { createEndpoint(nodeName) {
try { try {
// Load the config for this node // Load the config for this node
const config = this.getConfig(nodeName); const config = this.getConfig(nodeName);
// Convert config to JSON
const configJSON = JSON.stringify(config, null, 2);
// Assemble the complete script // Convert config to JSON
return ` const configJSON = JSON.stringify(config, null, 2);
// Create the namespace structure
window.EVOLV = window.EVOLV || {};
window.EVOLV.nodes = window.EVOLV.nodes || {};
window.EVOLV.nodes.${nodeName} = window.EVOLV.nodes.${nodeName} || {};
// Inject the pre-loaded config data directly into the namespace // Assemble the complete script
window.EVOLV.nodes.${nodeName}.config = ${configJSON}; return `
// Create the namespace structure
window.EVOLV = window.EVOLV || {};
window.EVOLV.nodes = window.EVOLV.nodes || {};
window.EVOLV.nodes.${nodeName} = window.EVOLV.nodes.${nodeName} || {};
console.log('${nodeName} config loaded and endpoint created'); // Inject the pre-loaded config data directly into the namespace
`; window.EVOLV.nodes.${nodeName}.config = ${configJSON};
} catch (error) {
throw new Error(`Failed to create endpoint for '${nodeName}': ${error.message}`); console.log('${nodeName} config loaded and endpoint created');
} `;
} catch (error) {
throw new Error(`Failed to create endpoint for '${nodeName}': ${error.message}`);
} }
}
} }
module.exports = ConfigManager; module.exports = ConfigManager;