diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index dafc69f500..301f112825 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -24,8 +24,6 @@ require 'OpenNebulaJSON/JSONUtils' #include JSONUtils class SunstoneServer < CloudServer - # FLAG that will filter the elements retrieved from the Pools - POOL_FILTER = Pool::INFO_ALL # Secs to sleep between checks to see if image upload to repo is finished IMAGE_POLL_SLEEP_TIME = 5 @@ -38,14 +36,10 @@ class SunstoneServer < CloudServer ############################################################################ # ############################################################################ - def get_pool(kind,gid, client=nil) + def get_pool(kind,user_flag, client=nil) client = @client if !client - if gid == "0" - user_flag = Pool::INFO_ALL - else - user_flag = POOL_FILTER - end + user_flag = Integer(user_flag) pool = case kind when "group" then GroupPoolJSON.new(client) diff --git a/src/sunstone/public/app/app.js b/src/sunstone/public/app/app.js index b3465b99d0..c293b59343 100644 --- a/src/sunstone/public/app/app.js +++ b/src/sunstone/public/app/app.js @@ -37,8 +37,6 @@ define(function(require) { var Notifier = require('utils/notifier'); var Menu = require('utils/menu'); var Locale = require('utils/locale'); - var OpenNebulaGroup = require('opennebula/group'); - var UserAndZoneTemplate = require('hbs!sunstone/user_and_zone'); var _commonDialogs = [ @@ -176,6 +174,9 @@ define(function(require) { $('.groups-menu').append(groupsHTML); $('.groups').on('click', function(){ that.idGroup = $(this).attr('value'); + if(that.idGroup != -2){ + Sunstone.runAction("User.chgrp", [parseInt(config['user_id'])], parseInt(that.idGroup)); + } $('.groups-menu a i').removeClass('fa-check'); $('a i', this).addClass('fa-check'); groupsRefresh(); @@ -184,6 +185,8 @@ define(function(require) { } else { Config.changeFilter(false); } + $('.refresh').click(); + $('.refresh-table').click(); }); }); }, diff --git a/src/sunstone/public/app/opennebula/action.js b/src/sunstone/public/app/opennebula/action.js index f00b5448b1..f99c7b705f 100644 --- a/src/sunstone/public/app/opennebula/action.js +++ b/src/sunstone/public/app/opennebula/action.js @@ -17,6 +17,7 @@ define(function(require) { var OpenNebulaHelper = require('./helper'); var OpenNebulaError = require('./error'); + var Config = require('sunstone-config'); var listCache = {}; var listWaiting = {}; @@ -162,13 +163,13 @@ define(function(require) { } listWaiting[cache_name] = true; - + var pool_filter = Config.isChangedFilter()?-4:-2; //console.log(cache_name+" list. NO cache, calling ajax"); $.ajax({ url: reqPath, type: "GET", - data: {timeout: timeout}, + data: {timeout: timeout, pool_filter: pool_filter}, dataType: "json", success: function(response) { var list; diff --git a/src/sunstone/public/app/opennebula/datastore.js b/src/sunstone/public/app/opennebula/datastore.js index 429578aaaa..6ebe7a386a 100644 --- a/src/sunstone/public/app/opennebula/datastore.js +++ b/src/sunstone/public/app/opennebula/datastore.js @@ -131,7 +131,9 @@ define(function(require) { return support; }, "initMarketExportSupported": function(){ + var pool_filter = Config.isChangedFilter()? -4 : -2; this.list({ + data : {pool_filter : pool_filter}, timeout: true, success: function (request, obj_list) {}, //error: Notifier.onError diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index a3c7146e72..68d5899f66 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -30,6 +30,10 @@ define(function(require) { _config['pool_filter'] = bool; }, + "isChangedFilter": function(){ + return _config['pool_filter']; + }, + "isTabActionEnabled": function(tabName, actionName, panelName) { var enabled = false; var configTab = _config['view']['tabs'][tabName]; diff --git a/src/sunstone/public/app/tabs/users-tab/panels/groups.js b/src/sunstone/public/app/tabs/users-tab/panels/groups.js index 1345b0b550..639cb3f81c 100644 --- a/src/sunstone/public/app/tabs/users-tab/panels/groups.js +++ b/src/sunstone/public/app/tabs/users-tab/panels/groups.js @@ -108,7 +108,7 @@ define(function(require) { this.groupsTableEdit.selectResourceTableSelect({ids: this.groups}); $("#cancel_update_group").hide(); - that = this; + var that = this; context.off("click", "#update_group"); context.on("click", "#update_group", function() { ResourceSelect.insert({ diff --git a/src/sunstone/public/app/utils/tab-datatable.js b/src/sunstone/public/app/utils/tab-datatable.js index f5c562cb33..a1ab9744b6 100644 --- a/src/sunstone/public/app/utils/tab-datatable.js +++ b/src/sunstone/public/app/utils/tab-datatable.js @@ -1231,16 +1231,17 @@ define(function(require) { success_func(request, []); Notifier.onError(request, error_json, container); } - + var pool_filter = SunstoneConfig.isChangedFilter()? -4 : -2; if (that.selectOptions.zone_id == undefined) { OpenNebula[that.resource].list({ + data : {pool_filter : pool_filter}, timeout: true, success: success_func, error: error_func }); } else { OpenNebula[that.resource].list_in_zone({ - data: {zone_id: that.selectOptions.zone_id}, + data: {zone_id: that.selectOptions.zone_id, pool_filter : pool_filter}, timeout: true, success: success_func, error: error_func @@ -1251,7 +1252,9 @@ define(function(require) { // TODO: This is probably duplicated somewhere function _list() { var that = this; + var pool_filter = SunstoneConfig.isChangedFilter()? -4 : -2; OpenNebula[that.resource].list({ + data : {pool_filter : pool_filter}, success: function(req, resp) { that.updateView(req, resp); }, diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index ec0ccb895b..765379415d 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -702,7 +702,7 @@ get '/:pool' do end @SunstoneServer.get_pool(params[:pool], - session[:user_gid], + params[:pool_filter], zone_client) end