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/f59305e3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f59305e3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f59305e3 Branch: refs/heads/feature-branch-AMBARI-21307 Commit: f59305e387b561f7903b4ec6e1729b300021af54 Parents: 8e64bac Author: Andrii Tkach <atk...@apache.org> Authored: Fri Aug 25 18:39:26 2017 +0300 Committer: Andrii Tkach <atk...@apache.org> Committed: Fri Aug 25 18:39:26 2017 +0300 ---------------------------------------------------------------------- .../main/admin/stack_and_upgrade_controller.js | 24 ++++++++++++--- ambari-web/app/messages.js | 1 + ambari-web/app/styles/stack_versions.less | 13 ++++++++ .../modal_popups/install_repo_confirmation.hbs | 32 ++++++++++++++++++++ .../admin/stack_and_upgrade_controller_test.js | 2 +- 5 files changed, 67 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f59305e3/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 61fa348..7ef779d 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 @@ -1474,11 +1474,27 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage, */ installRepoVersionConfirmation: function (repo) { var self = this; - return App.showConfirmationPopup(function () { + 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: bodyContent.format(repo.get('displayName')), + skipDependencyCheck: false, + bodyClass: Em.View.extend({ + classNames: ['install-repo-confirmation'], + content: availableServices, + isPatch: repo.get('isPatch'), + templateName: require('templates/common/modal_popups/install_repo_confirmation') + }), + onPrimary: function () { self.installRepoVersion(repo); - }, - Em.I18n.t('admin.stackVersions.version.install.confirm').format(repo.get('displayName')) - ); + this._super(); + } + }); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/f59305e3/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 87a5e97..a24bd7f 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1729,6 +1729,7 @@ Em.I18n.translations = { 'admin.stackVersions.editRepositories.info': 'Provide Base URLs for the Operating Systems you are configuring.', '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.linkTooltip': 'Click to Edit Repositories', 'admin.stackVersions.version.hostsTooltip': 'Click to List Hosts', 'admin.stackVersions.version.emptyHostsTooltip': 'No Hosts to List', http://git-wip-us.apache.org/repos/asf/ambari/blob/f59305e3/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 746f9d2..d584aa6 100644 --- a/ambari-web/app/styles/stack_versions.less +++ b/ambari-web/app/styles/stack_versions.less @@ -360,6 +360,19 @@ } } +.install-repo-confirmation { + .available-services-list { + margin: 10px 0 30px; + .service-version-info { + text-align: left; + margin-bottom: 20px; + .col-md-1 { + width: 90px; + } + } + } +} + #stack-upgrade-dialog, #stack-upgrade-record-dialog { .row { http://git-wip-us.apache.org/repos/asf/ambari/blob/f59305e3/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 new file mode 100644 index 0000000..9bb9533 --- /dev/null +++ b/ambari-web/app/templates/common/modal_popups/install_repo_confirmation.hbs @@ -0,0 +1,32 @@ +{{! +* 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. +}} +<p>{{{popupBody}}}</p> +{{#if view.isPatch}} + <div class="available-services-list"> + {{#each service in view.content}} + <p class="service-version-info"> + <span class="col-md-1"> + {{service.displayName}} + </span> + <span class="label available"> + {{service.latestVersion}} + </span> + </p> + {{/each}} + </div> +{{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/f59305e3/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 e2e3a06..8c6f690 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 @@ -1175,7 +1175,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;