You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by ol...@apache.org on 2014/08/19 08:08:59 UTC

svn commit: r1618806 - /incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-jvm.js

Author: olamy
Date: Tue Aug 19 06:08:59 2014
New Revision: 1618806

URL: http://svn.apache.org/r1618806
Log:
fix update graphs

Modified:
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-jvm.js

Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-jvm.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-jvm.js?rev=1618806&r1=1618805&r2=1618806&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-jvm.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-jvm.js Tue Aug 19 06:08:59 2014
@@ -29,9 +29,9 @@ define(['jquery','angular','bootstrap','
     function ( $scope,jvmCpu,jvmMemory,nonHeapMemory,activeThreads,osInfo,memoryInfo){
 
       console.log("JvmHomeCtrl");
-
+      $scope.data={};
       $scope.data.startDate = new Date();
-      $scope.data.startDate.setTime($scope.startDate.getTime() - dayDuration);
+      $scope.data.startDate.setTime($scope.data.startDate.getTime() - dayDuration);
 
 
       $scope.data.endDate = new Date();
@@ -41,12 +41,10 @@ define(['jquery','angular','bootstrap','
       jQuery("#dropdown-enddate").dropdown();
       jQuery("#dropdown-startdate").dropdown();
 
-      var drawCpu = function()
-      {
-        console.log("$scope.endDate:"+$scope.endDate);
-        jvmCpu.query({start: $scope.data.startDate.getTime(),end: $scope.endDate.getTime()} ).$promise.then( function ( results ){
+      var drawCpu = function(){
+        jvmCpu.query({start: $scope.data.startDate.getTime(),end: $scope.data.endDate.getTime()} ).$promise.then( function ( results ){
           $scope.cpuResults = toMorrisFormat( results.data );
-          $("#cpu").empty();
+          jQuery("#cpu").empty();
           Morris.Line({
                         element: 'cpu',
                         data: $scope.cpuResults,
@@ -64,65 +62,71 @@ define(['jquery','angular','bootstrap','
           });
       };
 
-      drawCpu();
+      var drawHeapMemory = function(){
+        jvmMemory.query({start:$scope.data.startDate.getTime(),end:$scope.data.endDate.getTime()} ).$promise.then(function(memoryResults){
+          var morrisDatas=toMorrisFormat(memoryResults.data);
+          jQuery("#memory" ).empty();
+          Morris.Line({
+                        element: 'memory',
+                        data: morrisDatas,
+                        xkey: 'x',
+                        ykeys: 'y',
+                        labels: [memoryResults.label],
+                        xLabelFormat:function(ret){
+                          var date = new Date();
+                          date.setTime(morrisDatas[ret.x].x);
+                          return date.toLocaleString();
+                        },
+                        parseTime: false,
+                        hideHover: 'auto'
+                      });
 
-      jvmMemory.query({start:$scope.data.startDate.getTime(),end:$scope.endDate.getTime()} ).$promise.then(function(memoryResults){
-        var morrisDatas=toMorrisFormat(memoryResults.data);
-        $("#memory" ).empty();
-        Morris.Line({
-                      element: 'memory',
-                      data: morrisDatas,
-                      xkey: 'x',
-                      ykeys: 'y',
-                      labels: [memoryResults.label],
-                      xLabelFormat:function(ret){
-                        var date = new Date();
-                        date.setTime(morrisDatas[ret.x].x);
-                        return date.toLocaleString();
-                      },
-                      parseTime: false,
-                      hideHover: 'auto'
-                    });
+        });        
+      };
+      
+      var drawNonHeapMemory = function(){
 
-      });
+        nonHeapMemory.query({start:$scope.data.startDate.getTime(),end:$scope.data.endDate.getTime()} ).$promise.then(function(memoryResults){
+          var morrisDatas=toMorrisFormat(memoryResults.data);
+          jQuery("#nonheapmemory" ).empty();
+          Morris.Line({
+                        element: 'nonheapmemory',
+                        data: morrisDatas,
+                        xkey: 'x',
+                        ykeys: 'y',
+                        labels: [memoryResults.label],
+                        xLabelFormat:function(ret){
+                          var date = new Date();
+                          date.setTime(morrisDatas[ret.x].x);
+                          return date.toLocaleString();
+                        },
+                        parseTime: false,
+                        hideHover: 'auto'
+                      });
 
-      nonHeapMemory.query({start:$scope.data.startDate.getTime(),end:$scope.endDate.getTime()} ).$promise.then(function(memoryResults){
-        var morrisDatas=toMorrisFormat(memoryResults.data);
-        $("#nonheapmemory" ).empty();
-        Morris.Line({
-                      element: 'nonheapmemory',
-                      data: morrisDatas,
-                      xkey: 'x',
-                      ykeys: 'y',
-                      labels: [memoryResults.label],
-                      xLabelFormat:function(ret){
-                        var date = new Date();
-                        date.setTime(morrisDatas[ret.x].x);
-                        return date.toLocaleString();
-                      },
-                      parseTime: false,
-                      hideHover: 'auto'
-                    });
+        });
 
-      });
+      };
 
-      activeThreads.query({start:$scope.data.startDate.getTime(),end:$scope.data.endDate.getTime()} ).$promise.then(function(results){
-        var morrisDatas=toMorrisFormat(results.data);
-        $("#activethreads" ).empty();
-        Morris.Line({
-                      element: 'activethreads',
-                      data: morrisDatas,
-                      xkey: 'x',
-                      ykeys: 'y',
-                      labels: [results.label],
-                      xLabelFormat:function(ret){
-                        return "";
-                      },
-                      parseTime: false,
-                      hideHover: 'auto'
-                    });
+      var drawActiveThreads = function(){
+        activeThreads.query({start:$scope.data.startDate.getTime(),end:$scope.data.endDate.getTime()} ).$promise.then(function(results){
+          var morrisDatas=toMorrisFormat(results.data);
+          $("#activethreads" ).empty();
+          Morris.Line({
+                        element: 'activethreads',
+                        data: morrisDatas,
+                        xkey: 'x',
+                        ykeys: 'y',
+                        labels: [results.label],
+                        xLabelFormat:function(ret){
+                          return "";
+                        },
+                        parseTime: false,
+                        hideHover: 'auto'
+                      });
 
-      });
+        });
+      };
 
       osInfo.query().$promise.then(function(result){
         $scope.os=result;
@@ -134,10 +138,13 @@ define(['jquery','angular','bootstrap','
       });
 
       $scope.updateGraphs = function(){
-        console.log("updateGraphs:"+$scope.data.endDate.toLocaleString());
         drawCpu();
+        drawHeapMemory();
+        drawNonHeapMemory();
+        drawActiveThreads();
       };
 
+      $scope.updateGraphs();
 
   }]);