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/26 09:09:38 UTC
svn commit: r1620519 - in /incubator/sirona/trunk/server/reporting:
reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/
reporting-ui/src/main/webapp/ reporting-ui/src/main/webapp/js/
reporting-ui/src/main/webapp/js/app/controllers/ repor...
Author: olamy
Date: Tue Aug 26 07:09:37 2014
New Revision: 1620519
URL: http://svn.apache.org/r1620519
Log:
start structure for gauges
Added:
incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/
incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/GaugeService.java (with props)
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js (with props)
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/gauges.html (with props)
Modified:
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/index.html
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/js/sirona.js
Added: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/GaugeService.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/GaugeService.java?rev=1620519&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/GaugeService.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/GaugeService.java Tue Aug 26 07:09:37 2014
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sirona.reporting.web.gauge;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.sirona.Role;
+import org.apache.sirona.repositories.Repository;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * @since 0.3
+ */
+@Path( "/gauges" )
+public class GaugeService
+{
+ private static final String UTF8 = "UTF-8";
+
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ public Map<String, String> all()
+ {
+ return sortNames( Repository.INSTANCE.gauges() );
+ }
+
+
+
+
+ private static Map<String, String> sortNames( final Collection<Role> gauges )
+ {
+ final Map<String, String> names = new TreeMap<String, String>();
+ for ( final Role gauge : gauges )
+ {
+ final String name = gauge.getName();
+ names.put( name, encode( name ) );
+ }
+ return names;
+ }
+
+ private static String encode( final String role )
+ {
+ final String base64 = Base64.encodeBase64URLSafeString( role.getBytes() );
+ try
+ {
+ return URLEncoder.encode( base64, UTF8 );
+ }
+ catch ( final UnsupportedEncodingException e )
+ {
+ return base64; // shouldn't occur
+ }
+ }
+
+}
Propchange: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/GaugeService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/gauge/GaugeService.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/index.html?rev=1620519&r1=1620518&r2=1620519&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/index.html (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/index.html Tue Aug 26 07:09:37 2014
@@ -66,7 +66,9 @@
<li>
<a href="#report">Report</a>
</li>
-
+ <li>
+ <a href="#gauges">Gauges</a>
+ </li>
<li>
<a href="#jvm">JVM</a>
</li>
Added: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js?rev=1620519&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js (added)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js Tue Aug 26 07:09:37 2014
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+/* Controllers */
+define(['jquery','angular','bootstrap','services','morris','ui-bootstrap','datetimepicker'], function (){
+
+
+ var jvmControllers = angular.module('gaugesControllers', ['sironaJvmServices','ui.bootstrap','ui.bootstrap.datetimepicker']);
+
+ jvmControllers.controller( 'GaugesHomeCtrl', ['$scope','$routeParams','gauges',
+ function ($scope,$routeParams,gauges){
+
+ $scope.data={};
+
+ var threadName=$routeParams.threadName;
+
+ console.log("ThreadsHomeCtrl:"+threadName);
+
+ gauges.query().$promise.then(function(result){
+ $scope.data.gauges=result;
+
+ });
+
+
+
+
+ }]);
+
+
+});
+
+
+
+
+
Propchange: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
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=1620519&r1=1620518&r2=1620519&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 Tue Aug 26 07:09:37 2014
@@ -85,4 +85,12 @@ define(['angular','angular-resource'], f
}
]);
+ sironaServices.factory('gauges', ['$resource',
+ function($resource){
+ return $resource('restServices/sironaServices/gauges',
+ {},
+ {query: {method:'GET', params:{},isArray:true}});
+ }
+ ]);
+
});
\ 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=1620519&r1=1620518&r2=1620519&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 Tue Aug 26 07:09:37 2014
@@ -38,6 +38,7 @@ require.config({
'controllers-jvm': 'app/controllers/controllers-jvm',
'controllers-threads': 'app/controllers/controllers-threads',
'controllers-report': 'app/controllers/controllers-report',
+ 'controllers-gauges': 'app/controllers/controllers-gauges',
'services': 'app/services/services',
'sirona': 'sirona',
'morris': 'plugins/morris/morris-0.5.0.min',
Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/sirona.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/sirona.js?rev=1620519&r1=1620518&r2=1620519&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/sirona.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/sirona.js Tue Aug 26 07:09:37 2014
@@ -17,8 +17,8 @@
'use strict';
-define(['jquery','controllers','controllers-jvm','controllers-threads','angular-route','bootstrap','datetimepicker'
- ,'controllers-report'],
+define(['jquery','controllers','controllers-jvm','controllers-threads','controllers-gauges','angular-route',
+ 'bootstrap','datetimepicker','controllers-report'],
function (jquery,controllers) {
var sirona = angular.module('sirona', [
@@ -26,7 +26,8 @@ define(['jquery','controllers','controll
'homeControllers',
'jvmControllers',
'threadsControllers',
- 'countersControllers'
+ 'countersControllers',
+ 'gaugesControllers'
]);
sirona.config(['$routeProvider','$logProvider',
@@ -63,6 +64,12 @@ define(['jquery','controllers','controll
controller: 'countersHomeCtrl'
}
).
+ when('/gauges',
+ {
+ templateUrl: 'partials/gauges.html',
+ controller: 'GaugesHomeCtrl'
+ }
+ ).
otherwise({
redirectTo: '/home'
});
Added: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/gauges.html
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/gauges.html?rev=1620519&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/gauges.html (added)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/gauges.html Tue Aug 26 07:09:37 2014
@@ -0,0 +1,19 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<div class="row">
+ gauges
+</div>
\ No newline at end of file
Propchange: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/gauges.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/gauges.html
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision