浏览代码

AMBARI-5128 Rolling Restart dialog shows incorrect message that slaves won't be restarted when service is in maintenance mode. (ababiichuk)

aBabiichuk 11 年之前
父节点
当前提交
75cb22e6eb
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      ambari-web/app/views/common/rolling_restart_view.js

+ 9 - 4
ambari-web/app/views/common/rolling_restart_view.js

@@ -140,6 +140,13 @@ App.RollingRestartView = Em.View.extend({
     });
     });
   }.property('allHostComponents', 'allHostComponents.@each.passiveState'),
   }.property('allHostComponents', 'allHostComponents.@each.passiveState'),
 
 
+  /**
+   * List of host components with host in Maintenance mode
+   * @type {Array}
+   */
+  componentsWithMaintenanceHost: function() {
+    return this.get('allHostComponents').filterProperty('host.passiveState','ON');
+  }.property('allHostComponents', 'allHostComponents.@each.passiveState'),
   /**
   /**
    * List of host components without components in out-of-service state
    * List of host components without components in out-of-service state
    * If <code>staleConfigsOnly</code> is true, components with <code>staleConfigs</code> = false are also filtered
    * If <code>staleConfigsOnly</code> is true, components with <code>staleConfigs</code> = false are also filtered
@@ -169,9 +176,7 @@ App.RollingRestartView = Em.View.extend({
    * @type {String}
    * @type {String}
    */
    */
   maintainanceMessage : function() {
   maintainanceMessage : function() {
-    var allCount = this.get('allHostComponents.length');
-    var nonMaintainCount = this.get('nonMaintainanceHostComponents.length');
-    var count = allCount - nonMaintainCount;
+    var count = this.get('componentsWithMaintenanceHost.length');
     if (count > 0) {
     if (count > 0) {
       var name = this.get('hostComponentDisplayName');
       var name = this.get('hostComponentDisplayName');
       if (count > 1) {
       if (count > 1) {
@@ -180,7 +185,7 @@ App.RollingRestartView = Em.View.extend({
       return Em.I18n.t('rollingrestart.dialog.msg.maintainance').format(count, name)
       return Em.I18n.t('rollingrestart.dialog.msg.maintainance').format(count, name)
     }
     }
     return null;
     return null;
-  }.property('allHostComponents', 'nonMaintainanceHostComponents', 'hostComponentDisplayName'),
+  }.property('componentsWithMaintenanceHost', 'hostComponentDisplayName'),
 
 
   /**
   /**
    * @type {String}
    * @type {String}