Author: jaimin
Date: Thu Feb  7 21:41:44 2013
New Revision: 1443740

URL: http://svn.apache.org/r1443740
Log:
AMBARI-1366. Nagios alert tweaks. (jaimin)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/controllers/main/host.js
    
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/summary.js
    incubator/ambari/trunk/ambari-web/app/models/alert.js
    incubator/ambari/trunk/ambari-web/app/models/host.js
    incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs
    
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary.hbs
    incubator/ambari/trunk/ambari-web/app/views/main/dashboard.js
    incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service.js
    incubator/ambari/trunk/ambari-web/app/views/main/menu.js
    incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
    incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Feb  7 21:41:44 2013
@@ -40,6 +40,8 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1366. Nagios alert tweaks. (jaimin)
+
  AMBARI-1365. Make Hosts table update dynamically. (jaimin)
 
  AMBARI-1361. Install progress dialog WARN icon + color. (jaimin)

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host.js Thu Feb  7 
21:41:44 2013
@@ -25,8 +25,8 @@ App.MainHostController = Em.ArrayControl
   content: App.Host.find(),
   comeWithFilter: false,
 
-  hostsWithAlerts: function () {
-    return App.router.get('clusterController.alerts').filterProperty('isOk', 
false).mapProperty('hostName').uniq();
+  alerts: function () {
+    return App.router.get('clusterController.alerts').filterProperty('isOk', 
false).filterProperty('ignoredForHosts', false);
   }.property('App.router.clusterController.alerts.length'),
 
   /**
@@ -111,9 +111,9 @@ App.MainHostController = Em.ArrayControl
       header: this.t('services.alerts.headingOfList'),
       bodyClass: Ember.View.extend({
         hostAlerts: function () {
-          var allAlerts = App.router.get('clusterController.alerts');
+          var allAlerts = 
App.router.get('clusterController.alerts').filterProperty('ignoredForHosts', 
false);
           if (host) {
-            return allAlerts.filterProperty('hostName', 
host.get('hostName')).filterProperty('isOk', false);
+            return allAlerts.filterProperty('hostName', host.get('hostName'));
           }
           return 0;
         }.property('App.router.clusterController.alerts'),

Modified: 
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/summary.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/summary.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/summary.js 
(original)
+++ 
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/summary.js 
Thu Feb  7 21:41:44 2013
@@ -27,7 +27,7 @@ App.MainServiceInfoSummaryController = E
     var serviceId = this.get('content.serviceName');
     if (serviceId) {
       return this.get('allAlerts').filter(function (item) {
-        return item.get('serviceType') && 
item.get('serviceType').toLowerCase() == serviceId.toLowerCase();
+        return item.get('serviceType').toLowerCase() == 
serviceId.toLowerCase() && !item.get('ignoredForServices');
       });
     }
     return [];

Modified: incubator/ambari/trunk/ambari-web/app/models/alert.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/alert.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/alert.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/alert.js Thu Feb  7 21:41:44 
2013
@@ -61,6 +61,20 @@ App.Alert = DS.Model.extend({
   }.property('status'),
 
   /**
+   * Used to show only required alerts at the service level
+   */
+  ignoredForServices: function() {
+    return ['TaskTracker process down', 'RegionServer process down', 'DataNode 
process down', 'DataNode storage full', 'ZooKeeper Server process 
down'].contains(this.get('title'));
+  }.property('title'),
+
+  /**
+   * Used to show only required alerts at the host level
+   */
+  ignoredForHosts: function() {
+    return this.get('title').indexOf('Percent') != -1;
+  }.property('title'),
+
+  /**
    * Provides how long ago this alert happened.
    * 
    * @type {String}

Modified: incubator/ambari/trunk/ambari-web/app/models/host.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/host.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/host.js Thu Feb  7 21:41:44 
2013
@@ -53,7 +53,7 @@ App.Host = DS.Model.extend({
   loadFifteen:DS.attr('number'),
 
   criticalAlertsCount: function () {
-    return 
App.router.get('clusterController.alerts').filterProperty('hostName', 
this.get('hostName')).filterProperty('isOk', false).length;
+    return 
App.router.get('clusterController.alerts').filterProperty('hostName', 
this.get('hostName')).filterProperty('isOk', 
false).filterProperty('ignoredForHosts', false).length;
   }.property('App.router.clusterController.alerts.length'),
 
   publicHostNameFormatted: function() {

Modified: incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs 
(original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs Thu 
Feb  7 21:41:44 2013
@@ -19,9 +19,9 @@
 <div id="host-details">
   <span {{bindAttr class="view.content.healthClass"}} {{bindAttr 
title="view.content.healthToolTip" }}></span><span class='host-title'>{{unbound 
view.content.publicHostName}}</span>
   {{#if view.content.criticalAlertsCount}}
-  <span class="label label-important alerts-count" {{action "showAlertsPopup" 
content 
target="App.router.mainHostController"}}>{{view.content.criticalAlertsCount}}</span>
+    <span class="label label-important alerts-count" {{action 
"showAlertsPopup" content 
target="App.router.mainHostController"}}>{{view.content.criticalAlertsCount}}</span>
   {{else}}
-    <span class="label label-success alerts-count">{{t 
hosts.host.alert.noAlerts}}</span>
+    <span class="label label-success alerts-count" {{action "showAlertsPopup" 
content target="App.router.mainHostController"}}>{{t 
hosts.host.alert.noAlerts}}</span>
   {{/if}}
   <div><a href="javascript:void(null)" data-toggle="modal" {{action 
backToHostsList}}><i class="icon-arrow-left"></i>&nbsp;{{t 
hosts.host.back}}</a></div>
 <!--   {{#if App.isAdmin}} -->

Modified: 
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary.hbs
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary.hbs?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary.hbs 
(original)
+++ 
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary.hbs 
Thu Feb  7 21:41:44 2013
@@ -112,7 +112,6 @@
 </div>
 </div>
 <div class="span6">
-  {{#if view.hasAlertsBox }}
        <div class="box">
                <div class="box-header">
                        <h4>{{t services.alerts.headingOfList}}</h4>
@@ -138,7 +137,6 @@
                        {{/if}}
                </ul>
        </div>
-  {{/if}}
 </div>
 </div>
 {{#if view.serviceMetricGraphs.length}}

Modified: incubator/ambari/trunk/ambari-web/app/views/main/dashboard.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/dashboard.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/dashboard.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/dashboard.js Thu Feb  7 
21:41:44 2013
@@ -96,7 +96,7 @@ App.MainDashboardView = Em.View.extend({
           var allAlerts = App.router.get('clusterController.alerts');
           var serviceId = this.get('service.serviceName');
           if (serviceId) {
-            return allAlerts.filterProperty('serviceType', 
serviceId).filterProperty('isOk', false);
+            return allAlerts.filterProperty('serviceType', 
serviceId).filterProperty('isOk', false).filterProperty('ignoredForServices', 
false);
           }
           return 0;
         }.property('App.router.clusterController.alerts'),

Modified: incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service.js 
(original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service.js Thu 
Feb  7 21:41:44 2013
@@ -92,7 +92,7 @@ App.MainDashboardServiceView = Em.View.e
 
   criticalAlertsCount: function () {
     var alerts = App.router.get('clusterController.alerts');
-    return alerts.filterProperty('serviceType', 
this.get('service.id')).filterProperty('isOk', false).length;
+    return alerts.filterProperty('serviceType', 
this.get('service.id')).filterProperty('isOk', 
false).filterProperty('ignoredForServices', false).length;
   }.property('App.router.clusterController.alerts'),
 
   isCollapsed: false,

Modified: incubator/ambari/trunk/ambari-web/app/views/main/menu.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/menu.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/menu.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/menu.js Thu Feb  7 
21:41:44 2013
@@ -68,9 +68,9 @@ App.MainMenuView = Em.CollectionView.ext
 
     alertsCount:function () {
       if (this.get('content').routing == 'hosts') {
-        return App.router.get('mainHostController.hostsWithAlerts').length;
+        return App.router.get('mainHostController.alerts').length;
       }
-    }.property('App.router.mainHostController.hostsWithAlerts.length'),
+    }.property('App.router.mainHostController.alerts.length'),
 
     templateName: require('templates/main/menu_item')
   })

Modified: 
incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js 
(original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js 
Thu Feb  7 21:41:44 2013
@@ -394,11 +394,5 @@ App.MainServiceInfoSummaryView = Em.View
     });
 
     return names.length ? names.join(', ') : false;
-  }.property('clientComponents'),
-  hasAlertsBox: function(){
-    var services = [
-      'NAGIOS'
-    ];
-    return -1 === services.indexOf(this.get('controller.content.serviceName'));
-  }.property('controller.content.serviceName')
+  }.property('clientComponents')
 });
\ No newline at end of file

Modified: incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js?rev=1443740&r1=1443739&r2=1443740&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js Thu Feb  7 
21:41:44 2013
@@ -64,7 +64,7 @@ App.MainServiceMenuView = Em.CollectionV
       var allAlerts = App.router.get('clusterController.alerts');
       var serviceId = this.get('content.serviceName');
       if (serviceId) {
-        return allAlerts.filterProperty('serviceType', 
serviceId).filterProperty('isOk', false).length;
+        return allAlerts.filterProperty('serviceType', 
serviceId).filterProperty('isOk', false).filterProperty('ignoredForServices', 
false).length;
       }
       return 0;
     }.property('App.router.clusterController.alerts'),


Reply via email to