Repository: ambari Updated Branches: refs/heads/trunk e362aa994 -> 99becb418
AMBARI-16900 Delete Host message is incorrect, suggests all Clients will be deleted from cluster. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/99becb41 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/99becb41 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/99becb41 Branch: refs/heads/trunk Commit: 99becb41819905db65245bd186481b3718c2f4af Parents: e362aa9 Author: Andrii Tkach <[email protected]> Authored: Thu May 26 18:09:45 2016 +0300 Committer: Andrii Tkach <[email protected]> Committed: Fri May 27 12:18:16 2016 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host/details.js | 6 ++---- ambari-web/test/controllers/main/host/details_test.js | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/99becb41/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 07991b0..1364adf 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -2067,7 +2067,6 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow */ getHostComponentsInfo: function () { var componentsOnHost = this.get('content.hostComponents'); - var allComponents = App.HostComponent.find(); var stoppedStates = [App.HostComponentStatus.stopped, App.HostComponentStatus.install_failed, App.HostComponentStatus.upgrade_failed, @@ -2082,13 +2081,12 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow unknownComponents: [], toDecommissionComponents: [] }; - var self = this; if (componentsOnHost && componentsOnHost.get('length') > 0) { componentsOnHost.forEach(function (cInstance) { if (cInstance.get('componentName') === 'ZOOKEEPER_SERVER') { container.zkServerInstalled = true; } - if (allComponents.filterProperty('componentName', cInstance.get('componentName')).get('length') === 1) { + if (this.getTotalComponent(cInstance) === 1) { container.lastComponents.push(cInstance.get('displayName')); } var workStatus = cInstance.get('workStatus'); @@ -2107,7 +2105,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow if (App.get('components.decommissionAllowed').contains(cInstance.get('componentName')) && !cInstance.get('view.isComponentRecommissionAvailable')) { container.toDecommissionComponents.push(cInstance.get('displayName')); } - }); + }, this); } return container; }, http://git-wip-us.apache.org/repos/asf/ambari/blob/99becb41/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 db061a7..66bd454 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -1998,10 +1998,13 @@ describe('App.MainHostDetailsController', function () { id: 'TASKTRACKER_host1', componentName: 'TASKTRACKER' }]); + this.mockTotal = sinon.stub(controller, 'getTotalComponent'); + this.mockTotal.returns(2); }); afterEach(function () { this.stub.restore(); + this.mockTotal.restore(); }); it('content.hostComponents is null', function () { @@ -2035,6 +2038,7 @@ describe('App.MainHostDetailsController', function () { isDeletable: true })] }); + this.mockTotal.returns(1); expect(controller.getHostComponentsInfo().lastComponents).to.eql(['TaskTracker']); });
