ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lpus...@apache.org
Subject [06/50] [abbrv] ambari git commit: AMBARI-21703. UI must consume API to show whether a service will be upgraded (alexantonenko)
Date Tue, 05 Sep 2017 09:41:01 GMT
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/418be516
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/418be516
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/418be516

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 418be516334aaebf0d83f8c074fef9fec4a2c2e3
Parents: 138caea
Author: Alex Antonenko <aantonenko@hortonworks.com>
Authored: Wed Aug 30 12:30:03 2017 +0300
Committer: Alex Antonenko <aantonenko@hortonworks.com>
Committed: Wed Aug 30 12:30:03 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        | 1 +
 ambari-web/app/styles/stack_versions.less                    | 8 ++++++++
 .../main/admin/stack_upgrade/upgrade_version_column.hbs      | 3 +++
 ambari-web/app/utils/ajax/ajax.js                            | 2 +-
 .../main/admin/stack_upgrade/upgrade_version_column_view.js  | 5 ++++-
 8 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/418be516/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 8b2014b..746fc53 100644
--- a/ambari-web/app/mappers/repository_version_mapper.js
+++ b/ambari-web/app/mappers/repository_version_mapper.js
@@ -122,7 +122,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/418be516/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/418be516/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 28569c9..17a791e 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1757,6 +1757,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/418be516/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 ffb32bf..a31c829 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');

http://git-wip-us.apache.org/repos/asf/ambari/blob/418be516/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 d2f7ab4..a9dcbaa 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -347,6 +347,14 @@
     }
   }
   div.version-column {
+    .not-upgradable {
+      padding-left: 10px;
+      margin-right: -20px;
+      cursor: pointer;
+    }
+    .icon-info-sign {
+      color: @blue;
+    }
     .services-section {
       .service-version-info {
         span.label.available {

http://git-wip-us.apache.org/repos/asf/ambari/blob/418be516/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 6502672..2ec0d7c 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
@@ -87,6 +87,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>
   {{/each}}
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/418be516/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 70a293c..260417c 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1357,7 +1357,7 @@ var urls = {
     'mock': '/data/clusters/info.json'
   },
   'cluster.load_last_upgrade': {
-    'real': '/clusters/{clusterName}/upgrades',
+    'real': '/clusters/{clusterName}/upgrades?fields=Upgrade/*',
     'mock': '/data/stack_versions/upgrades.json'
   },
   'cluster.update_upgrade_version': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/418be516/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 11ac1cb..4039497 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
@@ -26,6 +26,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')
@@ -50,12 +51,14 @@ App.UpgradeVersionColumnView = App.UpgradeVersionBoxView.extend({
     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(),


Mime
View raw message