ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject ambari git commit: AMBARI-13555. Express Upgrade: EX edits v2.(xiwang)
Date Sat, 24 Oct 2015 00:33:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 29d4ff341 -> b79fe89a4


AMBARI-13555. Express Upgrade: EX edits v2.(xiwang)


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

Branch: refs/heads/branch-2.1
Commit: b79fe89a4991c9aa5b683591f8296dca1a07d174
Parents: 29d4ff3
Author: Xi Wang <xiwang@apache.org>
Authored: Fri Oct 23 16:46:59 2015 -0700
Committer: Xi Wang <xiwang@apache.org>
Committed: Fri Oct 23 17:32:42 2015 -0700

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 23 ++++++++++---
 ambari-web/app/messages.js                      |  3 ++
 ambari-web/app/styles/stack_versions.less       | 30 ++++++++++++++---
 .../modal_popups/cluster_check_dialog.hbs       |  3 ++
 .../stack_upgrade/stack_upgrade_wizard.hbs      |  7 ++--
 .../admin/stack_upgrade/upgrade_options.hbs     | 34 ++++++++++----------
 ambari-web/app/utils/ajax/ajax.js               |  2 +-
 .../common/modal_popups/cluster_check_popup.js  |  3 +-
 .../admin/stack_and_upgrade_controller_test.js  | 13 +++++++-
 9 files changed, 85 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/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 f751277..40419a3 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
@@ -668,11 +668,22 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
             success: 'updateOptionsSuccessCallback'
           });
         } else {
-          version.upgradeType = self.get('upgradeMethods').findProperty('selected', true).get('type');
+          var upgradeType = self.get('upgradeMethods').findProperty('selected', true).get('type');
+          version.upgradeType = upgradeType;
           version.upgradeTypeDisplayName = self.get('upgradeMethods').findProperty('selected',
true).get('displayName');
           version.skipComponentFailures = this.get('skipComponentFailures');
           version.skipSCFailures = this.get('skipSCFailures');
-          self.runPreUpgradeCheck.call(self, version);
+
+          var fromVersion = self.get('upgradeVersion');
+          var toVersion = version.get('displayName');
+          var bodyMessage = Em.Object.create({
+            confirmButton: Em.I18n.t('yes'),
+            confirmMsg: upgradeType == 'ROLLING'? Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.RU.confirm.msg').format(fromVersion,
toVersion):
+             Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.EU.confirm.msg').format(fromVersion,
toVersion)
+          });
+          return App.showConfirmationFeedBackPopup(function (query) {
+            return self.runPreUpgradeCheck.call(self, version);
+          }, bodyMessage);
         }
       },
       onSecondary: function () {
@@ -686,9 +697,9 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
 
   /**
    * open upgrade options from upgrade wizard
-   * @return App.ModalPopup
    */
   openUpgradeOptions: function () {
+    if (this.get('isDowngrade')) return;
     this.upgradeOptions(true, null);
   },
 
@@ -751,10 +762,12 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     method.set('precheckResultsData', data);
     this.updateSelectedMethod(false);
     Em.run.later(this, function () {
+      // add tooltip for the type with preCheck errors
       App.tooltip($(".thumbnail.check-failed"), {
         placement: "bottom",
         title: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.preCheck.failed.tooltip')
       });
+      // destroy the tooltip for the type wo preCheck errors
       $(".thumbnail").not(".check-failed").not(".not-allowed-by-version").tooltip("destroy");
     }, 1000);
   },
