Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21450 9232f35cb -> fad21fb52


AMBARI-21703. UI must consume API to show whether a service will be upgraded 
(alexantonenko)


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

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: fad21fb5261e05626a10003e06f21cb588018d7c
Parents: 9232f35
Author: Alex Antonenko <hiv...@gmail.com>
Authored: Thu Aug 10 16:59:42 2017 +0300
Committer: Alex Antonenko <hiv...@gmail.com>
Committed: Fri Aug 11 14:50:17 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/mappers/repository_version_mapper.js          | 3 ++-
 ambari-web/app/mappers/stack_version_mapper.js               | 5 ++++-
 ambari-web/app/messages.js                                   | 2 ++
 ambari-web/app/models/stack_version/service_simple.js        | 3 ++-
 ambari-web/app/styles/stack_versions.less                    | 8 ++++++++
 .../main/admin/stack_upgrade/upgrade_version_column.hbs      | 3 +++
 .../main/admin/stack_upgrade/upgrade_version_column_view.js  | 6 +++++-
 7 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fad21fb5/ambari-web/app/mappers/repository_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/repository_version_mapper.js 
b/ambari-web/app/mappers/repository_version_mapper.js
index 704b24e..3a0a80a 100644
--- a/ambari-web/app/mappers/repository_version_mapper.js
+++ b/ambari-web/app/mappers/repository_version_mapper.js
@@ -121,7 +121,8 @@ App.repoVersionMapper = App.QuickDataMapper.create({
                 name: service.name,
                 display_name: service.display_name,
                 latest_version: service.versions[0] ? service.versions[0] : '',
-                is_available: 
item[repoVersionsKey].services.someProperty('name', service.name)
+                is_available: 
item[repoVersionsKey].services.someProperty('name', service.name),
+                is_upgradable: json.stackServices[service.name] && 
json.stackServices[service.name].upgrade
               };
               resultService.push(serviceObj);
             }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fad21fb5/ambari-web/app/mappers/stack_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_version_mapper.js 
b/ambari-web/app/mappers/stack_version_mapper.js
index 62187b0..2b091a0 100644
--- a/ambari-web/app/mappers/stack_version_mapper.js
+++ b/ambari-web/app/mappers/stack_version_mapper.js
@@ -77,7 +77,10 @@ App.stackVersionMapper = App.QuickDataMapper.create({
 
         if (item.repository_versions && item.repository_versions[0]) {
           item.repository_versions[0].RepositoryVersions.stackVersionId = 
item.ClusterStackVersions.id;
-          App.repoVersionMapper.map({"items": item.repository_versions }, 
true, true);
+          App.repoVersionMapper.map({
+            "items": item.repository_versions,
+            "stackServices": 
item.ClusterStackVersions.repository_summary.services
+          }, true, true);
         }
         resultStack.push(this.parseIt(stack, this.get('modelStack')));
       }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fad21fb5/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 1e30536..219438e 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1735,6 +1735,8 @@ Em.I18n.translations = {
   'admin.stackDowngrade.state.paused.fail.header': "Pause Downgrade failed",
   'admin.stackDowngrade.state.paused.fail.body': "Downgrade could not be 
paused. Try again later.",
 
+  'admin.stackVersions.version.service.notUpgradable': "Update available, but 
already installed.",
+
   'admin.stackVersions.version.upgrade.upgradeOptions.header': "Upgrade 
Options",
   'admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.version': "You 
are about to perform an upgrade to <b>{0}</b>.",
   'admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.method': "Choose 
the upgrade method:",

http://git-wip-us.apache.org/repos/asf/ambari/blob/fad21fb5/ambari-web/app/models/stack_version/service_simple.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/service_simple.js 
b/ambari-web/app/models/stack_version/service_simple.js
index 0e5df14..e3e2f48 100644
--- a/ambari-web/app/models/stack_version/service_simple.js
+++ b/ambari-web/app/models/stack_version/service_simple.js
@@ -24,6 +24,7 @@ App.ServiceSimple = DS.Model.extend({
   displayName: DS.attr('string'),
   latestVersion: DS.attr('string'),
   isAvailable: DS.attr('boolean'),
+  isUpgradable: DS.attr('boolean'),
   isHidden: function () {
     var hiddenServices = ['MAPREDUCE2'];
     return hiddenServices.contains(this.get('name')) || 
this.get('doNotShowAndInstall');
@@ -38,4 +39,4 @@ App.ServiceSimple = DS.Model.extend({
   }.property('name')
 });
 
-App.ServiceSimple.FIXTURES = [];
\ No newline at end of file
+App.ServiceSimple.FIXTURES = [];

http://git-wip-us.apache.org/repos/asf/ambari/blob/fad21fb5/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 c4335ae..06ad16c 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -332,6 +332,14 @@
         top: -5px;
       }
     }
+    .not-upgradable {
+      padding-left: 10px;
+      margin-right: -20px;
+      cursor: pointer;
+    }
+    .icon-info-sign {
+      color: @blue;
+    }
   }
   .patch-upgrade-column {
     margin-left: -7px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/fad21fb5/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 0c3aedc..7031c20 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
@@ -94,6 +94,9 @@
        <span {{bindAttr class="service.isVersionInvisible:invisible 
service.isAvailable:available :label"}}>
            {{service.latestVersion}}
        </span>
+        {{#if service.notUpgradable}}
+          <i class="icon-info-sign not-upgradable"></i>
+        {{/if}}
     </p>
     <div class="line-separator-bottom"></div>
   {{/each}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fad21fb5/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 b345a2d..666d077 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
@@ -31,6 +31,7 @@ App.UpgradeVersionColumnView = 
App.UpgradeVersionBoxView.extend({
 
   didInsertElement: function () {
     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')});
     if (!this.get('content.isCompatible')) {
       App.tooltip(this.$(".repo-version-tooltip"), {
         title: Em.I18n.t('admin.stackVersions.version.noCompatible.tooltip')
@@ -51,15 +52,18 @@ App.UpgradeVersionColumnView = 
App.UpgradeVersionBoxView.extend({
 
   services: function() {
     var originalServices = this.get('content.stackServices');
+    var isStandard = this.get('content.isStandard');
     // sort the services in the order the same as service menu
     return App.Service.find().map(function (service) {
       var stackService = originalServices.findProperty('name', 
service.get('serviceName'));
+      var isAvailable = this.isStackServiceAvailable(stackService);
       return Em.Object.create({
         displayName: service.get('displayName'),
         name: service.get('serviceName'),
         latestVersion: stackService ? stackService.get('latestVersion') : '',
         isVersionInvisible: !stackService,
-        isAvailable: this.isStackServiceAvailable(stackService)
+        notUpgradable: !this.get('content.isStandard')  && isAvailable && 
!stackService.get('isUpgradable'),
+        isAvailable: isAvailable
       });
     }, this);
   }.property(),

Reply via email to