mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-11 15:03:24 -05:00
Changed status.html to use /xml-rpc?method=stats every 5 seconds instead
of reloading the page every 10 seconds. This breaks in IE, will fix it later.
This commit is contained in:
parent
8fc0ab5272
commit
eb9a771dad
@ -8,12 +8,12 @@ adminroot_DATA = ftr.html linkOpaque.gif status.html aspl-license.txt \
|
||||
mt-daapd.css mt-daapd.png config.html index.html required.gif \
|
||||
gpl-license.html aspl-license.html thanks.html feedback.html \
|
||||
playlist.html playlist.js smart.html smart.js DAAPApplet-0.1.jar \
|
||||
smartpopup.html applet.html mt-daapd.js CREDITS
|
||||
smartpopup.html applet.html mt-daapd.js CREDITS status.js
|
||||
|
||||
EXTRA_DIST = ftr.html linkOpaque.gif status.html aspl-license.txt \
|
||||
gpl-license.txt linkTransparent.gif config-update.html hdr.html \
|
||||
mt-daapd.css mt-daapd.png config.html index.html required.gif \
|
||||
gpl-license.html aspl-license.html thanks.html feedback.html \
|
||||
playlist.html playlist.js smart.html smart.js DAAPApplet-0.1.jar \
|
||||
smartpopup.html applet.html mt-daapd.js CREDITS
|
||||
smartpopup.html applet.html mt-daapd.js CREDITS status.js
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
<title>mt-daapd</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="mt-daapd.css" />
|
||||
@ispage status.html:<meta http-equiv="refresh" content="10" />:@
|
||||
@ispage status.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
|
||||
@ispage status.html:<script type="text/javascript" src="status.js"></script>:@
|
||||
@ispage smart.html:<script type="text/javascript" src="smart.js"></script>:@
|
||||
@ispage playlist.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
|
||||
@ispage playlist.html:<script type="text/javascript" src="lib-js/script.aculo.us/builder.js"></script>:@
|
||||
|
@ -1,12 +1,80 @@
|
||||
@include hdr.html@
|
||||
|
||||
<style type="text/css">
|
||||
table {
|
||||
margin-top: 2ex;
|
||||
}
|
||||
#service, #stat {
|
||||
width: 60ex;
|
||||
}
|
||||
#thread {
|
||||
width: 80ex;
|
||||
}
|
||||
#service td, #thread td {
|
||||
text-align: left;
|
||||
}
|
||||
#service th, #thread th {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
<h1>Status</h1>
|
||||
<p>
|
||||
@THREADSTAT@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@SERVICE-STATUS@
|
||||
</p>
|
||||
<table id="service">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Service</th>
|
||||
<th>Status</th>
|
||||
<th>Control</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Rendezvous</td>
|
||||
<td id="rendezvous">Running</td>
|
||||
<td><!-- <a href="config-update.html?action=stopmdns">Stop MDNS Server</a> --></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DAAP Server</td>
|
||||
<td id="daap_server">Running</td>
|
||||
<td><!-- <a href="config-update.html?action=stopdaap">Stop DAAP Server</a> --></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File scanner</td>
|
||||
<td id="file_scanner">Idle</td>
|
||||
<td><a href="config-update.html?action=rescan">Start Scan</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="stat">
|
||||
<col style="width: 20ex;" />
|
||||
<col />
|
||||
<tr>
|
||||
<th>Uptime</th>
|
||||
<td id="uptime"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Songs</th>
|
||||
<td id="songs"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Songs Served</th>
|
||||
<td id="songs_served"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DB Version</th>
|
||||
<td>2</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="thread">
|
||||
<col style="width: 20ex;" />
|
||||
<col />
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Host</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td></td><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@include ftr.html@
|
||||
|
71
admin-root/status.js
Normal file
71
admin-root/status.js
Normal file
@ -0,0 +1,71 @@
|
||||
Event.observe(window,'load',initStatus);
|
||||
|
||||
var UPDATE_FREQUENCY = 5000; // number of ms between updates
|
||||
|
||||
function initStatus(e) {
|
||||
new Ajax.Request('xml-rpc?method=stats',{method: 'get',onComplete:rsStats});
|
||||
|
||||
window.setInterval(function () {
|
||||
new Ajax.Request('xml-rpc?method=stats',{method: 'get',onComplete:rsStats});
|
||||
},UPDATE_FREQUENCY);
|
||||
|
||||
}
|
||||
function rsStats(request) {
|
||||
['service','stat'].each(function (tag) {
|
||||
$A(request.responseXML.getElementsByTagName(tag)).each(function (element) {
|
||||
var node = $(element.firstChild.firstChild.nodeValue.toLowerCase().replace(/\ /,'_'));
|
||||
node.replaceChild(document.createTextNode(element.childNodes[1].firstChild.nodeValue),node.firstChild);
|
||||
});
|
||||
});
|
||||
var thread = $A(request.responseXML.getElementsByTagName('thread'));
|
||||
var threadTable = new Table('thread');
|
||||
threadTable.removeTBodyRows();
|
||||
thread.each(function (element) {
|
||||
row = [];
|
||||
row.push(element.childNodes[1].firstChild.nodeValue);
|
||||
row.push(element.childNodes[2].firstChild.nodeValue);
|
||||
threadTable.addTbodyRow(row);
|
||||
});
|
||||
}
|
||||
|
||||
Table = Class.create();
|
||||
Object.extend(Table.prototype,{
|
||||
initialize: function (id) {
|
||||
this.tbody = $(id).getElementsByTagName('tbody')[0];
|
||||
},
|
||||
removeTBodyRows: function () {
|
||||
Element.removeChildren(this.tbody);
|
||||
},
|
||||
addTbodyRow: function (cells) {
|
||||
var tr = document.createElement('tr');
|
||||
cells.each(function (cell) {
|
||||
var td = document.createElement('td');
|
||||
td.appendChild(document.createTextNode(cell));
|
||||
tr.appendChild(td);
|
||||
});
|
||||
this.tbody.appendChild(tr);
|
||||
}
|
||||
});
|
||||
Object.extend(Element, {
|
||||
removeChildren: function(element) {
|
||||
while(element.hasChildNodes()) {
|
||||
element.removeChild(element.firstChild);
|
||||
}
|
||||
},
|
||||
textContent: function(node) {
|
||||
if ((!node) || !node.hasChildNodes()) {
|
||||
// Empty text node
|
||||
return '';
|
||||
} else {
|
||||
if (node.textContent) {
|
||||
// W3C ?
|
||||
return node.textContent;
|
||||
} else if (node.text) {
|
||||
// IE
|
||||
return node.text;
|
||||
}
|
||||
}
|
||||
// We shouldn't end up here;
|
||||
return '';
|
||||
}
|
||||
});
|
@ -96,6 +96,7 @@ Section "MainSection" SEC01
|
||||
File "..\..\admin-root\aspl-license.txt"
|
||||
File "..\..\admin-root\aspl-license.html"
|
||||
File "..\..\admin-root\applet.html"
|
||||
File "..\..\admin-root\smart.js"
|
||||
SetOutPath "$INSTDIR\admin-root\lib-js"
|
||||
File "..\..\admin-root\lib-js\prototype.js"
|
||||
File "..\..\admin-root\lib-js\rico.js"
|
||||
|
Loading…
Reference in New Issue
Block a user