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-9415 Version state stays installed when upgrade started. (atkach)
Date Fri, 30 Jan 2015 17:04:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk ee4e786a4 -> 4e80ff992


AMBARI-9415 Version state stays installed when upgrade started. (atkach)


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

Branch: refs/heads/trunk
Commit: 4e80ff992fdf4132d166e3ab16c89f62accdbbeb
Parents: ee4e786
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Fri Jan 30 15:58:13 2015 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Fri Jan 30 19:03:59 2015 +0200

----------------------------------------------------------------------
 .../stack_upgrade/upgrade_version_box_view.js   | 15 ++++++--
 .../upgrade_version_box_view_test.js            | 37 +++++++++++++++++++-
 2 files changed, 48 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4e80ff99/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 40e9e06..4f422e8 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
@@ -42,6 +42,14 @@ App.UpgradeVersionBoxView = Em.View.extend({
   }.property('App.router.backgroundOperationsController.services.@each.progress'),
 
   /**
+   * version is upgrading
+   * @type {boolean}
+   */
+  isUpgrading: function () {
+    return (this.get('controller.upgradeVersion') === this.get('content.displayName') &&
App.get('upgradeState') !== 'INIT');
+  }.property('App.upgradeState', 'content.displayName', 'controller.upgradeVersion'),
+
+  /**
    * @type {string}
    */
   versionClass: function () {
@@ -85,6 +93,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
   /**
    * object that describes how content should be displayed
    * @type {Em.Object}
+   * TODO remove <code>isUpgrading</code> condition when transition of version
states in API fixed
    */
   stateElement: function () {
     var currentVersion = this.get('controller.currentVersion');
@@ -110,7 +119,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
       element.set('isLink', true);
       element.set('text', Em.I18n.t('hosts.host.stackVersions.status.installing'));
       element.set('action', 'showProgressPopup');
-    } else if (status === 'INSTALLED') {
+    } else if (status === 'INSTALLED' && !this.get('isUpgrading')) {
       if (stringUtils.compareVersions(this.get('content.repositoryVersion'), currentVersion.repository_version)
=== 1) {
         element.set('isButton', true);
         element.set('text', Em.I18n.t('admin.stackVersions.version.performUpgrade'));
@@ -121,7 +130,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
         element.set('text', Em.I18n.t('common.installed'));
         element.set('action', null);
       }
-    } else if (['UPGRADING', 'UPGRADE_FAILED', 'UPGRADED'].contains(status)) {
+    } else if (['UPGRADING', 'UPGRADE_FAILED', 'UPGRADED'].contains(status) || this.get('isUpgrading'))
{
       element.set('isLink', true);
       element.set('action', 'openUpgradeDialog');
       if (['HOLDING', 'HOLDING_FAILED', 'HOLDING_TIMEDOUT'].contains(App.get('upgradeState')))
{
@@ -141,7 +150,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
       }
     }
     return element;
-  }.property('content.status', 'controller.isDowngrade'),
+  }.property('content.status', 'controller.isDowngrade', 'isUpgrading'),
 
   didInsertElement: function () {
     App.tooltip($('.link-tooltip'), {title: Em.I18n.t('admin.stackVersions.version.linkTooltip')});

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e80ff99/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 9ccff43..69134bb 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
@@ -24,6 +24,41 @@ describe('App.UpgradeVersionBoxView', function () {
   var view = App.UpgradeVersionBoxView.create({
     controller: Em.Object.create({
       upgrade: Em.K
-    })
+    }),
+    content: Em.K
+  });
+
+  describe("#isUpgrading", function () {
+    afterEach(function () {
+      App.set('upgradeState', 'INIT');
+    });
+    it("wrong version", function () {
+      App.set('upgradeState', 'IN_PROGRESS');
+      view.set('controller.upgradeVersion', 'HDP-2.2.1');
+      view.set('content.displayName', 'HDP-2.2.2');
+      view.propertyDidChange('isUpgrading');
+      expect(view.get('isUpgrading')).to.be.false;
+    });
+    it("correct version", function () {
+      App.set('upgradeState', 'IN_PROGRESS');
+      view.set('controller.upgradeVersion', 'HDP-2.2.2');
+      view.set('content.displayName', 'HDP-2.2.2');
+      view.propertyDidChange('isUpgrading');
+      expect(view.get('isUpgrading')).to.be.true;
+    });
+    it("upgradeState INIT", function () {
+      App.set('upgradeState', 'INIT');
+      view.set('controller.upgradeVersion', 'HDP-2.2.2');
+      view.set('content.displayName', 'HDP-2.2.2');
+      view.propertyDidChange('isUpgrading');
+      expect(view.get('isUpgrading')).to.be.false;
+    });
+    it("upgradeState INIT and wrong version", function () {
+      App.set('upgradeState', 'INIT');
+      view.set('controller.upgradeVersion', 'HDP-2.2.2');
+      view.set('content.displayName', 'HDP-2.2.1');
+      view.propertyDidChange('isUpgrading');
+      expect(view.get('isUpgrading')).to.be.false;
+    });
   });
 });
\ No newline at end of file


Mime
View raw message