From 03244dd3bc0a81f721694d9dc091245a9de001bf Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Tue, 29 Jun 2021 12:08:10 +0200 Subject: [PATCH] B #5438: Fix IP shown on Sunstone (#1337) --- src/sunstone/public/app/opennebula/vm.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sunstone/public/app/opennebula/vm.js b/src/sunstone/public/app/opennebula/vm.js index bc379dc34d..f40c9a15dc 100644 --- a/src/sunstone/public/app/opennebula/vm.js +++ b/src/sunstone/public/app/opennebula/vm.js @@ -551,8 +551,8 @@ define(function(require) { ? monitoringPool.reduce(function(result, monitoringVM) { return $.extend(result, { [monitoringVM.ID]: monitoringVM }) }, {}) - : {} - } + : monitoringPool; + }; OpenNebulaAction.list(params, VM_MONITORING_CACHE_NAME, 'vm/monitor', process, undefined, false); }, @@ -712,7 +712,7 @@ define(function(require) { monitoring = cache.data } - if (!monitoring || $.isEmptyObject(monitoring)) { + if ($.isEmptyObject(monitoring)) { VM.pool_monitor({ success: function(response) { monitoring = response @@ -820,8 +820,8 @@ define(function(require) { } function getNicsFromMonitoring(element = {}) { - let monitoringPool = _getMonitoringPool() - let monitoringVM = monitoringPool[element.ID] + let monitoringPool = _getMonitoringPool(); + let monitoringVM = monitoringPool[element.ID] || monitoringPool; if (!monitoringPool || $.isEmptyObject(monitoringPool) || !monitoringVM) return []; @@ -869,7 +869,7 @@ define(function(require) { }).join(options.divider) || options.defaultValue }; - // Return a dropdown with all the + // Return dropdown with all the IPs function ipsDropdown(element, divider) { var ipsHtml = this.ipsStr(element, { divider, groupStrFunction: groupByIpsDropdown }); var ips = ipsHtml.split("
"); @@ -918,7 +918,7 @@ define(function(require) { return copy_nics.reduce(function(column, nic) { if (nic.IP || (nic.IP6_ULA && nic.IP6_GLOBAL)) { var identation = "    "; - var ip = nic.IP || nic.IP6 || nic.IP6_ULA + " " + identation + nic.IP6_GLOBAL; + var ip = nic.IP || nic.IP6 || nic.MAC || nic.IP6_ULA + " " + identation + nic.IP6_GLOBAL; var nicSection = nic.NIC_ID ? $("
  • ").append($("").css("color", "gray").html(nic.NIC_ID + ": " + ip)) : $("
  • ").append("
  • ").html("-") ; @@ -961,8 +961,8 @@ define(function(require) { var identation = "    "; return nics.reduce(function(column, nic) { - if (nic.IP || nic.IP6 || (nic.IP6_ULA && nic.IP6_GLOBAL)) { - var ip = nic.IP || nic.IP6 || nic.IP6_ULA + "
    " + identation + nic.IP6_GLOBAL + if (nic.IP || nic.IP6 || nic.MAC || (nic.IP6_ULA && nic.IP6_GLOBAL)) { + var ip = nic.IP || nic.IP6 || nic.MAC || nic.IP6_ULA + "
    " + identation + nic.IP6_GLOBAL column.append($("

    ").css("margin-bottom", 0).html(nic.NIC_ID + ": " + ip))