瀏覽代碼

AMBARI-6080. Hosts Components filter on Service summary page doesn't work. (akovalenko)

Aleksandr Kovalenko 11 年之前
父節點
當前提交
6f0723794e

+ 1 - 1
ambari-web/app/controllers/main/host.js

@@ -379,7 +379,7 @@ App.MainHostController = Em.ArrayController.extend(App.UserPref, {
 
     var filterForComponent = {
       iColumn: column,
-      value: id,
+      value: [id],
       type: 'multiple'
     };
     App.db.setFilterConditions(this.get('name'), [filterForComponent]);

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

@@ -19,8 +19,8 @@
 {{view view.sumMasterComponentView}}
 
 <tr>
-    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.clients.length singular="t:services.falcon.client" plural="t:services.falcon.clients"}}</a></td>
+    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.service.installedClients singular="t:services.falcon.client" plural="t:services.falcon.clients"}}</a></td>
     <td>
-        <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.clients.length singular="t:services.falcon.client" plural="t:services.falcon.clients"}} {{t common.installed}}
+        <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.service.installedClients singular="t:services.falcon.client" plural="t:services.falcon.clients"}} {{t common.installed}}
     </td>
 </tr>

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

@@ -19,8 +19,8 @@
 {{view view.sumMasterComponentView}}
 
 <tr>
-    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.clients.length singular="t:services.hive.client" plural="t:services.hive.clients"}}</a></td>
+    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.service.installedClients singular="t:services.hive.client" plural="t:services.hive.clients"}}</a></td>
     <td>
-        <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.clients.length singular="t:services.hive.client" plural="t:services.hive.clients"}} {{t common.installed}}
+        <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.service.installedClients singular="t:services.hive.client" plural="t:services.hive.clients"}} {{t common.installed}}
     </td>
 </tr>

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

@@ -18,8 +18,8 @@
 
 {{view view.sumMasterComponentView}}
 <tr>
-    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.clients.length singular="t:services.service.summary.mapreduce2.client" plural="t:services.service.summary.mapreduce2.clients"}}</a></td>
+    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.service.mapReduce2Clients singular="t:services.service.summary.mapreduce2.client" plural="t:services.service.summary.mapreduce2.clients"}}</a></td>
     <td>
-        <span class="green-live">{{view.service.mapReduce2Clients}} </span>{{pluralize view.clients.length singular="t:services.service.summary.mapreduce2.client" plural="t:services.service.summary.mapreduce2.clients"}} {{t common.installed}}
+        <span class="green-live">{{view.service.mapReduce2Clients}} </span>{{pluralize view.service.mapReduce2Clients singular="t:services.service.summary.mapreduce2.client" plural="t:services.service.summary.mapreduce2.clients"}} {{t common.installed}}
     </td>
 </tr>

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

@@ -20,9 +20,9 @@
 {{view view.sumMasterComponentView}}
 
 <tr>
-    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.clients.length singular="t:services.oozie.client" plural="t:services.oozie.clients"}}</a></td>
+    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.service.installedClients singular="t:services.oozie.client" plural="t:services.oozie.clients"}}</a></td>
     <td>
-        <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.clients.length singular="t:services.oozie.client" plural="t:services.oozie.clients"}} {{t common.installed}}
+        <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.service.installedClients singular="t:services.oozie.client" plural="t:services.oozie.clients"}} {{t common.installed}}
     </td>
 </tr>
 

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

@@ -16,8 +16,8 @@
 * limitations under the License.
 }}
 <tr>
-  <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.clients.length singular="t:services.pig.client" plural="t:services.pig.clients"}}</a></td>
+  <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.service.installedClients singular="t:services.pig.client" plural="t:services.pig.clients"}}</a></td>
   <td>
-    <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.clients.length singular="t:services.pig.client" plural="t:services.pig.clients"}} {{t common.installed}}
+    <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.service.installedClients singular="t:services.pig.client" plural="t:services.pig.clients"}} {{t common.installed}}
   </td>
 </tr>

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

@@ -16,8 +16,8 @@
 * limitations under the License.
 }}
 <tr>
-  <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.clients.length singular="t:services.sqoop.client" plural="t:services.sqoop.clients"}}</a></td>
+  <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.service.installedClients singular="t:services.sqoop.client" plural="t:services.sqoop.clients"}}</a></td>
   <td>
-    <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.clients.length singular="t:services.sqoop.client" plural="t:services.sqoop.clients"}} {{t common.installed}}
+    <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.service.installedClients singular="t:services.sqoop.client" plural="t:services.sqoop.clients"}} {{t common.installed}}
   </td>
 </tr>

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

@@ -16,8 +16,8 @@
 * limitations under the License.
 }}
 <tr>
-  <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.clients.length singular="t:services.tez.client" plural="t:services.tez.clients"}}</a></td>
+  <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.service.installedClients singular="t:services.tez.client" plural="t:services.tez.clients"}}</a></td>
   <td>
