mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-08 20:58:17 +03:00
Feature #2632: Fix quotas in sunstone
This commit is contained in:
parent
043a8a7410
commit
54d53f45b1
@ -227,7 +227,9 @@ var OpenNebula = {
|
||||
|
||||
if (response[pool_name]) {
|
||||
pool = response[pool_name][type];
|
||||
} else { pull = null };
|
||||
} else {
|
||||
pool = null;
|
||||
}
|
||||
|
||||
if (pool == null)
|
||||
{
|
||||
@ -246,6 +248,49 @@ var OpenNebula = {
|
||||
{
|
||||
p_pool[0] = {};
|
||||
p_pool[0][type] = pool;
|
||||
return(p_pool);
|
||||
}
|
||||
},
|
||||
|
||||
"pool_hash_processing": function(pool_name, resource_name, response)
|
||||
{
|
||||
var pool;
|
||||
|
||||
if (typeof(pool_name) == "undefined")
|
||||
{
|
||||
return Error('Incorrect Pool');
|
||||
}
|
||||
|
||||
var p_pool = {};
|
||||
|
||||
if (response[pool_name]) {
|
||||
pool = response[pool_name][resource_name];
|
||||
} else {
|
||||
pool = null;
|
||||
}
|
||||
|
||||
if (pool == null)
|
||||
{
|
||||
return p_pool;
|
||||
}
|
||||
else if (pool.length)
|
||||
{
|
||||
for (i=0;i<pool.length;i++)
|
||||
{
|
||||
var res = {};
|
||||
res[resource_name] = pool[i];
|
||||
|
||||
p_pool[res[resource_name]['ID']] = res;
|
||||
}
|
||||
return(p_pool);
|
||||
}
|
||||
else
|
||||
{
|
||||
var res = {};
|
||||
res[resource_name] = pool;
|
||||
|
||||
p_pool[res[resource_name]['ID']] = res;
|
||||
|
||||
return(p_pool);
|
||||
}
|
||||
}
|
||||
@ -849,8 +894,11 @@ var OpenNebula = {
|
||||
default_group_quotas = Quotas.default_quotas(response.GROUP_POOL.DEFAULT_GROUP_QUOTAS);
|
||||
|
||||
var list = OpenNebula.Helper.pool(resource,response)
|
||||
var quotas_hash = OpenNebula.Helper.pool_hash_processing(
|
||||
'GROUP_POOL','QUOTAS',response);
|
||||
|
||||
return callback ?
|
||||
callback(request, list) : null;
|
||||
callback(request, list, quotas_hash) : null;
|
||||
},
|
||||
error: function(response)
|
||||
{
|
||||
@ -907,8 +955,11 @@ var OpenNebula = {
|
||||
default_user_quotas = Quotas.default_quotas(response.USER_POOL.DEFAULT_USER_QUOTAS);
|
||||
|
||||
var list = OpenNebula.Helper.pool(resource,response)
|
||||
var quotas_hash = OpenNebula.Helper.pool_hash_processing(
|
||||
'USER_POOL','QUOTAS',response);
|
||||
|
||||
return callback ?
|
||||
callback(request, list) : null;
|
||||
callback(request, list, quotas_hash) : null;
|
||||
},
|
||||
error: function(response)
|
||||
{
|
||||
|
@ -683,11 +683,16 @@ function addGroupElement(request,group_json){
|
||||
}
|
||||
|
||||
//updates the list
|
||||
function updateGroupsView(request, group_list){
|
||||
function updateGroupsView(request, group_list, quotas_hash){
|
||||
group_list_json = group_list;
|
||||
var group_list_array = [];
|
||||
|
||||
$.each(group_list,function(){
|
||||
// Inject the VM group quota. This info is returned separately in the
|
||||
// pool info call, but the groupElementArray expects it inside the GROUP,
|
||||
// as it is returned by the individual info call
|
||||
this.GROUP.VM_QUOTA = quotas_hash[this.GROUP.ID].QUOTAS.VM_QUOTA;
|
||||
|
||||
group_list_array.push(groupElementArray(this));
|
||||
});
|
||||
updateView(group_list_array,dataTable_groups);
|
||||
|
@ -732,12 +732,18 @@ function addUserElement(request,user_json){
|
||||
}
|
||||
|
||||
// Callback to update the list of users
|
||||
function updateUsersView(request,users_list){
|
||||
function updateUsersView(request,users_list,quotas_list){
|
||||
var user_list_array = [];
|
||||
|
||||
$.each(users_list,function(){
|
||||
//if (this.USER.ID == uid)
|
||||
// dashboardQuotasHTML(this.USER);
|
||||
|
||||
// Inject the VM user quota. This info is returned separately in the
|
||||
// pool info call, but the userElementArray expects it inside the USER,
|
||||
// as it is returned by the individual info call
|
||||
this.USER.VM_QUOTA = quotas_list[this.USER.ID].QUOTAS.VM_QUOTA
|
||||
|
||||
user_list_array.push(userElementArray(this));
|
||||
});
|
||||
updateView(user_list_array,dataTable_users);
|
||||
|
Loading…
x
Reference in New Issue
Block a user