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

AMBARI-8608. Alerts UI: Updates to alert-definition description not sent when initial value is null. (akovalenko)

Aleksandr Kovalenko 10 роки тому
батько
коміт
80e1d9fb96

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

@@ -107,6 +107,7 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
         item.reporting = convertedReportDefinitions;
 
         rawSourceData[item.AlertDefinition.id] = item.AlertDefinition.source;
+        item.AlertDefinition.description = item.AlertDefinition.description || '';
 
         var alertDefinition = this.parseIt(item, this.get('config'));
 

+ 10 - 0
ambari-web/test/mappers/alert_definitions_mapper_test.js

@@ -35,6 +35,7 @@ describe('App.alertDefinitionsMapper', function () {
             "interval" : 5,
             "label" : "ResourceManager RPC Latency",
             "name" : "yarn_resourcemanager_rpc_latency",
+            "description" : "some description",
             "scope" : "ANY",
             "service_name" : "YARN",
             "source" : {
@@ -78,6 +79,7 @@ describe('App.alertDefinitionsMapper', function () {
             "interval" : 1,
             "label" : "ResourceManager Web UI",
             "name" : "yarn_resourcemanager_webui",
+            "description" : "",
             "scope" : "ANY",
             "service_name" : "YARN",
             "source" : {
@@ -112,6 +114,7 @@ describe('App.alertDefinitionsMapper', function () {
             "interval" : 1,
             "label" : "Percent NodeManagers Available",
             "name" : "yarn_nodemanager_webui_percent",
+            "description" : null,
             "scope" : "SERVICE",
             "service_name" : "YARN",
             "source" : {
@@ -142,6 +145,7 @@ describe('App.alertDefinitionsMapper', function () {
             "interval" : 1,
             "label" : "NodeManager Health",
             "name" : "yarn_nodemanager_health",
+            "description" : "some description",
             "scope" : "HOST",
             "service_name" : "YARN",
             "source" : {
@@ -159,6 +163,7 @@ describe('App.alertDefinitionsMapper', function () {
             "interval" : 1,
             "label" : "ZooKeeper Server Process",
             "name" : "zookeeper_server_process",
+            "description" : "some description",
             "scope" : "ANY",
             "service_name" : "ZOOKEEPER",
             "source" : {
@@ -258,6 +263,7 @@ describe('App.alertDefinitionsMapper', function () {
           id: 1,
           "name": "yarn_resourcemanager_rpc_latency",
           "label": "ResourceManager RPC Latency",
+          "description" : "some description",
           "service_id": "YARN",
           "component_name": "RESOURCEMANAGER",
           "enabled": true,
@@ -312,6 +318,7 @@ describe('App.alertDefinitionsMapper', function () {
             "id": 2,
             "name": "yarn_resourcemanager_webui",
             "label": "ResourceManager Web UI",
+            "description" : "",
             "service_id": "YARN",
             "component_name": "RESOURCEMANAGER",
             "enabled": true,
@@ -354,6 +361,7 @@ describe('App.alertDefinitionsMapper', function () {
             "id":3,
             "name":"yarn_nodemanager_webui_percent",
             "label":"Percent NodeManagers Available",
+            "description" : "",
             "service_id":"YARN",
             "component_name":null,
             "enabled":true,
@@ -377,6 +385,7 @@ describe('App.alertDefinitionsMapper', function () {
             "id":4,
             "name":"yarn_nodemanager_health",
             "label":"NodeManager Health",
+            "description" : "some description",
             "service_id":"YARN",
             "component_name":"NODEMANAGER",
             "enabled":true,
@@ -400,6 +409,7 @@ describe('App.alertDefinitionsMapper', function () {
             "id":5,
             "name":"zookeeper_server_process",
             "label":"ZooKeeper Server Process",
+            "description" : "some description",
             "service_id":"ZOOKEEPER",
             "component_name":"ZOOKEEPER_SERVER",
             "enabled":true,