ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [44/50] [abbrv] ambari git commit: AMBARI-18844 Web Client Should Support HOST_ORDERED Upgrades In Progress. (atkach)
Date Thu, 10 Nov 2016 16:59:12 GMT
AMBARI-18844 Web Client Should Support HOST_ORDERED Upgrades In Progress. (atkach)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: be6cd59af60ea703c37cb7d7ca94728191a3cbce
Parents: 56dc09e
Author: Andrii Tkach <atkach@apache.org>
Authored: Thu Nov 10 13:33:52 2016 +0200
Committer: Andrii Tkach <atkach@apache.org>
Committed: Thu Nov 10 14:32:19 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/config.js                        |  3 +-
 .../main/admin/stack_and_upgrade_controller.js  | 47 +++++++++++++++++---
 ambari-web/app/messages.js                      |  1 +
 ambari-web/app/styles/application.less          |  3 ++
 ambari-web/app/styles/stack_versions.less       |  3 ++
 ambari-web/app/templates/application.hbs        |  8 ++--
 .../admin/stack_upgrade/upgrade_version_box.hbs |  5 ++-
 .../stack_upgrade/upgrade_version_column.hbs    |  5 ++-
 .../stack_upgrade/upgrade_version_box_view.js   |  4 ++
 .../admin/stack_and_upgrade_controller_test.js  | 31 +++++++++++++
 .../upgrade_version_box_view_test.js            | 22 +++++++++
 11 files changed, 116 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index a2028ad..a14f38e 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -89,7 +89,8 @@ App.supports = {
   addingNewRepository: false,
   kerberosStackAdvisor: true,
   logCountVizualization: false,
-  manageJournalNode: true
+  manageJournalNode: true,
+  enabledWizardForHostOrderedUpgrade: true
 };
 
 if (App.enableExperimental) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/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 3c69b84..4429bf4 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
