Compare commits
1 Commits
98cd44d3ae
...
4a489acd89
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a489acd89 |
@@ -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
@@ -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;
|
||||||
Reference in New Issue
Block a user