Repository: ambari Updated Branches: refs/heads/trunk 2a031a830 -> d8f78c16f
AMBARI-8579. Alerts UI: Alert-groups not showing immediately in Alert-Notifications dialog. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d8f78c16 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d8f78c16 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d8f78c16 Branch: refs/heads/trunk Commit: d8f78c16f57173cf274a0599028a15708422352f Parents: 2a031a8 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Mon Dec 8 13:40:32 2014 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Mon Dec 8 13:40:32 2014 +0200 ---------------------------------------------------------------------- .../app/controllers/global/update_controller.js | 6 ++++++ .../alerts/alert_definitions_actions_controller.js | 6 +++++- .../alert_definitions_actions_controller_test.js | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/d8f78c16/ambari-web/app/controllers/global/update_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js index 535b888..5d8aa58 100644 --- a/ambari-web/app/controllers/global/update_controller.js +++ b/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 + }); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/d8f78c16/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js index 062ee29..6d7a568 100644 --- a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js +++ b/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(); http://git-wip-us.apache.org/repos/asf/ambari/blob/d8f78c16/ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js b/ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js index 047e58b..f01b055 100644 --- a/ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js +++ b/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; + }); + + }); + }); \ No newline at end of file