ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-21859. Pre-upgrade check option well before starting upgrade process (alexantonenko)
Date Thu, 31 Aug 2017 14:06:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 2f173260b -> c26162c55


AMBARI-21859. Pre-upgrade check option well before starting upgrade process (alexantonenko)


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

Branch: refs/heads/branch-2.6
Commit: c26162c5520f06d1c2325c52a16b94c790ea9173
Parents: 2f17326
Author: Alex Antonenko <aantonenko@hortonworks.com>
Authored: Thu Aug 31 17:05:48 2017 +0300
Committer: Alex Antonenko <aantonenko@hortonworks.com>
Committed: Thu Aug 31 17:05:48 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 19 +++++++++-----
 ambari-web/app/messages.js                      |  4 +++
 ambari-web/app/styles/stack_versions.less       |  6 +++++
 .../admin/stack_upgrade/upgrade_options.hbs     | 27 ++++++++++++--------
 .../stack_upgrade/upgrade_version_box_view.js   | 12 +++++++--
 .../admin/stack_and_upgrade_controller_test.js  | 15 ++++++++++-
 .../upgrade_version_box_view_test.js            | 25 ++++++++++++++++++
 7 files changed, 87 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c26162c5/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 60be84b..53b3171 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
@@ -964,7 +964,6 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       if (method.get('allowed')) {
         this.runPreUpgradeCheckOnly({
           id: version.get('id'),
-          value: version.get('repositoryVersion'),
           label: version.get('displayName'),
           type: method.get('type')
         });
@@ -1004,13 +1003,17 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     return configs;
   },
 
+  showUpgradeOptions: function ( version ) {
+    this.upgradeOptions(false, version, true);
+  },
+
   /**
    * Open upgrade options window: upgrade type and failures tolerance
    * @param {boolean} isInUpgradeWizard
    * @param {object} version
    * @return App.ModalPopup
    */
-  upgradeOptions: function (isInUpgradeWizard, version) {
+  upgradeOptions: function (isInUpgradeWizard, version, preUpgradeShow) {
     var self = this,
       upgradeMethods = this.get('upgradeMethods'),
       runningCheckRequests = this.get('runningCheckRequests');
@@ -1036,10 +1039,11 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
 
     return App.ModalPopup.show({
       encodeBody: false,
+      showFooter: !preUpgradeShow,
       primary: isInUpgradeWizard ? Em.I18n.t('ok') : Em.I18n.t('common.proceed'),
       primaryClass: 'btn-success',
       classNames: ['upgrade-options-popup'],
-      header: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.header'),
+      header: preUpgradeShow ? Em.I18n.t('admin.stackVersions.version.preUpgrade.header')
: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.header'),
       bodyClass: Em.View.extend({
         templateName: require('templates/main/admin/stack_upgrade/upgrade_options'),
         didInsertElement: function () {
@@ -1064,7 +1068,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
         }.property().volatile(),
         isInUpgradeWizard: isInUpgradeWizard,
         showPreUpgradeChecks: App.get('supports.preUpgradeCheck') && !isInUpgradeWizard,
-        versionText: isInUpgradeWizard ? '' : Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.version').format(version.get('displayName')),
+        versionText: preUpgradeShow ? Em.I18n.t('admin.stackVersions.version.preUpgrade.bodyMsg.version').format(version.get('displayName'))
: isInUpgradeWizard ? '' : Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.version').format(version.get('displayName')),
         selectMethod: function (event) {
           if (isInUpgradeWizard || !event.context.get('allowed') || event.context.get('isPrecheckFailed'))
return;
           var selectedMethod = event.context;
@@ -1084,7 +1088,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
         },
         rerunCheck: function (event) {
           self.runPreUpgradeCheckOnly({
-            value: version.get('id'),
+            id: version.get('id'),
             label: version.get('displayName'),
             type: event.context.get('type')
           });
@@ -1120,13 +1124,14 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
             bypassedFailures: bypassedFailures,
             callback: function () {
               self.runPreUpgradeCheckOnly.call(self, {
-                value: version.get('id'),
+                id: version.get('id'),
                 label: version.get('displayName'),
                 type: event.context.get('type')
               });
             }
           }, configs);
-        }
+        },
+        upgradeShow: !preUpgradeShow
       }),
 
       /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/c26162c5/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index d5cb9eb..0edac39 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1725,6 +1725,7 @@ Em.I18n.translations = {
   'admin.stackVersions.version.installNow': "Install Packages",
   'admin.stackVersions.version.reinstall': "Reinstall Packages",
   'admin.stackVersions.version.performUpgrade': "Perform Upgrade",
+  'admin.stackVersions.version.preUpgradeCheck': 'Pre-Upgrade Check',
   'admin.stackVersions.version.upgrade.pause': "Upgrade: Action Required",
   'admin.stackVersions.version.upgrade.notFinalized.warning': "The upgrade has not been finalized
yet. After the cluster is verified to be functional, do not forget to finalize the upgrade
as soon as possible (within a couple of days is highly recommended) as running the cluster
in unfinalized state causes extra resource requirements on HDFS.",
   'admin.stackVersions.version.upgrade.running': "Upgrade: In Progress",
@@ -1770,6 +1771,9 @@ Em.I18n.translations = {
 
   'admin.stackVersions.version.upgrade.alertsWarning': 'Cluster alerts will still be visible
and recorded in Ambari but notifications (such as Email and SNMP) will be suppressed during
the upgrade.',
 
+  'admin.stackVersions.version.preUpgrade.header' : 'Pre-Upgrade Check',
+  'admin.stackVersions.version.preUpgrade.bodyMsg.version': 'The following checks have been
run to test your ability to upgrade to <b>{0}</b>.',
+
   'admin.stackVersions.version.column.showDetails': "Show Details",
   'admin.stackVersions.version.column.showDetails.title': "Version Details",
   'admin.stackVersions.version.noCompatible.tooltip': 'Directly upgrading to this version
is not supported.',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c26162c5/ambari-web/app/styles/stack_versions.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/stack_versions.less b/ambari-web/app/styles/stack_versions.less
index 1ec16da..8dee023 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -643,6 +643,9 @@
     }
     .thumbnail.not-allowed {
       cursor: not-allowed;
+      &.default-cursor{
+        cursor: default;
+      }
     }
   }
 
@@ -713,6 +716,9 @@
   }
   .text {
     margin-left: 10px;
+    &.big-text{
+      font-size: 20px;
+    }
   }
   .icon-question-sign {
     color: @blue;

http://git-wip-us.apache.org/repos/asf/ambari/blob/c26162c5/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs
index abe164c..996c5a5 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs
@@ -17,15 +17,18 @@
 }}
 
 <div id="upgrade-options-popup-content">
