-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43154/
-----------------------------------------------------------

Review request for Ambari, Alexandr Antonenko, Di Li, and Oleg Nechiporenko.


Bugs: AMBARI-14766
    https://issues.apache.org/jira/browse/AMBARI-14766


Repository: ambari


Description
-------

Selecting "ALL" groups does not work under Manage Alert Notifications.

Reproduction Steps:-
1. Go to Alerts Tab in Ambari GUI
2. Actions --> Manage Notifications
3. Create New Alert Notification (Click the custom radio button for groups and 
select couple of options eg HDFS, PIG)
4. Save it.
5. Edit the newly created Alert notification by clicking on the All radio 
button. Everything gets selected.
6. Save it

Expected results:
On Saving the Alert notification, the dialog box "Manage Alert Notification" 
should show Groups as ALL ( or Show all the values eg HDFS, PIG, MR2). 
Basically all the values should be selected.


Diffs
-----

  
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
 d28987d 
  
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java
 f80b6f7 
  
ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js 
38e4e75 

Diff: https://reviews.apache.org/r/43154/diff/


Testing
-------

FIX:
====
The UI did not show "All" even after selecting "ALL" for Groups in the Edit 
Alert Target pop-up because the property "selectedAlertGroup" was not set to 
true even after the selection. This is fixed in the 
"manageAlertGroupsController" in ambari-web.

However, this only resolved the UI issue. The alert notifications were still 
not sent for all services after this change. This was because there was no 
corresponding update made in the server code for this "ALL" Groups selection 
for a Target. The DB has a table for AlertTarget (alert_target) and AlertGroup 
(alert_group). There is a many-to-many mapping between these 2 tables, which is 
tracked in the combination table alert_group_target. 
1. This combination table was not getting updated for the "ALL" Groups 
selection. 
2. Also, the Target was not updated as global in the DB. 

The "updateAlertTargets()" in "AlertTargetResourceProvider" is updated with the 
fix for both these issues.
The global property in Target is set if the ALL selection is made.
And, if the Target is global, all the groups in the DB are upadted with the 
current Target in the alert_group_target table.


TESTS:
======
2 test cases are added to test for Custom and All Group selections.
In case of Custom, the request to the REST API has group IDs passed and the 
global paramter is false.
The Target after this update must have global as false and should be mapped to 
only the selected groups passed in the request.

In case of All, the request to the REST API does not have group IDs passed and 
the global paramter is true.
The Target after this update must contain global as true and should be mapped 
to all the groups in the DB.


Thanks,

Keta Patel

Reply via email to