-    <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.clients.length singular="t:services.tez.client" plural="t:services.tez.clients"}} {{t common.installed}}
+    <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.service.installedClients singular="t:services.tez.client" plural="t:services.tez.clients"}} {{t common.installed}}
   </td>
 </tr>

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

@@ -20,8 +20,8 @@
 
 {{view view.sumMasterComponentView}}
 <tr>
-    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.clients.length singular="t:services.zookeeper.client" plural="t:services.zookeeper.clients"}}</a></td>
+    <td class="summary-label"><a {{action filterHosts view.clientObj}} href="javascript:void(null)" >{{pluralize view.service.installedClients singular="t:services.zookeeper.client" plural="t:services.zookeeper.clients"}}</a></td>
     <td>
-        <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.clients.length singular="t:services.zookeeper.client" plural="t:services.zookeeper.clients"}} {{t common.installed}}
+        <span class="green-live">{{view.service.installedClients}} </span>{{pluralize view.service.installedClients singular="t:services.zookeeper.client" plural="t:services.zookeeper.clients"}} {{t common.installed}}
     </td>
 </tr>

+ 3 - 2
ambari-web/app/views/main/host.js

@@ -115,6 +115,7 @@ App.MainHostView = App.TableView.extend(App.TableServerProvider, {
     } else {
       this.clearFilters();
     }
+    this.addObserver('pageContent.@each.selected', this, this.selectedHostsObserver);
   },
 
   /**
@@ -174,7 +175,7 @@ App.MainHostView = App.TableView.extend(App.TableServerProvider, {
    */
   selectedHostsObserver: function() {
     Ember.run.once(this, 'updateCheckedFlags');
-  }.observes('pageContent.@each.selected'),
+  },
 
   /**
    * Update <code>selectAllHosts</code> value
@@ -747,7 +748,7 @@ App.MainHostView = App.TableView.extend(App.TableServerProvider, {
        * Verify that checked checkboxes are equal to value stored in hidden field (components ids list)
        */
       checkComponents: function() {
-        var components = this.get('value').split(',');
+        var components = this.get('value');
         var self = this;
         if (components) {
           components.forEach(function(componentId) {

+ 19 - 32
ambari-web/app/views/main/service/info/summary.js

@@ -154,35 +154,21 @@ App.MainServiceInfoSummaryView = Em.View.extend({
     return result;
   }.property('controller.content'),
 
-  hasManyMonitors: function () {
-    var service = this.get('controller.content');
-    if (service.get("id") == "GANGLIA") {
-      var monitors = service.get('hostComponents').filterProperty('isMaster', false);
-      if (monitors.length == 0) {
-        return '';
-      } else if (monitors.length > 1) {
-        return Em.I18n.t('services.service.summary.viewHosts');
-      } else {
-        return Em.I18n.t('services.service.summary.viewHost');
-      }
-    }
-    return result;
-  }.property('controller.content'),
-
   /**
    * Property related to GANGLIA service, is unused for other services
-   * @return {Object}
+   * @type {Object}
    */
-  monitorsObj: function(){
-    var service = this.get('controller.content');
-    if (service.get("id") == "GANGLIA") {
-      var monitors = service.get('hostComponents').filterProperty('isMaster', false);
+  monitorsObj: function () {
+    if (this.get('controller.content.id') == "GANGLIA") {
+      var monitors = App.StackServiceComponent.find().filterProperty('serviceName', 'GANGLIA').filterProperty('isMaster', false);
       if (monitors.length) {
-        return monitors[0];
+        return Em.Object.create({
+          componentName: monitors.objectAt(0).get('componentName')
+        });
       }
     }
     return {};
-  }.property('controller.content'),
+  }.property('controller.content.id'),
 
   /**
    * Property related to ZOOKEEPER service, is unused for other services
@@ -200,20 +186,21 @@ App.MainServiceInfoSummaryView = Em.View.extend({
   }.property('controller.content'),
 
   /**
-   * Property related to OOZIE and ZOOKEEPER services, is unused for other services
-   * HIVE is supported too
-   * @return {Object}
+   * Contain Object with <code>componentName</code> property for <code>filterByComponent</code> method
+   * @type {Object}
    */
-  clientObj: function() {
-    var service = this.get('controller.content');
-    if (this.get('servicesHaveClients').contains(service.get("id"))) {
-      var clients = service.get('hostComponents').filterProperty('isClient', true);
-      if (clients.length > 0) {
-        return clients[0];
+  clientObj: function () {
+    var serviceName = this.get('controller.content.id');
+    if (this.get('servicesHaveClients').contains(serviceName)) {
+      var clients = App.StackServiceComponent.find().filterProperty('serviceName', serviceName).filterProperty('isClient');
+      if (clients.length) {
+        return Em.Object.create({
+          componentName: clients.objectAt(0).get('componentName')
+        });
       }
     }
     return {};
-  }.property('controller.content'),
+  }.property('controller.content.id'),
 
   data:{
     hive:{