diff --git a/src/sunstone/public/app/opennebula/vm.js b/src/sunstone/public/app/opennebula/vm.js index f8d81acf43..7d4c002dc3 100644 --- a/src/sunstone/public/app/opennebula/vm.js +++ b/src/sunstone/public/app/opennebula/vm.js @@ -805,11 +805,7 @@ define(function(require) { }); } // infoextended: alias will be group by nic - return ( - config.system_config && - config.system_config.get_extended_vm_info && - config.system_config.get_extended_vm_info === "true" - ) + return Config.isExtendedVmInfo ? groupStrFuntion(element, nics) : (ips.length == 0 && nics && nics.length > 0) ? $.map(nics, function(nic) { diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index fb58fae498..b4d2a6cf77 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -181,7 +181,8 @@ define(function(require) { "min":_config["user_config"]["threshold_min"], "low":_config["user_config"]["threshold_low"], "high":_config["user_config"]["threshold_high"] - } + }, + "isExtendedVmInfo": _config["system_config"] && _config["system_config"]["get_extended_vm_info"] && _config["system_config"]["get_extended_vm_info"] === "true", }; return Config; diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/actions.js b/src/sunstone/public/app/tabs/oneflow-services-tab/actions.js index 453e3539eb..b08946b990 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab/actions.js +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/actions.js @@ -86,18 +86,7 @@ define(function(require) { } var _actions = { - "Service.show" : { - type: "single", - call: OpenNebulaResource.show, - callback: function(request, response) { - Sunstone.runAction("VM.list") - Sunstone.getDataTable(TAB_ID).updateElement(request, response); - if (Sunstone.rightInfoVisible($('#' + TAB_ID))) { - Sunstone.insertPanels(TAB_ID, response); - } - }, - error: Notifier.onError - }, + "Service.show" : _commonActions.show(), "Service.refresh" : _commonActions.refresh(), "Service.delete" : _commonActions.del(), "Service.chown": _commonActions.multipleAction('chown'), diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles.js b/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles.js index 9ccc0b670d..dd5744865a 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles.js +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles.js @@ -90,10 +90,6 @@ define(function(require) { function _html() { var roleList = []; - if (!OpenNebulaAction.cache("VM")) { - Sunstone.runAction("VM.list"); - } - var roles = this.element.TEMPLATE.BODY.roles; if (roles && roles.length) { $.each(roles, function(){ @@ -200,49 +196,25 @@ define(function(require) { function _roleHTML(role_index) { var that = this; - - if (!OpenNebulaAction.cache("VM")) { - Sunstone.runAction("VM.list"); - } - that.cache = OpenNebulaAction.cache("VM"); - var role = this.element.TEMPLATE.BODY.roles[role_index]; - - var vms = []; + var roleVms = []; if (role.nodes) { - $.each(role.nodes, function(){ - var vm_info = this.vm_info; + $.each(role.nodes, function(index, node){ + var vm_info = node.vm_info; - var info = []; - if (this.scale_up) { - info.push(""); - } else if (this.disposed) { - info.push(""); - } else { - info.push(""); - } - - if (!that.element.TEMPLATE.BODY.ready_status_gate) { - info.push(""); - } - - var id = vm_info ? vm_info.VM.ID : this.deploy_id; + var id = vm_info ? vm_info.VM.ID : node.deploy_id; var name = vm_info ? vm_info.VM.NAME : ""; var uname = vm_info ? vm_info.VM.UNAME : ""; var gname = vm_info ? vm_info.VM.GNAME : ""; var ips = "", actions = ""; - if (that.cache && that.cache.data && Array.isArray(that.cache.data)) { - $.each(that.cache.data, function(_, data){ + + OpenNebulaVM.show({ + data : { id: id }, + timeout: true, + success: function (_, data) { if (data.VM && data.VM.ID === id) { - (that.element.TEMPLATE.BODY.ready_status_gate && - vm_info.VM.USER_TEMPLATE && - vm_info.VM.USER_TEMPLATE.READY && - vm_info.VM.USER_TEMPLATE.READY == "YES") - ? info.push('') - : info.push(''); - ips = OpenNebulaVM.ipsStr(data.VM); if (OpenNebulaVM.isVNCSupported(data.VM)) { @@ -253,30 +225,16 @@ define(function(require) { } var wFile = OpenNebulaVM.isWFileSupported(data.VM); - if (wFile) { - actions += OpenNebulaVM.buttonWFile(id, wFile); - } + actions += wFile ? OpenNebulaVM.buttonWFile(id, wFile) : ""; var rdp = OpenNebulaVM.isRDPSupported(data.VM); - if (rdp) { - actions += OpenNebulaVM.buttonRDP(rdp.IP, data.VM); - } + actions += rdp ? OpenNebulaVM.buttonRDP(rdp.IP, data.VM) : ""; } - }) - } - var rowInfo = [ - '', - ''+ id +'', - name, - uname, - gname, - ips, - actions, - ]; - - vms.push(info.concat(rowInfo)) + roleVms[index] = rowInfoRoleVm(id, name, uname, gname, ips, actions); + that.serviceroleVMsDataTable.updateView(null, roleVms, true); + } + }); }); } @@ -290,12 +248,25 @@ define(function(require) { Locale.tr("Owner"), Locale.tr("Group"), Locale.tr("IPs"), - "" // VNC and RDP + "" // Remote actions ], - 'vms': vms + 'vms': roleVms }); } + function rowInfoRoleVm(id, name = "", uname = "", gname = "", ips = "", actions = "") { + return [ + '', + ''+ id +'', + name, + uname, + gname, + ips, + actions + ]; + } + function _roleSetup(context, role_index) { if(this.servicePanel) { var role = this.element.TEMPLATE.BODY.roles[role_index]; @@ -311,8 +282,7 @@ define(function(require) { "bSortClasses" : false, "bDeferRender": true, "aoColumnDefs": [ - {"bSortable": false, "aTargets": [0,1,"check",7,8]}, - {"bVisible": false, "aTargets": [0,1]} + {"bSortable": false, "aTargets": ["check", 5, 6]} ] } }); diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/roleInfo.hbs b/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/roleInfo.hbs index b7ad738a79..997eefd350 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/roleInfo.hbs +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/roleInfo.hbs @@ -50,8 +50,6 @@
| - |
|---|