1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-10 01:17:40 +03:00

M #~: fix lost var ips (#4679)

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
Jorge Lobo 2020-05-07 18:42:24 +02:00 committed by GitHub
parent bdd325a6f8
commit 2d3ef1be41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -765,16 +765,37 @@ define(function(require) {
function getNICs(element){
var nics = element && element.TEMPLATE && element.TEMPLATE.NIC;
var pci = element && element.TEMPLATE && element.TEMPLATE.PCI;
if (nics == undefined || nics == false){
nics = [];
}
if (!$.isArray(nics)) {
nics = [nics];
}
if (pci != undefined || pci != false) {
if (!$.isArray(pci)) {
pci = [pci];
}
$.each(pci, function(){
if (this["TYPE"] == "NIC"){
nics.push(this);
}
});
}
return nics;
}
// Return the IP or several IPs of a VM
function ipsStr(element, divider, groupStrFuntion = groupByIpsStr) {
var divider = divider || "<br>";
var nics = getNICs(element);
var ips = [];
var monitoring = element && element.MONITORING;
if (monitoring) {
var externalIP;
$.each(EXTERNAL_IP_ATTRS, function(index, IPAttr) {
externalIP = monitoring[IPAttr];
if (externalIP) {
var splitArr = externalIP.split(",");
$.each(splitArr, function(i,ip){
if (ip && ($.inArray(ip, ips) == -1)) {
ips.push(ip);
@ -783,35 +804,6 @@ define(function(require) {
}
});
}
if (nics == undefined || nics == false){
nics = [];
}
if (!$.isArray(nics)) {
nics = [nics];
}
if (pci != undefined || pci != false) {
if (!$.isArray(pci)) {
pci = [pci];
}
$.each(pci, function(){
if (this["TYPE"] == "NIC"){
nics.push(this);
}
});
}
return nics;
}
// Return the IP or several IPs of a VM
function ipsStr(element, divider, groupStrFuntion = groupByIpsStr) {
var divider = divider || "<br>";
var nics = getNICs(element);
// infoextended: alias will be group by nic
return (
config.system_config &&