Author: justi9
Date: 2007-11-12 11:55:45 -0500 (Mon, 12 Nov 2007)
New Revision: 1288
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.strings
Log:
Ajaxifies current stats of clients and exchanges.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-11-12 16:43:01 UTC (rev 1287)
+++ mgmt/cumin/python/cumin/client.py 2007-11-12 16:55:45 UTC (rev 1288)
@@ -67,9 +67,6 @@
return "Client %s" % client.address
class ClientStatus(CuminStatus):
- def render_data_url(self, session, client):
- return "client.xml?id=%i" % client.id
-
def render_messages_produced(self, session, client):
value = client.get_measurement("msgsProduced").get_rate()
return fmt_rate(value, "msg", "sec")
@@ -107,6 +104,9 @@
def get_title(self, session, client):
return "Client '%s'" % client.address
+ def render_data_url(self, session, client):
+ return "client.xml?id=%i" % client.id
+
def render_address(self, session, client):
return client.address
@@ -133,7 +133,7 @@
def __init__(self, app, name):
super(ClientStatistics.StatisticsCurrent, self).__init__(app, name)
- self.add_child(MeasurementSet(app, "general_stats",
"general"))
+ self.add_child(MeasurementSet(app, "general",
"general"))
def get_title(self, session, client):
return "Current"
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2007-11-12 16:43:01 UTC (rev 1287)
+++ mgmt/cumin/python/cumin/client.strings 2007-11-12 16:55:45 UTC (rev 1288)
@@ -33,10 +33,10 @@
</tr>
[ClientStatus.javascript]
-function updateClientStatus(id, data) {
- updateStatus(id, data);
+function updateClientStatus(id, client) {
+ updateStatus(id, client);
- var m = data.root().object().measurement;
+ var m = client.measurement;
var mdata = {
"tr": [
null,
@@ -73,10 +73,23 @@
</table>
</div>
<script>
- wooly.setIntervalUpdate("{id}", "{data_url}", updateClientStatus,
3000);
+ cumin.client.listeners["{id}"] = updateClientStatus, 3000;
</script>
+[ClientView.javascript]
+function updateClient(data) {
+ var client = data.root().object();
+
+ for (var id in cumin.client.listeners) {
+ cumin.client.listeners[id](id, client);
+ }
+}
+
[ClientView.html]
+<script>
+ wooly.setIntervalUpdate("{data_url}", updateClient, 3000);
+</script>
+
{status}
<h1>{title}</h1>
@@ -106,12 +119,15 @@
<tr>
<td class="twocol">
<h2>General</h2>
- {general_stats}
+ {general}
</td>
<td class="twocol">
</td>
</tr>
</table>
+<script>
+ cumin.client.listeners["{id}.general"] = updateMeasurements;
+</script>
[StatisticsHistory.html]
<h2>Produced</h2>
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-12 16:43:01 UTC (rev 1287)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-12 16:55:45 UTC (rev 1288)
@@ -168,6 +168,9 @@
def get_title(self, session, exchange):
return "Exchange '%s'" % exchange.name
+ def render_data_url(self, session, exchange):
+ return "exchange.xml?id=%i" % exchange.id
+
def render_name(self, session, exchange):
return exchange.name
@@ -343,7 +346,7 @@
def __init__(self, app, name):
super(ExchangeStatistics.StatisticsCurrent, self).__init__(app, name)
- self.add_child(MeasurementSet(app, "general_stats",
"general"))
+ self.add_child(MeasurementSet(app, "general",
"general"))
def get_title(self, session, exchange):
return "Current"
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-11-12 16:43:01 UTC (rev 1287)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-11-12 16:55:45 UTC (rev 1288)
@@ -84,10 +84,10 @@
</script>
[ExchangeStatus.javascript]
-function updateExchangeStatus(id, data) {
- updateStatus(id, data);
+function updateExchangeStatus(id, exchange) {
+ updateStatus(id, exchange);
- var m = data.root().object().measurement;
+ var m = exchange.measurement;
var mdata = {
"tr": [
null,
@@ -130,10 +130,23 @@
</table>
</div>
<script>
- wooly.setIntervalUpdate("{id}", "{data_url}", updateExchangeStatus,
3000);
+ cumin.exchange.listeners["{id}"] = updateExchangeStatus
</script>
+[ExchangeView.javascript]
+function updateExchange(data) {
+ var exchange = data.root().object();
+
+ for (var id in cumin.exchange.listeners) {
+ cumin.exchange.listeners[id](id, exchange);
+ }
+}
+
[ExchangeView.html]
+<script>
+ wooly.setIntervalUpdate("{data_url}", updateExchange, 3000);
+</script>
+
{status}
<h1><img src="resource?name=exchange-36.png"> {title}</h1>
@@ -175,12 +188,15 @@
<tr>
<td class="twocol">
<h2>General</h2>
- {general_stats}
+ {general}
</td>
<td class="twocol">
</td>
</tr>
</table>
+<script>
+ cumin.exchange.listeners["{id}.general"] = updateMeasurements;
+</script>
[StatisticsHistory.html]
<h2>Received</h2>
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-11-12 16:43:01 UTC (rev 1287)
+++ mgmt/cumin/python/cumin/page.strings 2007-11-12 16:55:45 UTC (rev 1288)
@@ -554,8 +554,13 @@
function Cumin() {
this.queue = new Object();
- this.queue.latest = new Object();
- this.queue.listeners = new Array();
+ this.queue.listeners = new Object();
+
+ this.exchange = new Object();
+ this.exchange.listeners = new Object();
+
+ this.client = new Object();
+ this.client.listeners = new Object();
}
}())
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-12 16:43:01 UTC (rev 1287)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-12 16:55:45 UTC (rev 1288)
@@ -148,8 +148,6 @@
function updateQueue(data) {
var queue = data.root().object();
- //wooly.dir(cumin.queue.listeners);
-
for (var id in cumin.queue.listeners) {
cumin.queue.listeners[id](id, queue);
}