diff --git a/admin-root/Makefile.am b/admin-root/Makefile.am index fa506406..f9d674f1 100644 --- a/admin-root/Makefile.am +++ b/admin-root/Makefile.am @@ -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 diff --git a/admin-root/hdr.html b/admin-root/hdr.html index a6545846..78ab04a8 100644 --- a/admin-root/hdr.html +++ b/admin-root/hdr.html @@ -4,7 +4,8 @@ mt-daapd - @ispage status.html::@ + @ispage status.html::@ + @ispage status.html::@ @ispage smart.html::@ @ispage playlist.html::@ @ispage playlist.html::@ diff --git a/admin-root/status.html b/admin-root/status.html index 888db4db..8e39c56b 100644 --- a/admin-root/status.html +++ b/admin-root/status.html @@ -1,12 +1,80 @@ @include hdr.html@ - +

Status

-

-@THREADSTAT@ -

- -

-@SERVICE-STATUS@ -

+ + + + + + + + + + + + + + + + + + + + + + + + + +
ServiceStatusControl
RendezvousRunning
DAAP ServerRunning
File scannerIdleStart Scan
+ + + + + + + + + + + + + + + + + + + +
Uptime
Songs
Songs Served
DB Version2
+ + + + + + + + + + + + +
HostAction
@include ftr.html@ diff --git a/admin-root/status.js b/admin-root/status.js new file mode 100644 index 00000000..199ef34c --- /dev/null +++ b/admin-root/status.js @@ -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 ''; + } +}); \ No newline at end of file diff --git a/win32/nsi/mt-daapd.nsi b/win32/nsi/mt-daapd.nsi index e1d1396e..eeb4656b 100644 --- a/win32/nsi/mt-daapd.nsi +++ b/win32/nsi/mt-daapd.nsi @@ -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"