1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #4448: Fix alias grouped by nic (#4450)

This commit is contained in:
Sergio Betanzos 2020-03-31 10:33:07 +02:00 committed by GitHub
parent 5af8570a2b
commit f777e004b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 13 deletions

View File

@ -797,17 +797,19 @@ define(function(require) {
}
// infoextended: alias will be group by nic
return (config.system_config.get_extended_vm_info)
return (
config.system_config &&
config.system_config.get_extended_vm_info &&
config.system_config.get_extended_vm_info === "true"
)
? groupByIpsStr(element, nics)
: (ips.length == 0)
? $.each(nics, function(index, value) {
$.each(NIC_IP_ATTRS, function(j, attr){
if (value[attr] && attr === "IP") {
ips.push(value[attr]);
}
});
})
: (ips.length > 0) ? ips.join(divider) : r = "--";
: (ips.length == 0 && nics && nics.length > 0)
? $.map(nics, function(nic) {
if (nic["IP"]) {
return nic["IP"];
}
}).join(divider)
: "--";
};
function groupByIpsStr(element = {}, nics = []) {
@ -818,7 +820,9 @@ define(function(require) {
nicSection.append("*");
nic.ALIAS_IDS.split(",").forEach(function(aliasId) {
var alias = element.TEMPLATE.NIC_ALIAS.find(function(alias) { return alias.NIC_ID === aliasId })
var templateAlias = Array.isArray(element.TEMPLATE.NIC_ALIAS)
? element.TEMPLATE.NIC_ALIAS : [element.TEMPLATE.NIC_ALIAS];
var alias = templateAlias.find(function(alias) { return alias.NIC_ID === aliasId });
if (alias) {
nicSection.append($("<p/>").css({

View File

@ -76,8 +76,11 @@ define(function(require) {
var IP = OpenNebula.VM.ipsStr(this.element);
var alias = (!config.system_config.get_extended_vm_info)
? OpenNebula.VM.aliasStr(this.element) : null;
var alias = (
config.system_config &&
config.system_config.get_extended_vm_info &&
config.system_config.get_extended_vm_info === "true"
) ? null : OpenNebula.VM.aliasStr(this.element);
if (this.element.TEMPLATE.VROUTER_ID != undefined){
vrouterHTML = Navigation.link(