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-16845 Can not open BG operations after RU. (atkach)
Date Tue, 24 May 2016 15:31:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 21ded287f -> 407ec1537


AMBARI-16845 Can not open BG operations after RU. (atkach)


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

Branch: refs/heads/trunk
Commit: 407ec1537f8c2b0a0fd253fb4d2c4b6209ffb413
Parents: 21ded28
Author: Andrii Tkach <atkach@apache.org>
Authored: Tue May 24 17:28:24 2016 +0300
Committer: Andrii Tkach <atkach@apache.org>
Committed: Tue May 24 18:31:38 2016 +0300

----------------------------------------------------------------------
 .../stack_upgrade/upgrade_version_box_view.js   | 10 +++-
 .../upgrade_version_box_view_test.js            | 52 ++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/407ec153/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 818954e..1eb9a77 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
@@ -169,7 +169,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
     }
     else if (status === 'INIT') {
       requestInProgressRepoId && requestInProgressRepoId == this.get('content.id')
? element.setProperties(statePropertiesMap['LOADING']) : element.setProperties(statePropertiesMap[status]);
-      element.set('isDisabled', this.get('controller.requestInProgress') || isInstalling);
+      element.set('isDisabled', this.isDisabledOnInit() || isInstalling);
     }
     else if ((status === 'INSTALLED' && !this.get('isUpgrading')) ||
              (['INSTALL_FAILED', 'OUT_OF_SYNC'].contains(status))) {
@@ -237,6 +237,14 @@ App.UpgradeVersionBoxView = Em.View.extend({
     'parentView.repoVersions.@each.status'
   ),
 
+  /**
+   * check if actions of stack version disabled
+   * @returns {boolean}
+   */
+  isDisabledOnInit: function() {
+    return this.get('controller.requestInProgress') || (App.get('upgradeIsRunning') &&
!App.get('upgradeSuspended'));
+  },
+
   didInsertElement: function () {
     App.tooltip($('.link-tooltip'), {title: Em.I18n.t('admin.stackVersions.version.linkTooltip')});
     App.tooltip($('.hosts-tooltip'));

http://git-wip-us.apache.org/repos/asf/ambari/blob/407ec153/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 a99bcb0..2955f33 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
@@ -375,6 +375,7 @@ describe('App.UpgradeVersionBoxView', function () {
         },
         setup: function () {
           this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(false);
+          this.initMock.returns(false);
         },
         expected: {
           status: 'INIT',
@@ -396,6 +397,7 @@ describe('App.UpgradeVersionBoxView', function () {
         },
         setup: function () {
           this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(false);
+          this.initMock.returns(true);
         },
         expected: {
           status: 'INIT',
@@ -878,10 +880,12 @@ describe('App.UpgradeVersionBoxView', function () {
     beforeEach(function () {
       this.getMock = sinon.stub(App, 'get');
       this.isAccessibleMock = sinon.stub(App, 'isAuthorized');
+      this.initMock = sinon.stub(view, 'isDisabledOnInit');
     });
     afterEach(function () {
       this.getMock.restore();
       this.isAccessibleMock.restore();
+      this.initMock.restore();
     });
 
     cases.forEach(function (item) {
@@ -939,4 +943,52 @@ describe('App.UpgradeVersionBoxView', function () {
       });
     });
   });
+
+  describe("#isDisabledOnInit()", function () {
+    var testCases = [
+      {
+        requestInProgress: true,
+        upgradeIsRunning: true,
+        upgradeSuspended: true,
+        expected: true
+      },
+      {
+        requestInProgress: false,
+        upgradeIsRunning: true,
+        upgradeSuspended: false,
+        expected: true
+      },
+      {
+        requestInProgress: false,
+        upgradeIsRunning: true,
+        upgradeSuspended: true,
+        expected: false
+      },
+      {
+        requestInProgress: false,
+        upgradeIsRunning: false,
+        upgradeSuspended: false,
+        expected: false
+      }
+    ];
+
+    beforeEach(function() {
+      this.mock = sinon.stub(App, 'get');
+    });
+
+    afterEach(function() {
+      this.mock.restore();
+    });
+
+    testCases.forEach(function(test) {
+      it("requestInProgress: " + test.requestInProgress +
+         "upgradeIsRunning: " + test.upgradeIsRunning +
+         "upgradeSuspended: " + test.upgradeSuspended , function() {
+        this.mock.withArgs('upgradeSuspended').returns(test.upgradeSuspended);
+        this.mock.withArgs('upgradeIsRunning').returns(test.upgradeIsRunning);
+        view.set('controller.requestInProgress', test.requestInProgress);
+        expect(view.isDisabledOnInit()).to.be.equal(test.expected);
+      });
+    });
+  });
 });


Mime
View raw message