Browse Source

AMBARI-14011. Handle alerts with alertDefinitionType='RECOVERY' on UI

Alex Antonenko 10 years ago
parent
commit
b227b13768

+ 3 - 3
ambari-agent/src/test/python/ambari_agent/TestAlerts.py

@@ -1299,14 +1299,14 @@ class TestAlerts(TestCase):
         "type": "RECOVERY",
         "reporting": {
           "ok": {
-            "text": "Metrics Collector hasn't been auto-started since {0}."
+            "text": "Metrics Collector has not been auto-started and is running normally{0}."
           },
           "warning": {
-            "text": "Metrics Collector has been auto-started {1} times since {0}.",
+            "text": "Metrics Collector has been auto-started {1} times{0}.",
             "count": 1
           },
           "critical": {
-            "text": "Metrics Collector has been auto-started {1} times since {0}.",
+            "text": "Metrics Collector has been auto-started {1} times{0}.",
             "count": 5
           }
         }

+ 1 - 1
ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json

@@ -39,7 +39,7 @@
           "type": "RECOVERY",
           "reporting": {
             "ok": {
-              "text": "Metrics Collector hasn't been auto-started{0}."
+              "text": "Metrics Collector has not been auto-started and is running normally{0}."
             },
             "warning": {
               "text": "Metrics Collector has been auto-started {1} times{0}.",

+ 2 - 1
ambari-web/app/controllers/main/alerts/add_alert_definition/step1_controller.js

@@ -32,7 +32,8 @@ App.AddAlertDefinitionStep1Controller = Em.Controller.extend({
     Em.Object.create({value: 'WEB', isActive: false, icon: 'icon-globe'}),
     Em.Object.create({value: 'AGGREGATE', isActive: false, icon: 'icon-plus-sign-alt'}),
     Em.Object.create({value: 'SCRIPT', isActive: false, icon: 'icon-code'}),
-    Em.Object.create({value: 'SERVER', isActive: false, icon: 'icon-desktop'})
+    Em.Object.create({value: 'SERVER', isActive: false, icon: 'icon-desktop'}),
+    Em.Object.create({value: 'RECOVERY', isActive: false, icon: 'icon-desktop'})
   ],
 
   /**

+ 3 - 0
ambari-web/app/controllers/main/alerts/definition_configs_controller.js

@@ -155,6 +155,9 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
       case 'SERVER':
       	configs = this.renderServerConfigs();
       	break;
+      case 'RECOVERY':
+      	configs = this.renderWebConfigs();
+      	break;
       default:
     }
 

+ 3 - 0
ambari-web/app/mappers/alert_definitions_mapper.js

@@ -175,6 +175,9 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
           case 'SERVER':
             alertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('serverConfig'))));
             break;
+          case 'RECOVERY':
+            alertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('uriConfig'))));
+            break;
           default:
             console.error('Incorrect Alert Definition type:', item.AlertDefinition);
         }

+ 2 - 1
ambari-web/app/models/alerts/alert_definition.js

@@ -265,7 +265,8 @@ App.AlertDefinition = DS.Model.extend({
     'WEB': 'icon-globe',
     'PORT': 'icon-signin',
     'AGGREGATE': 'icon-plus',
-    'SERVER': 'icon-desktop'
+    'SERVER': 'icon-desktop',
+    'RECOVERY': 'icon-desktop'
   },
 
   /**

+ 4 - 0
ambari-web/app/views/main/alert_definitions_view.js

@@ -287,6 +287,10 @@ App.MainAlertDefinitionsView = App.TableView.extend({
       {
         value: 'SERVER',
         label: 'SERVER'
+      },
+      {
+        value: 'RECOVERY',
+        label: 'RECOVERY'
       }
     ],
     onChangeValue: function(){