Repository: ambari Updated Branches: refs/heads/trunk 4897ab831 -> 5c0306e68
AMBARI-6813. Background operations count incorrect after refreshing Dashboard page. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5c0306e6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5c0306e6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5c0306e6 Branch: refs/heads/trunk Commit: 5c0306e68aac3370946ef36e082deac0128bf5fb Parents: 4897ab8 Author: Aleksandr Kovalenko <[email protected]> Authored: Mon Aug 11 19:00:39 2014 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Mon Aug 11 19:02:12 2014 +0300 ---------------------------------------------------------------------- .../global/background_operations_controller.js | 17 +++++++++++++++-- ambari-web/app/router.js | 1 + ambari-web/app/utils/db.js | 19 ------------------- ambari-web/app/utils/host_progress_popup.js | 7 ++++--- 4 files changed, 20 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/5c0306e6/ambari-web/app/controllers/global/background_operations_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/global/background_operations_controller.js b/ambari-web/app/controllers/global/background_operations_controller.js index 17540c5..f6cb80b 100644 --- a/ambari-web/app/controllers/global/background_operations_controller.js +++ b/ambari-web/app/controllers/global/background_operations_controller.js @@ -33,6 +33,11 @@ App.BackgroundOperationsController = Em.Controller.extend({ */ services:[], serviceTimestamp: null, + + /** + * Number of operation to load + */ + operationsCount: 10, /** * Possible levels: * REQUESTS_LIST @@ -90,7 +95,7 @@ App.BackgroundOperationsController = Em.Controller.extend({ */ getQueryParams: function () { var levelInfo = this.get('levelInfo'); - var count = App.db.getBGOOperationsCount(); + var count = this.get('operationsCount'); var result = { name: 'background_operations.get_most_recent', successCallback: 'callBackForMostRecent', @@ -190,7 +195,7 @@ App.BackgroundOperationsController = Em.Controller.extend({ callBackForMostRecent: function (data) { var runningServices = 0; var currentRequestIds = []; - var countIssued = App.db.getBGOOperationsCount(); + var countIssued = this.get('operationsCount'); var countGot = data.itemTotal; data.items.forEach(function (request) { @@ -343,6 +348,14 @@ App.BackgroundOperationsController = Em.Controller.extend({ self.set ('popupView.isNotShowBgChecked', !initValue); } }); + }, + + /** + * Called on logout + */ + clear: function () { + // set operations count to default value + this.set('operationsCount', 10); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/5c0306e6/ambari-web/app/router.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js index 8e849b4..505b760 100644 --- a/ambari-web/app/router.js +++ b/ambari-web/app/router.js @@ -46,6 +46,7 @@ App.Router = Em.Router.extend({ this.get('addHostController').clear(); this.get('addServiceController').clear(); this.get('stackUpgradeController').clear(); + this.get('backgroundOperationsController').clear(); for (var i = 1; i < 11; i++) { this.set('wizardStep' + i + 'Controller.hasSubmitted', false); this.set('wizardStep' + i + 'Controller.isDisabled', true); http://git-wip-us.apache.org/repos/asf/ambari/blob/5c0306e6/ambari-web/app/utils/db.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js index 272112b..1530718 100644 --- a/ambari-web/app/utils/db.js +++ b/ambari-web/app/utils/db.js @@ -168,16 +168,6 @@ App.db.setAuthenticated = function (authenticated) { console.log('Now present value of authentication is: ' + App.db.data.app.authenticated); }; -App.db.setBGOOperationsCount = function(count) { - console.log('TRACE: Entering db:setBGOOperationsCount function'); - App.db.data = localStorage.getObject('ambari'); - if (!App.db.data.app.BGOOperationsCount) { - App.db.data.app.BGOOperationsCount = 10; - } - App.db.data.app.BGOOperationsCount = count; - localStorage.setObject('ambari', App.db.data); -}; - App.db.setFilterConditions = function(name, filterConditions) { console.log('TRACE: Entering db:setFilterConditions function'); App.db.data = localStorage.getObject('ambari'); @@ -562,15 +552,6 @@ App.db.getAuthenticated = function () { return App.db.data.app.authenticated; }; -App.db.getBGOOperationsCount = function () { - console.log('Trace: Entering db:getBGOOperationsCount function'); - App.db.data = localStorage.getObject('ambari'); - if (App.db.data.app.BGOOperationsCount) { - return App.db.data.app.BGOOperationsCount; - } - return 10; -}; - App.db.getFilterConditions = function(name) { console.log('TRACE: Entering db:getFilterConditions function'); App.db.data = localStorage.getObject('ambari'); http://git-wip-us.apache.org/repos/asf/ambari/blob/5c0306e6/ambari-web/app/utils/host_progress_popup.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js index 857f1a2..bcd3563 100644 --- a/ambari-web/app/utils/host_progress_popup.js +++ b/ambari-web/app/utils/host_progress_popup.js @@ -825,9 +825,10 @@ App.HostPopup = Em.Object.create({ * Onclick handler for Show more .. */ requestMoreOperations: function () { - var count = App.db.getBGOOperationsCount(); - App.db.setBGOOperationsCount(count + 10); - App.router.get('backgroundOperationsController').requestMostRecent(); + var BGOController = App.router.get('backgroundOperationsController'); + var count = BGOController.get('operationsCount'); + BGOController.set('operationsCount', (count + 10)); + BGOController.requestMostRecent(); }, setShowMoreAvailable: function () {
