Repository: ambari Updated Branches: refs/heads/branch-1.6.0 2eb05118d -> b0ae8663e
AMBARI-5711. 'Background operations' window displayed after attempt to switch HBase RegionServer to 'Decommission' state. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b0ae8663 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b0ae8663 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b0ae8663 Branch: refs/heads/branch-1.6.0 Commit: b0ae8663e14487570c04401ab10563c28475d429 Parents: 2eb0511 Author: Oleg Nechiporenko <[email protected]> Authored: Thu May 8 15:07:03 2014 +0300 Committer: Oleg Nechiporenko <[email protected]> Committed: Thu May 8 15:07:03 2014 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host.js | 47 +++++++++----------- ambari-web/app/controllers/main/host/details.js | 27 +---------- ambari-web/app/messages.js | 2 +- .../test/controllers/main/host/details_test.js | 4 +- 4 files changed, 24 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b0ae8663/ambari-web/app/controllers/main/host.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js index 8b707d7..d724f95 100644 --- a/ambari-web/app/controllers/main/host.js +++ b/ambari-web/app/controllers/main/host.js @@ -341,33 +341,28 @@ App.MainHostController = Em.ArrayController.extend({ } else { hostsWithComponentInProperState = components.filterProperty('workStatus','STARTED').mapProperty('host.hostName'); //For decommession - if (svcName == "HBASE") { - // HBASE service, decommission RegionServer in batch requests - App.router.get('mainHostDetailsController').warnBeforeDecommission(hostNames, svcName, masterName, slaveName); - } else { - var parameters = { - "slave_type": slaveName - }; - var contextString = turn_off? 'hosts.host.' + slaveName.toLowerCase() + '.recommission': - 'hosts.host.' + slaveName.toLowerCase() + '.decommission'; - if (turn_off) { - parameters['included_hosts'] = hostsWithComponentInProperState.join(',') - } - else { - parameters['excluded_hosts'] = hostsWithComponentInProperState.join(','); - } - App.ajax.send({ - name: 'bulk_request.decommission', - sender: this, - data: { - context: Em.I18n.t(contextString), - serviceName: service.get('serviceName'), - componentName: operationData.componentName, - parameters: parameters - }, - success: 'bulkOperationForHostComponentsSuccessCallback' - }); + var parameters = { + "slave_type": slaveName + }; + var contextString = turn_off? 'hosts.host.' + slaveName.toLowerCase() + '.recommission': + 'hosts.host.' + slaveName.toLowerCase() + '.decommission'; + if (turn_off) { + parameters['included_hosts'] = hostsWithComponentInProperState.join(',') + } + else { + parameters['excluded_hosts'] = hostsWithComponentInProperState.join(','); } + App.ajax.send({ + name: 'bulk_request.decommission', + sender: this, + data: { + context: Em.I18n.t(contextString), + serviceName: service.get('serviceName'), + componentName: operationData.componentName, + parameters: parameters + }, + success: 'bulkOperationForHostComponentsSuccessCallback' + }); } } else { http://git-wip-us.apache.org/repos/asf/ambari/blob/b0ae8663/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index 73fda3e..da3073b 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -924,7 +924,7 @@ App.MainHostDetailsController = Em.Controller.extend({ this.doDecommission(hostName, svcName, "JOBTRACKER", "TASKTRACKER"); break; case 'HBASE': - this.warnBeforeDecommission(hostName, svcName, "HBASE_MASTER", "HBASE_REGIONSERVER"); + this.doDecommission(hostName, svcName, "HBASE_MASTER", "HBASE_REGIONSERVER"); } this.showBackgroundOperationsPopup(); }, @@ -991,31 +991,6 @@ App.MainHostDetailsController = Em.Controller.extend({ }, /** - * Recommend user to put component in MM before decommission (for HBASE only) - * @method warnBeforeDecommission - * @param {string[]} hostNames - list of host when run from bulk operations or current host - * @param {string} serviceName - serviceName - * @param {string} componentName - master component name - * @param {string} slaveType - slave component name - */ - warnBeforeDecommission: function(hostNames, serviceName, componentName, slaveType) { - if (App.HostComponent.find().findProperty('componentName', componentName).get('passiveState') == "OFF") { - App.ModalPopup.show({ - header: Em.I18n.t('common.warning'), - message: function () { - return Em.I18n.t('hostPopup.reccomendation.beforeDecommission').format(App.format.components[componentName]); - }.property(), - bodyClass: Em.View.extend({ - template: Em.Handlebars.compile('<div class="alert alert-warning">{{message}}</div>') - }), - secondary: false - }); - } else { - this.doDecommissionRegionServer(hostNames, serviceName, componentName, slaveType); - } - }, - - /** * Performs Decommission (for RegionServer) * @method doDecommissionRegionServer * @param {string[]} hostNames - list of host when run from bulk operations or current host http://git-wip-us.apache.org/repos/asf/ambari/blob/b0ae8663/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index b8d5ffe..bf1cab9 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1537,7 +1537,7 @@ Em.I18n.translations = { 'hosts.host.regionserver.decommission.batch2':'Decommission RegionServer - Stop RegionServer', 'hosts.host.regionserver.decommission.batch3':'Decommission RegionServer - Turn drain mode off', 'hosts.host.hbase_regionserver.recommission':'Recommission RegionServer', - 'hosts.host.hbase_regionserver.decommsion':'Decommission RegionServer', + 'hosts.host.hbase_regionserver.decommission':'Decommission RegionServer', 'hosts.host.decommissioned':'Decommissioned', 'hosts.host.decommissioning':'Decommissioning', http://git-wip-us.apache.org/repos/asf/ambari/blob/b0ae8663/ambari-web/test/controllers/main/host/details_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js index 3d6bb2a..921183f 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -873,13 +873,11 @@ describe('App.MainHostDetailsController', function () { beforeEach(function () { sinon.stub(controller, "doDecommission", Em.K); - sinon.stub(controller, "warnBeforeDecommission", Em.K); sinon.stub(controller, "showBackgroundOperationsPopup", Em.K); }); afterEach(function () { controller.doDecommission.restore(); - controller.warnBeforeDecommission.restore(); controller.showBackgroundOperationsPopup.restore(); }); @@ -900,7 +898,7 @@ describe('App.MainHostDetailsController', function () { }); it('HBASE service', function () { controller.runDecommission('host1', 'HBASE'); - expect(controller.warnBeforeDecommission.calledWith('host1', 'HBASE', "HBASE_MASTER", "HBASE_REGIONSERVER")).to.be.true; + expect(controller.doDecommission.calledWith('host1', 'HBASE', "HBASE_MASTER", "HBASE_REGIONSERVER")).to.be.true; expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true; }); });
