You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/08/06 14:33:32 UTC

ambari git commit: AMBARI-12661. Infinity spinner on HDFS summary page (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 1342e0cbe -> 0080dc1da


AMBARI-12661. Infinity spinner on HDFS summary page (alexantonenko)


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

Branch: refs/heads/branch-2.1
Commit: 0080dc1da17ddb55ccdbb48d1f51659cbb4e3861
Parents: 1342e0c
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Aug 6 15:30:14 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Aug 6 15:33:28 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/mappers/service_mapper.js        |  3 +-
 .../app/mappers/service_metrics_mapper.js       | 88 +++++++++++---------
 ambari-web/app/views/main/service/service.js    | 10 +--
 .../app/views/main/service/services/hbase.js    |  7 +-
 4 files changed, 56 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0080dc1d/ambari-web/app/mappers/service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js
index 1424997..2109604 100644
--- a/ambari-web/app/mappers/service_mapper.js
+++ b/ambari-web/app/mappers/service_mapper.js
@@ -52,7 +52,8 @@ App.serviceMapper = App.QuickDataMapper.create({
 
     if (!this.get('initialAppLoad')) {
       var parsedCacheServices = App.cache['services'].map(function(item){
-         return self.parseIt(item, self.get('config'));
+        App.serviceMetricsMapper.mapExtendedModel(item);
+        return self.parseIt(item, self.get('config'));
       });
       App.store.loadMany(this.get('model'), parsedCacheServices);
       App.store.commit();

http://git-wip-us.apache.org/repos/asf/ambari/blob/0080dc1d/ambari-web/app/mappers/service_metrics_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index c079b16..bb9c17e 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -227,8 +227,6 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
 
       //parse service metrics from components
       services.forEach(function (item) {
-        var finalJson = [];
-
         hostComponents.filterProperty('service_id', item.ServiceInfo.service_name).mapProperty('id').forEach(function (hostComponent) {
           if (!item.host_components.contains(hostComponent)) {
             item.host_components.push(hostComponent);
@@ -236,43 +234,9 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
         }, this);
         item.host_components.sort();
 
-        if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HDFS") {
-          finalJson = this.hdfsMapper(item);
-          finalJson.rand = Math.random();
-          result.push(finalJson);
-          App.store.load(App.HDFSService, finalJson);
-        } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HBASE") {
-          finalJson = this.hbaseMapper(item);
-          finalJson.rand = Math.random();
-          result.push(finalJson);
-          App.store.load(App.HBaseService, finalJson);
-        } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "FLUME") {
-          finalJson = this.flumeMapper(item);
-          finalJson.rand = Math.random();
-          result.push(finalJson);
-          App.store.load(App.FlumeService, finalJson);
-          App.store.loadMany(App.FlumeAgent, finalJson.agentJsons);
-        } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "YARN") {
-          finalJson = this.yarnMapper(item);
-          finalJson.rand = Math.random();
-          result.push(finalJson);
-          App.store.load(App.YARNService, finalJson);
-        } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "MAPREDUCE2") {
-          finalJson = this.mapreduce2Mapper(item);
-          finalJson.rand = Math.random();
-          result.push(finalJson);
-          App.store.load(App.MapReduce2Service, finalJson);
-        } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "STORM") {
-          finalJson = this.stormMapper(item);
-          finalJson.rand = Math.random();
-          this.mapQuickLinks(finalJson, item);
-          result.push(finalJson);
-          App.store.load(App.StormService, finalJson);
-        } else {
-          finalJson = this.parseIt(item, this.config);
-          finalJson.rand = Math.random();
-          this.mapQuickLinks(finalJson, item);
-          result.push(finalJson);
+        var extendedModelInfo = this.mapExtendedModel(item);
+        if (extendedModelInfo) {
+          result.push(extendedModelInfo);
         }
       }, this);
 
@@ -284,6 +248,50 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
     }
     console.timeEnd('App.serviceMetricsMapper execution time');
   },
