From 1f6286b28f222563bc3a09d4f1aaa791426618fc Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Mon, 24 Jul 2017 15:46:12 +0200 Subject: [PATCH] Added TotalVMs and solved bug in VMGroups (#412) --- src/sunstone/public/app/tabs/vmgroup-tab.js | 3 ++- .../public/app/tabs/vmgroup-tab/datatable.js | 16 ++++++++++++++++ .../app/tabs/vmgroup-tab/utils/role-tab/html.hbs | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/vmgroup-tab.js b/src/sunstone/public/app/tabs/vmgroup-tab.js index 171ac47a9c..5abdbbe893 100644 --- a/src/sunstone/public/app/tabs/vmgroup-tab.js +++ b/src/sunstone/public/app/tabs/vmgroup-tab.js @@ -42,7 +42,8 @@ define(function(require) { infoHeader: Locale.tr("VM Groups"), subheader: '\ '+Locale.tr("TOTAL")+'\ - ', +  \ + '+Locale.tr("TOTAL VMs")+'', resource: 'VMGroup', buttons: Buttons, actions: Actions, diff --git a/src/sunstone/public/app/tabs/vmgroup-tab/datatable.js b/src/sunstone/public/app/tabs/vmgroup-tab/datatable.js index 7bd48480ea..df4ccd0056 100644 --- a/src/sunstone/public/app/tabs/vmgroup-tab/datatable.js +++ b/src/sunstone/public/app/tabs/vmgroup-tab/datatable.js @@ -80,6 +80,8 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following vm groups:") }; + this.totalVMGroups = 0; + this.totalVMs = 0; this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); this.searchColumn = SEARCH_COLUMN; @@ -90,6 +92,8 @@ define(function(require) { Table.prototype = Object.create(TabDataTable.prototype); Table.prototype.constructor = Table; Table.prototype.elementArray = _elementArray; + Table.prototype.preUpdateView = _preUpdateView; + Table.prototype.postUpdateView = _postUpdateView; return Table; @@ -100,6 +104,7 @@ define(function(require) { function _elementArray(element_json) { var element = element_json[XML_ROOT]; var numVms = 0; + this.totalVMGroups++; for(role_index in element.ROLES.ROLE){ if(element.ROLES.ROLE[role_index].VMS){ @@ -108,6 +113,7 @@ define(function(require) { numVms += vms.length; } } + this.totalVMs += numVms; var search = { NAME: element.NAME, @@ -129,4 +135,14 @@ define(function(require) { ]; } + function _preUpdateView() { + this.totalVMGroups = 0; + this.totalVMs= 0; + } + + function _postUpdateView() { + $(".total_vmgroup").text(this.totalVMGroups); + $(".total_vms_vmgroup").text(this.totalVMs); + } + }); diff --git a/src/sunstone/public/app/tabs/vmgroup-tab/utils/role-tab/html.hbs b/src/sunstone/public/app/tabs/vmgroup-tab/utils/role-tab/html.hbs index 8252fca592..65fa52d772 100644 --- a/src/sunstone/public/app/tabs/vmgroup-tab/utils/role-tab/html.hbs +++ b/src/sunstone/public/app/tabs/vmgroup-tab/utils/role-tab/html.hbs @@ -33,7 +33,7 @@

-
+