AMBARI-21682. Patched Service Doesn't Display Correct Hadoop Version on Stacks 
Page (alexantonenko)


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

Branch: refs/heads/branch-2.6
Commit: 8bf44f3d58d252ed21cd9da0595f9d96488cfefa
Parents: 053cfc9
Author: Alex Antonenko <hiv...@gmail.com>
Authored: Tue Aug 8 18:47:42 2017 +0300
Committer: Alex Antonenko <hiv...@gmail.com>
Committed: Tue Aug 8 18:47:42 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  1 +
 .../models/stack_version/repository_version.js  |  2 ++
 .../stack_upgrade/upgrade_version_box_view.js   |  8 ++++++-
 .../upgrade_version_column_view.js              | 24 ++++++++++++++++++--
 4 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8bf44f3d/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 10d2990..e4cb51a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1771,6 +1771,7 @@ Em.I18n.translations = {
   'admin.stackVersions.hosts.popup.header.not_installed': "Not installed",
   'admin.stackVersions.hosts.popup.header': "Version Status: {0}",
   'admin.stackVersions.hosts.popup.title': "{0} Version is {1} on {2} hosts:",
+  'admin.stackVersions.hosts.popup.current.title': "{0} is applied on {1} 
hosts:",
   'admin.stackVersions.hosts.popup.primary': "Go to Hosts",
 
   'admin.stackVersions.details.install.hosts.popup.title': "Install {0} 
version",

http://git-wip-us.apache.org/repos/asf/ambari/blob/8bf44f3d/ambari-web/app/models/stack_version/repository_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/repository_version.js 
b/ambari-web/app/models/stack_version/repository_version.js
index c0eddba..6a0a5f0 100644
--- a/ambari-web/app/models/stack_version/repository_version.js
+++ b/ambari-web/app/models/stack_version/repository_version.js
@@ -36,6 +36,8 @@ App.RepositoryVersion = DS.Model.extend({
 
   isPatch: Em.computed.equal('type', 'PATCH'),
 
+  isStandard: Em.computed.equal('type', 'STANDARD'),
+
   /**
    * status used until corresponding stack version get created
    * @type {string}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8bf44f3d/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 c48003e..11f50bb 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
@@ -85,16 +85,19 @@ App.UpgradeVersionBoxView = Em.View.extend({
    */
   versionStateMap: {
     'current': {
+      'type': 'CURRENT',
       'value': ['CURRENT'],
       'property': 'currentHosts',
       'label': Em.I18n.t('admin.stackVersions.hosts.popup.header.current')
     },
     'installed': {
+      'type': 'INSTALLED',
       'value': ['INSTALLED'],
       'property': 'installedHosts',
       'label': Em.I18n.t('admin.stackVersions.hosts.popup.header.installed')
     },
     'not_installed': {
+      'type': 'NOT_INSTALLED',
       'value': ['INSTALLING', 'INSTALL_FAILED', 'OUT_OF_SYNC'],
       'property': 'notInstalledHosts',
       'label': 
Em.I18n.t('admin.stackVersions.hosts.popup.header.not_installed')
@@ -453,11 +456,14 @@ App.UpgradeVersionBoxView = Em.View.extend({
     var displayName = this.get('content.displayName');
     var hosts = this.get(status['property']);
     var self = this;
+    var title = status.type === 'CURRENT'
+      ? 
Em.I18n.t('admin.stackVersions.hosts.popup.current.title').format(displayName, 
hosts.length)
+      : Em.I18n.t('admin.stackVersions.hosts.popup.title').format(displayName, 
status.label, hosts.length);
     hosts.sort();
     if (hosts.length) {
       return App.ModalPopup.show({
         bodyClass: Ember.View.extend({
-          title: 
Em.I18n.t('admin.stackVersions.hosts.popup.title').format(displayName, 
status.label, hosts.length),
+          title: title,
           hosts: hosts,
           template: Em.Handlebars.compile('<h4>{{view.title}}</h4><div 
class="limited-height-2">{{#each 
view.hosts}}<div>{{this}}</div>{{/each}}</div>')
         }),

http://git-wip-us.apache.org/repos/asf/ambari/blob/8bf44f3d/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 17dd1a3..b345a2d 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
@@ -59,12 +59,32 @@ App.UpgradeVersionColumnView = 
App.UpgradeVersionBoxView.extend({
         name: service.get('serviceName'),
         latestVersion: stackService ? stackService.get('latestVersion') : '',
         isVersionInvisible: !stackService,
-        isAvailable: stackService ? stackService.get('isAvailable') : false
+        isAvailable: this.isStackServiceAvailable(stackService)
       });
-    });
+    }, this);
   }.property(),
 
   /**
+   * @param {Em.Object} stackService
+   * @returns {boolean}
+   */
+  isStackServiceAvailable: function(stackService) {
+    var appliedPatchVersions = 
App.RepositoryVersion.find().filterProperty('isPatch').filterProperty('status', 
'CURRENT');
+    var appliedPatchServices = [];
+    appliedPatchVersions.forEach(function(version) {
+      var availableServices = 
version.get('stackServices').toArray().filterProperty('isAvailable').mapProperty('name');
+      appliedPatchServices = 
appliedPatchServices.concat(availableServices).uniq();
+    });
+    if (stackService) {
+      if (this.get('content.isStandard') && 
appliedPatchServices.contains(stackService.get('name'))) {
+        return false;
+      }
+      return stackService.get('isAvailable');
+    }
+    return false;
+  },
+
+  /**
    * on click handler for "show details" link
    */
   openVersionBoxPopup: function (event) {

Reply via email to