From befc7a95c22f506c53f0dc53da72bec67c172f08 Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Wed, 12 May 2021 13:16:10 +0200 Subject: [PATCH] F #~: External IP always first (#1208) --- src/sunstone/public/app/opennebula/vm.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/sunstone/public/app/opennebula/vm.js b/src/sunstone/public/app/opennebula/vm.js index bfa21da3c4..db22bbdce7 100644 --- a/src/sunstone/public/app/opennebula/vm.js +++ b/src/sunstone/public/app/opennebula/vm.js @@ -1087,10 +1087,11 @@ define(function(require) { nics.forEach(function(nic, index){ var copy_nic = Object.assign({}, nic); - if (nic.EXTERNAL_IP) + if (nic.EXTERNAL_IP){ external_nics.push(nic); - - delete copy_nic.EXTERNAL_IP; + delete copy_nic.EXTERNAL_IP; + } + non_external_nics.push(copy_nic); }); @@ -1102,9 +1103,8 @@ define(function(require) { // Show the first IP two times for the dropdown. var copy_nics = Object.assign([], all_nics); - + var first_nic = Object.assign({}, all_nics[0]); - delete first_nic["EXTERNAL_IP"]; delete first_nic["ALIAS_IDS"]; copy_nics.unshift(first_nic); var first = true; @@ -1112,14 +1112,17 @@ define(function(require) { return copy_nics.reduce(function(column, nic) { if (first){ - if (nic.IP || (nic.IP6_ULA && nic.IP6_GLOBAL)) { + if (nic.EXTERNAL_IP || nic.IP || (nic.IP6_ULA && nic.IP6_GLOBAL)) { var ip = nic.EXTERNAL_IP || nic.IP || nic.IP6_ULA + " " + identation + nic.IP6_GLOBAL; - column.append(nic.NIC_ID + ": " + ip + ""); + nic_and_ip = nic.NIC_ID + ": " + ip; + if (nic.EXTERNAL_IP) + nic_and_ip = "" + nic_and_ip + "" + column.append(nic_and_ip + ""); } first=false; } else{ - if (nic.IP || (nic.IP6_ULA && nic.IP6_GLOBAL)) { + if (nic.EXTERNAL_IP || nic.IP || (nic.IP6_ULA && nic.IP6_GLOBAL)) { var ip; var nicSection = $("").css("color", "gray");