Преглед на файлове

AMBARI-1051. Dashboard page takes long time to load. (Srimanth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1419004 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako преди 12 години
родител
ревизия
2f2ad38056

+ 3 - 0
AMBARI-666-CHANGES.txt

@@ -427,6 +427,9 @@ AMBARI-666 branch (unreleased changes)
 
   IMPROVEMENTS
 
+  AMBARI-1051. Dashboard page takes long time to load. (Srimanth Gunturi via
+  yusaku)
+
   AMBARI-1041. Additional metrics need to be added to Heatmap UI. (Srimanth
   Gunturi via yusaku)
 

+ 3 - 3
ambari-web/app/controllers/global/cluster_controller.js

@@ -284,10 +284,10 @@ App.ClusterController = Em.Controller.extend({
       return;
     }
     
-    var servicesUrl1 = this.getUrl('/data/dashboard/services.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=*,components/host_components/*');
+    var servicesUrl = this.getUrl('/data/dashboard/services.json', '/services?fields=components/ServiceComponentInfo,components/host_components,components/host_components/HostRoles');
 
     var self = this;
-    App.HttpClient.get(servicesUrl1, App.statusMapper, {
+    App.HttpClient.get(servicesUrl, App.statusMapper, {
       complete:function (jqXHR, textStatus) {
         console.log('Cluster Controller: Updated components statuses successfully!!!')
         self.loadUpdatedStatusDelayed();
@@ -351,7 +351,7 @@ App.ClusterController = Em.Controller.extend({
 
     App.router.get('updateController').updateServiceMetric(function(){
       self.updateLoadStatus('services');
-    });
+    }, true);
 
     setTimeout(function(){
       self.set('updateStatus', true);

+ 12 - 9
ambari-web/app/controllers/global/update_controller.js

@@ -60,14 +60,10 @@ App.UpdateController = Em.Controller.extend({
   },
 
   updateHost:function(){
-
       var hostsUrl = this.getUrl('/data/hosts/hosts.json', '/hosts?fields=*');
       App.HttpClient.get(hostsUrl, App.hostsMapper, {
-        complete:function (jqXHR, textStatus) {
-
-        }
+        complete:function (jqXHR, textStatus) {}
       });
-
   },
   graphs: [],
   graphsUpdate: function () {
@@ -86,14 +82,21 @@ App.UpdateController = Em.Controller.extend({
       });
       this.set('graphs', existedGraphs);
   },
-  updateServiceMetric:function(callback){
+  
+  /**
+   * Updates the services information. 
+   * 
+   * @param isInitialLoad  If true, only basic information is loaded.
+   */
+  updateServiceMetric: function (callback, isInitialLoad) {
     var self = this;
     self.set('isUpdated', false);
-    var servicesUrl = this.getUrl('/data/dashboard/services.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=*,components/host_components/*,components/ServiceComponentInfo');
-    var callback = callback || function(jqXHR, textStatus){
+    var servicesUrl = isInitialLoad ? 
+        this.getUrl('/data/dashboard/services.json', '/services?fields=components/ServiceComponentInfo,components/host_components,components/host_components/HostRoles') : 
+        this.getUrl('/data/dashboard/services.json', '/services?fields=components/ServiceComponentInfo,components/host_components,components/host_components/HostRoles,components/host_components/metrics/jvm/memHeapUsedM,components/host_components/metrics/jvm/memHeapCommittedM,components/host_components/metrics/mapred/jobtracker/trackers_decommissioned');
+    var callback = callback || function (jqXHR, textStatus) {
       self.set('isUpdated', true);
     };
-
     App.HttpClient.get(servicesUrl, App.servicesMapper, {
       complete: callback
     });

+ 3 - 1
ambari-web/app/mappers/server_data_mapper.js

@@ -99,7 +99,9 @@ App.QuickDataMapper = App.ServerDataMapper.extend({
       if (pathArr[0].substr(-1) == ']') {
         var index = parseInt(pathArr[0].substr(-2, 1));
         var attr = pathArr[0].substr(0, pathArr[0].length - 3);
-        current = current[attr][index];
+        if (attr in current) {
+          current = current[attr][index];
+        }
       } else {
         current = current[pathArr[0]];
       }