-  <div class="text version-text">{{{view.versionText}}}</div>
-  <div class="text method-text">{{t admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.method}}</div>
+  <div {{bindAttr class="view.upgradeShow::big-text :text"}}>{{{view.versionText}}}</div>
+  {{#if view.upgradeShow}}
+    <div class="text method-text">{{t admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.method}}</div>
+  {{/if}}
   <div {{bindAttr class=":row-fluid :method-options view.isInUpgradeWizard:disabled"}}>
       {{#each method in view.upgradeMethods}}
           {{#unless method.cantBeStarted}}
             <div class="method-option span5">
               <div {{bindAttr class="method.allowed::not-allowed method.allowed::not-allowed-by-version
                     method.isPrecheckFailed:not-allowed method.isPrecheckFailed:check-failed
-                    method.selected:selected method.type :thumbnail"}}
+                    method.selected:selected method.type :thumbnail
+                    view.upgradeShow::default-cursor"}}
                   {{action selectMethod method target="view"}}>
                 <div {{bindAttr class="method.icon :method-icon"}}></div>
                 <div class="method-name">{{method.displayName}}</div>
@@ -54,13 +57,15 @@
           {{/unless}}
       {{/each}}
   </div>
+  {{#if view.upgradeShow}}
+      <div class="text tolerance-text">{{t admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.tolerance}}
+          <i class="icon-question-sign failure-tolerance-tooltip" data-toggle="tooltip"></i>
+          <label class="tolerance-option">{{view Ember.Checkbox checkedBinding="view.parentView.skipSCFailures"}}
+              {{t admin.stackVersions.version.upgrade.upgradeOptions.tolerance.option2}}</label>
+          <label class="tolerance-option">{{view Ember.Checkbox checkedBinding="view.parentView.skipComponentFailures"}}
+              {{t admin.stackVersions.version.upgrade.upgradeOptions.tolerance.option1}}</label>
+      </div>
+      <div class="alert alert-warning">{{t admin.stackVersions.version.upgrade.alertsWarning}}</div>
+  {{/if}}
 
-  <div class="text tolerance-text">{{t admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.tolerance}}
-    <i class="icon-question-sign failure-tolerance-tooltip" data-toggle="tooltip"></i>
-    <label class="tolerance-option">{{view Ember.Checkbox checkedBinding="view.parentView.skipSCFailures"}}
-      {{t admin.stackVersions.version.upgrade.upgradeOptions.tolerance.option2}}</label>
-    <label class="tolerance-option">{{view Ember.Checkbox checkedBinding="view.parentView.skipComponentFailures"}}
-      {{t admin.stackVersions.version.upgrade.upgradeOptions.tolerance.option1}}</label>
-  </div>
-  <div class="alert alert-warning">{{t admin.stackVersions.version.upgrade.alertsWarning}}</div>
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c26162c5/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 e46a400..e36b83a 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
@@ -266,13 +266,21 @@ App.UpgradeVersionBoxView = Em.View.extend({
           isDisabled: isDisabled
         });
       } else {
-        element.set('text', this.get('isVersionColumnView') ? Em.I18n.t('common.upgrade')
: Em.I18n.t('admin.stackVersions.version.performUpgrade'));
+        var isVersionColumnView = this.get('isVersionColumnView');
+        element.set('text', isVersionColumnView ? Em.I18n.t('common.upgrade') : Em.I18n.t('admin.stackVersions.version.performUpgrade'));
         element.set('action', 'confirmUpgrade');
         element.get('buttons').pushObject({
-          text: this.get('isVersionColumnView') ? Em.I18n.t('common.reinstall') : Em.I18n.t('admin.stackVersions.version.reinstall'),
+          text: isVersionColumnView ? Em.I18n.t('common.reinstall') : Em.I18n.t('admin.stackVersions.version.reinstall'),
           action: 'installRepoVersionConfirmation',
           isDisabled: isDisabled
         });
+
+        element.get('buttons').pushObject({
+          text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
+          action: 'showUpgradeOptions',
+          isDisabled: isDisabled
+        });
+
         if (this.get('content.isPatch')) {
           element.get('buttons').pushObject({
             text: Em.I18n.t('common.discard'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/c26162c5/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 181e43f..e69b3bf 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
@@ -1759,7 +1759,6 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       }));
       expect(controller.runPreUpgradeCheckOnly.calledWith({
         id: 1,
-        value: '1.2',
         label: 'V1',
         type: 'ROLLING'
       })).to.be.true;
@@ -3582,4 +3581,18 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     });
   });
 
+  describe('#showUpgradeOptions', function () {
+    before(function () {
+      sinon.stub(controller, 'upgradeOptions', Em.K);
+    });
+    after(function () {
+      controller.upgradeOptions.restore();
+    });
+    it("show upgrade options popup window", function() {
+      var version = Em.Object.create({displayName: 'HDP-2.2'});
+      controller.showUpgradeOptions(version);
+      expect(controller.upgradeOptions.calledWith(false, version, true)).to.be.true;
+    });
+  })
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/c26162c5/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 94bd497..abcad21 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
@@ -467,6 +467,11 @@ describe('App.UpgradeVersionBoxView', function () {
             text: Em.I18n.t('admin.stackVersions.version.reinstall'),
             action: 'installRepoVersionConfirmation',
             isDisabled: true
+          },
+          {
+            text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
+            action: 'showUpgradeOptions',
+            isDisabled: true
           }],
           text: Em.I18n.t('admin.stackVersions.version.performUpgrade'),
           action: 'confirmUpgrade',
@@ -504,6 +509,11 @@ describe('App.UpgradeVersionBoxView', function () {
             text: Em.I18n.t('admin.stackVersions.version.reinstall'),
             action: 'installRepoVersionConfirmation',
             isDisabled: true
+          },
+          {
+            text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
+            action: 'showUpgradeOptions',
+            isDisabled: true
           }],
           text: Em.I18n.t('admin.stackVersions.version.performUpgrade'),
           action: 'confirmUpgrade',
@@ -632,6 +642,11 @@ describe('App.UpgradeVersionBoxView', function () {
               isDisabled: true
             },
             {
+              text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
+              action: 'showUpgradeOptions',
+              isDisabled: true
+            },
+            {
               "action": "confirmDiscardRepoVersion",
               "isDisabled": true,
               "text": "Discard"
@@ -671,6 +686,11 @@ describe('App.UpgradeVersionBoxView', function () {
               text: Em.I18n.t('admin.stackVersions.version.reinstall'),
               action: 'installRepoVersionConfirmation',
               isDisabled: true
+            },
+            {
+              text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
+              action: 'showUpgradeOptions',
+              isDisabled: true
             }
           ],
           isDisabled: true
@@ -1383,6 +1403,11 @@ describe('App.UpgradeVersionBoxView', function () {
             "isDisabled": false
           },
           {
+            text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
+            action: 'showUpgradeOptions',
+            isDisabled: false
+          },
+          {
             "text": Em.I18n.t('common.discard'),
             "action": "confirmDiscardRepoVersion",
             "isDisabled": false


Mime
View raw message