@@ -777,8 +790,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     } else {
       var ruMethod = this.get('upgradeMethods').findProperty('type', 'ROLLING');
       var euMethod = this.get('upgradeMethods').findProperty('type', 'NON_ROLLING');
-      if (ruMethod.get('isPrecheckFailed')) ruMethod.set('selected', false);
-      if (euMethod.get('isPrecheckFailed')) euMethod.set('selected', false);
+      if (ruMethod && ruMethod.get('isPrecheckFailed')) ruMethod.set('selected',
false);
+      if (euMethod && euMethod.get('isPrecheckFailed')) euMethod.set('selected',
false);
     }
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 0b5dcd6..564440b 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1496,8 +1496,11 @@ Em.I18n.translations = {
   'admin.stackVersions.version.upgrade.upgradeOptions.preCheck.rerun':'Rerun Checks',
   'admin.stackVersions.version.upgrade.upgradeOptions.preCheck.msg.title':'Checks:',
   'admin.stackVersions.version.upgrade.upgradeOptions.preCheck.allPassed':'Passed',
+  'admin.stackVersions.version.upgrade.upgradeOptions.preCheck.allPassed.msg':'All checks
passed',
   'admin.stackVersions.version.upgrade.upgradeOptions.preCheck.failed.tooltip':'Option not
available',
   'admin.stackVersions.version.upgrade.upgradeOptions.notAllowed':'Not allowed by the current
version',
+  'admin.stackVersions.version.upgrade.upgradeOptions.EU.confirm.msg': 'You are about to
perform an <b>Express Upgrade</b> from <b>{0}</b> to <b>{1}</b>.
This will incur cluster downtime. Are you sure you want to proceed?',
+  'admin.stackVersions.version.upgrade.upgradeOptions.RU.confirm.msg': 'You are about to
perform a <b>Rolling Upgrade</b> from <b>{0}</b> to <b>{1}</b>.
Are you sure you want to proceed?',
 
   'admin.stackVersions.hosts.popup.header.current': "Current",
   'admin.stackVersions.hosts.popup.header.installed': "Installed",

http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/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 048e3dd..6c5ed0b 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -267,11 +267,28 @@
   .task-list-main-warp i {
     font-size: 16px;
   }
-  .upgrade-options-button {
+  .upgrade-options-link {
     position: absolute;
+    cursor: pointer;
     right: 10%;
-    top: 10px;
+    top: 13px;
     width: 100px;
+    a {
+      font-size: 13px;
+    }
+    .icon-cogs {
+      color: #0088cc;
+      margin-right: 3px;
+    }
+  }
+  .upgrade-options-link.disabled {
+    cursor: not-allowed;
+    a, .icon-cogs {
+      color: #808080;
+    }
+    a:hover {
+      text-decoration: none;
+    }
   }
 }
 
@@ -292,7 +309,7 @@
       width: 43.5%;
     }
     .thumbnail {
-      height: 140px;
+      height: 165px;
       cursor: pointer;
       border: none;
       width: 99%;
@@ -328,11 +345,11 @@
       }
     }
     .selected.ROLLING, .selected.NON_ROLLING {
-      background-color: #cbe3c2;
+      background-color: #d3e7ca;
       box-shadow: 0 8px 6px -6px #b3b3b3;
     }
     .ROLLING:hover, .NON_ROLLING:hover {
-      background-color: #d3e7ca;
+      background-color: #cbe3c2;
     }
 
     .thumbnail.not-allowed:hover {
@@ -389,6 +406,9 @@
   }
   .tolerance-text .tolerance-option {
     margin: 5px 15px;
+    .ember-checkbox {
+      margin-top: 0px;
+    }
   }
   .text {
     margin-left: 10px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs b/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs
index 38160ac..8767d70 100644
--- a/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs
+++ b/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs
@@ -16,6 +16,9 @@
 * limitations under the License.
 }}
 <div id="pre-upgrade-check">
