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,22 +1,18 @@
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;
var envs = [];
var nodes = {};
for (var i = 0, envInfo, env; envInfo = resp.infos[i]; i++) {
env = envInfo.env;
if (env.status == 1) {
for (var j = 0, node; node = envInfo.nodes[j]; j++) {
if (node.nodeGroup == "storage") { // Focus only on nodes within the "storage" group
nodes[env.envName] = nodes[env.envName] || [];
if (!nodes[env.envName].includes(node.id)) {
nodes[env.envName].push({
var storageNodes = [];
var env = resp.env; // Directly access the chosen environment's details
if (env.status == 1) {
for (var i = 0, node; node = env.nodes[i]; i++) {
if (node.nodeGroup == "storage") {
storageNodes.push({
id: node.id,
caption: (node.displayName || node.name) + ' (' + node.nodeGroup + ')'
});
}
}
}
}
}
if (envs.length > 0) {