Explorar el Código

AMBARI-8579. Alerts UI: Alert-groups not showing immediately in Alert-Notifications dialog. (onechiporenko)

Oleg Nechiporenko hace 10 años
padre
commit
d8f78c16f5

+ 6 - 0
ambari-web/app/controllers/global/update_controller.js

@@ -489,6 +489,12 @@ App.UpdateController = Em.Controller.extend({
     App.HttpClient.get(url, App.alertGroupsMapper, {
       complete: callback
     });
+  },
+
+  updateAlertNotifications: function (callback) {
+    App.HttpClient.get(App.get('apiPrefix') + '/alert_targets?fields=*', App.alertNotificationMapper, {
+      complete: callback
+    });
   }
 
 });

+ 5 - 1
ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js

@@ -134,8 +134,12 @@ App.MainAlertDefinitionActionsController = Em.ArrayController.extend({
             if (errors.length > 0) {
               console.log(errors);
               self.get('subViewController').set('errorMessage', errors.join(". "));
-            } else {
+            }
+            else {
               self.hide();
+              App.router.get('updateController').updateAlertGroups(function () {
+                App.router.get('updateController').updateAlertNotifications(Em.K);
+              });
             }
           } else {
             runNextQuery();

+ 17 - 0
ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js

@@ -53,4 +53,21 @@ describe('App.MainAlertDefinitionActionsController', function () {
 
   });
 
+  describe('#manageAlertGroups', function () {
+
+    beforeEach(function () {
+      sinon.stub(App.ModalPopup, 'show', Em.K);
+    });
+
+    afterEach(function () {
+      App.ModalPopup.show.restore();
+    });
+
+    it('should show modal popup', function () {
+      controller.manageAlertGroups();
+      expect(App.ModalPopup.show.calledOnce).to.be.true;
+    });
+
+  });
+
 });