+  {{#if view.isAllPassed}}
+    <i class="icon-ok"></i>&nbsp;<span>{{t admin.stackVersions.version.upgrade.upgradeOptions.preCheck.allPassed.msg}}</span>
+  {{/if}}
   {{#if view.fails.length}}
     <h4>{{view.failTitle}}</h4>
     <div class="alert alert-warning">

http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
index ef46994..a45bad1 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
@@ -17,9 +17,10 @@
 }}
 
 <div id="stack-upgrade-dialog">
-  <button class="btn btn-primary upgrade-options-button" {{bindAttr disabled="controller.isDowngrade"}}
{{action openUpgradeOptions target="controller"}}>
-    <i class="icon-cogs"></i>&nbsp;{{t common.options}}
-  </button>
+  <div {{bindAttr class=":upgrade-options-link controller.isDowngrade:disabled"}} {{action
openUpgradeOptions target="controller"}}>
+    <i class="icon-cogs"></i><a>{{t common.options}}</a>
+  </div>
+
   <div {{bindAttr class="view.isLoaded::hidden :row-fluid"}}>
     <div class="span3 task-list-main-warp">{{statusIcon controller.requestStatus}}
       &nbsp;{{view.upgradeStatusLabel}}</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/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 7d50785..1be2539 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
@@ -23,33 +23,33 @@
     {{#each method in view.upgradeMethods}}
       <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.isPrecheckFailed:not-allowed method.isPrecheckFailed:check-failed
+          method.selected:selected method.type :thumbnail"}}
           {{action selectMethod method target="view"}}>
             <div {{bindAttr class="method.icon :method-icon"}}></div>
             <div class="method-name">{{method.displayName}}</div>
             <div class="method-description">{{{method.description}}}</div>
+            {{#unless view.isInUpgradeWizard}}
+              {{#if method.precheckResultsMessage}}
+                <div {{bindAttr class=":method-precheck-message method.precheckResultsMessageClass"}}>
+                  <i {{bindAttr class="method.precheckResultsMessageIconClass"}}></i>
+                  <b>{{t admin.stackVersions.version.upgrade.upgradeOptions.preCheck.msg.title}}</b>&nbsp;
+                  <a {{action openMessage method target="view"}}>
+                    {{method.precheckResultsMessage}}
+                  </a>
+                </div>
+              {{/if}}
+            {{/unless}}
         </div>
-        {{#unless view.isInUpgradeWizard}}
-          {{#if method.precheckResultsMessage}}
-            <div {{bindAttr class=":method-precheck-message method.precheckResultsMessageClass"}}>
-              <i {{bindAttr class="method.precheckResultsMessageIconClass"}}></i>
-              <b>{{t admin.stackVersions.version.upgrade.upgradeOptions.preCheck.msg.title}}</b>&nbsp;
-              <a {{action openMessage method target="view"}}>
-                {{method.precheckResultsMessage}}
-              </a>
-            </div>
-          {{/if}}
-        {{/unless}}
       </div>
     {{/each}}
   </div>
 
   <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>
-    <div class="tolerance-option">{{view Ember.Checkbox checkedBinding="view.parentView.skipSCFailures"}}
-      {{t admin.stackVersions.version.upgrade.upgradeOptions.tolerance.option2}}</div>
-    <div class="tolerance-option">{{view Ember.Checkbox checkedBinding="view.parentView.skipComponentFailures"}}
-      {{t admin.stackVersions.version.upgrade.upgradeOptions.tolerance.option1}}</div>
+    <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>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/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 ba9506e..20789aa 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1613,7 +1613,7 @@ var urls = {
         data: JSON.stringify({
           "Upgrade": {
             "repository_version": data.value,
-            "type": data.type,
+            "upgrade_type": data.type,
             "skip_failures": data.skipComponentFailures,
             "skip_service_check_failures": data.skipSCFailures
           }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/ambari-web/app/views/common/modal_popups/cluster_check_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/cluster_check_popup.js b/ambari-web/app/views/common/modal_popups/cluster_check_popup.js
index 6e901ec..b3f0c4c 100644
--- a/ambari-web/app/views/common/modal_popups/cluster_check_popup.js
+++ b/ambari-web/app/views/common/modal_popups/cluster_check_popup.js
@@ -99,7 +99,8 @@ App.showPreUpgradeCheckPopup = function (data, header, failTitle, failAlert,
war
       templateName: require('templates/common/modal_popups/cluster_check_dialog'),
       fails: fails,
       warnings: warnings,
-      hasConfigsMergeConflicts: hasConfigsMergeConflicts
+      hasConfigsMergeConflicts: hasConfigsMergeConflicts,
+      isAllPassed: !fails.length && !warnings.length && !hasConfigsMergeConflicts.length
     };
   if (hasConfigsMergeConflicts) {
     popupBody.configsMergeTable = Em.View.extend({

http://git-wip-us.apache.org/repos/asf/ambari/blob/b79fe89a/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 e0cab41..efdf059 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
@@ -767,10 +767,12 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   describe("#upgradeOptions()", function() {
     before(function () {
       sinon.spy(App, 'ModalPopup');
+      sinon.spy(App, 'showConfirmationFeedBackPopup');
       sinon.stub(controller, 'runPreUpgradeCheck', Em.K);
     });
     after(function () {
       App.ModalPopup.restore();
+      App.showConfirmationFeedBackPopup.restore();
       controller.runPreUpgradeCheck.restore();
     });
     it("show confirmation popup", function() {
@@ -793,11 +795,20 @@ describe('App.MainAdminStackAndUpgradeController', function() {
           allowed: true
         })
       ];
+      controller.set('isDowngrade', false);
       var popup = controller.upgradeOptions(false, version);
       expect(App.ModalPopup.calledOnce).to.be.true;
-      popup.onPrimary();
+      var confirmPopup = popup.onPrimary();
+      expect(App.showConfirmationFeedBackPopup.calledOnce).to.be.true;
+      confirmPopup.onPrimary();
       expect(controller.runPreUpgradeCheck.calledWith(version)).to.be.true;
     });
+    it("NOT show confirmation popup on Downgrade", function() {
+      var version = Em.Object.create({displayName: 'HDP-2.2'});
+      controller.set('isDowngrade', true);
+      var popup = controller.upgradeOptions(false, version);
+      expect(App.ModalPopup.calledOnce).to.be.false;
+    });
   });
 
   describe("#confirmUpgrade()", function() {


Mime
View raw message