B #3626: Sunstone show "undefined" IPv6 (#3688)

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
(cherry picked from commit 648a043590)
This commit is contained in:
Jorge Lobo authored and Tino Vazquez committed 2019-09-12 17:08:11 +02:00
1 parent 8bf9da9ce8
commit 575f061508
2 files changed
+27 -17

No files matched your search

@@ -129,9 +129,11 @@ define(function(require) {
var that = this;
nicsNames.forEach(function(element) {
var alias_str = element.ID + " " + element.NET + " " + element.IP;
$("#parent", that.context).append(new Option(alias_str, element.NAME));
var nicID = element && element.ID? element.ID : "";
var nicNET = element && element.NET? element.NET : "";
var nicIP = element && element.IP? element.IP : "";
var alias_str = nicID + " - " + nicNET + " " + nicIP;
$("#parent", that.context).append(new Option(alias_str, element.NAME));
});
}
});
@@ -18,7 +18,6 @@ define(function(require) {
/*
DEPENDENCIES
*/
var Locale = require("utils/locale");
var Config = require("sunstone-config");
var Sunstone = require("sunstone");
@@ -378,14 +377,13 @@ define(function(require) {
$(nRow).attr("nic_id", aData.NIC_ID);
}
});
$("#tab_network_form .nics_table", context).dataTable().fnSort([[1, "asc"]]);
// Add event listener for opening and closing each NIC row details
context.off("click", "#tab_network_form .nics_table td.open-control");
context.on("click", "#tab_network_form .nics_table td.open-control", function () {
var row = $(this).closest("table").DataTable().row($(this).closest("tr"));
if (row.child.isShown()) {
row.child.hide();
$(this).children("span").addClass("fa-chevron-down");
@@ -395,18 +393,29 @@ define(function(require) {
var html = "";
$.each(row.data().NIC_ALIAS, function(index, elem) {
var new_div = "<div id=alias_" + this.NIC_ID + " style=\"margin-left: 40px; margin-bottom: 5px\">" +
"<b>" + "- Alias-" + this.ALIAS_ID + ":" + "</b>" +
"&nbsp;&nbsp;&nbsp;" + this.IP +
"&nbsp;&nbsp;&nbsp;" + this.MAC +
"&nbsp;&nbsp;&nbsp;" + this.ACTIONS + "</div>";
var new_div = "<div id=alias_" + this.NIC_ID + " style=\"margin-left: 40px; margin-bottom: 5px\"><b> - Alias-" + this.ALIAS_ID + ":</b>";
html += new_div;
if(!!this.IP) {
new_div += "&nbsp;&nbsp;&nbsp;" + this.IP;
}
if(!!this.IP6) {
new_div += "&nbsp;&nbsp;&nbsp;" + this.IP6;
}
new_div += "&nbsp;&nbsp;&nbsp;" + this.MAC;
if(!!this.IP6_ULA) {
new_div += "&nbsp;&nbsp;&nbsp;<b>ULA:</b>&nbsp;" + this.IP6_ULA;
}
if(!!this.IP6_GLOBAL) {
new_div += "&nbsp;&nbsp;&nbsp;<b>Global:</b>&nbsp;" + this.IP6_GLOBAL;
}
new_div += "&nbsp;&nbsp;&nbsp;" + this.ACTIONS + "</div>";
if (Config.isTabActionEnabled("vms-tab", "VM.detachnic")) {
context.off("click", ".detachnic");
context.on("click", ".detachnic", {element_id: that.element.ID}, detach_alias);
}
html += new_div;
if (Config.isTabActionEnabled("vms-tab", "VM.detachnic")) {
context.off("click", ".detachnic");
context.on("click", ".detachnic", {element_id: that.element.ID}, detach_alias);
}
});
} else {
html = "";
@@ -573,7 +582,6 @@ define(function(require) {
return state;
}
function _setState(state, context) {
var that = this;