diff options
Diffstat (limited to 'src/index.html')
-rw-r--r-- | src/index.html | 51 |
1 files changed, 32 insertions, 19 deletions
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> |