ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-21961. UI showing confirmation when no services will be installed (alexantonenko)
Date Thu, 14 Sep 2017 19:46:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 93da01877 -> 1694faa54


AMBARI-21961. UI showing confirmation when no services will be installed (alexantonenko)


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

Branch: refs/heads/branch-2.6
Commit: 1694faa547171811fe04fc539069e85821c2787c
Parents: 93da018
Author: Alex Antonenko <aantonenko@hortonworks.com>
Authored: Thu Sep 14 22:46:03 2017 +0300
Committer: Alex Antonenko <aantonenko@hortonworks.com>
Committed: Thu Sep 14 22:46:03 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js    | 11 +++++++----
 ambari-web/app/messages.js                        |  1 +
 .../stack_upgrade/upgrade_version_box_view.js     |  8 ++++----
 .../admin/stack_and_upgrade_controller_test.js    |  8 +++++---
 .../upgrade_version_box_view_test.js              | 18 +++++++++---------
 5 files changed, 26 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1694faa5/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 64f4e09..618abdb 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
@@ -1457,14 +1457,17 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
   /**
    * confirmation popup before install repository version
    */
-  installRepoVersionConfirmation: function (repo) {
+  installRepoVersionPopup: function (repo) {
+    var availableServices = repo.get('stackServices').filter(function(service) {
+      return App.Service.find(service.get('name')).get('isLoaded') && service.get('isAvailable')
&& service.get('isUpgradable');
+    }, this);
+    if (!availableServices.length){
+      return App.showAlertPopup( Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.title'),
Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.noAvailableServices').format(repo.get('displayName'))
);
+    }
     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')
&& service.get('isUpgradable');
-    }, this);
     return App.ModalPopup.show({
       header: Em.I18n.t('popup.confirmation.commonHeader'),
       popupBody: bodyContent.format(repo.get('displayName')),

http://git-wip-us.apache.org/repos/asf/ambari/blob/1694faa5/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 319aa61..3315b8a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1702,6 +1702,7 @@ Em.I18n.translations = {
   'admin.stackVersions.upgrade.start.fail.title':'Upgrade could not be started',
   'admin.stackVersions.upgrade.installPackage.fail.title':'Packages could not be installed',
   'admin.stackVersions.upgrade.installPackage.fail.timeout':'Request timed out.',
+  'admin.stackVersions.upgrade.installPackage.fail.noAvailableServices':"Version {0} does
not contain services that are installed.",
 
   'admin.stackVersions.upgrade.patch.revert.confirmation':'Are you sure you want to revert
the following services:',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1694faa5/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 5e6f69a..b07beb3 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
@@ -120,7 +120,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
     'NOT_REQUIRED': {
       isButton: true,
       text: Em.I18n.t('common.install'),
-      action: 'installRepoVersionConfirmation'
+      action: 'installRepoVersionPopup'
     },
     'LOADING': {
       isSpinner: true,
@@ -260,7 +260,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
         case 'OUT_OF_SYNC':
           element.set('isButtonGroup', true);
           element.set('text', this.get('isVersionColumnView') ? Em.I18n.t('common.reinstall')
: Em.I18n.t('admin.stackVersions.version.reinstall'));
-          element.set('action', 'installRepoVersionConfirmation');
+          element.set('action', 'installRepoVersionPopup');
           element.get('buttons').pushObject({
             text: this.get('isVersionColumnView') ? Em.I18n.t('common.upgrade') : Em.I18n.t('admin.stackVersions.version.performUpgrade'),
             action: 'confirmUpgrade',
@@ -270,7 +270,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
         case 'INSTALL_FAILED':
           element.set('isButton', true);
           element.set('text', this.get('isVersionColumnView') ? Em.I18n.t('common.reinstall')
: Em.I18n.t('admin.stackVersions.version.reinstall'));
-          element.set('action', 'installRepoVersionConfirmation');
+          element.set('action', 'installRepoVersionPopup');
           break;
         default:
           var isVersionColumnView = this.get('isVersionColumnView');
@@ -279,7 +279,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
           element.set('action', 'confirmUpgrade');
           element.get('buttons').pushObject({
             text: isVersionColumnView ? Em.I18n.t('common.reinstall') : Em.I18n.t('admin.stackVersions.version.reinstall'),
-            action: 'installRepoVersionConfirmation',
+            action: 'installRepoVersionPopup',
             isDisabled: isDisabled
           });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1694faa5/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 3c81dda..44e738b 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
@@ -1192,18 +1192,20 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     });
   });
 
-  describe("#installRepoVersionConfirmation()", function () {
+  describe("#installRepoVersionPopup()", function () {
     before(function () {
       sinon.stub(controller, 'installRepoVersion', Em.K);
+      sinon.stub(App.Service, 'find').returns({});
     });
     after(function () {
       controller.installRepoVersion.restore();
+      App.Service.find.restore();
     });
     it("show popup", function () {
       var repo = Em.Object.create({'displayName': 'HDP-2.2', stackServices: []});
-      var popup = controller.installRepoVersionConfirmation(repo);
+      var popup = controller.installRepoVersionPopup(repo);
       popup.onPrimary();
-      expect(controller.installRepoVersion.calledWith(repo)).to.be.true;
+      expect(controller.installRepoVersion.calledWith(repo)).to.be.false;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1694faa5/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 50beb48..d84e6cb 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
@@ -484,7 +484,7 @@ describe('App.UpgradeVersionBoxView', function () {
           status: 'INSTALL_FAILED',
           isButton: true,
           text: Em.I18n.t('admin.stackVersions.version.reinstall'),
-          action: 'installRepoVersionConfirmation',
+          action: 'installRepoVersionPopup',
         },
         title: 'INSTALL_FAILED state, no admin access, request in progress, another installation
running'
       },
@@ -515,7 +515,7 @@ describe('App.UpgradeVersionBoxView', function () {
           status: 'INSTALL_FAILED',
           isButton: true,
           text: Em.I18n.t('admin.stackVersions.version.reinstall'),
-          action: 'installRepoVersionConfirmation',
+          action: 'installRepoVersionPopup',
         },
         title: 'INSTALL_FAILED state, no admin access, no requests in progress, another installation
running'
       },
@@ -549,7 +549,7 @@ describe('App.UpgradeVersionBoxView', function () {
             isDisabled: false
           }],
           text: Em.I18n.t('admin.stackVersions.version.reinstall'),
-          action: 'installRepoVersionConfirmation',
+          action: 'installRepoVersionPopup',
           isDisabled: false
         },
         title: 'OUT_OF_SYNC state, admin access, no requests in progress, no installation'
@@ -582,7 +582,7 @@ describe('App.UpgradeVersionBoxView', function () {
             isDisabled: true
           }],
           text: Em.I18n.t('admin.stackVersions.version.reinstall'),
-          action: 'installRepoVersionConfirmation',
+          action: 'installRepoVersionPopup',
           isDisabled: true
         },
         title: 'OUT_OF_SYNC state, admin access, request in progress, no installation'
@@ -636,7 +636,7 @@ describe('App.UpgradeVersionBoxView', function () {
           buttons: [
             {
               text: Em.I18n.t('admin.stackVersions.version.reinstall'),
-              action: 'installRepoVersionConfirmation',
+              action: 'installRepoVersionPopup',
               isDisabled: true
             },
             {
@@ -682,7 +682,7 @@ describe('App.UpgradeVersionBoxView', function () {
           buttons: [
             {
               text: Em.I18n.t('admin.stackVersions.version.reinstall'),
-              action: 'installRepoVersionConfirmation',
+              action: 'installRepoVersionPopup',
               isDisabled: true
             },
             {
@@ -1371,7 +1371,7 @@ describe('App.UpgradeVersionBoxView', function () {
         ],
         "isButtonGroup": true,
         "text": Em.I18n.t('admin.stackVersions.version.reinstall'),
-        "action": 'installRepoVersionConfirmation',
+        "action": 'installRepoVersionPopup',
         "isDisabled": false
       })));
     });
@@ -1397,7 +1397,7 @@ describe('App.UpgradeVersionBoxView', function () {
         "buttons": [
           {
             "text": Em.I18n.t('admin.stackVersions.version.reinstall'),
-            "action": "installRepoVersionConfirmation",
+            "action": "installRepoVersionPopup",
             "isDisabled": false
           },
           {
@@ -1478,7 +1478,7 @@ describe('App.UpgradeVersionBoxView', function () {
         ],
         "isButton": false,
         "text": Em.I18n.t('common.install'),
-        "action": 'installRepoVersionConfirmation',
+        "action": 'installRepoVersionPopup',
         "isDisabled": false,
         "isButtonGroup": true
       })));


Mime
View raw message