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/09/01 14:25:18 UTC

svn commit: r1621758 - in /incubator/sirona/trunk/server/reporting: reporting-api/src/main/java/org/apache/sirona/reporting/web/status/ reporting-ui/src/main/webapp/ reporting-ui/src/main/webapp/js/ reporting-ui/src/main/webapp/js/app/controllers/ repo...

Author: olamy
Date: Mon Sep  1 12:25:17 2014
New Revision: 1621758

URL: http://svn.apache.org/r1621758
Log:
start status pages

Added:
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/ApplicationStatuses.java   (with props)
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-status.js
      - copied, changed from r1621008, incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.js
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status-detail.html   (with props)
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status.html   (with props)
Modified:
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/NodeStatusInfo.java
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/StatusService.java
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/index.html
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.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/js/sirona.js

Added: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/ApplicationStatuses.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/ApplicationStatuses.java?rev=1621758&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/ApplicationStatuses.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/ApplicationStatuses.java Mon Sep  1 12:25:17 2014
@@ -0,0 +1,42 @@
+package org.apache.sirona.reporting.web.status;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+/**
+ * @author Olivier Lamy
+ * @since 0.3
+ */
+public class ApplicationStatuses
+    implements Serializable
+{
+
+    private final String name;
+
+    private final Collection<NodeStatusInfo> nodeStatusInfos;
+
+    public ApplicationStatuses( String name, Collection<NodeStatusInfo> nodeStatusInfos )
+    {
+        this.name = name;
+        this.nodeStatusInfos = nodeStatusInfos;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public Collection<NodeStatusInfo> getNodeStatusInfos()
+    {
+        return nodeStatusInfos;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "ApplicationStatuses{" +
+            "name='" + name + '\'' +
+            ", nodeStatusInfo=" + nodeStatusInfos +
+            '}';
+    }
+}

Propchange: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/ApplicationStatuses.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/ApplicationStatuses.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/NodeStatusInfo.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/NodeStatusInfo.java?rev=1621758&r1=1621757&r2=1621758&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/NodeStatusInfo.java (original)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/NodeStatusInfo.java Mon Sep  1 12:25:17 2014
@@ -31,14 +31,17 @@ public class NodeStatusInfo
     implements Serializable
 {
 
+    private final String name;
+
     private final List<ValidationResultInfo> results;
 
     private final Date date;
 
     private final String status;
 
-    public NodeStatusInfo( NodeStatus nodeStatus )
+    public NodeStatusInfo( String name, NodeStatus nodeStatus )
     {
+        this.name = name;
         this.date = nodeStatus.getDate();
         this.status = StatusHelper.map( nodeStatus.getStatus() );
 
@@ -58,8 +61,9 @@ public class NodeStatusInfo
         }
     }
 
-    public NodeStatusInfo( String status, Date date, List<ValidationResultInfo> results )
+    public NodeStatusInfo( String name, String status, Date date, List<ValidationResultInfo> results )
     {
+        this.name = name;
         this.status = status;
         this.date = date;
         this.results = results;
@@ -80,11 +84,17 @@ public class NodeStatusInfo
         return status;
     }
 
+    public String getName()
+    {
+        return name;
+    }
+
     @Override
     public String toString()
     {
         return "NodeStatusInfo{" +
-            "results=" + results +
+            "name='" + name + '\'' +
+            ", results=" + results +
             ", date=" + date +
             ", status='" + status + '\'' +
             '}';

Modified: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/StatusService.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/StatusService.java?rev=1621758&r1=1621757&r2=1621758&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/StatusService.java (original)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/status/StatusService.java Mon Sep  1 12:25:17 2014
@@ -23,7 +23,9 @@ import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
@@ -39,13 +41,12 @@ public class StatusService
 
     private static final String APP_DELIMITER = "#";
 
-
-    // FIXME olamy: write documentation on that as it's not very clear what's going on here!!
-    // it's simply an adaptation of the previous code
+    // FIXME olamy: write documentation on that as it's not very clear!! what's going on here!!
+    // it's simply a copy/paste and adaptation of the previous code
 
     @GET
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    public Map<String, Map<String, NodeStatusInfo>> all()
+    public List<ApplicationStatuses> all()
     {
         final Map<String, Map<String, NodeStatusInfo>> statusesByApp =
             new HashMap<String, Map<String, NodeStatusInfo>>();
@@ -68,10 +69,17 @@ public class StatusService
                 statusesOfTheApp = new TreeMap<String, NodeStatusInfo>();
                 statusesByApp.put( segments[0], statusesOfTheApp );
             }
-            statusesOfTheApp.put( segments[1], new NodeStatusInfo( entry.getValue() ) );
+            statusesOfTheApp.put( segments[1], new NodeStatusInfo( segments[1], entry.getValue() ) );
+        }
+
+        List<ApplicationStatuses> applicationStatuseses = new ArrayList<ApplicationStatuses>( statusesByApp.size() );
+
+        for ( Map.Entry<String, Map<String, NodeStatusInfo>> entry : statusesByApp.entrySet() )
+        {
+            applicationStatuseses.add( new ApplicationStatuses( entry.getKey(), entry.getValue().values() ) );
         }
 
-        return statusesByApp;
+        return applicationStatuseses;
     }
 
 }

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=1621758&r1=1621757&r2=1621758&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 Mon Sep  1 12:25:17 2014
@@ -70,6 +70,9 @@
               <a href="#gauges">Gauges</a>
             </li>
             <li>
