You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ij...@apache.org on 2013/11/08 12:08:45 UTC
svn commit: r1539978 - in /jena/branches/jena-fuseki-new-ui/pages:
css/fui.css js/app/main.index.js js/app/services/
js/app/services/ping-service.js ping.txt
Author: ijd
Date: Fri Nov 8 11:08:45 2013
New Revision: 1539978
URL: http://svn.apache.org/r1539978
Log:
Added ping service to set service status light
Added:
jena/branches/jena-fuseki-new-ui/pages/js/app/services/
jena/branches/jena-fuseki-new-ui/pages/js/app/services/ping-service.js (with props)
jena/branches/jena-fuseki-new-ui/pages/ping.txt (with props)
Modified:
jena/branches/jena-fuseki-new-ui/pages/css/fui.css
jena/branches/jena-fuseki-new-ui/pages/js/app/main.index.js
Modified: jena/branches/jena-fuseki-new-ui/pages/css/fui.css
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pages/css/fui.css?rev=1539978&r1=1539977&r2=1539978&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/pages/css/fui.css (original)
+++ jena/branches/jena-fuseki-new-ui/pages/css/fui.css Fri Nov 8 11:08:45 2013
@@ -21,9 +21,28 @@ a#server-status-light {
}
#server-status-light span.server-up {
background-color: #38a800;
+ border:1px solid #4b9b23;
+
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #59e811), color-stop(1, #38a800));
+ background:-moz-linear-gradient(top, #59e811 5%, #38a800 100%);
+ background:-webkit-linear-gradient(top, #59e811 5%, #38a800 100%);
+ background:-o-linear-gradient(top, #59e811 5%, #38a800 100%);
+ background:-ms-linear-gradient(top, #59e811 5%, #38a800 100%);
+ background:linear-gradient(to bottom, #59e811 5%, #38a800 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#59e811', endColorstr='#38a800',GradientType=0);
}
+
#server-status-light span.server-down {
background-color: #d21e1e;
+ border:1px solid #a02323;
+
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ed2424), color-stop(1, #d21e1e));
+ background:-moz-linear-gradient(top, #ed2424 5%, #d21e1e 100%);
+ background:-webkit-linear-gradient(top, #ed2424 5%, #d21e1e 100%);
+ background:-o-linear-gradient(top, #ed2424 5%, #d21e1e 100%);
+ background:-ms-linear-gradient(top, #ed2424 5%, #d21e1e 100%);
+ background:linear-gradient(to bottom, #ed2424 5%, #d21e1e 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89306',GradientType=0);
}
a.navbar-brand {
Modified: jena/branches/jena-fuseki-new-ui/pages/js/app/main.index.js
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pages/js/app/main.index.js?rev=1539978&r1=1539977&r2=1539978&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/pages/js/app/main.index.js (original)
+++ jena/branches/jena-fuseki-new-ui/pages/js/app/main.index.js Fri Nov 8 11:08:45 2013
@@ -6,6 +6,7 @@ define( ['require', '../common-config'],
'sprintf', 'bootstrap',
'models/fuseki-server', 'models/dataset',
'views/dataset-selection-list',
+ 'services/ping-service',
'lib/jquery.xdomainrequest', 'lib/qonsole'
],
function( _, $, Backbone, Marionette, fui, IndexController ) {
@@ -19,6 +20,9 @@ define( ['require', '../common-config'],
// initialise the backbone application
fui.controllers.indexController = new IndexController();
fui.start( options );
+
+ // additional services
+ require( 'services/ping-service' ).start();
});
}
);
\ No newline at end of file
Added: jena/branches/jena-fuseki-new-ui/pages/js/app/services/ping-service.js
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pages/js/app/services/ping-service.js?rev=1539978&view=auto
==============================================================================
--- jena/branches/jena-fuseki-new-ui/pages/js/app/services/ping-service.js (added)
+++ jena/branches/jena-fuseki-new-ui/pages/js/app/services/ping-service.js Fri Nov 8 11:08:45 2013
@@ -0,0 +1,48 @@
+/**
+ * The ping service checks the status of the attached server and sets the light in the
+ * control bar accordingly.
+ */
+define( ['jquery', 'underscore', 'sprintf'],
+ function( $, _, sprintf ) {
+
+ var DEFAULT_PING_TIME = 5000;
+ var _startTime = 0;
+
+ var onBeforeSend = function() {
+ _startTime = new Date().getTime();
+ };
+
+ var duration = function() {
+ return new Date().getTime() - _startTime;
+ };
+
+ var onPingSuccess = function( ) {
+ setPingStatus( "server-up", sprintf( "Last ping returned OK in %dms", duration() ) );
+ };
+
+ var onPingFail = function( jqXHR, msg, errorThrown ) {
+ setPingStatus( "server-down", sprintf( "Last ping returned '%s' in %dms", errorThrown || msg, duration() ) );
+ };
+
+ var setPingStatus = function( lampClass, statusText ) {
+ $( "a#server-status-light span").removeClass()
+ .addClass( lampClass )
+ .attr( "title", statusText );
+ };
+
+ var start = function( period ) {
+ ping( period || DEFAULT_PING_TIME );
+ };
+
+ var ping = function( period ) {
+ onBeforeSend();
+ $.getJSON( "/ping.txt" ).done( onPingSuccess )
+ .fail( onPingFail );
+ setTimeout( function() {ping( period );}, period );
+ };
+
+ return {
+ start: start
+ }
+ }
+);
\ No newline at end of file
Propchange: jena/branches/jena-fuseki-new-ui/pages/js/app/services/ping-service.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: jena/branches/jena-fuseki-new-ui/pages/ping.txt
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pages/ping.txt?rev=1539978&view=auto
==============================================================================
--- jena/branches/jena-fuseki-new-ui/pages/ping.txt (added)
+++ jena/branches/jena-fuseki-new-ui/pages/ping.txt Fri Nov 8 11:08:45 2013
@@ -0,0 +1 @@
+{"status": "up"}
\ No newline at end of file
Propchange: jena/branches/jena-fuseki-new-ui/pages/ping.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain