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

Bug #1071: Several ozones GUI fixes

* Wrong dashboard counts
 * Wrong listing of aggregated resources
 * Error when showing VMs in pending state in a zone view
 * Remove 'public' column from views, not used anymore, showed "no" all the time
(cherry picked from commit 2c60d204f6e51c873258f231c527f4dd77cd6b7c)
This commit is contained in:
Hector Sanjuan 2012-01-23 11:59:53 +01:00 committed by Ruben S. Montero
parent f2e8103d35
commit 177cad9136
4 changed files with 47 additions and 70 deletions

View File

@ -70,15 +70,15 @@ function updateVMsList(req,list,tag,zone_id,zone_name){
state,
vm.CPU,
humanize_size(vm.MEMORY),
vm.HISTORY_RECORDS ? vm.HISTORY_RECORDS.HISTORY.HOSTNAME : "--",
hostname,
pretty_time(vm.STIME)
]);
};
});
updateView(vms_array,vmsDataTable);
}
vmsDataTable.fnAddData(vms_array);
vmsDataTable.fnDraw(false);
};
function updateVNsList(req,list,tag,zone_id,zone_name){
var vnDataTable = $(tag).dataTable();
@ -103,7 +103,6 @@ function updateVNsList(req,list,tag,zone_id,zone_name){
network.NAME,
parseInt(network.TYPE) ? "FIXED" : "RANGED",
network.BRIDGE,
parseInt(network.PUBLIC) ? "yes" : "no",
total_leases
]);
} else {
@ -114,14 +113,14 @@ function updateVNsList(req,list,tag,zone_id,zone_name){
network.NAME,
parseInt(network.TYPE) ? "FIXED" : "RANGED",
network.BRIDGE,
parseInt(network.PUBLIC) ? "yes" : "no",
total_leases
]);
}
});
updateView(vn_array,vnDataTable);
}
vnDataTable.fnAddData(vn_array);
vnDataTable.fnDraw(false);
};
function updateTemplatesList(req,list,tag,zone_id,zone_name){
var templateDataTable = $(tag).dataTable();
@ -138,7 +137,6 @@ function updateTemplatesList(req,list,tag,zone_id,zone_name){
template.GNAME,
template.NAME,
pretty_time(template.REGTIME),
parseInt(template.PUBLIC) ? "yes" : "no"
]);
} else {
template_array.push([
@ -147,11 +145,11 @@ function updateTemplatesList(req,list,tag,zone_id,zone_name){
template.GNAME,
template.NAME,
pretty_time(template.REGTIME),
parseInt(template.PUBLIC) ? "yes" : "no"
]);
};
});
updateView(template_array,templateDataTable);
templateDataTable.fnAddData(template_array);
templateDataTable.fnDraw(false);
}
function updateUsersList(req,list,tag, zone_id,zone_name){
@ -186,8 +184,9 @@ function updateUsersList(req,list,tag, zone_id,zone_name){
}
});
updateView(user_array,userDataTable);
}
userDataTable.fnAddData(user_array);
userDataTable.fnDraw(false);
};
function updateImagesList(req,list,tag,zone_id,zone_name){
var imageDataTable = $(tag).dataTable();
@ -206,7 +205,6 @@ function updateImagesList(req,list,tag,zone_id,zone_name){
image.NAME,
oZones.Helper.image_type(image.TYPE),
pretty_time(image.REGTIME),
parseInt(image.PUBLIC) ? "yes" : "no",
parseInt(image.PERSISTENT) ? "yes" : "no",
oZones.Helper.resource_state("image",image.STATE),
image.RUNNING_VMS
@ -219,15 +217,15 @@ function updateImagesList(req,list,tag,zone_id,zone_name){
image.NAME,
oZones.Helper.image_type(image.TYPE),
pretty_time(image.REGTIME),
parseInt(image.PUBLIC) ? "yes" : "no",
parseInt(image.PERSISTENT) ? "yes" : "no",
oZones.Helper.resource_state("image",image.STATE),
image.RUNNING_VMS
]);
};
});
updateView(image_array,imageDataTable);
}
imageDataTable.fnAddData(image_array);
imageDataTable.fnDraw(false);
};
function hostElementArray(host,zone_id,zone_name){

View File

@ -70,7 +70,6 @@ var aggregated_vns_tab_content =
<th>Name</th>\
<th>Type</th>\
<th>Bridge</th>\
<th>Public?</th>\
<th>Total Leases</th>\
</tr>\
</thead>\
@ -91,7 +90,6 @@ var aggregated_images_tab_content =
<th>Name</th>\
<th>Type</th>\
<th>Registration time</th>\
<th>Public</th>\
<th>Persistent</th>\
<th>State</th>\
<th>#VMS</th>\
@ -129,7 +127,6 @@ var aggregated_templates_tab_content =
<th>Group</th>\
<th>Name</th>\
<th>Registration time</th>\
<th>Public</th>\
</tr>\
</thead>\
<tbody>\
@ -410,80 +407,98 @@ Sunstone.addMainTab("agg_templates_tab",templates_tab);
function hostsListCB(req,list){
dataTable_agg_hosts.fnClearTable();
var total_hosts = [];
$.each(list,function(){
if (this.ZONE.error){
notifyError(this.ZONE.error.message);
return;
};
var host_json = oZones.Helper.pool("HOST",this.ZONE);
total_hosts = total_hosts.concat(host_json);
updateHostsList(req, host_json,'#datatable_agg_hosts',this.ZONE.ID,this.ZONE.NAME);
updateZonesDashboard("hosts",host_json);
});
updateZonesDashboard("hosts",total_hosts);
}
function vmsListCB(req,list){
dataTable_agg_vms.fnClearTable();
var total_vms = [];
$.each(list,function(){
if (this.ZONE.error){
notifyError(this.ZONE.error.message);
return;
};
var vms_json = oZones.Helper.pool("VM",this.ZONE);
total_vms = total_vms.concat(vms_json);
updateVMsList(req, vms_json,'#datatable_agg_vms',this.ZONE.ID,this.ZONE.NAME);
updateZonesDashboard("vms",vms_json);
});
updateZonesDashboard("vms",total_vms);
}
function vnsListCB(req,list){
dataTable_agg_vns.fnClearTable();
var total_vns = [];
$.each(list,function(){
if (this.ZONE.error){
notifyError(this.ZONE.error.message);
return;
};
var vn_json = oZones.Helper.pool("VNET",this.ZONE);
total_vns = total_vns.concat(vn_json);
updateVNsList(req, vn_json,'#datatable_agg_vnets',this.ZONE.ID,this.ZONE.NAME);
updateZonesDashboard("vnets",vn_json);
});
updateZonesDashboard("vnets",total_vns);
}
function imagesListCB(req,list){
dataTable_agg_images.fnClearTable();
total_images = [];
$.each(list,function(){
if (this.ZONE.error){
notifyError(this.ZONE.error.message);
return;
};
var image_json = oZones.Helper.pool("IMAGE",this.ZONE);
total_images = total_images.concat(image_json);
updateImagesList(req,image_json,'#datatable_agg_images',this.ZONE.ID,this.ZONE.NAME);
updateZonesDashboard("images",image_json);
});
updateZonesDashboard("images",total_images);
}
function usersListCB(req,list){
dataTable_agg_users.fnClearTable();
var total_users = [];
$.each(list,function(){
if (this.ZONE.error){
notifyError(this.ZONE.error.message);
return;
};
var user_json = oZones.Helper.pool("USER",this.ZONE);
total_users = total_users.concat(user_json);
updateUsersList(req,user_json,'#datatable_agg_users',this.ZONE.ID,this.ZONE.NAME);
updateZonesDashboard("users",user_json);
});
updateZonesDashboard("users",total_users);
}
function templatesListCB(req,list){
dataTable_agg_templates.fnClearTable();
var total_templates = [];
$.each(list,function(){
if (this.ZONE.error){
notifyError(this.ZONE.error.message);
return;
};
var template_json = oZones.Helper.pool("VMTEMPLATE",this.ZONE);
total_templates = total_templates.concat(template_json);
updateTemplatesList(req,template_json,'#datatable_agg_templates',this.ZONE.ID,this.ZONE.NAME);
updateZonesDashboard("templates",template_json);
});
updateZonesDashboard("templates",total_templates);
}
function setAutorefreshes(){
@ -566,7 +581,7 @@ $(document).ready(function(){
"bAutoWidth":false,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "sWidth": "60px", "aTargets": [6,7,8,9] },
{ "sWidth": "60px", "aTargets": [6,7,8] },
{ "sWidth": "35px", "aTargets": [0,2] },
{ "sWidth": "100px", "aTargets": [1,3,4] }
]
@ -578,8 +593,8 @@ $(document).ready(function(){
"bAutoWidth":false,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "sWidth": "60px", "aTargets": [10] },
{ "sWidth": "35px", "aTargets": [0,2,8,9,11] },
{ "sWidth": "60px", "aTargets": [9] },
{ "sWidth": "35px", "aTargets": [0,2,8,10] },
{ "sWidth": "100px", "aTargets": [1,3,4,6,7] }
]
});
@ -590,7 +605,7 @@ $(document).ready(function(){
"bAutoWidth":false,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "sWidth": "35px", "aTargets": [0,2,7] },
{ "sWidth": "35px", "aTargets": [0,2] },
{ "sWidth": "100px", "aTargets": [1,3,4,6] }
]
});

