ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lpus...@apache.org
Subject [25/50] [abbrv] ambari git commit: AMBARI-21859. Pre-upgrade check option well before starting upgrade process (alexantonenko)
Date Tue, 05 Sep 2017 09:41:20 GMT
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/638fc708
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/638fc708
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/638fc708

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 638fc708c81a61db3fc5a870c7c55b0e3d8232b3
Parents: ff23a2e
Author: Alex Antonenko <aantonenko@hortonworks.com>
Authored: Thu Aug 31 16:59:51 2017 +0300
Committer: Alex Antonenko <aantonenko@hortonworks.com>
Committed: Thu Aug 31 16:59:51 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 20 +++++++++-------
 ambari-web/app/messages.js                      |  4 ++++
 ambari-web/app/styles/stack_versions.less       |  6 +++++
 .../admin/stack_upgrade/upgrade_options.hbs     | 19 ++++++++++++---
 .../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(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/638fc708/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 8e9ce86..5c96251 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
@@ -986,7 +986,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')
         });
@@ -1026,13 +1025,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');
@@ -1068,10 +1071,10 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
         return this.get('controller.getSupportedUpgradeError') ? null : Em.I18n.t('common.cancel');
       }.property('controller.getSupportedUpgradeError'),
       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'),
       controller: this,
       showFooter: function() {
-        return this.get('controller.isUpgradeTypesLoaded');
+        return this.get('controller.isUpgradeTypesLoaded') && !preUpgradeShow;
       }.property('controller.isUpgradeTypesLoaded'),
       bodyClass: Em.View.extend({
         templateName: require('templates/main/admin/stack_upgrade/upgrade_options'),
@@ -1097,7 +1100,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;
@@ -1117,7 +1120,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')
           });
@@ -1153,13 +1156,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/638fc708/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index c4e4492..caaca95 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1744,6 +1744,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 Process",
@@ -1789,6 +1790,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/638fc708/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 a9dcbaa..8bd5835 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -529,6 +529,9 @@
   .method-options.disabled {
     .img-thumbnail {
       cursor: not-allowed;
+      &.default-cursor{
+        cursor: default;
+      }
       .method-name,.method-icon,.method-description {
         color: #a9a9a9;
       }
@@ -593,6 +596,9 @@
   }
   .text {
     margin-left: 10px;
+    &.big-text{
+      font-size: 20px;
+    }
   }
   .glyphicon-question-sign {
     color: @blue;

http://git-wip-us.apache.org/repos/asf/ambari/blob/638fc708/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 fe3833c..ad1703c 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
@@ -22,15 +22,18 @@
         <pre>{{view.parentView.controller.getSupportedUpgradeError}}</pre>
     {{else}}
       <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 :method-options view.isInUpgradeWizard:disabled"}}>
             {{#each method in view.upgradeMethods}}
                 {{#unless method.cantBeStarted}}
                   <div class="method-option col-md-6">
                     <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 :img-thumbnail"}}
+                            method.selected:selected method.type :img-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>
@@ -87,4 +90,14 @@
       {{t admin.stackVersions.version.upgrade.upgradeOptions.loading}}
     </div>
   </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}}
 {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/638fc708/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 9518c52..87e843b 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
@@ -271,13 +271,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/638fc708/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 1d2306e..770aae3 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
@@ -1734,7 +1734,6 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       }));
       expect(controller.runPreUpgradeCheckOnly.calledWith({
         id: 1,
-        value: '1.2',
         label: 'V1',
         type: 'ROLLING'
       })).to.be.true;
@@ -3574,4 +3573,18 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       expect(controller.get('requestInProgress')).to.be.false;
     });
   });
+
+  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/638fc708/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 af3e990..acad709 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
@@ -550,6 +550,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',
@@ -587,6 +592,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',
@@ -715,6 +725,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"
@@ -754,6 +769,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
@@ -1421,6 +1441,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