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-21704 Upgrade Wizard Has Incorrect Title. (atkach)
Date Mon, 28 Aug 2017 10:11:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 8f0bcc019 -> 6b5232088


AMBARI-21704 Upgrade Wizard Has Incorrect Title. (atkach)


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

Branch: refs/heads/trunk
Commit: 6b5232088c87d07eaa8b740d12a35c3d1b171590
Parents: 8f0bcc0
Author: Andrii Tkach <atkach@apache.org>
Authored: Mon Aug 28 13:10:39 2017 +0300
Committer: Andrii Tkach <atkach@apache.org>
Committed: Mon Aug 28 13:10:39 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 59 ++++++++++++++------
 ambari-web/app/messages.js                      |  9 +--
 ambari-web/app/utils/ajax/ajax.js               |  2 +-
 .../stack_upgrade/upgrade_version_box_view.js   | 11 ++--
 .../admin/stack_and_upgrade_controller_test.js  | 39 +++++++++----
 .../upgrade_version_box_view_test.js            |  6 +-
 6 files changed, 86 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6b523208/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 b33c55d..f02c5f3 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
@@ -151,12 +151,33 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    * @type {string}
    */
   wizardModalTitle: function () {
-    if (this.get('isDowngrade')) {
-      return Em.I18n.t('admin.stackUpgrade.dialog.downgrade.header').format(this.get('upgradeVersion'));
-    }
-    return Em.I18n.t('admin.stackUpgrade.dialog.header').format(this.get('upgradeVersion'));
+    var repoVersion = App.RepositoryVersion.find().findProperty('repositoryVersion', this.get('toVersion'));
+    return this.getUpgradeDowngradeHeader(
+      this.get('upgradeTypeDisplayName'),
+      this.get('upgradeVersion'),
+      this.get('isDowngrade'),
+      repoVersion && repoVersion.get('isPatch')
+    );
   }.property('upgradeTypeDisplayName', 'upgradeVersion', 'isDowngrade'),
 
+
+  /**
+   * @param {string} upgradeType
+   * @param {string} upgradeVersion
+   * @param {boolean} isDowngrade
+   * @param {boolean} isPatch
+   * @returns {string}
+   */
+  getUpgradeDowngradeHeader: function(upgradeType, upgradeVersion, isDowngrade, isPatch)
{
+    if (isDowngrade) {
+      return Em.I18n.t('admin.stackUpgrade.dialog.downgrade.header').format(upgradeVersion);
+    }
+    if (isPatch) {
+      return Em.I18n.t('admin.stackUpgrade.dialog.upgrade.patch.header').format(upgradeType,
upgradeVersion);
+    }
+    return Em.I18n.t('admin.stackUpgrade.dialog.upgrade.header').format(upgradeType, upgradeVersion);
+  },
+
   /**
    * methods through which cluster could be upgraded, "allowed" indicated if the method is
allowed
    * by stack upgrade path
@@ -258,6 +279,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     'fromVersion',
     'upgradeId',
     'upgradeVersion',
+    'toVersion',
     'currentVersion',
     'upgradeTypeDisplayName',
     'upgradeType',
@@ -687,7 +709,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       },
       Em.I18n.t('admin.stackUpgrade.downgrade.body').format(currentVersion.repository_name),
       null,
-      Em.I18n.t('admin.stackUpgrade.dialog.downgrade.header').format(currentVersion.repository_name),
+      Em.I18n.t('admin.stackUpgrade.dialog.downgrade.header').format(this.get('upgradeVersion')),
       Em.I18n.t('admin.stackUpgrade.downgrade.proceed')
     );
   },
@@ -736,7 +758,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       sender: this,
       data: {
         value: currentVersion.repository_version,
-        label: currentVersion.repository_name,
+        label: this.get('upgradeVersion'),
         id: currentVersion.id,
         isDowngrade: true,
         upgradeType: this.get('upgradeType')
@@ -897,7 +919,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
   upgradeSuccessCallback: function (data, opt, params) {
     this.set('upgradeData', null);
     this.set('upgradeId', data.resources[0].Upgrade.request_id);
-    this.set('fromVersion', params.isDowngrade ? data.resources[0].Upgrade.associated_version
: null);
+    this.set('toVersion', params.value);
     this.set('upgradeVersion', params.label);
     this.set('isDowngrade', !!params.isDowngrade);
     var upgradeMethod = this.get('upgradeMethods').findProperty('type', params.type),
@@ -921,7 +943,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     this.setDBProperties({
       upgradeVersion: params.label,
       upgradeId: data.resources[0].Upgrade.request_id,
-      fromVersion: params.isDowngrade ? data.resources[0].Upgrade.associated_version : null,
+      toVersion: params.value,
       upgradeState: 'PENDING',
       isDowngrade: !!params.isDowngrade,
       upgradeType: upgradeType,
@@ -960,7 +982,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     this.get('upgradeMethods').forEach(function (method) {
       if (method.get('allowed')) {
         this.runPreUpgradeCheckOnly({
-          value: version.get('id'),
+          id: version.get('id'),
+          value: version.get('repositoryVersion'),
           label: version.get('displayName'),
           type: method.get('type')
         });
@@ -1376,7 +1399,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    */
   runPreUpgradeCheck: function(version) {
     var params = {
-      value: version.get('id'),
+      value: version.get('repositoryVersion'),
       label: version.get('displayName'),
       type: version.get('upgradeType'),
       skipComponentFailures: version.get('skipComponentFailures') ? 'true' : 'false',
@@ -1451,7 +1474,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       },
       Em.I18n.t('admin.stackUpgrade.upgrade.retry.confirm.body').format(version.get('displayName')),
       null,
-      Em.I18n.t('admin.stackUpgrade.dialog.header').format(version.get('upgradeTypeDislayName'),
version.get('displayName'))
+      this.getUpgradeDowngradeHeader(version.get('upgradeTypeDislayName'), version.get('displayName'),
false)
     );
   },
 
