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/0bd85d75 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0bd85d75 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0bd85d75 Branch: refs/heads/feature-branch-AMBARI-21307 Commit: 0bd85d754512f220be307b0baa6e7f26d208d45a Parents: 2a57959 Author: Alex Antonenko <aantone...@hortonworks.com> Authored: Mon Aug 28 16:53:25 2017 +0300 Committer: Alex Antonenko <aantone...@hortonworks.com> Committed: Mon Aug 28 16:53:25 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/0bd85d75/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index ba80702..28569c9 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1795,6 +1795,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/0bd85d75/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/0bd85d75/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 719cd96..1831a30 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 @@ -87,16 +87,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') @@ -437,11 +440,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/0bd85d75/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 60364ec..0c4408d 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 @@ -54,9 +54,9 @@ 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(), /** @@ -98,6 +98,26 @@ App.UpgradeVersionColumnView = App.UpgradeVersionBoxView.extend({ }, /** + * @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) {