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",
"name": "hidrostal-H05K-S03R",
"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);
}
createEndpoint(nodeName) {
try {
// Load the config for this node
const config = this.getConfig(nodeName);
createEndpoint(nodeName) {
try {
// Load the config for this node
const config = this.getConfig(nodeName);
// Convert config to JSON
const configJSON = JSON.stringify(config, null, 2);
// Convert config to JSON
const configJSON = JSON.stringify(config, null, 2);
// Assemble the complete script
return `
// Create the namespace structure
window.EVOLV = window.EVOLV || {};
window.EVOLV.nodes = window.EVOLV.nodes || {};
window.EVOLV.nodes.${nodeName} = window.EVOLV.nodes.${nodeName} || {};
// Assemble the complete script
return `
// 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
window.EVOLV.nodes.${nodeName}.config = ${configJSON};
// Inject the pre-loaded config data directly into the namespace
window.EVOLV.nodes.${nodeName}.config = ${configJSON};
console.log('${nodeName} config loaded and endpoint created');
`;
} 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;