Author: justi9
Date: 2007-11-06 11:31:53 -0500 (Tue, 06 Nov 2007)
New Revision: 1244
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/notes/justin-todo.txt
Log:
Makes the client list work just like the queue and exchange lists.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-11-06 16:12:13 UTC (rev 1243)
+++ mgmt/cumin/python/cumin/client.py 2007-11-06 16:31:53 UTC (rev 1244)
@@ -10,9 +10,18 @@
strings = StringCatalog(__file__)
class ClientSet(ItemSet):
+ def __init__(self, app, name):
+ super(ClientSet, self).__init__(app, name)
+
+ self.unit = UnitSwitch(app, "unit")
+ self.add_child(self.unit)
+
def render_title(self, session, vhost):
return "Clients (%i)" % len(vhost.client_items())
+ def render_unit_plural(self, session, vhost):
+ return self.unit.get(session) == "b" and "Bytes" or
"Msgs."
+
def get_items(self, session, vhost):
return sorted_by(vhost.client_items(), "address")
@@ -27,18 +36,18 @@
frame.show_view(branch).show_sessions(branch)
return fmt_link(branch.marshal(), len(client.session_items()))
- def render_item_messages_produced(self, session, client):
- return client.get_measurement("msgsProduced").get_value()
+ def render_item_produced(self, session, client):
+ unit = self.unit.get(session)
+ key = unit == "b" and "bytesProduced" or
"msgsProduced"
+ value = client.get_measurement(key).get_rate()
+ return fmt_rate(value, unit == "b" and "byte" or
"msg", "sec")
- def render_item_bytes_produced(self, session, client):
- return client.get_measurement("bytesProduced").get_value()
+ def render_item_consumed(self, session, client):
+ unit = self.unit.get(session)
+ key = unit == "b" and "bytesConsumed" or
"msgsConsumed"
+ value = client.get_measurement(key).get_rate()
+ return fmt_rate(value, unit == "b" and "byte" or
"msg", "sec")
- def render_item_messages_consumed(self, session, client):
- return client.get_measurement("msgsConsumed").get_value()
-
- def render_item_bytes_consumed(self, session, client):
- return client.get_measurement("bytesConsumed").get_value()
-
def render_item_status(self, session, client):
return fmt_status(len(client.errors), len(client.warnings))
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2007-11-06 16:12:13 UTC (rev 1243)
+++ mgmt/cumin/python/cumin/client.strings 2007-11-06 16:31:53 UTC (rev 1244)
@@ -1,5 +1,7 @@
[ClientSet.html]
<form>
+ {unit}
+
<div class="sactions">
<h2>Act on Selected Clients:</h2>
<button>Close</button>
@@ -11,10 +13,8 @@
<th><input type="checkbox"/></th>
<th>Address</th>
<th class="ralign">Sessions</th>
- <th class="ralign">Msgs. Produced</th>
- <th class="ralign">Bytes Produced</th>
- <th class="ralign">Msgs. Consumed</th>
- <th class="ralign">Bytes Consumed</th>
+ <th class="ralign">{unit_plural} Produced</th>
+ <th class="ralign">{unit_plural} Consumed</th>
<th>Status</th>
</tr>
@@ -27,10 +27,8 @@
<td><input type="checkbox"/></td>
<td>{item_link}</td>
<td class="ralign">{item_sessions}</td>
- <td class="ralign">{item_messages_produced}</td>
- <td class="ralign">{item_messages_consumed}</td>
- <td class="ralign">{item_bytes_produced}</td>
- <td class="ralign">{item_bytes_consumed}</td>
+ <td class="ralign">{item_produced}</td>
+ <td class="ralign">{item_consumed}</td>
<td>{item_status}</td>
</tr>
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-11-06 16:12:13 UTC (rev 1243)
+++ mgmt/notes/justin-todo.txt 2007-11-06 16:31:53 UTC (rev 1244)
@@ -20,6 +20,8 @@
* Display the unit for session remaining lifespan
+ * Fix tab order in broker register
+
Deferred
* Make the status lights also be links to an appropriate view