AMBARI-7309 UI should issue separate requests for starting service and disabling MM. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/34ffd774 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/34ffd774 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/34ffd774 Branch: refs/heads/branch-alerts-dev Commit: 34ffd774c4c05ce98881f920e4b40af9b89a887f Parents: f53e654 Author: aBabiichuk <ababiic...@cybervisiontech.com> Authored: Mon Sep 15 17:18:40 2014 +0300 Committer: aBabiichuk <ababiic...@cybervisiontech.com> Committed: Tue Sep 16 20:49:01 2014 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/main/service/item.js | 36 +++++++++++++------- .../app/utils/batch_scheduled_requests.js | 2 +- 2 files changed, 25 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/34ffd774/ambari-web/app/controllers/main/service/item.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js index edb524c..84d833f 100644 --- a/ambari-web/app/controllers/main/service/item.js +++ b/ambari-web/app/controllers/main/service/item.js @@ -157,20 +157,34 @@ App.MainServiceItemController = Em.Controller.extend({ return App.showConfirmationFeedBackPopup(function(query, runMmOperation) { self.set('isPending', true); - self.startStopPopupPrimary(serviceHealth, query, runMmOperation); + self.startStopWithMmode(serviceHealth, query, runMmOperation); }, bodyMessage); }, - startStopPopupPrimary: function (serviceHealth, query, runMmOperation) { - var requestInfo = ""; - var turnOnMM = "ON"; - if (serviceHealth == "STARTED") { - turnOnMM = "OFF"; - requestInfo = App.BackgroundOperationsController.CommandContexts.START_SERVICE.format(this.get('content.serviceName')); + + startStopWithMmode: function(serviceHealth, query, runMmOperation) { + var self = this; + if (runMmOperation) { + if (serviceHealth == "STARTED") { + this.startStopPopupPrimary(serviceHealth, query).complete(function() { + batchUtils.turnOnOffPassiveRequest("OFF", Em.I18n.t('passiveState.turnOff'), self.get('content.serviceName').toUpperCase()); + }); + } else { + batchUtils.turnOnOffPassiveRequest("ON", Em.I18n.t('passiveState.turnOn'), this.get('content.serviceName').toUpperCase()).complete(function() { + self.startStopPopupPrimary(serviceHealth, query); + }) + } } else { - requestInfo = App.BackgroundOperationsController.CommandContexts.STOP_SERVICE.format(this.get('content.serviceName')); + this.startStopPopupPrimary(serviceHealth, query); } + }, + + startStopPopupPrimary: function (serviceHealth, query) { + var requestInfo = (serviceHealth == "STARTED") + ? App.BackgroundOperationsController.CommandContexts.START_SERVICE.format(this.get('content.serviceName')) + : App.BackgroundOperationsController.CommandContexts.STOP_SERVICE.format(this.get('content.serviceName')); + var data = { 'context': requestInfo, 'serviceName': this.get('content.serviceName').toUpperCase(), @@ -179,10 +193,8 @@ App.MainServiceItemController = Em.Controller.extend({ }, 'query': query }; - if (runMmOperation) { - data.ServiceInfo.maintenance_state = turnOnMM; - } - App.ajax.send({ + + return App.ajax.send({ 'name': 'common.service.update', 'sender': this, 'success': 'startStopPopupSuccessCallback', http://git-wip-us.apache.org/repos/asf/ambari/blob/34ffd774/ambari-web/app/utils/batch_scheduled_requests.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/batch_scheduled_requests.js b/ambari-web/app/utils/batch_scheduled_requests.js index 1ee7c70..52bf0d8 100644 --- a/ambari-web/app/utils/batch_scheduled_requests.js +++ b/ambari-web/app/utils/batch_scheduled_requests.js @@ -266,7 +266,7 @@ module.exports = { }, turnOnOffPassiveRequest: function(state, message, serviceName, callback) { - App.ajax.send({ + return App.ajax.send({ 'name': 'common.service.passive', 'sender': { 'successCallback': callback || defaultSuccessCallback,