Repository: ambari Updated Branches: refs/heads/trunk 001c77f57 -> 37b847069
AMBARI-22028 Downgrade button TypeError. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/37b84706 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/37b84706 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/37b84706 Branch: refs/heads/trunk Commit: 37b847069f1d2a07ed9deb5e580ba23e90b77ade Parents: 001c77f Author: Andrii Tkach <[email protected]> Authored: Thu Sep 21 17:50:55 2017 +0300 Committer: Andrii Tkach <[email protected]> Committed: Thu Sep 21 17:54:24 2017 +0300 ---------------------------------------------------------------------- .../app/controllers/global/cluster_controller.js | 1 + .../controllers/global/cluster_controller_test.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/37b84706/ambari-web/app/controllers/global/cluster_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index d61d61b..3689ba2 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -339,6 +339,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, { App.stackUpgradeHistoryMapper.map(data); upgradeController.loadStackVersionsToModel(true).done(function () { upgradeController.loadCompatibleVersions(); + upgradeController.updateCurrentStackVersion(); App.set('stackVersionsAvailable', App.StackVersion.find().content.length > 0); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/37b84706/ambari-web/test/controllers/global/cluster_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/global/cluster_controller_test.js b/ambari-web/test/controllers/global/cluster_controller_test.js index 7f68efc..ff8e51c 100644 --- a/ambari-web/test/controllers/global/cluster_controller_test.js +++ b/ambari-web/test/controllers/global/cluster_controller_test.js @@ -445,8 +445,10 @@ describe('App.clusterController', function () { restoreLastUpgrade: Em.K, initDBProperties: Em.K, loadUpgradeData: Em.K, + loadCompatibleVersions: Em.K, + updateCurrentStackVersion: Em.K, loadStackVersionsToModel: function () { - return {done: Em.K}; + return {done: Em.clb}; } }); @@ -459,6 +461,8 @@ describe('App.clusterController', function () { sinon.spy(upgradeController, 'initDBProperties'); sinon.spy(upgradeController, 'loadUpgradeData'); sinon.spy(upgradeController, 'loadStackVersionsToModel'); + sinon.spy(upgradeController, 'loadCompatibleVersions'); + sinon.spy(upgradeController, 'updateCurrentStackVersion'); sinon.stub(App.stackUpgradeHistoryMapper, 'map'); }); @@ -471,6 +475,8 @@ describe('App.clusterController', function () { upgradeController.initDBProperties.restore(); upgradeController.loadUpgradeData.restore(); upgradeController.loadStackVersionsToModel.restore(); + upgradeController.loadCompatibleVersions.restore(); + upgradeController.updateCurrentStackVersion.restore(); App.stackUpgradeHistoryMapper.map.restore(); }); @@ -503,6 +509,14 @@ describe('App.clusterController', function () { expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true; }); + it('loadCompatibleVersions should be called', function () { + expect(upgradeController.loadCompatibleVersions.calledOnce).to.be.true; + }); + + it('updateCurrentStackVersion should be called', function () { + expect(upgradeController.updateCurrentStackVersion.calledOnce).to.be.true; + }); + it('initDBProperties is not called', function () { expect(upgradeController.initDBProperties.called).to.be.false; });
