This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 7df55ee  AMBARI-23345 Installer Wizard: Add a Cancel button to go back 
to Admin View.
7df55ee is described below

commit 7df55eec8e5b41dbaac2341c40a4ed31eb5b56c8
Author: Andrii Tkach <[email protected]>
AuthorDate: Fri Mar 23 17:52:39 2018 +0200

    AMBARI-23345 Installer Wizard: Add a Cancel button to go back to Admin View.
---
 ambari-web/app/controllers/installer.js            |  8 ++++
 .../app/controllers/wizard/step2_controller.js     |  2 +
 ambari-web/app/messages.js                         |  1 +
 ambari-web/app/routes/installer.js                 |  6 +++
 ambari-web/app/styles/stack_versions.less          | 12 ------
 ambari-web/app/styles/wizard.less                  | 13 +++++-
 ambari-web/app/templates.js                        |  1 +
 .../templates/common/assign_master_components.hbs  |  1 +
 .../templates/wizard/installer_cancel_button.hbs   | 26 ++++++++++++
 ambari-web/app/templates/wizard/step0.hbs          |  1 +
 ambari-web/app/templates/wizard/step1.hbs          |  3 +-
 ambari-web/app/templates/wizard/step2.hbs          |  1 +
 ambari-web/app/templates/wizard/step3.hbs          |  1 +
 ambari-web/app/templates/wizard/step4.hbs          |  1 +
 ambari-web/app/templates/wizard/step6.hbs          |  3 +-
 .../templates/wizard/step7_with_category_tabs.hbs  |  3 +-
 ambari-web/app/templates/wizard/step8.hbs          |  1 +
 ambari-web/app/views/wizard/step1_view.js          | 48 ++++++++++++----------
 .../wizard/step3/hostWarningPopupBody_view.js      |  3 ++
 ambari-web/test/controllers/installer_test.js      | 18 ++++++++
 20 files changed, 114 insertions(+), 39 deletions(-)

