ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-15110 On large cluster clicking on 'Install Packages' does not show the 'Installing' progress bar. (atkach)
Date Fri, 19 Feb 2016 10:49:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 1e93caf4f -> 1f4c8026a


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/1f4c8026
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1f4c8026
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1f4c8026

Branch: refs/heads/branch-2.2
Commit: 1f4c8026a17867346b43152677c790a3b6249c2f
Parents: 1e93caf
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Fri Feb 19 11:43:13 2016 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Fri Feb 19 11:43:13 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/1f4c8026/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 0d15fd8..bd1927e 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/1f4c8026/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 ba794e7..fd4380e 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
@@ -71,21 +71,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);
     });


Mime
View raw message