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/06 14:27:08 UTC
svn commit: r1616201 - in /incubator/sirona/trunk: ./
server/reporting/reporting-ui/src/main/webapp/js/
server/reporting/reporting-ui/src/main/webapp/js/app/controllers/
server/reporting/reporting-ui/src/main/webapp/js/app/services/
server/reporting/re...
Author: olamy
Date: Wed Aug 6 12:27:08 2014
New Revision: 1616201
URL: http://svn.apache.org/r1616201
Log:
start cpu
Added:
incubator/sirona/trunk/oldreportingUi.sh (with props)
Modified:
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/main.js
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html
Added: incubator/sirona/trunk/oldreportingUi.sh
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/oldreportingUi.sh?rev=1616201&view=auto
==============================================================================
--- incubator/sirona/trunk/oldreportingUi.sh (added)
+++ incubator/sirona/trunk/oldreportingUi.sh Wed Aug 6 12:27:08 2014
@@ -0,0 +1 @@
+mvn tomcat7:run -pl :sirona-reporting-webapp -am
Propchange: incubator/sirona/trunk/oldreportingUi.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sirona/trunk/oldreportingUi.sh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js?rev=1616201&r1=1616200&r2=1616201&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js Wed Aug 6 12:27:08 2014
@@ -17,9 +17,11 @@
'use strict';
/* Controllers */
-define(['angular','services'], function (){
+define(['angular','services','morris'], function (){
- var homeControllers = angular.module('homeControllers', []);
+ var dayDuration = 24 * 3600 * 1000;
+
+ var homeControllers = angular.module('homeControllers', ['sironaJvmServices']);
homeControllers.controller( 'HomeCtrl', ['$scope', function ( $scope ){
console.log("HomeCtrl");
@@ -28,10 +30,62 @@ define(['angular','services'], function
var jvmControllers = angular.module('jvmControllers', ['sironaJvmServices']);
- jvmControllers.controller( 'JvmHomeCtrl', ['$scope', function ( $scope ){
+ jvmControllers.controller( 'JvmHomeCtrl', ['$scope','jvmCpu', function ( $scope,jvmCpu ){
console.log("JvmHomeCtrl");
+
+ var yesterday = new Date();
+ yesterday.setTime(yesterday.getTime() - dayDuration);
+
+ var now = new Date();
+
+ //var cpuResults = jvmCpu.query({start:yesterday.getTime(),end:now.getTime()});
+
+ jvmCpu.query({start:yesterday.getTime(),end:now.getTime()} ).$promise.then(function(cpuResults){
+ Morris.Line({
+ element: 'cpu',
+ data: toMorrisFormat(cpuResults.data),
+ xkey: 'x',
+ ykeys: ['a'],
+ labels: [cpuResults.label]
+ });
+
+ });
+
+
}]);
+ /*
+ format
+ {"label":"CPU Usage","color":"#317eac"
+ ,"data":{"1407322921555":3.71142578125,"1407322981555":2.63671875,"1407323041555":1.97216796875}}
+
+ to morris format
+ [
+ { y: '2006', a: 100 },
+ { y: '2007', a: 75 },
+ { y: '2008', a: 50 },
+ { y: '2009', a: 75 },
+ { y: '2010', a: 50 },
+ { y: '2011', a: 75 },
+ { y: '2012', a: 100 }
+ ]
+ */
+ var toMorrisFormat=function(reportResult){
+ if (reportResult==null){
+ console.log("reportResult==null");
+ return [];
+ }
+ var values = [];
+ angular.forEach(reportResult, function(key,value) {
+ this.push({x:value,a: key});
+ }, values);
+
+ console.log("size:"+values.length+':'+values[0].x);
+ console.log("size:"+values.length+':'+values[1].x);
+
+ return values;
+ }
+
});
Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js?rev=1616201&r1=1616200&r2=1616201&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js Wed Aug 6 12:27:08 2014
@@ -22,9 +22,9 @@ define(['angular','angular-resource'], f
sironaServices.factory('jvmCpu', ['$resource',
function($resource){
- return $resource('restServices/sironaServices/jvmreports/cpu', {}, {
- query: {method:'GET', params:{}, isArray:true}
- });
+ return $resource('restServices/sironaServices/jvmreports/cpu/:start/:end',
+ {start:'@start',end:'@end'},
+ {query: {method:'GET', params:{}}});
}]);
});
\ No newline at end of file
Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/main.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/main.js?rev=1616201&r1=1616200&r2=1616201&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/main.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/main.js Wed Aug 6 12:27:08 2014
@@ -36,13 +36,16 @@ require.config({
'bootstrap' : 'bootstrap.3.2.0.min',
'controllers': 'app/controllers/controllers',
'services': 'app/services/services',
- 'sirona': 'sirona'
+ 'sirona': 'sirona',
+ 'morris': 'plugins/morris/morris',
+ 'raphael': 'plugins/morris/raphael.min'
},
shim: {
'angular': ['jquery'],
'angular-route': ['angular'],
- 'angular-resource': ['angular']
+ 'angular-resource': ['angular'],
+ 'morris': ['raphael']
},
deps: ['sirona']
Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html?rev=1616201&r1=1616200&r2=1616201&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html Wed Aug 6 12:27:08 2014
@@ -14,4 +14,4 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-jvm
\ No newline at end of file
+<div id="cpu"></div>
\ No newline at end of file