+              <a href="#status">Status</a>
+            </li>
+            <li>
               <a href="#jvm">JVM</a>
             </li>
             <li>

Modified: 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=1621758&r1=1621757&r2=1621758&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-gauges.js Mon Sep  1 12:25:17 2014
@@ -21,9 +21,9 @@ define(['jquery','angular','bootstrap','
 
   var dayDuration = 24 * 3600 * 1000;
 
-  var jvmControllers = angular.module('gaugesControllers', ['sironaJvmServices','ui.bootstrap','ui.bootstrap.datetimepicker']);
+  var gaugesControllers = angular.module('gaugesControllers', ['sironaJvmServices','ui.bootstrap','ui.bootstrap.datetimepicker']);
 
-  jvmControllers.controller( 'GaugesHomeCtrl', ['$scope','$routeParams','gauges',
+  gaugesControllers.controller( 'GaugesHomeCtrl', ['$scope','$routeParams','gauges',
     function ($scope,$routeParams,gauges){
 
       $scope.data={};
@@ -35,7 +35,7 @@ define(['jquery','angular','bootstrap','
 
   }]);
 
-  jvmControllers.controller( 'gaugeDetailCtrl', ['$scope','$routeParams','gaugesResults',
+  gaugesControllers.controller( 'gaugeDetailCtrl', ['$scope','$routeParams','gaugesResults',
     function ($scope,$routeParams,gauges){
 
       $scope.data={};

Copied: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-status.js (from r1621008, incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.js)
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-status.js?p2=incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-status.js&p1=incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.js&r1=1621008&r2=1621758&rev=1621758&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-status.js Mon Sep  1 12:25:17 2014
@@ -20,29 +20,25 @@
 define(['jquery','angular','bootstrap','services','morris','ui-bootstrap','datetimepicker'], function (){
 
 
-  var jvmControllers = angular.module('threadsControllers', ['sironaJvmServices','ui.bootstrap','ui.bootstrap.datetimepicker']);
+  var statusControllers = angular.module('statusControllers', ['sironaJvmServices','ui.bootstrap']);
 
-  jvmControllers.controller( 'ThreadsHomeCtrl', ['$scope','$routeParams','threads',
-    function ($scope,$routeParams,threads){
+  statusControllers.controller( 'StatusHomeCtrl', ['$scope','$routeParams',
+    function ($scope,$routeParams){
 
       $scope.data={};
 
-      var threadName=$routeParams.threadName;
+      console.log("StatusHomeCtrl");
 
-      console.log("ThreadsHomeCtrl:"+threadName);
-
-      threads.query().$promise.then(function(result){
-        $scope.data.threadInfos=result;
-
-      });
+  }]);
 
-      if (angular.isDefined(threadName)){
-        $scope.data.currentThread = threads.get({threadName:threadName});
-      }
+  statusControllers.controller( 'StatusDetailCtrl', ['$scope','$routeParams',
+    function ($scope,$routeParams){
 
+      $scope.data={};
 
-  }]);
+      console.log("StatusDetailCtrl:"+$routeParams.nodeName);
 
+    }]);
 
 });
 

Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.js?rev=1621758&r1=1621757&r2=1621758&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers-threads.js Mon Sep  1 12:25:17 2014
@@ -20,9 +20,9 @@
 define(['jquery','angular','bootstrap','services','morris','ui-bootstrap','datetimepicker'], function (){
 
 
-  var jvmControllers = angular.module('threadsControllers', ['sironaJvmServices','ui.bootstrap','ui.bootstrap.datetimepicker']);
+  var threadsControllers = angular.module('threadsControllers', ['sironaJvmServices','ui.bootstrap','ui.bootstrap.datetimepicker']);
 
-  jvmControllers.controller( 'ThreadsHomeCtrl', ['$scope','$routeParams','threads',
+  threadsControllers.controller( 'ThreadsHomeCtrl', ['$scope','$routeParams','threads',
     function ($scope,$routeParams,threads){
 
       $scope.data={};

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=1621758&r1=1621757&r2=1621758&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 Mon Sep  1 12:25:17 2014
@@ -101,4 +101,6 @@ define(['angular','angular-resource'], f
     }
   ]);
 
+
+
 });
\ 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=1621758&r1=1621757&r2=1621758&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 Mon Sep  1 12:25:17 2014
@@ -39,6 +39,7 @@ require.config({
     'controllers-threads': 'app/controllers/controllers-threads',
     'controllers-report': 'app/controllers/controllers-report',
     'controllers-gauges': 'app/controllers/controllers-gauges',
+    'controllers-status': 'app/controllers/controllers-status',
     '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=1621758&r1=1621757&r2=1621758&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 Mon Sep  1 12:25:17 2014
@@ -18,7 +18,7 @@
 'use strict';
 
 define(['jquery','controllers','controllers-jvm','controllers-threads','controllers-gauges','angular-route',
-         'bootstrap','datetimepicker','controllers-report'],
+         'bootstrap','datetimepicker','controllers-report','controllers-status'],
        function (jquery,controllers) {
 
   var sirona = angular.module('sirona', [
@@ -27,7 +27,8 @@ define(['jquery','controllers','controll
     'jvmControllers',
     'threadsControllers',
     'countersControllers',
-    'gaugesControllers'
+    'gaugesControllers',
+    'statusControllers'
   ]);
 
   sirona.config(['$routeProvider','$logProvider',
@@ -70,12 +71,24 @@ define(['jquery','controllers','controll
                controller: 'GaugesHomeCtrl'
              }
         ).
-          when('/gauges/:gaugeName',
+        when('/gauges/:gaugeName',
              {
                templateUrl: 'partials/gauge-detail.html',
                controller: 'gaugeDetailCtrl'
              }
         ).
+        when('/status',
+             {
+               templateUrl: 'partials/status.html',
+               controller: 'StatusHomeCtrl'
+             }
+        ).
+        when('/status/:nodeName',
+             {
+               templateUrl: 'partials/status-detail.html',
+               controller: 'StatusDetailCtrl'
+             }
+        ).
         otherwise({
           redirectTo: '/home'
         });

Added: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status-detail.html
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status-detail.html?rev=1621758&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status-detail.html (added)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status-detail.html Mon Sep  1 12:25:17 2014
@@ -0,0 +1,21 @@
+<!--
+  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">
+  <div class="col-lg-12">
+    status detail
+  </div>
+</div>
\ No newline at end of file

Propchange: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status-detail.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status-detail.html
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status.html
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status.html?rev=1621758&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status.html (added)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status.html Mon Sep  1 12:25:17 2014
@@ -0,0 +1,21 @@
+<!--
+  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">
+  <div class="col-lg-12">
+    status
+  </div>
+</div>
\ No newline at end of file

Propchange: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/status.html
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision