You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/11/19 11:50:13 UTC

ambari git commit: AMBARI-8381. Alerts UI: Alerts summary Add "Pending" filter for status. (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 6fbfdb4a0 -> 46e4d943b


AMBARI-8381. Alerts UI: Alerts summary Add "Pending" filter for status. (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/46e4d943
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/46e4d943
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/46e4d943

Branch: refs/heads/trunk
Commit: 46e4d943b1950023388258fd0126e5b4d1f541f4
Parents: 6fbfdb4
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Nov 19 12:46:17 2014 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Nov 19 12:46:17 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/views/common/filter_view.js           | 12 +++++++++++-
 ambari-web/app/views/main/alert_definitions_view.js  |  8 ++++----
 ambari-web/test/views/common/filter_view_test.js     | 15 +++++++++++++++
 ambari-web/test/views/main/dashboard/widgets_test.js |  2 +-
 4 files changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/46e4d943/ambari-web/app/views/common/filter_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/filter_view.js b/ambari-web/app/views/common/filter_view.js
index 3a818d8..dfc3bc0 100644
--- a/ambari-web/app/views/common/filter_view.js
+++ b/ambari-web/app/views/common/filter_view.js
@@ -596,9 +596,19 @@ module.exports = {
       case 'alert_status':
         /**
          * origin - alertDefinition.summary
-         * compareValue - "OK|WARN..."
+         * compareValue - "OK|WARNING|CRITICAL|UNKNOWN|PENDING"
+         * PENDING means that OK is 0, WARNING is 0, CRITICAL is 0 and UNKNOWN is 0
          */
         return function (origin, compareValue) {
+          if ('PENDING' === compareValue) {
+            var isPending = true;
+            Em.keys(origin).forEach(function(state) {
+              if (origin[state] && origin[state] > 0) {
+                isPending = false;
+              }
+            });
+            return isPending;
+          }
           return !!origin[compareValue] && origin[compareValue] > 0;
         };
         break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/46e4d943/ambari-web/app/views/main/alert_definitions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alert_definitions_view.js b/ambari-web/app/views/main/alert_definitions_view.js
index 6e9c276..7c12342 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -120,12 +120,12 @@ App.MainAlertDefinitionsView = App.TableView.extend({
         label: 'CRITICAL'
       },
       {
-        value: 'DISABLED',
-        label: 'DISABLED'
-      },
-      {
         value: 'UNKNOWN',
         label: 'UNKNOWN'
+      },
+      {
+        value: 'PENDING',
+        label: 'PENDING'
       }
     ],
     onChangeValue: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/46e4d943/ambari-web/test/views/common/filter_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/filter_view_test.js b/ambari-web/test/views/common/filter_view_test.js
index 48ad66f..01f759b 100644
--- a/ambari-web/test/views/common/filter_view_test.js
+++ b/ambari-web/test/views/common/filter_view_test.js
@@ -484,6 +484,21 @@ describe('filters.getFilterByType', function () {
         origin: {WARN: 0},
         compareValue: 'WARN',
         e: false
+      },
+      {
+        origin: {OK: 0, WARN: 0},
+        compareValue: 'PENDING',
+        e: true
+      },
+      {
+        origin: {},
+        compareValue: 'PENDING',
+        e: true
+      },
+      {
+        origin: {OK: 1},
+        compareValue: 'PENDING',
+        e: false
       }
     ]).forEach(function(test, i) {
         it('test #' + (i + 1), function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/46e4d943/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
index 4fdd6cd..9ff1d40 100644
--- a/ambari-web/test/views/main/dashboard/widgets_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -118,7 +118,7 @@ describe('App.MainDashboardWidgetsView', function() {
           yarn_model: {}
         },
         e: {
-          visibleL: total_widgets_count - 1,
+          visibleL: total_widgets_count,
           hiddenL: 1
         },
         m: 'All models are not null'