summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-06-19 16:59:46 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-06-19 16:59:46 +0200
commit7671311f029531ad8bbb5a10a21ba9a22cd18687 (patch)
tree8f1f4ec0543c8b360972392e00f5cf0665acf1bf
parent98eda2caba4d8bea667bfb015f0bc4426b7f0ee0 (diff)
downloadbiruda-7671311f029531ad8bbb5a10a21ba9a22cd18687.tar.gz
biruda-7671311f029531ad8bbb5a10a21ba9a22cd18687.tar.bz2
better handling of connection errors, handling close button in web client
-rw-r--r--src/GNUmakefile2
-rw-r--r--src/index.html51
2 files changed, 33 insertions, 20 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile
index 1ca09c4..eacc405 100644
--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -136,7 +136,7 @@ run: all
@-./biruda --guess-env --human-readable
@-./biruda -f -c biruda.conf
-test:
+test: all
@-./biruda -f -c biruda.conf &
@sleep 10
@-./biruda -i --no-colors -c biruda.conf -F testscript
diff --git a/src/index.html b/src/index.html
index 0f4f0a5..d7dddb1 100644
--- a/src/index.html
+++ b/src/index.html
@@ -11,14 +11,19 @@
$( "#tabs" ).tabs({
cache: false,
beforeLoad: function( event, ui ) {
- //~ ui.jqXHR.fail( function( ) {
- //~ ui.panel.html(
- //~ "Couldn't load status of biruda. Check if biruda is running and the webserver is enabled." );
- //~ });
event.preventDefault( );
return false;
}
});
+
+ var tabs = $( "#tabs" ).tabs( );
+
+ tabs.delegate( 'span.ui-icon-close', 'click', function( ) {
+ var panelId = $( this ).closest( "li" ).remove( ).attr( 'aria-controls' );
+ $( '#' + panelId ).remove( );
+ tabs.tabs( 'refresh' );
+ });
+
});
$(document).ready( function( ) {
@@ -28,24 +33,32 @@
function refresh_status( ) {
$.get( "/status", { } )
.done( function( data ) {
- var lines = data.split( '\n' );
- var html = "<table><tr><th>worker</th><th>status</th></tr>\n";
- $.each( lines, function( ) {
- var fields = this.split( ' ' );
- var type = fields[0];
- var name = fields[1];
- var status = fields[2];
- if( type == "worker" ) {
- html += "<tr><td>" + name + "</td><td>" + status + "</td></tr>\n";
- }
- });
- html += "</table>\n";
- $('#tabs-1').html( html );
+ var html;
+ if( data == '' ) {
+ html = "<p>Loading..</p>";
+ } else {
+ html = "<table><tr><th>worker</th><th>status</th></tr>\n";
+ var lines = data.split( '\n' );
+ $.each( lines, function( ) {
+ var fields = this.split( ' ' );
+ var type = fields[0];
+ var name = fields[1];
+ var status = fields[2];
+ if( type == "worker" ) {
+ html += "<tr><td>" + name + "</td><td>" + status + "</td></tr>\n";
+ }
+ });
+ html += "</table>\n";
+ }
+ $( '#tabs-1' ).html( html );
+ }).fail( function( ) {
+ $( '#tabs-1' ).html( "<p>Couldn't load status of biruda. Check if biruda is running and the webserver is enabled.</p>" )
});
-
+
}
- var refreshId =setInterval( refresh_status, 5000 );
+ var refreshId = setInterval( refresh_status, 5000 );
+
</script>
<style>