diff --git a/ambari-web/app/controllers/installer.js 
b/ambari-web/app/controllers/installer.js
index 4aa57c3..0aa360c 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -29,6 +29,8 @@ App.InstallerController = 
App.WizardController.extend(App.Persist, {
 
   totalSteps: 11,
 
+  isInstallerWizard: true,
+
   content: Em.Object.create({
     cluster: null,
     installOptions: null,
@@ -128,6 +130,12 @@ App.InstallerController = 
App.WizardController.extend(App.Persist, {
     this.setDBProperty('hosts', dbHosts);
   },
 
+  cancelInstall: function() {
+    return App.showConfirmationPopup(() => {
+      App.router.get('applicationController').goToAdminView();
+    });
+  },
+
   /**
    * Load services data. Will be used at <code>Select services(step4)</code> 
step
    */
diff --git a/ambari-web/app/controllers/wizard/step2_controller.js 
b/ambari-web/app/controllers/wizard/step2_controller.js
index 05813e2..832e49f 100644
--- a/ambari-web/app/controllers/wizard/step2_controller.js
+++ b/ambari-web/app/controllers/wizard/step2_controller.js
@@ -410,6 +410,8 @@ App.WizardStep2Controller = Em.Controller.extend({
     var self = this;
     return App.ModalPopup.show({
       header: Em.I18n.t('common.warning'),
+      primary: Em.I18n.t('common.continue'),
+      primaryClass: 'btn-warning',
       onPrimary: function () {
         this.hide();
         self.proceedNext(true);
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 9b30f8f..0c52e6a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -287,6 +287,7 @@ Em.I18n.translations = {
   'common.compare': 'Compare',
   'common.latest': 'Latest',
   'common.custom': 'Custom',
+  'common.continue': 'Continue',
   'common.continueAnyway': 'Continue Anyway',
   'common.property.undefined': "Undefined",
   'common.summary': "Summary",
diff --git a/ambari-web/app/routes/installer.js 
b/ambari-web/app/routes/installer.js
index f1f6659..2efc47b 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -92,9 +92,11 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
     connectOutlets: function (router) {
       console.time('step0 connectOutlets');
       var self = this;
+      var wizardStep0Controller = router.get('wizardStep0Controller');
       var controller = router.get('installerController');
       controller.setCurrentStep('0');
       controller.loadAllPriorSteps().done(function () {
+        wizardStep0Controller.set('wizardController', controller);
         controller.connectOutlet('wizardStep0', controller.get('content'));
         self.scrollTop();
         console.timeEnd('step0 connectOutlets');
@@ -187,8 +189,10 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
       router.setNavigationFlow('step2');
 
       var controller = router.get('installerController');
+      var wizardStep2Controller = router.get('wizardStep2Controller');
       controller.setCurrentStep('2');
       controller.loadAllPriorSteps().done(function () {
+        wizardStep2Controller.set('wizardController', controller);
         self.scrollTop();
         controller.connectOutlet('wizardStep2', controller.get('content'));
         console.timeEnd('step2 connectOutlets');
@@ -352,9 +356,11 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
       router.setNavigationFlow('step6');
 
       var controller = router.get('installerController');
+      var wizardStep6Controller = router.get('wizardStep6Controller');
       router.get('wizardStep6Controller').set('hosts', []);
       controller.setCurrentStep('6');
       controller.loadAllPriorSteps().done(function () {
+        wizardStep6Controller.set('wizardController', controller);
         controller.connectOutlet('wizardStep6', controller.get('content'));
         self.scrollTop();
         console.timeEnd('step6 connectOutlets');
diff --git a/ambari-web/app/styles/stack_versions.less 
b/ambari-web/app/styles/stack_versions.less
index 2311acd..b218141 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -770,18 +770,6 @@
   }
 }
 
-#skip-validation,
-#use-redhat {
-  .glyphicon-question-sign {
-    color: @blue;
-  }
-
-  .redhat-label {
-    padding-left: 0;
-    margin-left: -7px;
-  }
-}
-
 .upgrade-wizard-modal {
   .modal-body {
     position: static;
diff --git a/ambari-web/app/styles/wizard.less 
b/ambari-web/app/styles/wizard.less
index 4917aa7..97717ec 100644
--- a/ambari-web/app/styles/wizard.less
+++ b/ambari-web/app/styles/wizard.less
@@ -737,10 +737,19 @@
       width: 90%;
     }
     #skip-validation, #use-redhat {
+      .glyphicon-question-sign {
+        color: @blue;
+      }
+      .redhat-label {
+        vertical-align: super;
+        padding-left: 0;
+        margin-left: -5px;
+      }
+      .use-redhat-checkbox i {
+        vertical-align: super;
+      }
       label {
         color: #666;
-        font-weight: normal;
-        margin-top: -2px;
         &.disabled {
           opacity: 0.7;
         }
diff --git a/ambari-web/app/templates.js b/ambari-web/app/templates.js
index be19b6f..2f1af46 100644
--- a/ambari-web/app/templates.js
+++ b/ambari-web/app/templates.js
@@ -36,3 +36,4 @@ require('templates/common/configs/widgets/controls/edit');
 require('templates/common/configs/widgets/config_label');
 require('templates/common/configs/configs_comparison_row');
 require('templates/common/configs/configs_comparison_cell');
+require('templates/wizard/installer_cancel_button');
diff --git a/ambari-web/app/templates/common/assign_master_components.hbs 
b/ambari-web/app/templates/common/assign_master_components.hbs
index 7095742..f8db6e5 100644
--- a/ambari-web/app/templates/common/assign_master_components.hbs
+++ b/ambari-web/app/templates/common/assign_master_components.hbs
@@ -167,6 +167,7 @@
           {{/if}}
         </button>
       {{/if}}
+      {{template "templates/wizard/installer_cancel_button"}}
       <button {{QAAttr "wizard-next"}} type="button" class="btn btn-success 
pull-right" {{bindAttr disabled="nextButtonDisabled"}} {{action submit 
target="controller"}}>
         {{#if App.router.nextBtnClickInProgress}}
           {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
diff --git a/ambari-web/app/templates/wizard/installer_cancel_button.hbs 
b/ambari-web/app/templates/wizard/installer_cancel_button.hbs
new file mode 100644
index 0000000..ee30cc1
--- /dev/null
+++ b/ambari-web/app/templates/wizard/installer_cancel_button.hbs
@@ -0,0 +1,26 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+{{#if controller.wizardController.isInstallerWizard}}
+  <button type="button" class="btn btn-default pull-left"
+    {{bindAttr disabled="App.router.btnClickInProgress"}}
+    {{action cancelInstall target="App.router.installerController"}}
+    {{QAAttr "wizard-cancel"}}>
+    {{t common.cancel}}
+  </button>
+{{/if}}
diff --git a/ambari-web/app/templates/wizard/step0.hbs 
b/ambari-web/app/templates/wizard/step0.hbs
index e38e7f2..ecfe257 100644
--- a/ambari-web/app/templates/wizard/step0.hbs
+++ b/ambari-web/app/templates/wizard/step0.hbs
@@ -44,6 +44,7 @@
 </div>
 
 <div class="wizard-footer col-md-12 btn-area">
+  {{template "templates/wizard/installer_cancel_button"}}
   <button type="button" class="btn btn-success pull-right" {{QAAttr 
"wizard-next"}} {{bindAttr disabled="isSubmitDisabled"}} {{action "submit" 
target="controller"}}>
     {{#if App.router.nextBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
diff --git a/ambari-web/app/templates/wizard/step1.hbs 
b/ambari-web/app/templates/wizard/step1.hbs
index dad8511..d3bf376 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -218,7 +218,7 @@
                   {{#view view.redhatCheckBoxView
                   classNames="use-redhat-checkbox"
                   }}
-                    <label {{bindAttr for="view.checkboxId" 
class=":redhat-label :display-inline-block 
controller.selectedStack.usePublicRepo:disabled" 
data-original-title="view.redhatDisabledTooltip"}}>
+                    <label {{bindAttr for="view.checkboxId" 
class=":redhat-label :display-inline-block 
controller.selectedStack.usePublicRepo:disabled" 
data-original-title="view.parentView.redhatDisabledTooltip"}}>
                       {{t 
installer.step1.advancedRepo.useRedhatSatellite.message}}
                     </label>
                     <i class="glyphicon glyphicon-question-sign" 
rel="use-redhat-tooltip"
@@ -251,6 +251,7 @@
       {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
     {{/if}}
   </button>
+  {{template "templates/wizard/installer_cancel_button"}}
   <button type="button" class="btn btn-success pull-right" {{bindAttr 
disabled="view.isSubmitDisabled"}} {{action next}} {{QAAttr "wizard-next"}}>
     {{#if App.router.nextBtnClickInProgress}}
       {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
diff --git a/ambari-web/app/templates/wizard/step2.hbs 
b/ambari-web/app/templates/wizard/step2.hbs
index 167246a..cdf2ee2 100644
--- a/ambari-web/app/templates/wizard/step2.hbs
+++ b/ambari-web/app/templates/wizard/step2.hbs
@@ -203,6 +203,7 @@
         {{/if}}
       </button>
     {{/unless}}
+    {{template "templates/wizard/installer_cancel_button"}}
     <button class="btn btn-success pull-right" {{bindAttr 
disabled="isSubmitDisabled"}} {{action evaluateStep target="controller"}} 
{{QAAttr "wizard-next"}}>
       {{#if App.router.nextBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
diff --git a/ambari-web/app/templates/wizard/step3.hbs 
b/ambari-web/app/templates/wizard/step3.hbs
index 8d7fefe..6b32c6f 100644
--- a/ambari-web/app/templates/wizard/step3.hbs
+++ b/ambari-web/app/templates/wizard/step3.hbs
@@ -153,6 +153,7 @@
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
       {{/if}}
     </button>
+    {{template "templates/wizard/installer_cancel_button"}}
     <button type="button" class="btn btn-success pull-right" {{bindAttr 
disabled="isNextButtonDisabled"}} {{action submit target="controller"}} 
{{QAAttr "wizard-next"}}>
       {{#if App.router.nextBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
diff --git a/ambari-web/app/templates/wizard/step4.hbs 
b/ambari-web/app/templates/wizard/step4.hbs
index 68db717..1e2b329 100644
--- a/ambari-web/app/templates/wizard/step4.hbs
+++ b/ambari-web/app/templates/wizard/step4.hbs
@@ -105,6 +105,7 @@
         {{/if}}
       </button>
     {{/unless}}
+    {{template "templates/wizard/installer_cancel_button"}}
     <button type="button" {{QAAttr "wizard-next"}} class="btn btn-success 
pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action submit 
target="controller"}}>
       {{#if App.router.nextBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
diff --git a/ambari-web/app/templates/wizard/step6.hbs 
b/ambari-web/app/templates/wizard/step6.hbs
index 3f2d888..8071e10 100644
--- a/ambari-web/app/templates/wizard/step6.hbs
+++ b/ambari-web/app/templates/wizard/step6.hbs
@@ -115,12 +115,13 @@
 
 <div class="wizard-footer col-md-12">
   <div class="btn-area">
-    <button type="button" {{QAAttr "wizard-back"}} class="btn btn-default 
installer-back-btn" {{bindAttr disabled="App.router.btnClickInProgress"}} 
{{action back}}>
+    <button type="button" {{QAAttr "wizard-back"}} class="btn btn-default 
installer-back-btn pull-left" {{bindAttr 
disabled="App.router.btnClickInProgress"}} {{action back}}>
       &larr; {{t common.back}}
       {{#if App.router.backBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
       {{/if}}
     </button>
+    {{template "templates/wizard/installer_cancel_button"}}
     <button type="button" {{QAAttr "wizard-next"}} class="btn btn-success 
pull-right" {{bindAttr disabled="submitDisabled"}} {{action next}}>
       {{#if App.router.nextBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
diff --git a/ambari-web/app/templates/wizard/step7_with_category_tabs.hbs 
b/ambari-web/app/templates/wizard/step7_with_category_tabs.hbs
index d72333b..14c43a1 100644
--- a/ambari-web/app/templates/wizard/step7_with_category_tabs.hbs
+++ b/ambari-web/app/templates/wizard/step7_with_category_tabs.hbs
@@ -50,12 +50,13 @@
 
 <div class="wizard-footer col-md-12">
   <div class="btn-area">
-    <button type="button" {{QAAttr "wizard-back"}} class="btn btn-default 
installer-back-btn" {{bindAttr disabled="App.router.btnClickInProgress"}} 
{{action back target="controller"}}>
+    <button type="button" {{QAAttr "wizard-back"}} class="btn btn-default 
installer-back-btn pull-left" {{bindAttr 
disabled="App.router.btnClickInProgress"}} {{action back target="controller"}}>
       &larr; {{t common.back}}
       {{#if App.router.backBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
       {{/if}}
     </button>
+    {{template "templates/wizard/installer_cancel_button"}}
     <div class="pull-right">
       {{#if App.supports.preInstallChecks}}
         <a class="btn btn-default" {{action runPreInstallChecks 
target="App.router.preInstallChecksController"}} {{bindAttr 
disabled="isSubmitDisabled"}}><i class="glyphicon glyphicon-exclamation"></i> 
{{t installer.step7.preInstallChecks}}</a>
diff --git a/ambari-web/app/templates/wizard/step8.hbs 
b/ambari-web/app/templates/wizard/step8.hbs
index 1058bc3..00a97fe 100644
--- a/ambari-web/app/templates/wizard/step8.hbs
+++ b/ambari-web/app/templates/wizard/step8.hbs
@@ -90,6 +90,7 @@
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
       {{/if}}
     </button>
+    {{template "templates/wizard/installer_cancel_button"}}
     <button type="button" {{QAAttr "wizard-next"}} class="btn btn-success 
pull-right"
        id="spinner" {{bindAttr disabled="controller.isSubmitDisabled"}} 
{{action submit target="controller"}}>
       {{#if App.router.nextBtnClickInProgress}}
diff --git a/ambari-web/app/views/wizard/step1_view.js 
b/ambari-web/app/views/wizard/step1_view.js
index 9870079..71ee8d5 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -23,29 +23,33 @@ App.WizardStep1View = Em.View.extend({
 
   templateName: require('templates/wizard/step1'),
 
-  didInsertElement: function () {
-    $("[rel=skip-validation-tooltip]").tooltip({ placement: 'right'});
-    $("[rel=use-redhat-tooltip]").tooltip({ placement: 'right'});
-    $('.add-os-button,.redhat-label').tooltip();
-    this.$().on('mouseover', '.version-contents-body .table-hover > tbody > 
tr', function () {
-      App.tooltip($(this).find('.action .icon'), {placement: 'bottom'});
-      App.tooltip($(this).find('.icon-undo'), {placement: 'bottom'});
-    });
-    if (this.get('controller.selectedStack.showAvailable')) {
-      // first time load
-      if (this.get('controller.selectedStack.useRedhatSatellite')) {
-        // restore `use local repo` on page refresh
-        this.get('controller').useLocalRepo();
-      }
-    } else {
-      var selected = this.get('controller.content.stacks') && 
this.get('controller.content.stacks').findProperty('showAvailable');
-      if (!selected) {
-        // network disconnection
-        Em.trySet(this, 'controller.selectedStack.useLocalRepo', true);
-        Em.trySet(this, 'controller.selectedStack.usePublicRepo', false);
-      }
+  initView: function () {
+    if (this.get('controller.isLoadingComplete') && this.get('state') === 
'inDOM') {
+      Em.run.next(() => {
+        $("[rel=skip-validation-tooltip]").tooltip({ placement: 'right'});
+        $("[rel=use-redhat-tooltip]").tooltip({ placement: 'right'});
+        $('.add-os-button,.redhat-label').tooltip();
+        this.$().on('mouseover', '.version-contents-body .table-hover > tbody 
> tr', function () {
+          App.tooltip($(this).find('.action .icon'), {placement: 'bottom'});
+          App.tooltip($(this).find('.icon-undo'), {placement: 'bottom'});
+        });
+        if (this.get('controller.selectedStack.showAvailable')) {
+          // first time load
+          if (this.get('controller.selectedStack.useRedhatSatellite')) {
+            // restore `use local repo` on page refresh
+            this.get('controller').useLocalRepo();
+          }
+        } else {
+          var selected = this.get('controller.content.stacks') && 
this.get('controller.content.stacks').findProperty('showAvailable');
+          if (!selected) {
+            // network disconnection
+            Em.trySet(this, 'controller.selectedStack.useLocalRepo', true);
+            Em.trySet(this, 'controller.selectedStack.usePublicRepo', false);
+          }
+        }
+      });
     }
-  },
+  }.observes('controller.isLoadingComplete'),
 
   willDestroyElement: function () {
     $("[rel=skip-validation-tooltip]").tooltip('destroy');
diff --git a/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js 
b/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
index 786c4f7..e405e6d 100644
--- a/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
+++ b/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
@@ -284,6 +284,9 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         }
       });
     });
+    warningsArray.sort((a, b) => {
+      return b.warnings.length - a.warnings.length;
+    });
     return warningsArray;
   }.property('category', 'warningsByHost', 
'bodyController.jdkCategoryWarnings', 'bodyController.repoCategoryWarnings', 
'bodyController.diskCategoryWarnings', 'bodyController.hostCheckWarnings',  
'bodyController.thpCategoryWarnings'),
 
diff --git a/ambari-web/test/controllers/installer_test.js 
b/ambari-web/test/controllers/installer_test.js
index 3831c79..62b7bba 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -67,6 +67,24 @@ describe('App.InstallerController', function () {
     });
   });
 
+  describe('#cancelInstall', function() {
+    var mock = {
+      goToAdminView: sinon.spy()
+    };
+    beforeEach(function() {
+      sinon.stub(App.router, 'get').returns(mock);
+    });
+    afterEach(function() {
+      App.router.get.restore();
+    });
+
+    it('goToAdminView should be called', function() {
+      var popup = installerController.cancelInstall();
+      popup.onPrimary();
+      expect(mock.goToAdminView.calledOnce).to.be.true;
+    });
+  });
+
   describe('#checkRepoURL', function() {
     var stacks = Em.A([
       Em.Object.create({

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to