Repository: ambari Updated Branches: refs/heads/branch-2.0.0 b7a1e7174 -> 50217684b
AMBARI-10042. No request info is loaded on step 6 of Enable Kerberos Wizard. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/50217684 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/50217684 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/50217684 Branch: refs/heads/branch-2.0.0 Commit: 50217684b6063c72a8c378756d53417e2a745b27 Parents: b7a1e71 Author: Aleksandr Kovalenko <akovale...@hortonworks.com> Authored: Thu Mar 12 16:58:40 2015 +0200 Committer: Aleksandr Kovalenko <akovale...@hortonworks.com> Committed: Thu Mar 12 19:33:09 2015 +0200 ---------------------------------------------------------------------- .../progress_popup_controller.js | 3 ++ ambari-web/app/utils/ajax/ajax.js | 2 +- .../progress_popup_controller_test.js | 46 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/50217684/ambari-web/app/controllers/main/admin/highAvailability/progress_popup_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_popup_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_popup_controller.js index 3441723..c723bf1 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/progress_popup_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_popup_controller.js @@ -109,6 +109,9 @@ App.HighAvailabilityProgressPopupController = Ember.Controller.extend({ var name = 'background_operations.get_by_request'; if (!Em.isNone(stageId)) { name = 'common.request.polling'; + if (stageId === 0) { + stageId = '0'; + } } requestIds.forEach(function (requestId) { App.ajax.send({ http://git-wip-us.apache.org/repos/asf/ambari/blob/50217684/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 2804308..4081c2a 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -187,7 +187,7 @@ var urls = { }, 'common.request.polling': { - 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/Tasks/request_id,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,Requests/*&tasks/Tasks/stage_id={stageId}', + 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/Tasks/request_id,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status,tasks/Tasks/structured_out,Requests/*&tasks/Tasks/stage_id={stageId}', 'mock': '/data/background_operations/host_upgrade_tasks.json' }, http://git-wip-us.apache.org/repos/asf/ambari/blob/50217684/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js index c6ec583..95512e9 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js +++ b/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js @@ -137,4 +137,50 @@ describe('App.HighAvailabilityProgressPopupController', function () { }); + describe('#getHosts', function () { + + var cases = [ + { + name: 'background_operations.get_by_request', + title: 'default background operation polling' + }, + { + stageId: 0, + name: 'common.request.polling', + stageIdPassed: '0', + title: 'polling by stage, stageId = 0' + }, + { + stageId: 1, + name: 'common.request.polling', + stageIdPassed: 1, + title: 'polling by stage' + } + ]; + + beforeEach(function () { + sinon.stub(App.ajax, 'send', Em.K); + }); + + afterEach(function () { + App.ajax.send.restore(); + }); + + cases.forEach(function (item) { + it(item.title, function () { + controller.setProperties({ + requestIds: [1, 2], + stageId: item.stageId + }); + controller.getHosts(); + expect(App.ajax.send.calledTwice).to.be.true; + expect(App.ajax.send.firstCall.args[0].name).to.equal(item.name); + expect(App.ajax.send.secondCall.args[0].name).to.equal(item.name); + expect(App.ajax.send.firstCall.args[0].data.stageId).to.eql(item.stageIdPassed); + expect(App.ajax.send.secondCall.args[0].data.stageId).to.eql(item.stageIdPassed); + }); + }); + + }); + });