Repository: ambari Updated Branches: refs/heads/trunk ab10cff01 -> 58523e14a
AMBARI-9446. Components Requiring Restart window shows incorrect data. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/58523e14 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/58523e14 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/58523e14 Branch: refs/heads/trunk Commit: 58523e14a1403f55fd1b5e741e56933ce4d832ee Parents: ab10cff Author: Aleksandr Kovalenko <akovale...@hortonworks.com> Authored: Tue Feb 3 14:06:07 2015 +0200 Committer: Aleksandr Kovalenko <akovale...@hortonworks.com> Committed: Tue Feb 3 14:06:07 2015 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/main/service/info/configs.js | 8 +++----- ambari-web/app/templates/main/service/info/configs.hbs | 4 ++-- .../test/controllers/main/service/info/config_test.js | 10 ++-------- 3 files changed, 7 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/58523e14/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index 5c70d8b..e0a1a1a 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -2403,8 +2403,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM */ showHostsShouldBeRestarted: function (restartRequiredHostsAndComponents) { var hosts = []; - var rhc = this.get('content.restartRequiredHostsAndComponents') || restartRequiredHostsAndComponents; - for (var hostName in rhc) { + for (var hostName in restartRequiredHostsAndComponents) { hosts.push(hostName); } var hostsText = hosts.length == 1 ? Em.I18n.t('common.host') : Em.I18n.t('common.hosts'); @@ -2417,11 +2416,10 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM * @method showComponentsShouldBeRestarted */ showComponentsShouldBeRestarted: function (restartRequiredHostsAndComponents) { - var rhc = this.get('content.restartRequiredHostsAndComponents') || restartRequiredHostsAndComponents; var hostsComponets = []; var componentsObject = {}; - for (var hostName in rhc) { - rhc[hostName].forEach(function (hostComponent) { + for (var hostName in restartRequiredHostsAndComponents) { + restartRequiredHostsAndComponents[hostName].forEach(function (hostComponent) { hostsComponets.push(hostComponent); if (componentsObject[hostComponent] != undefined) { componentsObject[hostComponent]++; http://git-wip-us.apache.org/repos/asf/ambari/blob/58523e14/ambari-web/app/templates/main/service/info/configs.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/info/configs.hbs b/ambari-web/app/templates/main/service/info/configs.hbs index 205ae0e..528f95d 100644 --- a/ambari-web/app/templates/main/service/info/configs.hbs +++ b/ambari-web/app/templates/main/service/info/configs.hbs @@ -23,8 +23,8 @@ <div> <div class="alert alert-warning clearfix"> <i class="icon-refresh"></i> {{t services.service.config.restartService.needToRestart}} <a - href="#" {{action showComponentsShouldBeRestarted target="controller"}}>{{view.componentsCount}} {{pluralize view.componentsCount singular="t:common.component" plural="t:common.components"}}</a> {{t on}} - <a href="#" {{action showHostsShouldBeRestarted target="controller"}}>{{view.hostsCount}} {{pluralize view.hostsCount singular="t:common.host" plural="t:common.hosts"}}</a> + href="#" {{action "showComponentsShouldBeRestarted" controller.content.restartRequiredHostsAndComponents target="controller"}}>{{view.componentsCount}} {{pluralize view.componentsCount singular="t:common.component" plural="t:common.components"}}</a> {{t on}} + <a href="#" {{action "showHostsShouldBeRestarted" controller.content.restartRequiredHostsAndComponents target="controller"}}>{{view.hostsCount}} {{pluralize view.hostsCount singular="t:common.host" plural="t:common.hosts"}}</a> <span class="restart-components pull-right"> </span> <div class="btn-group pull-right"> http://git-wip-us.apache.org/repos/asf/ambari/blob/58523e14/ambari-web/test/controllers/main/service/info/config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js index e34969d..c7003bc 100644 --- a/ambari-web/test/controllers/main/service/info/config_test.js +++ b/ambari-web/test/controllers/main/service/info/config_test.js @@ -211,17 +211,14 @@ describe("App.MainServiceInfoConfigsController", function () { beforeEach(function () { sinon.stub(mainServiceInfoConfigsController, "showItemsShouldBeRestarted", Em.K); - mainServiceInfoConfigsController.set("content", {restartRequiredHostsAndComponents: ""}); }); afterEach(function () { mainServiceInfoConfigsController.showItemsShouldBeRestarted.restore(); - mainServiceInfoConfigsController.set("content", undefined); }); tests.forEach(function (t) { it("trigger showItemsShouldBeRestarted popup with components", function () { - mainServiceInfoConfigsController.set("content.restartRequiredHostsAndComponents", t.input); - mainServiceInfoConfigsController.showComponentsShouldBeRestarted(); + mainServiceInfoConfigsController.showComponentsShouldBeRestarted(t.input); expect(mainServiceInfoConfigsController.showItemsShouldBeRestarted.calledWith(t.components, t.text)).to.equal(true); }); }); @@ -249,17 +246,14 @@ describe("App.MainServiceInfoConfigsController", function () { beforeEach(function () { sinon.stub(mainServiceInfoConfigsController, "showItemsShouldBeRestarted", Em.K); - mainServiceInfoConfigsController.set("content", {restartRequiredHostsAndComponents: ""}); }); afterEach(function () { mainServiceInfoConfigsController.showItemsShouldBeRestarted.restore(); - mainServiceInfoConfigsController.set("content", undefined); }); tests.forEach(function (t) { it("trigger showItemsShouldBeRestarted popup with hosts", function () { - mainServiceInfoConfigsController.set("content.restartRequiredHostsAndComponents", t.input); - mainServiceInfoConfigsController.showHostsShouldBeRestarted(); + mainServiceInfoConfigsController.showHostsShouldBeRestarted(t.input); expect(mainServiceInfoConfigsController.showItemsShouldBeRestarted.calledWith(t.hosts, t.text)).to.equal(true); }); });