main
Anthony 2024-03-08 01:22:10 +08:00
parent d3492127f7
commit 9af9ce9900
1 changed files with 16 additions and 12 deletions

View File

@ -1,19 +1,23 @@
var chosenEnvName = "chosenEnvironmentName"; // Replace with the actual chosen environment name var resp = api.env.control.GetEnvs();
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 storageNodes = []; var nodes = {};
var env = resp.env; // Directly access the chosen environment's details for (var i = 0, envInfo, env; envInfo = resp.infos[i]; i++) {
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") {
storageNodes.push({ nodes[env.envName] = nodes[env.envName] || [];
if (!nodes[env.envName].includes(node.id)) {
nodes[env.envName].push({
id: node.id, id: node.id,
caption: (node.displayName || node.name) + ' (' + node.nodeGroup + ')' caption: (node.displayName || node.name) + ' (' + node.nodeGroup + ')'
}); });
} }
} }
} }
}
}
if (envs.length > 0) { if (envs.length > 0) {
jps.settings.main.fields[1].values = envs; jps.settings.main.fields[1].values = envs;