You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2016/02/19 14:26:36 UTC
[19/21] ambari git commit: AMBARI-15110 On large cluster clicking on
'Install Packages' does not show the 'Installing' progress bar. (atkach)
AMBARI-15110 On large cluster clicking on 'Install Packages' does not show the 'Installing' progress bar. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9c9b4ab3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9c9b4ab3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9c9b4ab3
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9c9b4ab3b6c7822168ad2c5e408ead2170ecc65d
Parents: 0941997
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Fri Feb 19 11:38:18 2016 +0200
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Fri Feb 19 11:38:18 2016 +0200
----------------------------------------------------------------------
.../stack_upgrade/upgrade_version_box_view.js | 8 ++++++--
.../stack_upgrade/upgrade_version_box_view_test.js | 17 ++++++++++++++---
2 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/9c9b4ab3/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index 20280fe..0721234 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -41,8 +41,12 @@ App.UpgradeVersionBoxView = Em.View.extend({
* @type {number}
*/
installProgress: function() {
- var requestId = App.get('testMode') ? 1 : App.db.get('repoVersionInstall', 'id')[0];
- var installRequest = App.router.get('backgroundOperationsController.services').findProperty('id', requestId);
+ if (App.get('testMode')) return 100;
+
+ var installRequest, requestIds = App.db.get('repoVersionInstall', 'id');
+ if (requestIds) {
+ installRequest = App.router.get('backgroundOperationsController.services').findProperty('id', requestIds[0]);
+ }
return (installRequest) ? installRequest.get('progress') : 0;
}.property('App.router.backgroundOperationsController.serviceTimestamp'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/9c9b4ab3/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
index e432813..5746d3a 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
@@ -79,21 +79,32 @@ describe('App.UpgradeVersionBoxView', function () {
});
describe("#installProgress", function () {
+
beforeEach(function () {
- sinon.stub(App.db, 'get').returns(1);
+ this.mockDB = sinon.stub(App.db, 'get');
this.mock = sinon.stub(App.router, 'get');
+ App.set('testMode', false);
});
afterEach(function () {
- App.db.get.restore();
+ this.mockDB.restore();
this.mock.restore();
});
+
+ it("request id is not set", function () {
+ this.mock.returns([]);
+ this.mockDB.returns(undefined);
+ view.propertyDidChange('installProgress');
+ expect(view.get('installProgress')).to.equal(0);
+ });
it("request absent", function () {
this.mock.returns([]);
+ this.mockDB.returns([1]);
view.propertyDidChange('installProgress');
expect(view.get('installProgress')).to.equal(0);
});
it("request present", function () {
- this.mock.returns([Em.Object.create({progress: 100})]);
+ this.mockDB.returns([1]);
+ this.mock.returns([Em.Object.create({progress: 100, id: 1})]);
view.propertyDidChange('installProgress');
expect(view.get('installProgress')).to.equal(100);
});