@@ -118,6 +118,14 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
   getSupportedUpgradeError: '',
 
   /**
+   * Restricted type of upgrade, can't be viewed in wizard.
+   * It's status visible only in upgrade status label
+   * @type {boolean}
+   * @default false
+   */
+  isWizardRestricted: false,
+
+  /**
    * methods through which cluster could be upgraded, "allowed" indicated if the method is
allowed
    * by stack upgrade path
    * @type {Array}
@@ -134,7 +142,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       isCheckRequestInProgress: false,
       precheckResultsMessage: '',
       precheckResultsTitle: '',
-      action: ''
+      action: '',
+      isWizardRestricted: false
     }),
     Em.Object.create({
       displayName: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.EU.title'),
@@ -147,7 +156,22 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       isCheckRequestInProgress: false,
       precheckResultsMessage: '',
       precheckResultsTitle: '',
-      action: ''
+      action: '',
+      isWizardRestricted: false
+    }),
+    Em.Object.create({
+      displayName: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.HOU.title'),
+      type: 'HOST_ORDERED',
+      icon: "glyphicon glyphicon-bolt",
+      description: '',
+      selected: false,
+      allowed: false,
+      isCheckComplete: false,
+      isCheckRequestInProgress: false,
+      precheckResultsMessage: '',
+      precheckResultsTitle: '',
+      action: '',
+      isWizardRestricted: !App.supports.enabledWizardForHostOrderedUpgrade
     })
   ],
 
@@ -206,7 +230,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     'failuresTolerance',
     'isDowngrade',
     'downgradeAllowed',
-    'isSuspended'
+    'isSuspended',
+    'isWizardRestricted'
   ],
 
   /**
@@ -826,15 +851,18 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     this.set('upgradeId', data.resources[0].Upgrade.request_id);
     this.set('upgradeVersion', params.label);
     this.set('isDowngrade', !!params.isDowngrade);
-    var upgradeMethod = this.get('upgradeMethods').findProperty('type', params.type);
-    var upgradeTypeDisplayName = null;
-    var upgradeType = null;
+    var upgradeMethod = this.get('upgradeMethods').findProperty('type', params.type),
+        upgradeTypeDisplayName = null,
+        upgradeType = null,
+        isWizardRestricted = false;
 
     if (upgradeMethod) {
       upgradeTypeDisplayName = upgradeMethod.get('displayName');
       upgradeType = upgradeMethod.get('type');
+      isWizardRestricted = upgradeMethod.get('isWizardRestricted');
     }
 
+    this.set('isWizardRestricted', isWizardRestricted);
     this.set('upgradeType', upgradeType);
     this.set('upgradeTypeDisplayName', upgradeTypeDisplayName);
     this.set('failuresTolerance', Em.Object.create({
@@ -847,6 +875,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       upgradeState: 'PENDING',
       isDowngrade: !!params.isDowngrade,
       upgradeType: upgradeType,
+      isWizardRestricted: isWizardRestricted,
       upgradeTypeDisplayName: upgradeTypeDisplayName,
       failuresTolerance: Em.Object.create({
         skipComponentFailures: params.skipComponentFailures == 'true',
@@ -946,6 +975,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
         });
       request.type = 'ALL';
       this.get('runningCheckRequests').push(request);
+    } else {
+      this.set('isUpgradeTypesLoaded', true);
     }
 
     return App.ModalPopup.show({
@@ -1636,6 +1667,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       currentVersion: undefined,
       upgradeTypeDisplayName: undefined,
       upgradeType: undefined,
+      isWizardRestricted: false,
       failuresTolerance: undefined,
       isDowngrade: undefined,
       downgradeAllowed: undefined
@@ -1688,7 +1720,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    * @return {App.ModalPopup}
    */
   openUpgradeDialog: function () {
-    if (App.isAuthorized('CLUSTER.UPGRADE_DOWNGRADE_STACK')) {
+    if (App.isAuthorized('CLUSTER.UPGRADE_DOWNGRADE_STACK') && !this.get('isWizardRestricted'))
{
       App.propertyDidChange('upgradeSuspended');
       App.router.transitionTo('admin.stackUpgrade');
     }
@@ -1874,6 +1906,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       isDowngrade: lastUpgradeData.Upgrade.direction === 'DOWNGRADE',
       upgradeState: lastUpgradeData.Upgrade.request_status,
       upgradeType: lastUpgradeData.Upgrade.upgrade_type,
+      isWizardRestricted: upgradeType.get('isWizardRestricted'),
       downgradeAllowed: lastUpgradeData.Upgrade.downgrade_allowed,
       upgradeTypeDisplayName: upgradeType.get('displayName'),
       failuresTolerance: Em.Object.create({

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index e707576..83a7208 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1730,6 +1730,7 @@ Em.I18n.translations = {
   'admin.stackVersions.version.upgrade.upgradeOptions.RU.title': "Rolling Upgrade",
   '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.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',

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index f24f355..df2d054 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -160,6 +160,9 @@ table.diff {
 
 .ru-badge {
   text-align: center;
+  a:hover {
+    text-decoration: none;
+  }
   .upgrade-in-progress {
     text-shadow: none;
     background-color: #006DCC;

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/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 9d4190a..b183303 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -192,6 +192,9 @@
         color: #0088cc;
         font-size: 16px;
       }
+      i[disabled='disabled'] {
+        color: inherit;
+      }
       .label {
         padding: 5px 20px;
         font-size: 14px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/ambari-web/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs
index 669daa7..2831a80 100644
--- a/ambari-web/app/templates/application.hbs
+++ b/ambari-web/app/templates/application.hbs
@@ -129,11 +129,11 @@
   <div class="container main-container">
     <div id="content">
       {{#if App.wizardIsNotFinished}}
-        <div class="ru-badge col-md-12">
+        <div class="ru-badge">
           <div class="clearfix">
-            <div class="col-md-11">
+            <div class="row">
               {{#if isExistingClusterDataLoaded}}
-                <p class="col-md-4 col-md-offset-4">
+                <p class="col-md-10 col-md-offset-2">
                   {{#if App.router.wizardWatcherController.isNonWizardUser}}
                     <span class="label upgrade-in-progress">
                       <i class="glyphicon glyphicon-cog"></i>&nbsp;{{App.router.wizardWatcherController.wizardDisplayName}}
@@ -149,7 +149,7 @@
                   {{/if}}
                 </p>
                 {{#if App.router.mainAdminStackAndUpgradeController.isFinalizeItem}}
-                  <p class="col-md-10 alert alert-danger">{{t admin.stackVersions.version.upgrade.notFinalized.warning}}</p>
+                  <p class="col-md-10 col-md-offset-2 alert alert-danger">{{t admin.stackVersions.version.upgrade.notFinalized.warning}}</p>
                 {{/if}}
               {{/if}}
             </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
index cb91bd7..13dca9a 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
@@ -69,9 +69,10 @@
   {{/if}}
   {{#if view.stateElement.isLink}}
     {{#if view.stateElement.iconClass}}
-      <i {{bindAttr class="view.stateElement.iconClass"}}></i>
+      <i {{bindAttr class="view.stateElement.iconClass" disabled="view.stateElement.isDisabled"}}></i>
     {{/if}}
-    <a href="#" {{action runAction target="view"}}>{{view.stateElement.text}}</a>
+    <a href="#" {{action runAction target="view"}}
+        {{bindAttr disabled="view.stateElement.isDisabled"}}>{{view.stateElement.text}}</a>
     {{#if view.stateElement.isInstalling}}
       {{view App.ProgressBarView
         progressBinding="view.installProgress"

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
index b7477ca..7cd9ffb 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
@@ -61,9 +61,10 @@
   {{/if}}
   {{#if view.stateElement.isLink}}
     {{#if view.stateElement.iconClass}}
-        <i {{bindAttr class="view.stateElement.iconClass"}}></i>
+      <i {{bindAttr class="view.stateElement.iconClass" disabled="view.stateElement.isDisabled"}}></i>
     {{/if}}
-      <a href="#" {{action runAction target="view"}}>{{view.stateElement.text}}</a>
+    <a href="#" {{action runAction target="view"}}
+        {{bindAttr disabled="view.stateElement.isDisabled"}}>{{view.stateElement.text}}</a>
     {{#if view.stateElement.isInstalling}}
       {{view App.ProgressBarView
           progressBinding="view.installProgress"

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/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 ebcd423..3508feb 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
@@ -226,6 +226,10 @@ App.UpgradeVersionBoxView = Em.View.extend({
       element.set('text', this.get('isVersionColumnView') ? Em.I18n.t('common.resume'): text);
       element.set('isDisabled', this.get('controller.requestInProgress'));
     }
+    //For restricted upgrade wizard should be disabled in any state
+    if (this.get('controller.isWizardRestricted')) {
+      element.set('isDisabled', true);
+    }
     return element;
   }.property(
     'content.status',

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/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 21def14..e83ae2c 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
@@ -365,11 +365,25 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       expect(App.router.transitionTo.called).to.be.false;
     });
 
+    it('should not open dialog, isWizardRestricted=true', function () {
+      this.mockAuthorized.returns(true);
+      controller.set('isWizardRestricted', true);
+      controller.openUpgradeDialog();
+      expect(App.router.transitionTo.called).to.be.false;
+    });
+
     it('upgradeSuspended should not receive value', function () {
       this.mockAuthorized.returns(false);
       controller.openUpgradeDialog();
       expect(mock.observer.called).to.be.false;
     });
+
+    it('upgradeSuspended should not receive value, isWizardRestricted=true', function ()
{
+      this.mockAuthorized.returns(true);
+      controller.set('isWizardRestricted', true);
+      controller.openUpgradeDialog();
+      expect(mock.observer.called).to.be.false;
+    });
   });
 
   describe("#runPreUpgradeCheck()", function() {
@@ -1791,6 +1805,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         isDowngrade: false,
         upgradeState: 'PENDING',
         upgradeType: "ROLLING",
+        isWizardRestricted: false,
         downgradeAllowed: true,
         upgradeTypeDisplayName: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.RU.title'),
         failuresTolerance: Em.Object.create({
@@ -3053,6 +3068,22 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       App.clusterStatus.setClusterStatus.restore();
     });
 
+    it("setDBProperties should be called", function() {
+      controller.finish();
+      expect(controller.setDBProperties.calledWith({
+        upgradeId: undefined,
+        upgradeState: 'INIT',
+        upgradeVersion: undefined,
+        currentVersion: undefined,
+        upgradeTypeDisplayName: undefined,
+        upgradeType: undefined,
+        isWizardRestricted: false,
+        failuresTolerance: undefined,
+        isDowngrade: undefined,
+        downgradeAllowed: undefined
+      })).to.be.true;
+    });
+
     it("App.clusterStatus.setClusterStatus should be called", function() {
       controller.finish();
       expect(App.clusterStatus.setClusterStatus.calledOnce).to.be.true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/be6cd59a/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 c64e5af..8087c67 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
@@ -707,6 +707,28 @@ describe('App.UpgradeVersionBoxView', function () {
           'isUpgrading': true,
           'controller.isDowngrade': false,
           'controller.upgradeVersion': 'HDP-2.2.1',
+          'controller.isWizardRestricted': true,
+          'content.displayName': 'HDP-2.2.1'
+        },
+        setup: function () {
+          this.getMock.withArgs('upgradeState').returns('HOLDING');
+        },
+        expected: {
+          isDisabled: true,
+          status: 'UPGRADING',
+          isLink: true,
+          action: 'openUpgradeDialog',
+          iconClass: 'glyphicon glyphicon-pause',
+          text: Em.I18n.t('admin.stackVersions.version.upgrade.pause')
+        },
+        title: 'upgrading, holding, isWizardRestricted=true'
+      },
+      {
+        inputData: {
+          'content.status': 'UPGRADING',
+          'isUpgrading': true,
+          'controller.isDowngrade': false,
+          'controller.upgradeVersion': 'HDP-2.2.1',
           'content.displayName': 'HDP-2.2.1'
         },
         setup: function () {


Mime
View raw message