Author: justi9
Date: 2007-11-08 16:15:48 -0500 (Thu, 08 Nov 2007)
New Revision: 1274
Modified:
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/resources/wooly.js
Log:
Changes the signature for interval update callbacks. Adds a doc.root
method.
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-08 21:15:48 UTC (rev 1274)
@@ -116,7 +116,7 @@
return "Exchange '%s'" % exchange.name
class ExchangeStatus(CuminStatus):
- def render_xml_url(self, session, exchange):
+ def render_data_url(self, session, exchange):
return "exchange.xml?id=%i" % exchange.id
def render_messages_received(self, session, exchange):
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-11-08 21:15:48 UTC (rev 1274)
@@ -84,8 +84,10 @@
</script>
[ExchangeStatus.javascript]
-function updateExchangeStatus(xml, elem) {
- updateStatus(xml, elem);
+function updateExchangeStatus(id, data) {
+ updateStatus(id, data);
+
+ var status = wooly.doc().elembyid(id);
}
[ExchangeStatus.html]
@@ -118,7 +120,7 @@
</table>
</div>
<script>
- wooly.setIntervalUpdate("{id}", "{xml_url}", updateExchangeStatus,
3000);
+ wooly.setIntervalUpdate("{id}", "{data_url}", updateExchangeStatus,
3000);
</script>
[ExchangeView.html]
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/page.strings 2007-11-08 21:15:48 UTC (rev 1274)
@@ -547,22 +547,24 @@
}
[CuminPage.javascript]
-function updateStatus(xml, elem) {
- var ecount = xml.elem("error-count").text().get();
+function updateStatus(id, data) {
+ var ecount = data.elem("error-count").text().get();
var errors = ecount + " " + (ecount == "1" &&
"error" || "errors");
- var wcount = xml.elem("warning-count").text().get();
+ var wcount = data.elem("warning-count").text().get();
var warnings = wcount + " " + (wcount == "1" &&
"warning" || "warnings");
+ var status = wooly.doc().elembyid(id);
+
if (ecount != "0") {
- elem.node.className = "mstatus red";
+ status.node.className = "mstatus red";
} else if (wcount != "0") {
- elem.node.className = "mstatus yellow";
+ status.node.className = "mstatus yellow";
} else {
- elem.node.className = "mstatus green";
+ status.node.className = "mstatus green";
}
- elem.elem("div").set(errors + ", " + warnings);
+ status.elem("div").set(errors + ", " + warnings);
}
[CuminPage.html]
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-08 21:15:48 UTC (rev 1274)
@@ -108,7 +108,7 @@
return "Queue '%s'" % queue.name
class QueueStatus(CuminStatus):
- def render_url(self, session, queue):
+ def render_data_url(self, session, queue):
return "queue.xml?id=%i" % queue.id
def render_consumers(self, session, queue):
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-08 21:15:48 UTC (rev 1274)
@@ -89,10 +89,10 @@
</script>
[QueueStatus.javascript]
-function updateQueueStatus(xml, elem) {
- updateStatus(xml, elem);
+function updateQueueStatus(id, data) {
+ updateStatus(id, data);
- var ms = xml.elems("measurements").next();
+ var ms = data.root().elem("measurements");
var menq = ms.elem("msgtotalenqueues").elem("r").text().get();
var mdeq = ms.elem("msgtotaldequeues").elem("r").text().get();
@@ -103,7 +103,8 @@
var mdepacc = ms.elem("msgdepth").elem("r").text().get();
var bdepacc = ms.elem("bytedepth").elem("r").text().get();
- var trs = elem.elem("table").elem("tbody").elems("tr",
1);
+ var status = wooly.doc().elembyid(id);
+ var trs =
status.elem("table").elem("tbody").elems("tr", 1);
var tds = null;
tds = trs.next().elems("td");
@@ -158,7 +159,7 @@
</table>
</div>
<script>
- wooly.setIntervalUpdate("{id}", "{url}", updateQueueStatus, 3000);
+ wooly.setIntervalUpdate("{id}", "{data_url}", updateQueueStatus,
3000);
</script>
[QueueView.html]
Modified: mgmt/cumin/resources/wooly.js
===================================================================
--- mgmt/cumin/resources/wooly.js 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/resources/wooly.js 2007-11-08 21:15:48 UTC (rev 1274)
@@ -50,9 +50,7 @@
if (req.readyState == 4 && req.status == 200) {
//dir(req);
- var elem = wooly.doc().elembyid(id);
-
- callback(wooly.doc(req.responseXML), elem);
+ callback(id, wooly.doc(req.responseXML));
}
} catch (e) {
log(e);
@@ -80,6 +78,10 @@
this.node = node;
+ this.root = function() {
+ return new WoolyElement(this, node.documentElement);
+ }
+
this.elembyid = function(id) {
var node = this.node.getElementById(id);