@@ -2039,11 +2062,9 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       data: {
         upgradeId: upgrade && upgrade.get('upgradeId'),
         id: version.get('id'),
-        value: version.get('id'),
+        value: version.get('repositoryVersion'),
         label: version.get('displayName'),
-        type: version.get('upgradeType'),
-        skipComponentFailures: version.get('skipComponentFailures') ? 'true' : 'false',
-        skipSCFailures: version.get('skipSCFailures') ? 'true' : 'false'
+        isDowngrade: true
       }
     });
   },
@@ -2057,7 +2078,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     var upgradeType = this.get('upgradeMethods').findProperty('type', lastUpgradeData.Upgrade.upgrade_type);
     const isDowngrade = lastUpgradeData.Upgrade.direction === 'DOWNGRADE';
     this.setDBProperties({
-      fromVersion: isDowngrade ? lastUpgradeData.Upgrade.associated_version : null,
+      toVersion: lastUpgradeData.Upgrade.associated_version,
       upgradeId: lastUpgradeData.Upgrade.request_id,
       isDowngrade,
       upgradeState: lastUpgradeData.Upgrade.request_status,
@@ -2071,8 +2092,10 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       })
     });
     this.loadRepoVersionsToModel().done(function () {
-      var toVersion = isDowngrade ? null : App.RepositoryVersion.find().findProperty('repositoryVersion',
lastUpgradeData.Upgrade.associated_version);
-      self.setDBProperty('upgradeVersion', toVersion && toVersion.get('displayName'));
+      var toVersion = App.RepositoryVersion.find().findProperty('repositoryVersion', lastUpgradeData.Upgrade.associated_version);
+      if (!isDowngrade) {
+        self.setDBProperty('upgradeVersion', toVersion && toVersion.get('displayName'));
+      }
       self.initDBProperties();
       self.loadUpgradeData(true);
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b523208/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 805a760..2f07163 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1764,10 +1764,10 @@ Em.I18n.translations = {
   'admin.stackVersions.version.upgrade.upgradeOptions.tolerance.option1': "Skip all Slave
Component failures",
   'admin.stackVersions.version.upgrade.upgradeOptions.tolerance.option2': "Skip all Service
Check failures",
   'admin.stackVersions.version.upgrade.upgradeOptions.tolerance.tooltip': "These upgrade
failure tolerance options are useful when performing an upgrade on a large cluster and you
want to minimize user intervention.",
-  'admin.stackVersions.version.upgrade.upgradeOptions.RU.title': "Rolling Upgrade",
+  'admin.stackVersions.version.upgrade.upgradeOptions.RU.title': "Rolling",
   'admin.stackVersions.version.upgrade.upgradeOptions.RU.description': "Services remain running
while the upgrade is performed. Minimized disruption but slower upgrade.",
-  'admin.stackVersions.version.upgrade.upgradeOptions.EU.title': "Express Upgrade",
-  'admin.stackVersions.version.upgrade.upgradeOptions.HOU.title': "Host Ordered Upgrade",
+  'admin.stackVersions.version.upgrade.upgradeOptions.EU.title': "Express",
+  'admin.stackVersions.version.upgrade.upgradeOptions.HOU.title': "Host Ordered",
   'admin.stackVersions.version.upgrade.upgradeOptions.EU.description': "Services are stopped
while the upgrade is performed. Incurs downtime, but faster upgrade.",
   'admin.stackVersions.version.upgrade.upgradeOptions.errors_bypassed': "Bypassed errors,<br/>proceed
at your own risk.",
   'admin.stackVersions.version.upgrade.upgradeOptions.preCheck.rerun':'Rerun Checks',
@@ -1867,7 +1867,8 @@ Em.I18n.translations = {
   'admin.stackUpgrade.state.paused.downgrade': "Downgrade Paused",
   'admin.stackUpgrade.state.aborted.downgrade': "Downgrade Aborted",
   'admin.stackUpgrade.state.completed.downgrade': "Downgrade Finished",
-  'admin.stackUpgrade.dialog.header': "Upgrade to {0}",
+  'admin.stackUpgrade.dialog.upgrade.header': "{0} Upgrade to {1}",
+  'admin.stackUpgrade.dialog.upgrade.patch.header': "{0} Patch Upgrade to {1}",
   'admin.stackUpgrade.dialog.downgrade.header': "Downgrade from {0}",
   'admin.stackUpgrade.dialog.operationFailed': "This operation failed.",
   'admin.stackUpgrade.dialog.stop': "Stop Upgrade",

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b523208/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 0dcc945..ab771e7 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1853,7 +1853,7 @@ var urls = {
   },
 
   'admin.upgrade.pre_upgrade_check': {
-    'real': '/clusters/{clusterName}/rolling_upgrades_check?fields=*&UpgradeChecks/repository_version_id={value}&UpgradeChecks/upgrade_type={type}&UpgradeChecks/target_stack={targetStack}',
+    'real': '/clusters/{clusterName}/rolling_upgrades_check?fields=*&UpgradeChecks/repository_version_id={id}&UpgradeChecks/upgrade_type={type}',
     'mock': '/data/stack_versions/pre_upgrade_check.json'
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b523208/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 b93b097..719cd96 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
@@ -172,12 +172,11 @@ App.UpgradeVersionBoxView = Em.View.extend({
     });
     var isSuspended = App.get('upgradeSuspended');
 
-    if (['INSTALLING', 'CURRENT'].contains(status)) {
-      if (this.get('content.isPatch') && status === 'CURRENT') {
-        element.setProperties(statePropertiesMap['CURRENT_PATCH']);
-      } else {
-        element.setProperties(statePropertiesMap[status]);
-      }
+    if (status === 'CURRENT' && this.get('content.isPatch') && !this.get('isUpgrading'))
{
+      element.setProperties(statePropertiesMap['CURRENT_PATCH']);
+    }
+    else if (['INSTALLING', 'CURRENT'].contains(status) && !this.get('content.isPatch'))
{
+      element.setProperties(statePropertiesMap[status]);
     }
     else if (status === 'NOT_REQUIRED') {
       requestInProgressRepoId && requestInProgressRepoId == this.get('content.id')
? element.setProperties(statePropertiesMap['LOADING']) : element.setProperties(statePropertiesMap[status]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b523208/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 918c92f..71b9df1 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
@@ -405,7 +405,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       expect(args[0].sender).to.be.eql(controller);
       expect(args[0].data).to.be.eql({
         id: '1',
-        value: '1',
+        value: '2.2',
         label: 'HDP-2.2',
         type: 'ROLLING',
         targetStack: "HDP-2.2",
@@ -1148,7 +1148,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       expect(this.callArgs.data).to.eql({
         id: '1',
         value: '2.2',
-        label: 'HDP-2.2',
+        label: 'HDP-2.3',
         isDowngrade: true,
         upgradeType: "NON_ROLLING"
       });
@@ -1728,11 +1728,13 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     it("Rolling method allowed", function () {
       controller.get('upgradeMethods').setEach('allowed', true);
       controller.runUpgradeMethodChecks(Em.Object.create({
-        id: '1',
+        id: 1,
+        repositoryVersion: '1.2',
         displayName: 'V1'
       }));
       expect(controller.runPreUpgradeCheckOnly.calledWith({
-        value: '1',
+        id: 1,
+        value: '1.2',
         label: 'V1',
         type: 'ROLLING'
       })).to.be.true;
@@ -1783,7 +1785,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     });
     it('proper data is saved to the localDB', function () {
       expect(controller.setDBProperties.getCall(0).args[0]).to.eql({
-        fromVersion: null,
+        toVersion: '1.1',
         upgradeId: 1,
         isDowngrade: false,
         upgradeState: 'PENDING',
@@ -3500,16 +3502,33 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       expect(args[0]).to.exists;
       expect(args[0].data).to.be.eql({
         upgradeId: 1,
+        isDowngrade: true,
         id: 2,
-        value: 2,
-        label: '1.2',
-        type: 'EXPRESS',
-        skipComponentFailures: 'false',
-        skipSCFailures: 'false'
+        value: '1.1',
+        label: '1.2'
       });
       args[0].callback();
       expect(controller.get('requestInProgress')).to.be.false;
     });
   });
 
+  describe('#getUpgradeDowngradeHeader', function() {
+
+    it('should return downgrade header', function() {
+      expect(controller.getUpgradeDowngradeHeader('t1', 'v1', true)).to.be.equal(
+        Em.I18n.t('admin.stackUpgrade.dialog.downgrade.header').format('v1')
+      );
+    });
+    it('should return patch upgrade header', function() {
+      expect(controller.getUpgradeDowngradeHeader('t1', 'v1', false, true)).to.be.equal(
+        Em.I18n.t('admin.stackUpgrade.dialog.upgrade.patch.header').format('t1', 'v1')
+      );
+    });
+    it('should return upgrade header', function() {
+      expect(controller.getUpgradeDowngradeHeader('t1', 'v1', false, false)).to.be.equal(
+        Em.I18n.t('admin.stackUpgrade.dialog.upgrade.header').format('t1', 'v1')
+      );
+    });
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b523208/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 0337913..71519c5 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
@@ -451,7 +451,8 @@ describe('App.UpgradeVersionBoxView', function () {
       {
         inputData: {
           'content.status': 'CURRENT',
-          'content.isPatch': true
+          'content.isPatch': true,
+          'isUpgrading': false
         },
         expected: {
           status: 'CURRENT',
@@ -1020,6 +1021,9 @@ describe('App.UpgradeVersionBoxView', function () {
         if (item.setup) {
           item.setup.call(this);
         }
+        view.reopen({
+          isUpgrading: item.inputData.isUpgrading
+        });
         view.setProperties(item.inputData);
         var result = view.get('stateElement').getProperties(Em.keys(item.expected));
         if (result.buttons) {


Mime
View raw message