diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2015-06-19 08:34:28 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2015-06-19 08:34:28 +0200 |
commit | 98eda2caba4d8bea667bfb015f0bc4426b7f0ee0 (patch) | |
tree | c81c2291ece264a922f9814bae52bc1064047fb6 /src/index.html | |
parent | 89ad0d1de12b3728a8199572a59d66d994fe5e7c (diff) | |
download | biruda-98eda2caba4d8bea667bfb015f0bc4426b7f0ee0.tar.gz biruda-98eda2caba4d8bea667bfb015f0bc4426b7f0ee0.tar.bz2 |
proper PNG handling and parsing AJAX answer for status page in web client
Diffstat (limited to 'src/index.html')
-rw-r--r-- | src/index.html | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/index.html b/src/index.html index d828762..0f4f0a5 100644 --- a/src/index.html +++ b/src/index.html @@ -11,10 +11,12 @@ $( "#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." ); - }); + //~ 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; } }); }); @@ -24,21 +26,44 @@ }); function refresh_status( ) { - $('#tabs').tabs( 'load', 0 ); + $.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 refreshId =setInterval( refresh_status, 5000 ); </script> + + <style> + #tabs li .ui-icon-close { float: left; margin: 0.4em 0.2em 0 0; cursor: pointer; } + </style> </head> <body> <div id="tabs"> <ul> - <li><a href="/status">Status</a></li> - <li><a href="#tabs-2">Worker 1</a></li> - <li><a href="#tabs-3">Worker 2</a></li> + <li><a href="#tabs-1">Status</a></li> + <li><a href="#tabs-2">Worker 1</a><span class='ui-icon ui-icon-close' role='presentation'>Close</span></li> + <li><a href="#tabs-3">Worker 2</a><span class='ui-icon ui-icon-close' role='presentation'>Close</span></li> </ul> + <div id="tabs-1"> + <p>.. loading status ..</p> + </div> <div id="tabs-2"> <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p> </div> |