ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [26/36] ambari git commit: AMBARI-21416 Unable to Click on Stack Installation Details During Installation. (atkach)
Date Fri, 07 Jul 2017 14:58:13 GMT
AMBARI-21416 Unable to Click on Stack Installation Details During Installation. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/88cba7fb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/88cba7fb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/88cba7fb

Branch: refs/heads/branch-feature-logsearch-ui
Commit: 88cba7fbd1842c6e87eec010a00653bcedbfac65
Parents: 068f86a
Author: Andrii Tkach <atkach@apache.org>
Authored: Thu Jul 6 17:58:28 2017 +0300
Committer: Andrii Tkach <atkach@apache.org>
Committed: Thu Jul 6 18:10:22 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 16 +++++++-
 .../stack_upgrade/upgrade_version_box_view.js   |  2 +-
 .../admin/stack_and_upgrade_controller_test.js  | 40 +++++++++++++++++++-
 .../upgrade_version_box_view_test.js            | 11 +++---
 4 files changed, 60 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/88cba7fb/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index c4f835d..f712eea 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -1699,11 +1699,25 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    */
   showProgressPopup: function(version) {
     var popupTitle = Em.I18n.t('admin.stackVersions.details.install.hosts.popup.title').format(version.get('displayName'));
-    var requestIds = App.get('testMode') ? [1] : App.db.get('repoVersionInstall', 'id');
+    var requestIds = this.getRepoVersionInstallId();
     var hostProgressPopupController = App.router.get('highAvailabilityProgressPopupController');
     hostProgressPopupController.initPopup(popupTitle, requestIds, this);
   },
 
+  getRepoVersionInstallId: function() {
+    if (App.get('testMode')) return [1];
+
+    var requestIds = App.db.get('repoVersionInstall', 'id');
+    var lastRepoVersionInstall = App.router.get('backgroundOperationsController.services').find(function(request)
{
+      return request.get('name').startsWith('Install version');
+    });
+    if (!requestIds ||
+      (lastRepoVersionInstall && !requestIds.contains(lastRepoVersionInstall.get('id'))))
{
+      requestIds = [lastRepoVersionInstall.get('id')];
+    }
+    return requestIds;
+  },
+
   /**
    * reset upgradeState to NOT_REQUIRED when upgrade is COMPLETED
    * and clean auxiliary data

http://git-wip-us.apache.org/repos/asf/ambari/blob/88cba7fb/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 1af7d5c..3462b58 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
@@ -43,7 +43,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
   installProgress: function() {
     if (App.get('testMode')) return 100;
 
-    var installRequest, requestIds = App.db.get('repoVersionInstall', 'id');
+    var installRequest, requestIds = this.get('controller').getRepoVersionInstallId();
     if (requestIds) {
       installRequest = App.router.get('backgroundOperationsController.services').findProperty('id',
requestIds[0]);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/88cba7fb/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index b87714e..ca0c4e7 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -3093,13 +3093,13 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     beforeEach(function() {
       sinon.stub(App.router, 'get').withArgs('highAvailabilityProgressPopupController').returns(mock);
       sinon.stub(mock, 'initPopup');
-      sinon.stub(App.db, 'get').returns([1]);
+      sinon.stub(controller, 'getRepoVersionInstallId').returns([1]);
     });
 
     afterEach(function() {
       App.router.get.restore();
       mock.initPopup.restore();
-      App.db.get.restore();
+      controller.getRepoVersionInstallId.restore();
     });
 
     it("initPopup should be called", function() {
@@ -3112,6 +3112,42 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     });
   });
 
+  describe('#getRepoVersionInstallId', function() {
+    beforeEach(function() {
+      this.mockDB = sinon.stub(App.db, 'get');
+      this.mockRequests = sinon.stub(App.router, 'get');
+    });
+    afterEach(function() {
+      this.mockDB.restore();
+      this.mockRequests.restore();
+    });
+
+    it('should return id from latest version install', function() {
+      this.mockDB.returns(null);
+      this.mockRequests.returns([Em.Object.create({
+        name: 'Install version',
+        id: 1
+      })]);
+      expect(controller.getRepoVersionInstallId()[0]).to.be.equal(1);
+    });
+    it('should return id from localDB', function() {
+      this.mockDB.returns([2]);
+      this.mockRequests.returns([Em.Object.create({
+        name: 'Install version',
+        id: 2
+      })]);
+      expect(controller.getRepoVersionInstallId()[0]).to.be.equal(2);
+    });
+    it('should return id from latest version install and ignore deprecated localDb value',
function() {
+      this.mockDB.returns([2]);
+      this.mockRequests.returns([Em.Object.create({
+        name: 'Install version',
+        id: 3
+      })]);
+      expect(controller.getRepoVersionInstallId()[0]).to.be.equal(3);
+    });
+  });
+
   describe("#finish()", function () {
 
     beforeEach(function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/88cba7fb/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 b5738a0..0b8eb1e 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
@@ -31,6 +31,7 @@ describe('App.UpgradeVersionBoxView', function () {
       initFilters: Em.K,
       controller: Em.Object.create({
         upgrade: Em.K,
+        getRepoVersionInstallId: Em.K,
         currentVersion: Em.Object.create()
       }),
       content: Em.Object.create(),
@@ -93,29 +94,29 @@ describe('App.UpgradeVersionBoxView', function () {
   describe("#installProgress", function () {
 
     beforeEach(function () {
-      this.mockDB = sinon.stub(App.db, 'get');
+      this.mockId = sinon.stub(view.get('controller'), 'getRepoVersionInstallId');
       this.mock = sinon.stub(App.router, 'get');
       App.set('testMode', false);
     });
     afterEach(function () {
-      this.mockDB.restore();
+      this.mockId.restore();
       this.mock.restore();
     });
 
     it("request id is not set", function () {
       this.mock.returns([]);
-      this.mockDB.returns(undefined);
+      this.mockId.returns(undefined);
       view.propertyDidChange('installProgress');
       expect(view.get('installProgress')).to.equal(0);
     });
     it("request absent", function () {
       this.mock.returns([]);
-      this.mockDB.returns([1]);
+      this.mockId.returns([1]);
       view.propertyDidChange('installProgress');
       expect(view.get('installProgress')).to.equal(0);
     });
     it("request present", function () {
-      this.mockDB.returns([1]);
+      this.mockId.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