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/22 09:07:06 UTC

svn commit: r1619690 - in /incubator/sirona/trunk/server/reporting: reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/ reporting-ui/src/main/webapp/js/app/controllers/ reporting-ui/src/main/webapp/partials/

Author: olamy
Date: Fri Aug 22 07:07:06 2014
New Revision: 1619690

URL: http://svn.apache.org/r1619690
Log:
fix display

Modified:
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CounterInfo.java
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CountersService.java
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-report.js
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/report.html

Modified: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CounterInfo.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CounterInfo.java?rev=1619690&r1=1619689&r2=1619690&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CounterInfo.java (original)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CounterInfo.java Fri Aug 22 07:07:06 2014
@@ -24,7 +24,11 @@ import org.apache.sirona.counters.Counte
 public class CounterInfo
 {
 
-    private final KeyInfo keyInfo;
+    private final String name;
+
+    private final String roleName;
+
+    private final String unitName;
 
     private final double hits;
 
@@ -47,7 +51,9 @@ public class CounterInfo
     public CounterInfo( KeyInfo keyInfo, double hits, double max, double mean, double min, double standardDeviation,
                         double sum, double variance, double concurrency, double maxConcurrency )
     {
-        this.keyInfo = keyInfo;
+        this.name = keyInfo.getName();
+        this.roleName = keyInfo.getRoleName();
+        this.unitName = keyInfo.getUnitName();
         this.hits = hits;
         this.max = max;
         this.mean = mean;
@@ -59,9 +65,19 @@ public class CounterInfo
         this.maxConcurrency = maxConcurrency;
     }
 
-    public KeyInfo getKeyInfo()
+    public String getName()
+    {
+        return name;
+    }
+
+    public String getRoleName()
+    {
+        return roleName;
+    }
+
+    public String getUnitName()
     {
-        return keyInfo;
+        return unitName;
     }
 
     public double getHits()
@@ -113,7 +129,9 @@ public class CounterInfo
     public String toString()
     {
         return "CounterInfo{" +
-            "keyInfo=" + keyInfo +
+            "name='" + name + '\'' +
+            ", roleName='" + roleName + '\'' +
+            ", unitName='" + unitName + '\'' +
             ", hits=" + hits +
             ", max=" + max +
             ", mean=" + mean +

Modified: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CountersService.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CountersService.java?rev=1619690&r1=1619689&r2=1619690&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CountersService.java (original)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/counters/CountersService.java Fri Aug 22 07:07:06 2014
@@ -48,11 +48,11 @@ public class CountersService
 
         for ( Counter counter : counters )
         {
-            out.add( new CounterInfo( new KeyInfo( counter.getKey() ), MetricData.Hits.value( counter ),
-                                      MetricData.Max.value( counter ), //
-                                      MetricData.Mean.value( counter ), MetricData.Min.value( counter ), //
-                                      MetricData.StandardDeviation.value( counter ), MetricData.Sum.value( counter ), //
-                                      MetricData.Variance.value( counter ), MetricData.Concurrency.value( counter ), //
+            out.add( new CounterInfo( new KeyInfo( counter.getKey() ), MetricData.Hits.value( counter ), //
+                                      MetricData.Max.value( counter ), MetricData.Mean.value( counter ), //
+                                      MetricData.Min.value( counter ), MetricData.StandardDeviation.value( counter ), //
+                                      MetricData.Sum.value( counter ), MetricData.Variance.value( counter ), //
+                                      MetricData.Concurrency.value( counter ),
                                       MetricData.MaxConcurrency.value( counter ) ) ); //
         }
 
@@ -71,12 +71,11 @@ public class CountersService
 
         return counter == null
             ? null
-            : new CounterInfo( new KeyInfo( counter.getKey() ), MetricData.Hits.value( counter ),
-                               MetricData.Max.value( counter ), //
-                               MetricData.Mean.value( counter ), MetricData.Min.value( counter ), //
-                               MetricData.StandardDeviation.value( counter ), MetricData.Sum.value( counter ), //
-                               MetricData.Variance.value( counter ), MetricData.Concurrency.value( counter ), //
-                               MetricData.MaxConcurrency.value( counter ) );
+            : new CounterInfo( new KeyInfo( counter.getKey() ), MetricData.Hits.value( counter ), //
+                               MetricData.Max.value( counter ), MetricData.Mean.value( counter ), //
+                               MetricData.Min.value( counter ), MetricData.StandardDeviation.value( counter ), //
+                               MetricData.Sum.value( counter ), MetricData.Variance.value( counter ), //
+                               MetricData.Concurrency.value( counter ), MetricData.MaxConcurrency.value( counter ) );
 
     }
 

Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-report.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-report.js?rev=1619690&r1=1619689&r2=1619690&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-report.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-report.js Fri Aug 22 07:07:06 2014
@@ -27,18 +27,95 @@ define(['jquery','angular','bootstrap','
   reportControllers.controller( 'countersHomeCtrl', ['$scope','$routeParams','$http','counters',
     function ( $scope,$routeParams,$http,counters){
 
-      $scope.gridOptions={};
+      $scope.colDefs = [
+        {field: 'name', displayName: 'Counter'},
+        {field: 'roleName', displayName: 'Role', cellTemplate:"<div class='ngCellText'>{{row.getProperty(col.field)}} ({{row.getProperty('unitName')}})</div>"},
+        {field: 'hits', displayName: 'Hits'},
+        {field: 'max', displayName: 'Max'},
+        {field: 'mean', displayName: 'Mean'},
+        {field: 'min', displayName: 'Min'},
+        {field: 'standardDeviation', displayName: 'StandardDeviation'},
+        {field: 'sum', displayName: 'Sum'},
+        {field: 'variance', displayName: 'Variance'},
+        {field: 'concurrency', displayName: 'Concurrency'},
+        {field: 'maxConcurrency', displayName: 'MaxConcurrency'},
+      ];
+
+
+      $scope.gridOptions={
+        enablePaging: true,
+        showFooter: false,
+        showGroupPanel: true,
+        jqueryUITheme: true,
+        columnDefs: 'colDefs',
+        plugins: [new ngGridFlexibleHeightPlugin()]
+      };
 
       $http.get('restServices/sironaServices/counters')
           .success(function(data) {
-
                      $scope.counters = data;
                    });
 
       $scope.gridOptions.data='counters';
 
+
+
+      $scope.getTableStyle= function() {
+        var rowHeight=80;
+        var headerHeight=50;
+        return {
+          height: ($scope.gridOptions.data.length * rowHeight + headerHeight) + "px"
+        };
+      };
+
   }]);
 
+
+  function ngGridFlexibleHeightPlugin (opts) {
+    var self = this;
+    self.grid = null;
+    self.scope = null;
+    self.init = function (scope, grid, services) {
+      self.domUtilityService = services.DomUtilityService;
+      self.grid = grid;
+      self.scope = scope;
+      var recalcHeightForData = function () { setTimeout(innerRecalcForData, 1); };
+      var innerRecalcForData = function () {
+        var gridId = self.grid.gridId;
+        var footerPanelSel = '.' + gridId + ' .ngFooterPanel';
+        var extraHeight = self.grid.$topPanel.height() + jQuery(footerPanelSel).height();
+        var naturalHeight = self.grid.$canvas.height() + 1;
+        if (opts != null) {
+          if (opts.minHeight != null && (naturalHeight + extraHeight) < opts.minHeight) {
+            naturalHeight = opts.minHeight - extraHeight - 2;
+          }
+          if (opts.maxHeight != null && (naturalHeight + extraHeight) > opts.maxHeight) {
+            naturalHeight = opts.maxHeight;
+          }
+        }
+
+        var newViewportHeight = naturalHeight + 3;
+        if (!self.scope.baseViewportHeight || self.scope.baseViewportHeight !== newViewportHeight) {
+          self.grid.$viewport.css('height', newViewportHeight + 'px');
+          self.grid.$root.css('height', (newViewportHeight + extraHeight) + 'px');
+          self.scope.baseViewportHeight = newViewportHeight;
+          self.domUtilityService.RebuildGrid(self.scope, self.grid);
+        }
+      };
+      self.scope.catHashKeys = function () {
+        var hash = '',
+            idx;
+        for (idx in self.scope.renderedRows) {
+          hash += self.scope.renderedRows[idx].$$hashKey;
+        }
+        return hash;
+      };
+      self.scope.$watch('catHashKeys()', innerRecalcForData);
+      self.scope.$watch(self.grid.config.data, recalcHeightForData);
+    };
+  };
+
+
 });
 
 

Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/report.html
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/report.html?rev=1619690&r1=1619689&r2=1619690&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/report.html (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/report.html Fri Aug 22 07:07:06 2014
@@ -14,6 +14,8 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+    <!-- ng-style="getTableStyle()" -->
+
+<div ng-grid="gridOptions">
 
-<div class="gridStyle" ng-grid="gridOptions">
 </div>