浏览代码

AMBARI-9590 Restart required components are not viewable. (ababiichuk)

aBabiichuk 10 年之前
父节点
当前提交
0ee5b5ecb8

+ 6 - 2
ambari-web/app/controllers/main/service/info/configs.js

@@ -2387,9 +2387,11 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
 
   /**
    * trigger showItemsShouldBeRestarted popup with hosts that requires resetart
+   * @param event
    * @method showHostsShouldBeRestarted
    */
-  showHostsShouldBeRestarted: function (restartRequiredHostsAndComponents) {
+  showHostsShouldBeRestarted: function (event) {
+    var restartRequiredHostsAndComponents = event.context;
     var hosts = [];
     for (var hostName in restartRequiredHostsAndComponents) {
       hosts.push(hostName);
@@ -2401,9 +2403,11 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
 
   /**
    * trigger showItemsShouldBeRestarted popup with components that requires resetart
+   * @param event
    * @method showComponentsShouldBeRestarted
    */
-  showComponentsShouldBeRestarted: function (restartRequiredHostsAndComponents) {
+  showComponentsShouldBeRestarted: function (event) {
+    var restartRequiredHostsAndComponents = event.context;
     var hostsComponets = [];
     var componentsObject = {};
     for (var hostName in restartRequiredHostsAndComponents) {

+ 2 - 2
ambari-web/app/templates/main/service/info/summary.hbs

@@ -21,8 +21,8 @@
     <div id="summary-restart-bar">
       <div class="alert alert-warning clearfix">
         <i class="icon-refresh"></i> {{{view.needToRestartMessage}}} {{t services.service.config.restartService.needToRestart}}
-        <a href="#" {{action showComponentsShouldBeRestarted target="view"}}>{{view.componentsCount}} {{pluralize view.componentsCount singular="t:common.component" plural="t:common.components"}}</a> {{t on}}
-        <a href="#" {{action showHostsShouldBeRestarted target="view"}}>{{view.hostsCount}} {{pluralize view.hostsCount singular="t:common.host" plural="t:common.hosts"}}</a>
+        <a href="#" {{action showComponentsShouldBeRestarted controller.content.restartRequiredHostsAndComponents target="App.router.mainServiceInfoConfigsController"}}>{{view.componentsCount}} {{pluralize view.componentsCount singular="t:common.component" plural="t:common.components"}}</a> {{t on}}
+        <a href="#" {{action showHostsShouldBeRestarted controller.content.restartRequiredHostsAndComponents target="App.router.mainServiceInfoConfigsController"}}>{{view.hostsCount}} {{pluralize view.hostsCount singular="t:common.host" plural="t:common.hosts"}}</a>
         <span class="restart-components pull-right">&nbsp</span>
 
         <div class="btn-group pull-right">

+ 3 - 14
ambari-web/app/views/main/service/info/summary.js

@@ -251,12 +251,8 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
     return App.AlertDefinition.find().someProperty('serviceName', this.get('controller.content.serviceName'));
   }.property('controller.content.serviceName'),
 
-  restartRequiredHostsAndComponents:function () {
-    return this.get('controller.content.restartRequiredHostsAndComponents');
-  }.property('controller.content.restartRequiredHostsAndComponents'),
-
   updateComponentInformation: function() {
-    var hc = this.get('restartRequiredHostsAndComponents');
+    var hc = this.get('controller.content.restartRequiredHostsAndComponents');
     var hostsCount = 0;
     var componentsCount = 0;
     for (var host in hc) {
@@ -265,7 +261,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
     }
     this.set('componentsCount', componentsCount);
     this.set('hostsCount', hostsCount);
-  }.observes('restartRequiredHostsAndComponents'),
+  }.observes('controller.content.restartRequiredHostsAndComponents'),
 
   rollingRestartSlaveComponentName : function() {
     return batchUtils.getRollingRestartComponentName(this.get('serviceName'));
@@ -278,14 +274,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
     }
     return label;
   }.property('rollingRestartSlaveComponentName'),
-  showComponentsShouldBeRestarted: function () {
-    var rhc = this.get('restartRequiredHostsAndComponents');
-    App.router.get('mainServiceInfoConfigsController').showComponentsShouldBeRestarted(rhc);
-  },
-  showHostsShouldBeRestarted: function () {
-    var rhc = this.get('restartRequiredHostsAndComponents');
-    App.router.get('mainServiceInfoConfigsController').showHostsShouldBeRestarted(rhc);
-  },
+
   restartAllStaleConfigComponents: function () {
     var self = this;
     var serviceDisplayName = this.get('service.displayName');

+ 14 - 6
ambari-web/test/controllers/main/service/info/config_test.js

@@ -194,15 +194,19 @@ describe("App.MainServiceInfoConfigsController", function () {
     var tests = [
       {
         input: {
-          'publicHostName1': ['TaskTracker'],
-          'publicHostName2': ['JobTracker', 'TaskTracker']
+          context: {
+            'publicHostName1': ['TaskTracker'],
+            'publicHostName2': ['JobTracker', 'TaskTracker']
+          }
         },
         components: "2 TaskTrackers, 1 JobTracker",
         text: Em.I18n.t('service.service.config.restartService.shouldBeRestarted').format(Em.I18n.t('common.components'))
       },
       {
         input: {
-          'publicHostName1': ['TaskTracker']
+          context: {
+            'publicHostName1': ['TaskTracker']
+          }
         },
         components: "1 TaskTracker",
         text: Em.I18n.t('service.service.config.restartService.shouldBeRestarted').format(Em.I18n.t('common.component'))
@@ -229,15 +233,19 @@ describe("App.MainServiceInfoConfigsController", function () {
     var tests = [
       {
         input: {
-          'publicHostName1': ['TaskTracker'],
-          'publicHostName2': ['JobTracker', 'TaskTracker']
+          context: {
+            'publicHostName1': ['TaskTracker'],
+            'publicHostName2': ['JobTracker', 'TaskTracker']
+          }
         },
         hosts: "publicHostName1, publicHostName2",
         text: Em.I18n.t('service.service.config.restartService.shouldBeRestarted').format(Em.I18n.t('common.hosts'))
       },
       {
         input: {
-          'publicHostName1': ['TaskTracker']
+          context: {
+            'publicHostName1': ['TaskTracker']
+          }
         },
         hosts: "publicHostName1",
         text: Em.I18n.t('service.service.config.restartService.shouldBeRestarted').format(Em.I18n.t('common.host'))