+
+  /**
+   * Generate service mapped object and load data to extended models.
+   *
+   * @method mapExtendedModel
+   * @param {Object} item - json presents service information
+   * @returns {Boolean|Object} - mapped info
+   */
+  mapExtendedModel: function(item) {
+    var finalJson = false;
+    if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HDFS") {
+      finalJson = this.hdfsMapper(item);
+      finalJson.rand = Math.random();
+      App.store.load(App.HDFSService, finalJson);
+    } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HBASE") {
+      finalJson = this.hbaseMapper(item);
+      finalJson.rand = Math.random();
+      App.store.load(App.HBaseService, finalJson);
+    } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "FLUME") {
+      finalJson = this.flumeMapper(item);
+      finalJson.rand = Math.random();
+      App.store.load(App.FlumeService, finalJson);
+      App.store.loadMany(App.FlumeAgent, finalJson.agentJsons);
+    } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "YARN") {
+      finalJson = this.yarnMapper(item);
+      finalJson.rand = Math.random();
+      App.store.load(App.YARNService, finalJson);
+    } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "MAPREDUCE2") {
+      finalJson = this.mapreduce2Mapper(item);
+      finalJson.rand = Math.random();
+      App.store.load(App.MapReduce2Service, finalJson);
+    } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "STORM") {
+      finalJson = this.stormMapper(item);
+      finalJson.rand = Math.random();
+      this.mapQuickLinks(finalJson, item);
+      App.store.load(App.StormService, finalJson);
+    } else {
+      finalJson = this.parseIt(item, this.config);
+      finalJson.rand = Math.random();
+      this.mapQuickLinks(finalJson, item);
+    }
+
+    return finalJson;
+  },
   /**
    * compute display name of host-components
    * compute tooltip content of services by host-components
@@ -473,7 +481,6 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
   },
 
   yarnMapper: function (item) {
-    var result = [];
     var self = this;
     var finalConfig = jQuery.extend({}, this.config);
     // Change the JSON so that it is easy to map
@@ -525,7 +532,6 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
   },
 
   mapreduce2Mapper: function (item) {
-    var result = [];
     var finalConfig = jQuery.extend({}, this.config);
     // Change the JSON so that it is easy to map
     var mapReduce2Config = this.mapReduce2Config;

http://git-wip-us.apache.org/repos/asf/ambari/blob/0080dc1d/ambari-web/app/views/main/service/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/service.js b/ambari-web/app/views/main/service/service.js
index 75eeab8..841d819 100644
--- a/ambari-web/app/views/main/service/service.js
+++ b/ambari-web/app/views/main/service/service.js
@@ -125,16 +125,16 @@ App.MainDashboardServiceView = Em.View.extend({
     return this.get('controller.data.' + this.get('serviceName'));
   }.property('controller.data'),
 
-  dashboardMasterComponentView : Em.View.extend({
+  dashboardMasterComponentView: Em.View.extend({
     didInsertElement: function() {
-      App.tooltip($('[rel=healthTooltip]'));
+      App.tooltip($('[rel=SummaryComponentHealthTooltip]'));
     },
     templateName: require('templates/main/service/info/summary/master_components'),
     mastersComp: function () {
-      return this.get('parentView.service.hostComponents').filterProperty('isMaster', true);
-    }.property("service"),
+      return this.get('parentView.parentView.mastersObj');
+    }.property("parentView.parentView.mastersObj"),
     willDestroyElement: function() {
-      $('[rel=healthTooltip]').tooltip('destroy');
+      $('[rel=SummaryComponentHealthTooltip]').tooltip('destroy');
     }
   }),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0080dc1d/ambari-web/app/views/main/service/services/hbase.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/hbase.js b/ambari-web/app/views/main/service/services/hbase.js
index ebed92f..d17d2a0 100644
--- a/ambari-web/app/views/main/service/services/hbase.js
+++ b/ambari-web/app/views/main/service/services/hbase.js
@@ -56,11 +56,8 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
   }.property("service"),
 
   showPhoenixInfo: function () {
-    if (this.get('service.phoenixServersTotal') > 0) {
-      return true;
-    }
-    return false;
-  }.property("service"),
+    return !!this.get('service.phoenixServersTotal');
+  }.property("service.phoenixServersTotal"),
 
   /**
    * One(!) active master component