From 5ee8e3b8cce088acb4602eb21c2572fb688ba5c5 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 28 Sep 2009 13:22:19 +0200 Subject: [PATCH] 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. --- js/pz2.js | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) 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; -- 1.7.10.4