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

Added TotalVMs and solved bug in VMGroups (#412)

This commit is contained in:
Abel Coronado 2017-07-24 15:46:12 +02:00 committed by Ruben S. Montero
parent f89decb42f
commit 1f6286b28f
3 changed files with 19 additions and 2 deletions

View File

@ -42,7 +42,8 @@ define(function(require) {
infoHeader: Locale.tr("VM Groups"),
subheader: '<span>\
<span class="total_vmgroup"/> <small>'+Locale.tr("TOTAL")+'</small>\
</span>',
</small>&emsp;\
<span class="total_vms_vmgroup"/> <small>'+Locale.tr("TOTAL VMs")+'</small></span>',
resource: 'VMGroup',
buttons: Buttons,
actions: Actions,

View File

@ -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);
}
});

View File

@ -33,7 +33,7 @@
</span>
<div style="margin-left: 30px; margin-bottom:5px;">
<input type="radio" name="protocol_{{idRole}}" value="NONE" checked><label>{{tr "None"}}</label></br>
<input type="radio" name="protocol_{{idRole}}" value="AFFINED""><label>{{tr "Affined"}}</label></br>
<input type="radio" name="protocol_{{idRole}}" value="AFFINED"><label>{{tr "Affined"}}</label></br>
<input type="radio" name="protocol_{{idRole}}" value="ANTI_AFFINED"><label>{{tr "Anti Affined"}}</label>
</div>
</label>