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-22133. Repositories With No Components On Them Are Shown as Upgradeable (alexantonenko)
Date Wed, 04 Oct 2017 18:21:19 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 02a37f546 -> 41c63fb6f


AMBARI-22133. Repositories With No Components On Them Are Shown as Upgradeable (alexantonenko)


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

Branch: refs/heads/branch-2.6
Commit: 41c63fb6fde7b2960a52d993d7d4172162ec350a
Parents: 02a37f5
Author: Alex Antonenko <aantonenko@hortonworks.com>
Authored: Wed Oct 4 21:21:06 2017 +0300
Committer: Alex Antonenko <aantonenko@hortonworks.com>
Committed: Wed Oct 4 21:21:06 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/styles/stack_versions.less       |  2 +-
 .../stack_upgrade/upgrade_version_column.hbs    |  2 +-
 .../stack_upgrade/upgrade_version_box_view.js   | 42 +++++++++----
 .../upgrade_version_column_view.js              |  2 +-
 .../upgrade_version_box_view_test.js            | 66 +++++++++++++-------
 5 files changed, 75 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/41c63fb6/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 a6004cf..c03f5ff 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -443,7 +443,7 @@
     .icon-info-sign {
       color: @blue;
     }
-    .icon-medkit, .icon-bug {
+    .icon-wrench, .icon-bug {
       color: @gray;
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/41c63fb6/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 dc7b712..0bff3b5 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
@@ -102,7 +102,7 @@
       <i class="icon-bug" aria-hidden="true"></i>
     {{/if}}
     {{#if view.content.isMaint}}
-      <i class="icon-medkit" aria-hidden="true"></i>
+      <i class="icon-wrench" aria-hidden="true"></i>
     {{/if}}
     <span>{{view.content.displayName}}</span>
   {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/41c63fb6/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 63f5b35..95bdcc0 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
@@ -269,28 +269,44 @@ App.UpgradeVersionBoxView = Em.View.extend({
           break;
         default:
           var isVersionColumnView = this.get('isVersionColumnView');
-          element.set('isButtonGroup', true);
-          element.set('text', isVersionColumnView ? Em.I18n.t('common.upgrade') : Em.I18n.t('admin.stackVersions.version.performUpgrade'));
-          element.set('action', 'confirmUpgrade');
-          element.get('buttons').pushObject({
-            text: isVersionColumnView ? Em.I18n.t('common.reinstall') : Em.I18n.t('admin.stackVersions.version.reinstall'),
-            action: 'installRepoVersionPopup',
-            isDisabled: isDisabled
+          var stackServices = this.get('content.stackServices');
+          var isUpgradable = stackServices && stackServices.some( function(stackService){
+              return stackService.get('isUpgradable');
           });
+          var isPatch = this.get('content.isPatch');
+          var isMaint = this.get('content.isMaint');
 
-          element.get('buttons').pushObject({
-            text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
-            action: 'showUpgradeOptions',
-            isDisabled: isDisabled
-          });
+          element.set('isButtonGroup', true);
+          if (isUpgradable){
+            element.set('text', isVersionColumnView ? Em.I18n.t('common.upgrade') : Em.I18n.t('admin.stackVersions.version.performUpgrade'));
+            element.set('action', 'confirmUpgrade');
+            element.get('buttons').pushObject({
+              text: isVersionColumnView ? Em.I18n.t('common.reinstall') : Em.I18n.t('admin.stackVersions.version.reinstall'),
+              action: 'installRepoVersionPopup',
+              isDisabled: isDisabled
+            });
 
-          if (this.get('content.isPatch') || this.get('content.isMaint')) {
+            element.get('buttons').pushObject({
+              text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
+              action: 'showUpgradeOptions',
+              isDisabled: isDisabled
+            });
+          }
+          else{
+            element.set('iconClass', 'icon-ok');
+            element.set('text', Em.I18n.t('common.installed'))
+          }
+
+          if ( isPatch || isMaint ) {
             element.get('buttons').pushObject({
               text: Em.I18n.t('common.hide'),
               action: 'confirmDiscardRepoVersion',
               isDisabled: isDisabled
             });
           }
+
+
+
           this.addRemoveIopSelectButton(element, isDisabled);
       }
       element.set('isDisabled', isDisabled);

http://git-wip-us.apache.org/repos/asf/ambari/blob/41c63fb6/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
index df5240f..7e23720 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
@@ -28,7 +28,7 @@ App.UpgradeVersionColumnView = App.UpgradeVersionBoxView.extend({
     App.tooltip($('.out-of-sync-badge'), {title: Em.I18n.t('hosts.host.stackVersions.status.out_of_sync')});
     App.tooltip($('.not-upgradable'), {title: Em.I18n.t('admin.stackVersions.version.service.notUpgradable')});
     App.tooltip($('.icon-bug'), {title: Em.I18n.t('common.patch')});
-    App.tooltip($('.icon-medkit'), {title: Em.I18n.t('common.maint')});
+    App.tooltip($('.icon-wrench'), {title: Em.I18n.t('common.maint')});
     if (!this.get('content.isCompatible')) {
       App.tooltip(this.$(".repo-version-tooltip"), {
         title: Em.I18n.t('admin.stackVersions.version.noCompatible.tooltip')

http://git-wip-us.apache.org/repos/asf/ambari/blob/41c63fb6/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 3623a53..4469222 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
@@ -356,7 +356,8 @@ describe('App.UpgradeVersionBoxView', function () {
 
   describe('#stateElement', function () {
     beforeEach(function () {
-      view.set('content.stackVersion', Em.Object.create({supportsRevert: false}))
+      view.set('content.stackVersion', Em.Object.create({supportsRevert: false}));
+      view.set('content.stackServices', [Em.Object.create({isUpgradable: true})])
     });
 
     var cases = [
@@ -606,6 +607,7 @@ describe('App.UpgradeVersionBoxView', function () {
       {
         inputData: {
           'content.status': 'INSTALLED',
+          'content.stackServices': [Em.Object.create({isUpgradable:true})],
           'controller.requestInProgress': true,
           'content.isPatch': true,
           'parentView.repoVersions': [
@@ -632,15 +634,16 @@ describe('App.UpgradeVersionBoxView', function () {
           isButtonGroup: true,
           buttons: [
             {
-              text: Em.I18n.t('admin.stackVersions.version.reinstall'),
-              action: 'installRepoVersionPopup',
-              isDisabled: true
+              "action": "installRepoVersionPopup",
+              "isDisabled": true,
+              "text": "Reinstall Packages",
             },
             {
-              text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
-              action: 'showUpgradeOptions',
-              isDisabled: true
+              "action": "showUpgradeOptions",
+              "isDisabled": true,
+              "text": "Pre-Upgrade Check"
             },
+
             {
               "action": "confirmDiscardRepoVersion",
               "isDisabled": true,
@@ -1367,7 +1370,34 @@ describe('App.UpgradeVersionBoxView', function () {
       })));
     });
 
-    it('version higher than current and in INSTALLED state', function() {
+    it('version higher than current and in INSTALLED state hasnt services andis not patch
or maint', function() {
+      view.set('controller', Em.Object.create({
+        currentVersion: Em.Object.create({
+          repository_version: '2.0',
+          stack_name: 'HDP'
+        })
+      }));
+      view.set('content', Em.Object.create({
+        status: 'INSTALLED',
+        repositoryVersion: '2.1',
+        stackVersionType: 'HDP',
+        isPatch: false
+      }));
+      var element = Em.Object.create({
+        buttons: []
+      });
+      view.processPreUpgradeState(element);
+      expect(JSON.stringify(element)).to.be.equal(JSON.stringify(Em.Object.create({
+        "buttons": [],
+        "isButtonGroup": true,
+        'iconClass': 'icon-ok',
+        "text": Em.I18n.t('common.installed'),
+        "isDisabled": false
+      })));
+      expect(view.addRemoveIopSelectButton.calledOnce).to.be.true;
+    });
+
+    it('version higher than current and in INSTALLED state hasnt services ant is patch',
function() {
       view.set('controller', Em.Object.create({
         currentVersion: Em.Object.create({
           repository_version: '2.0',
@@ -1387,24 +1417,14 @@ describe('App.UpgradeVersionBoxView', function () {
       expect(JSON.stringify(element)).to.be.equal(JSON.stringify(Em.Object.create({
         "buttons": [
           {
-            "text": Em.I18n.t('admin.stackVersions.version.reinstall'),
-            "action": "installRepoVersionPopup",
-            "isDisabled": false
-          },
-          {
-            text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
-            action: 'showUpgradeOptions',
-            isDisabled: false
-          },
-          {
-            "text": Em.I18n.t('common.hide'),
-            "action": "confirmDiscardRepoVersion",
-            "isDisabled": false
+           "text":Em.I18n.t('common.hide'),
+           "action":"confirmDiscardRepoVersion",
+           "isDisabled":false
           }
         ],
         "isButtonGroup": true,
-        "text": Em.I18n.t('admin.stackVersions.version.performUpgrade'),
-        "action": 'confirmUpgrade',
+        'iconClass': 'icon-ok',
+        "text": Em.I18n.t('common.installed'),
         "isDisabled": false
       })));
       expect(view.addRemoveIopSelectButton.calledOnce).to.be.true;


Mime
View raw message