This is an automated email from the ASF dual-hosted git repository.

ababiichuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 1ab3bec  AMBARI-24073 Adding alerts to alert groups not working. 
(ababiichuk)
1ab3bec is described below

commit 1ab3bec90b4ff292a801b7fdcf7c12ecf89c2342
Author: ababiichuk <[email protected]>
AuthorDate: Mon Jun 11 16:02:27 2018 +0300

    AMBARI-24073 Adding alerts to alert groups not working. (ababiichuk)
---
 ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js   |  6 ++++++
 .../test/mappers/socket/alert_groups_mapper_adapter_test.js    | 10 ++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js 
b/ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js
index c325da3..58ff0b2 100644
--- a/ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js
+++ b/ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js
@@ -25,6 +25,12 @@ App.alertGroupsMapperAdapter = App.QuickDataMapper.create({
   map: function(event) {
     event.groups.forEach((alertGroup) => {
       if (event.updateType === 'UPDATE' || event.updateType === 'CREATE') {
+        const {definitions} = alertGroup;
+        if (definitions) {
+          alertGroup.definitions = definitions.map(id => ({
+            id
+          }));
+        }
         App.alertGroupsMapper.map({
           items: [
             {
diff --git a/ambari-web/test/mappers/socket/alert_groups_mapper_adapter_test.js 
b/ambari-web/test/mappers/socket/alert_groups_mapper_adapter_test.js
index ab1684e..4163f6a 100644
--- a/ambari-web/test/mappers/socket/alert_groups_mapper_adapter_test.js
+++ b/ambari-web/test/mappers/socket/alert_groups_mapper_adapter_test.js
@@ -40,7 +40,8 @@ describe('App.alertGroupsMapperAdapter', function () {
         updateType: 'UPDATE',
         groups: [
           {
-            id: 1
+            id: 1,
+            definitions: [2]
           }
         ]
       };
@@ -48,7 +49,12 @@ describe('App.alertGroupsMapperAdapter', function () {
       expect(App.alertGroupsMapper.map.getCall(0).args[0]).to.be.eql({
         items: [{
           AlertGroup: {
-            id: 1
+            id: 1,
+            definitions: [
+              {
+                id: 2
+              }
+            ]
           }
         }]
       });

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to