View File

@ -81,10 +81,6 @@ var dashboard_tab_content =
<td class="key_td">Total</td>\
<td class="value_td"><span id="total_templates"></span></td>\
</tr>\
<tr>\
<td class="key_td">Public</td>\
<td class="value_td"><span id="public_templates"></span></td>\
</tr>\
</table>\
</div>\
</div>\
@ -124,10 +120,6 @@ var dashboard_tab_content =
<td class="key_td">Total</td>\
<td class="value_td"><span id="total_vnets"></span></td>\
</tr>\
<tr>\
<td class="key_td">Public</td>\
<td class="value_td"><span id="public_vnets"></span></td>\
</tr>\
</table>\
</div>\
</div>\
@ -146,10 +138,6 @@ var dashboard_tab_content =
<td class="key_td">Total</td>\
<td class="value_td"><span id="total_images"></span></td>\
</tr>\
<tr>\
<td class="key_td">Public</td>\
<td class="value_td"><span id="public_images"></span></td>\
</tr>\
</table>\
</div>\
</div>\
@ -180,7 +168,6 @@ var dashboard_tab = {
Sunstone.addMainTab('dashboard_tab',dashboard_tab);
$(document).ready(function(){
//Dashboard link listener
$("#dashboard_table h3 a").live("click", function (){
var tab = $(this).attr('href');
showTab(tab);
@ -220,15 +207,7 @@ function updateZonesDashboard(what,json_info){
break;
case "templates":
var total_templates=json_info.length;
var public_templates=0;
$.each(json_info,function(){
if (parseInt(this.VMTEMPLATE.PUBLIC)){
public_templates++;
};
});
$('#total_templates',db).html(total_templates);
$('#public_templates',db).html(public_templates);
break;
case "vms":
var total_vms=json_info.length;
@ -248,14 +227,8 @@ function updateZonesDashboard(what,json_info){
$('#failed_vms',db).html(failed_vms);
break;
case "vnets":
var public_vnets=0;
var total_vnets=json_info.length;
$.each(json_info,function(){
if (parseInt(this.VNET.PUBLIC)){
public_vnets++;}
});
$('#total_vnets',db).html(total_vnets);
$('#public_vnets',db).html(public_vnets);
break;
case "users":
var total_users=json_info.length;
@ -263,13 +236,7 @@ function updateZonesDashboard(what,json_info){
break;
case "images":
var total_images=json_info.length;
var public_images=0;
$.each(json_info,function(){
if (parseInt(this.IMAGE.PUBLIC)){
public_images++;}
});
$('#total_images',db).html(total_images);
$('#public_images',db).html(public_images);
break;
}
}

View File

@ -352,7 +352,6 @@ function updateZoneInfo(req,zone_json){
<th>Group</th>\
<th>Name</th>\
<th>Registration time</th>\
<th>Public</th>\
</tr>\
</thead>\
<tbody>\
@ -396,7 +395,6 @@ function updateZoneInfo(req,zone_json){
<th>Name</th>\
<th>Type</th>\
<th>Bridge</th>\
<th>Public?</th>\
<th>Total Leases</th>\
</tr>\
</thead>\
@ -418,7 +416,6 @@ function updateZoneInfo(req,zone_json){
<th>Name</th>\
<th>Type</th>\
<th>Registration time</th>\
<th>Public</th>\
<th>Persistent</th>\
<th>State</th>\
<th>#VMS</th>\
@ -490,7 +487,7 @@ function updateZoneInfo(req,zone_json){
"bAutoWidth":false,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "sWidth": "60px", "aTargets": [4,5,6,7] },
{ "sWidth": "60px", "aTargets": [4,5,6] },
{ "sWidth": "35px", "aTargets": [0] },
{ "sWidth": "100px", "aTargets": [1,2] }
]
@ -502,8 +499,8 @@ function updateZoneInfo(req,zone_json){
"bAutoWidth":false,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "sWidth": "60px", "aTargets": [8] },
{ "sWidth": "35px", "aTargets": [0,6,7,9] },
{ "sWidth": "60px", "aTargets": [7] },
{ "sWidth": "35px", "aTargets": [0,6,8] },
{ "sWidth": "100px", "aTargets": [1,2,4,5] }
]
});
@ -514,7 +511,7 @@ function updateZoneInfo(req,zone_json){
"bAutoWidth":false,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "sWidth": "35px", "aTargets": [0,5] },
{ "sWidth": "35px", "aTargets": [0] },
{ "sWidth": "100px", "aTargets": [1,2,4] }
]
});