AMBARI-21615 Add confirmation when installing PATCH version. (atkach)

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

Branch: refs/heads/branch-2.6
Commit: 68cffbf3901ecc54a0c98a9eef6f3cf79f144245
Parents: eb28ec3
Author: Andrii Tkach <atk...@apache.org>
Authored: Mon Jul 31 16:00:10 2017 +0300
Committer: Andrii Tkach <atk...@apache.org>
Committed: Mon Jul 31 16:00:10 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 11 +++-
 ambari-web/app/messages.js                      |  1 +
 ambari-web/app/styles/stack_versions.less       | 57 ++++++++++----------
 .../modal_popups/install_repo_confirmation.hbs  | 14 +++++
 .../admin/stack_and_upgrade_controller_test.js  |  2 +-
 5 files changed, 54 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/68cffbf3/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 531c11e..c9f27d6 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
@@ -1426,11 +1426,20 @@ App.MainAdminStackAndUpgradeController = 
Em.Controller.extend(App.LocalStorage,
    */
   installRepoVersionConfirmation: function (repo) {
     var self = this;
+    var bodyContent = repo.get('isPatch')
+      ? Em.I18n.t('admin.stackVersions.version.install.patch.confirm')
+      : Em.I18n.t('admin.stackVersions.version.install.confirm');
+    var availableServices = repo.get('stackServices').filter(function(service) 
{
+      return App.Service.find(service.get('name')).get('isLoaded') && 
service.get('isAvailable');
+    }, this);
     return App.ModalPopup.show({
       header: Em.I18n.t('popup.confirmation.commonHeader'),
-      popupBody: 
Em.I18n.t('admin.stackVersions.version.install.confirm').format(repo.get('displayName')),
+      popupBody: bodyContent.format(repo.get('displayName')),
       skipDependencyCheck: false,
       bodyClass: Em.View.extend({
+        classNames: ['install-repo-confirmation'],
+        content: availableServices,
+        isPatch: repo.get('isPatch'),
         didInsertElement: function () {
           App.tooltip($('[rel="skip-dep-check"]'), {
             placement: "top",

http://git-wip-us.apache.org/repos/asf/ambari/blob/68cffbf3/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index fc2d4f3..210bc8a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1702,6 +1702,7 @@ Em.I18n.translations = {
   'admin.stackVersions.editRepositories.info': 'Provide Base URLs for the 
Operating Systems you are configuring. Uncheck all other Operating Systems.',
   'admin.stackVersions.editRepositories.validation.warning': 'Some of the 
repositories failed validation. Make changes to the base url or skip validation 
if you are sure that urls are correct',
   'admin.stackVersions.version.install.confirm': 'You are about to install 
packages for version <strong>{0}</strong> on all hosts.',
+  'admin.stackVersions.version.install.patch.confirm': 'You are about to 
install packages for version <strong>{0}</strong> on all hosts for the 
following services:',
   'admin.stackVersions.version.install.skipDependencies': 'Skip Dependency 
Check',
   'admin.stackVersions.version.install.skipDependencies.tooltip': 'When 
selected, Ambari will not verify that all package dependencies have been 
satisfied after installing the new stack.',
   'admin.stackVersions.version.linkTooltip': 'Click to Edit Repositories',

http://git-wip-us.apache.org/repos/asf/ambari/blob/68cffbf3/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 d652899..7cf09c8 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -144,7 +144,8 @@
 }
 
 #stack-upgrade-page,
-.version-box-popup {
+.version-box-popup,
+.install-repo-confirmation {
   .versions-slides {
     overflow-x: auto;
     padding-bottom: 25px;
@@ -317,16 +318,6 @@
       width: 100%;
       text-align: center;
       padding-bottom: 4px;
-      .service-version-info {
-        margin-bottom: 14px;
-        text-align: center;
-        span.label {
-          padding: 5px 15px;
-          background-color: #a3a3a3;
-          z-index: 100;
-          position: relative;
-        }
-      }
       .line-separator, .line-separator-bottom{
         height: 2px;
         background: #e4e4e4;
@@ -341,24 +332,6 @@
       }
     }
   }
-  div.current-version-box.version-column {
-    .services-section{
-      .service-version-info {
-        span.label {
-          background-color: #468847;
-        }
-      }
-    }
-  }
-  div.version-column {
-    .services-section {
-      .service-version-info {
-        span.label.available {
-          background-color: #468847;
-        }
-      }
-    }
-  }
   .patch-upgrade-column {
     margin-left: -7px;
     border-color: @health-status-red;
@@ -372,6 +345,32 @@
       }
     }
   }
+  .service-version-info {
+    margin-bottom: 14px;
+    text-align: center;
+    span.label {
+      padding: 5px 15px;
+      background-color: #a3a3a3;
+      z-index: 100;
+      position: relative;
+    }
+    span.label.available {
+      background-color: #468847;
+    }
+  }
+}
+
+.install-repo-confirmation {
+  .available-services-list {
+    margin: 10px 0 30px;
+    .service-version-info {
+      text-align: left;
+      margin-bottom: 20px;
+      .span1 {
+        width: 90px;
+      }
+    }
+  }
 }
 
 #stack-upgrade-dialog {

http://git-wip-us.apache.org/repos/asf/ambari/blob/68cffbf3/ambari-web/app/templates/common/modal_popups/install_repo_confirmation.hbs
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/templates/common/modal_popups/install_repo_confirmation.hbs 
b/ambari-web/app/templates/common/modal_popups/install_repo_confirmation.hbs
index 13fd779..5c35021 100644
--- a/ambari-web/app/templates/common/modal_popups/install_repo_confirmation.hbs
+++ b/ambari-web/app/templates/common/modal_popups/install_repo_confirmation.hbs
@@ -16,6 +16,20 @@
 * limitations under the License.
 }}
 <p>{{{popupBody}}}</p>
+{{#if view.isPatch}}
+  <div class="available-services-list">
+      {{#each service in view.content}}
+          <p class="service-version-info">
+            <span class="span1">
+              {{service.displayName}}
+            </span>
+            <span class="label available">
+              {{service.latestVersion}}
+            </span>
+          </p>
+      {{/each}}
+  </div>
+{{/if}}
 <div class="row-fluid">
   <div class="tinyspan">
     {{view Ember.Checkbox classNames="align-checkbox" 
checkedBinding="skipDependencyCheck"}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/68cffbf3/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 fd90ae7..ea71b28 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
@@ -1199,7 +1199,7 @@ describe('App.MainAdminStackAndUpgradeController', 
function() {
       controller.installRepoVersion.restore();
     });
     it("show popup", function () {
-      var repo = Em.Object.create({'displayName': 'HDP-2.2'});
+      var repo = Em.Object.create({'displayName': 'HDP-2.2', stackServices: 
[]});
       var popup = controller.installRepoVersionConfirmation(repo);
       popup.onPrimary();
       expect(controller.installRepoVersion.calledWith(repo)).to.be.true;

Reply via email to