Env Node update

main
Anthony 2024-03-08 01:17:58 +08:00
parent 18d8b93169
commit d3492127f7
1 changed files with 12 additions and 16 deletions

View File

@ -1,20 +1,16 @@
var resp = api.env.control.GetEnvs(); var chosenEnvName = "chosenEnvironmentName"; // Replace with the actual chosen environment name
var resp = api.env.control.GetEnvInfo(chosenEnvName); // Adjust API call to fetch only the chosen environment
if (resp.result !== 0) return resp; if (resp.result !== 0) return resp;
var envs = [];
var nodes = {}; var storageNodes = [];
for (var i = 0, envInfo, env; envInfo = resp.infos[i]; i++) { var env = resp.env; // Directly access the chosen environment's details
env = envInfo.env; if (env.status == 1) {
if (env.status == 1) { for (var i = 0, node; node = env.nodes[i]; i++) {
for (var j = 0, node; node = envInfo.nodes[j]; j++) { if (node.nodeGroup == "storage") {
if (node.nodeGroup == "storage") { // Focus only on nodes within the "storage" group storageNodes.push({
nodes[env.envName] = nodes[env.envName] || []; id: node.id,
if (!nodes[env.envName].includes(node.id)) { caption: (node.displayName || node.name) + ' (' + node.nodeGroup + ')'
nodes[env.envName].push({ });
id: node.id,
caption: (node.displayName || node.name) + ' (' + node.nodeGroup + ')'
});
}
}
} }
} }
} }