Переглянути джерело

AMBARI-1017. Alerts not showing up in Ambari UI due to refactoring. (Srimanth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418953 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 роки тому
батько
коміт
0135ae98f7

+ 3 - 0
AMBARI-666-CHANGES.txt

@@ -476,6 +476,9 @@ AMBARI-666 branch (unreleased changes)
 
   BUG FIXES
 
+  AMBARI-1017. Alerts not showing up in Ambari UI due to model refactoring.
+  (Srimanth Gunturi via yusaku)
+
   AMBARI-1013. Host metrics charts should use live data. (Srimanth Gunturi
   via yusaku)
 

+ 1 - 1
ambari-web/app/controllers/global/cluster_controller.js

@@ -91,7 +91,7 @@ App.ClusterController = Em.Controller.extend({
         if (svcComponents) {
           var nagiosSvcComponent = svcComponents.findProperty("componentName", "NAGIOS_SERVER");
           if(nagiosSvcComponent){
-            var hostName = nagiosSvcComponent.get('host_name');
+            var hostName = nagiosSvcComponent.get('host.hostName');
             if(hostName){
               return "http://"+hostName+"/nagios";
             }

+ 12 - 8
ambari-web/app/controllers/main/dashboard.js

@@ -24,12 +24,16 @@ App.MainDashboardController = Em.Controller.extend({
     return App.router.get('clusterController.alerts');
   }.property('App.router.clusterController.alerts'),
 
-  alertsFilteredBy: 'All',
+  alertsFilteredByName: 'All',
+  alertsFilteredByType: 'All',
   alertsFilter: function(event) {
-    if (event.context)
-      this.set('alertsFilteredBy', event.context.get('serviceName'));
-    else
-      this.set('alertsFilteredBy', 'All');
+    if (event.context && event.context.model && event.context.model.get('serviceName')){
+      this.set('alertsFilteredByName', event.context.model.get('displayName'));
+      this.set('alertsFilteredByType', event.context.model.get('serviceName'));
+    } else {
+      this.set('alertsFilteredByName', 'All');
+      this.set('alertsFilteredByType', 'All');
+    }
   },
   /**
    * We do not want to re-get all the data everytime the filter
@@ -37,15 +41,15 @@ App.MainDashboardController = Em.Controller.extend({
    * load.
    */
   displayAlerts: function(){
-    if(this.get('alertsFilteredBy')=='All')
+    if(this.get('alertsFilteredByType')=='All')
       return this.get('alerts');
     else
-      var type = this.get('alertsFilteredBy').toLowerCase();
+      var type = this.get('alertsFilteredByType').toLowerCase();
       return this.get('alerts').filter(function(item){
         var serviceType = item.get('serviceType');
         return serviceType && serviceType.toLowerCase()==type.toLowerCase();
       });
-  }.property('alerts', 'alertsFilteredBy'),
+  }.property('alerts', 'alertsFilteredByType'),
   
   nagiosUrl: function(){
     return App.router.get('clusterController.nagiosUrl');

+ 3 - 3
ambari-web/app/templates/main/dashboard.hbs

@@ -64,12 +64,12 @@
       <div class="box-header">
         <h4>Alerts</h4>
         <div class="btn-group">
-          <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">{{controller.alertsFilteredBy}} <span class="caret"></span></button>
+          <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">{{controller.alertsFilteredByName}} <span class="caret"></span></button>
           <a class="btn" target="_blank" rel="tooltip" title="Go to Nagios" {{bindAttr href="controller.nagiosUrl"}}><i class="icon-link"></i></a>
           <ul class="dropdown-menu">
             <li><a {{action alertsFilter target="controller"}} href="javascript:void(null)">All</a></li>
-            {{#each service in controller.services}}
-              <li><a {{action alertsFilter service target="controller"}} href="javascript:void(null)">{{service.displayName}}</a></li>
+            {{#each service in view.content}}
+              <li><a {{action alertsFilter service target="controller"}} href="javascript:void(null)">{{service.model.displayName}}</a></li>
             {{/each}}
           </ul>
         </div>