You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/03/03 14:21:25 UTC
ambari git commit: AMBARI-9890. Web Client Should Create Alert Target
With 'overwriteExisting' Directive (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk b432db1c7 -> 6f5d57e0c
AMBARI-9890. Web Client Should Create Alert Target With 'overwriteExisting' Directive (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6f5d57e0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6f5d57e0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6f5d57e0
Branch: refs/heads/trunk
Commit: 6f5d57e0cfbfcc23ee5c1bedb3fbca6b069e7604
Parents: b432db1
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Tue Mar 3 14:27:09 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Tue Mar 3 15:21:09 2015 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/wizard/step8_controller.js | 1 +
ambari-web/app/utils/ajax/ajax.js | 2 +-
.../manage_alert_notifications_controller_test.js | 11 ++++++-----
ambari-web/test/controllers/wizard/step8_test.js | 12 +++++++-----
4 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6f5d57e0/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 4cca5b2..0835b77 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1853,6 +1853,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
this.addRequestToAjaxQueue({
name: 'alerts.create_alert_notification',
data: {
+ urlParams: 'overwriteExisting=true',
data: apiObject
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6f5d57e0/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index f008301..9185364 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -415,7 +415,7 @@ var urls = {
'type': 'DELETE'
},
'alerts.create_alert_notification': {
- 'real': '/alert_targets',
+ 'real': '/alert_targets?{urlParams}',
'mock': '',
'format': function (data) {
return {
http://git-wip-us.apache.org/repos/asf/ambari/blob/6f5d57e0/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
index 054dcd5..cacf981 100644
--- a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
@@ -24,11 +24,11 @@ describe('App.ManageAlertNotificationsController', function () {
beforeEach(function () {
controller = App.ManageAlertNotificationsController.create({});
- sinon.stub(App.ajax, 'send');
+ sinon.stub($, 'ajax', Em.K);
});
afterEach(function () {
- App.ajax.send.restore();
+ $.ajax.restore();
});
describe('#alertNotifications', function () {
@@ -572,7 +572,8 @@ describe('App.ManageAlertNotificationsController', function () {
it("should send ajax request", function () {
controller.createAlertNotification();
- expect(App.ajax.send.calledOnce).to.be.true;
+ expect($.ajax.calledOnce).to.be.true;
+ expect($.ajax.args[0][0].url.contains('overwriteExisting=true')).to.be.false;
});
});
@@ -607,7 +608,7 @@ describe('App.ManageAlertNotificationsController', function () {
it("should send ajax request", function () {
controller.updateAlertNotification();
- expect(App.ajax.send.calledOnce).to.be.true;
+ expect($.ajax.calledOnce).to.be.true;
});
});
@@ -653,7 +654,7 @@ describe('App.ManageAlertNotificationsController', function () {
expect(App.showConfirmationPopup.calledOnce).to.be.true;
popup.onPrimary();
- expect(App.ajax.send.calledOnce).to.be.true;
+ expect($.ajax.calledOnce).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6f5d57e0/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 39a2498..43cd4fc 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -1369,10 +1369,8 @@ describe('App.WizardStep8Controller', function () {
describe('#createNotification', function () {
beforeEach(function () {
- sinon.stub(App, 'get', function (k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
+ var stub = sinon.stub(App, 'get');
+ stub.withArgs('testMode').returns(false);
installerStep8Controller.clearStep();
installerStep8Controller.set('content', {controllerName: 'installerController'});
installerStep8Controller.set('configs', [
@@ -1389,16 +1387,20 @@ describe('App.WizardStep8Controller', function () {
{name: 'some_p', value: 'some_v', serviceName: 'MISC', filename: 'alert_notification'}
]);
installerStep8Controller.get('ajaxRequestsQueue').clear();
+ sinon.stub($, 'ajax', function () {return {complete: Em.K}});
});
afterEach(function () {
App.get.restore();
+ $.ajax.restore();
});
it('should add request to queue', function () {
installerStep8Controller.createNotification();
expect(installerStep8Controller.get('ajaxRequestsQueue.queue.length')).to.equal(1);
-
+ installerStep8Controller.get('ajaxRequestsQueue').runNextRequest();
+ expect($.ajax.calledOnce).to.be.true;
+ expect($.ajax.args[0][0].url.contains('overwriteExisting=true')).to.be.true;
});
it('sent data should be valid', function () {