From: Adam Dickmeiss Date: Mon, 28 Sep 2009 11:22:19 +0000 (+0200) Subject: JS: Use generic array for stats data. X-Git-Tag: v1.2.1~9^2~9 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=5ee8e3b8cce088acb4602eb21c2572fb688ba5c5;p=pazpar2-moved-to-github.git JS: Use generic array for stats data. The stat response data is now stored in an array based on element names. This allow us to not keep in "sync" with the Pazpar2 response which changed from 1.0.13 to 1.1.0. --- diff --git a/js/pz2.js b/js/pz2.js index f290eec..affff33 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -324,37 +324,9 @@ pz2.prototype = Number( data.getElementsByTagName("activeclients")[0] .childNodes[0].nodeValue ); context.activeClients = activeClients; - var stat = { - "activeclients": activeClients, - "hits": - Number( data.getElementsByTagName("hits")[0] - .childNodes[0].nodeValue ), - "records": - Number( data.getElementsByTagName("records")[0] - .childNodes[0].nodeValue ), - "clients": - Number( data.getElementsByTagName("clients")[0] - .childNodes[0].nodeValue ), - "initializing": - Number( data.getElementsByTagName("initializing")[0] - .childNodes[0].nodeValue ), - "searching": - Number( data.getElementsByTagName("searching")[0] - .childNodes[0].nodeValue ), - "presenting": - Number( data.getElementsByTagName("presenting")[0] - .childNodes[0].nodeValue ), - "idle": - Number( data.getElementsByTagName("idle")[0] - .childNodes[0].nodeValue ), - "failed": - Number( data.getElementsByTagName("failed")[0] - .childNodes[0].nodeValue ), - "error": - Number( data.getElementsByTagName("error")[0] - .childNodes[0].nodeValue ) - }; - + + var stat = Element_parseChildNodes(data.documentElement); + context.statCounter++; var delay = context.statTime + context.statCounter * context.dumpFactor;