1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

Feature #1288: Sunstone: Add VM quota information to users and groups tables, just as in CLI

(cherry picked from commit 88b86d0ab0aeecbdc7b8d25bde6b736ba7538c08)
This commit is contained in:
Hector Sanjuan 2012-06-27 17:32:32 +02:00 committed by Ruben S. Montero
parent f04380adf4
commit 8c792cc0ff
2 changed files with 40 additions and 6 deletions

View File

@ -31,6 +31,9 @@ var groups_tab_content = '\
<th>'+tr("ID")+'</th>\
<th>'+tr("Name")+'</th>\
<th>'+tr("Users")+'</th>\
<th>'+tr("VMs")+'</th>\
<th>'+tr("Memory used")+'</th>\
<th>'+tr("CPU used")+'</th>\
</tr>\
</thead>\
<tbody id="tbodygroups">\
@ -293,11 +296,25 @@ function groupElementArray(group_json){
users_str=getUserName(group.USERS.ID);
};
var vms = "-";
var memory = "-";
var cpu = "-";
if (!$.isEmptyObject(group.VM_QUOTA)){
vms = group.VM_QUOTA.VM.VMS_USED;
memory = group.VM_QUOTA.VM.MEMORY_USED;
cpu = group.VM_QUOTA.VM.CPU_USED;
}
return [
'<input class="check_item" type="checkbox" id="group_'+group.ID+'" name="selected_items" value="'+group.ID+'"/>',
group.ID,
group.NAME,
users_str ];
users_str,
vms,
memory,
cpu
];
}
function updateGroupSelect(){
@ -405,7 +422,7 @@ $(document).ready(function(){
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0] },
{ "sWidth": "35px", "aTargets": [1] }
{ "sWidth": "35px", "aTargets": [1,4,5,6] }
],
"oLanguage": (datatable_lang != "") ?
{
@ -416,7 +433,7 @@ $(document).ready(function(){
dataTable_groups.fnClearTable();
addElement([
spinner,
'','',''],dataTable_groups);
'','','','','',''],dataTable_groups);
Sunstone.runAction("Group.list");
setupCreateGroupDialog();

View File

@ -34,6 +34,9 @@ var users_tab_content = '\
<th>'+tr("Name")+'</th>\
<th>'+tr("Group")+'</th>\
<th>'+tr("Authentication driver")+'</th>\
<th>'+tr("VMs")+'</th>\
<th>'+tr("Memory used")+'</th>\
<th>'+tr("CPU used")+'</th>\
<th>'+tr("Group ID")+'</th>\
</tr>\
</thead>\
@ -490,12 +493,26 @@ function userElements(){
function userElementArray(user_json){
var user = user_json.USER;
var vms = "-";
var memory = "-";
var cpu = "-";
if (!$.isEmptyObject(user.VM_QUOTA)){
vms = user.VM_QUOTA.VM.VMS_USED;
memory = user.VM_QUOTA.VM.MEMORY_USED;
cpu = user.VM_QUOTA.VM.CPU_USED;
}
return [
'<input class="check_item" type="checkbox" id="user_'+user.ID+'" name="selected_items" value="'+user.ID+'"/>',
user.ID,
user.NAME,
user.GNAME,
user.AUTH_DRIVER,
vms,
memory,
cpu,
user.GID
]
};
@ -722,9 +739,9 @@ $(document).ready(function(){
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0] },
{ "sWidth": "35px", "aTargets": [1,5] },
{ "sWidth": "35px", "aTargets": [1,5,6,7,8] },
{ "sWidth": "150px", "aTargets": [4] },
{ "bVisible": false, "aTargets": [5]}
{ "bVisible": false, "aTargets": [8]}
],
"oLanguage": (datatable_lang != "") ?
{
@ -734,7 +751,7 @@ $(document).ready(function(){
dataTable_users.fnClearTable();
addElement([
spinner,
'','','','',''],dataTable_users);
'','','','','','','',''],dataTable_users);
Sunstone.runAction("User.list");