Author: justi9
Date: 2007-11-07 23:26:36 -0500 (Wed, 07 Nov 2007)
New Revision: 1266
Modified:
mgmt/cumin/bin/cumin-test
mgmt/cumin/python/cumin/__init__.py
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/brokercluster.py
mgmt/cumin/python/cumin/brokergroup.py
mgmt/cumin/python/cumin/brokerprofile.py
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/formats.py
mgmt/cumin/python/cumin/measurement.strings
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/realm.py
mgmt/cumin/python/cumin/virtualhost.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/pages.py
mgmt/cumin/python/wooly/widgets.py
mgmt/cumin/python/wooly/widgets.strings
mgmt/misc/boneyard.py
mgmt/notes/justin-todo.txt
Log:
Cleans up some todo items.
Adds rolled-up stats to exchanges and clients.
Renames render_title methods to get_title to reflect that they may be
called outside of render. Adds a render_title method to Widget that
does call get_title.
Adds a none option to the inital group selector in broker register.
Changes the css collator to avoid producing duplicate sets of rules.
Introduces a javascript collator and page.
Modified: mgmt/cumin/bin/cumin-test
===================================================================
--- mgmt/cumin/bin/cumin-test 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/bin/cumin-test 2007-11-08 04:26:36 UTC (rev 1266)
@@ -33,7 +33,7 @@
data.load()
data.start_updates()
- if debug or bench:
+ if debug or bench_hits:
app.enable_debug()
if bench_hits:
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/__init__.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -2,7 +2,7 @@
from random import randint
from wooly import Application, Session, Page
-from wooly.pages import CssPage, ResourcePage
+from wooly.pages import CssPage, JavascriptPage, ResourcePage
from wooly.server import WebServer
from wooly.devel import DevelPage
from wooly.parameters import IntegerParameter
@@ -31,6 +31,7 @@
self.set_default_page(self.cumin_page)
self.add_page(CssPage(self, "cumin.css"))
+ self.add_page(JavascriptPage(self, "cumin.js"))
self.add_page(ResourcePage(self, "resource"))
self.add_page(DevelPage(self, "devel.html"))
self.add_page(QueueXmlPage(self, "queue.xml"))
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/broker.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -15,8 +15,8 @@
strings = StringCatalog(__file__)
class BrokerSet(ItemSet):
- def render_title(self, session, model):
- return "Brokers (%i)" % len(model.get_brokers())
+ def get_title(self, session, model):
+ return "Brokers %s" % fmt_count(len(model.get_brokers()))
def get_items(self, session, model):
return sorted_by(model.get_brokers())
@@ -140,7 +140,7 @@
self.client.set_object(session, client)
return self.show_mode(session, self.client)
- def render_title(self, session, broker):
+ def get_title(self, session, broker):
return "Broker '%s'" % broker.name
class BrokerConfigPropertyForm(CuminForm, Frame):
@@ -180,6 +180,9 @@
self.lvalue = TextInput(app, "local_value", self)
self.add_child(self.lvalue)
+ def get_title(self, session, prop):
+ return "Edit Property '%s'" % prop.name
+
def get_object(self, session, object):
return self.param.get(session)
@@ -210,9 +213,6 @@
self.svalue.set(session, prop.broker_value)
self.lvalue.set(session, prop.value)
- def render_title(self, session, prop):
- return "Edit Property '%s'" % prop.name
-
def get_profile_value(prop):
profile = prop.get_broker().get_broker_profile()
value = None
@@ -248,7 +248,7 @@
def show_config(self, session):
return self.tabs.show_mode(session, self.config)
- def render_title(self, session, broker):
+ def get_title(self, session, broker):
return "Broker '%s'" % broker.name
def render_name(self, session, broker):
@@ -278,41 +278,39 @@
return "1.0"
class BrokerQueueTab(QueueSet):
- def render_title(self, session, broker):
+ def get_title(self, session, broker):
count = len(broker.default_virtual_host.queue_items())
- return "Queues (%i)" % count
+ return "Queues %s" % fmt_count(count)
def get_object(self, session, broker):
return broker.default_virtual_host
class BrokerExchangeTab(ExchangeSet):
- def render_title(self, session, broker):
+ def get_title(self, session, broker):
count = len(broker.default_virtual_host.exchange_items())
- return "Exchanges (%i)" % count
+ return "Exchanges %s" % fmt_count(count)
def get_object(self, session, broker):
return broker.default_virtual_host
class BrokerClientTab(ClientSet):
- def render_title(self, session, broker):
+ def get_title(self, session, broker):
count = len(broker.default_virtual_host.client_items())
- return "Clients (%i)" % count
+ return "Clients %s" % fmt_count(count)
def get_object(self, session, broker):
return broker.default_virtual_host
class BrokerVirtualHostTab(VirtualHostSet):
- def render_title(self, session, broker):
- return "Configuration"
+ def get_title(self, session, broker):
+ return "Functional Hosts %s" % \
+ fmt_count(len(broker.virtual_host_items()))
- def render_title(self, session, broker):
- return "Functional Hosts (%i)" % len(broker.virtual_host_items())
-
def get_items(self, session, broker):
return sorted_by(broker.virtual_host_items())
class BrokerConfigTab(ConfigPropertySet):
- def render_title(self, session, broker):
+ def get_title(self, session, broker):
return "Configuration"
def get_items(self, session, broker):
@@ -339,11 +337,11 @@
return branch.marshal()
class BrokerStatsTab(Widget):
- def render_title(self, session, broker):
+ def get_title(self, session, broker):
return "Statistics"
class BrokerLogTab(Widget):
- def render_title(self, session, broker):
+ def get_title(self, session, broker):
return "Log Messages"
class BrokerBrowser(Widget):
@@ -469,6 +467,7 @@
self.add_form_parameter(self.addrs)
self.group_param = BrokerGroupParameter(app, "group_param")
+ self.group_param.set_default(None)
self.add_parameter(self.group_param)
self.add_form_parameter(self.group_param)
@@ -544,6 +543,9 @@
return "More Entries"
class BrokerAdd(BrokerForm):
+ def get_title(self, session, object):
+ return "Register New Brokers"
+
def process_cancel(self, session, model):
branch = session.branch()
self.page().show_view(branch)
@@ -558,6 +560,3 @@
print name, addr, group
self.process_cancel(session, model)
-
- def render_title(self, session, object):
- return "Register New Brokers"
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/broker.strings 2007-11-08 04:26:36 UTC (rev 1266)
@@ -242,7 +242,12 @@
<tr>
<td><input type="text" name="{field_name_name}"
value="{field_name_value}" size="15"
tabindex="100"/></td>
<td><input type="text" name="{field_address_name}"
value="{field_address_value}" size="35"
tabindex="100"/></td>
- <td><select name="{field_group_name}"
tabindex="100">{groups}</select></td>
+ <td>
+ <select name="{field_group_name}" tabindex="100">
+ <option>None</option>
+ {groups}
+ </select>
+ </td>
</tr>
[BrokerForm.group_html]
Modified: mgmt/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/brokercluster.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -17,8 +17,9 @@
self.broker_tmpl = Template(self, "broker_html")
- def render_title(self, session, model):
- return "Broker Clusters (%i)" % len(model.get_broker_clusters())
+ def get_title(self, session, model):
+ return "Broker Clusters %s" \
+ % fmt_count(len(model.get_broker_clusters()))
def get_items(self, session, model):
return sorted_by(model.get_broker_clusters())
@@ -59,7 +60,7 @@
self.broker.set_object(session, broker)
return self.show_mode(session, self.broker)
- def render_title(self, session, cluster):
+ def get_title(self, session, cluster):
return "Broker Cluster '%s'" % cluster.name
class BrokerClusterStatus(CuminStatus):
@@ -78,19 +79,19 @@
self.tabs.add_tab(self.ClusterBrokerTab(app, "brokers"))
self.tabs.add_tab(self.ClusterStatsTab(app, "stats"))
- def render_title(self, session, cluster):
+ def get_title(self, session, cluster):
return "Broker Cluster '%s'" % cluster.name
def render_name(self, session, cluster):
return cluster.name
class ClusterBrokerTab(BrokerSetForm):
- def render_title(self, session, cluster):
- return "Brokers (%i)" % len(cluster.broker_items())
+ def get_title(self, session, cluster):
+ return "Brokers %s" % fmt_count(len(cluster.broker_items()))
def get_items(self, session, cluster):
return sorted_by(cluster.broker_items())
class ClusterStatsTab(Widget):
- def render_title(self, session, cluster):
+ def get_title(self, session, cluster):
return "Statistics"
Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/brokergroup.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -11,8 +11,8 @@
strings = StringCatalog(__file__)
class BrokerGroupSet(ItemSet):
- def render_title(self, session, model):
- return "Broker Groups (%i)" % len(model.get_broker_groups())
+ def get_title(self, session, model):
+ return "Broker Groups %s" % fmt_count(len(model.get_broker_groups()))
def render_group_add_href(self, session, model):
branch = session.branch()
@@ -58,7 +58,7 @@
self.add_child(self.edit)
self.set_edit_mode(self.edit)
- def render_title(self, session, group):
+ def get_title(self, session, group):
return "Broker Group '%s'" % group.name
class BrokerGroupStatus(CuminStatus):
@@ -76,7 +76,7 @@
self.tabs.add_tab(self.GroupBrokerTab(app, "brokers"))
- def render_title(self, session, group):
+ def get_title(self, session, group):
return "Broker Group '%s'" % group.name
def render_name(self, session, group):
@@ -91,12 +91,12 @@
return branch.marshal()
class GroupBrokerTab(BrokerSetForm):
+ def get_title(self, session, group):
+ return "Brokers %s" % fmt_count(len(group.broker_items()))
+
def get_items(self, session, group):
return sorted_by(group.broker_items())
- def render_title(self, session, group):
- return "Brokers (%i)" % len(group.broker_items())
-
class BrokerGroupForm(CuminForm):
def __init__(self, app, name):
super(BrokerGroupForm, self).__init__(app, name)
@@ -117,6 +117,9 @@
self.page().set_redirect_url(session, branch.marshal())
class BrokerGroupAdd(BrokerGroupForm, Frame):
+ def get_title(self, session, model):
+ return "Add Group"
+
def process_cancel(self, session, model):
branch = session.branch()
self.page().show_view(branch)
@@ -126,10 +129,10 @@
group = BrokerGroup(model)
self.process_group(session, group)
- def render_title(self, session, model):
- return "Add Group"
+class BrokerGroupEdit(BrokerGroupForm, Frame):
+ def get_title(self, session, group):
+ return "Edit Group '%s'" % group.name
-class BrokerGroupEdit(BrokerGroupForm, Frame):
def process_cancel(self, session, group):
branch = session.branch()
self.parent.show_view(branch)
@@ -141,9 +144,6 @@
def process_display(self, session, group):
self.group_name.set(session, group.name)
- def render_title(self, session, group):
- return "Edit Group '%s'" % group.name
-
class BrokerGroupInput(OptionInputSet):
def get_items(self, session, model):
return model.get_broker_groups()
Modified: mgmt/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/cumin/python/cumin/brokerprofile.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/brokerprofile.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -30,7 +30,7 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
- def render_title(self, session, profile):
+ def get_title(self, session, profile):
return "Broker Profile '%s'" % profile.name
class BrokerProfileView(Widget):
@@ -43,7 +43,7 @@
self.tabs.add_tab(self.ProfileConfigTab(app, "config"))
self.tabs.add_tab(self.ProfileBrokerTab(app, "brokers"))
- def render_title(self, session, profile):
+ def get_title(self, session, profile):
return "Broker Profile '%s'" % profile.name
def render_name(self, session, profile):
@@ -53,15 +53,15 @@
def get_items(self, session, profile):
return sorted_by(profile.config_property_items())
- def render_title(self, session, profile):
+ def get_title(self, session, profile):
return "Configuration"
class ProfileBrokerTab(BrokerSet):
def __init__(self, app, name):
super(BrokerProfileView.ProfileBrokerTab, self).__init__(app, name)
- def render_title(self, session, profile):
- return "Brokers (%i)" % len(profile.broker_items())
+ def get_title(self, session, profile):
+ return "Brokers %s" % fmt_count(len(profile.broker_items()))
def get_items(self, session, profile):
return sorted_by(profile.broker_items())
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/client.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -16,8 +16,8 @@
self.unit = UnitSwitch(app, "unit")
self.add_child(self.unit)
- def render_title(self, session, vhost):
- return "Clients (%i)" % len(vhost.client_items())
+ def get_title(self, session, vhost):
+ return "Clients %s" % fmt_count(len(vhost.client_items()))
def render_unit_plural(self, session, vhost):
return self.unit.get(session) == "b" and "Bytes" or
"Msgs."
@@ -63,12 +63,26 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
- def render_title(self, session, client):
+ def get_title(self, session, client):
return "Client %s" % client.address
class ClientStatus(CuminStatus):
- pass
+ def render_messages_produced(self, session, client):
+ value = client.get_measurement("msgsProduced").get_rate()
+ return fmt_rate(value, "msg", "sec")
+
+ def render_messages_consumed(self, session, client):
+ value = client.get_measurement("msgsConsumed").get_rate()
+ return fmt_rate(value, "msg", "sec")
+ def render_bytes_produced(self, session, client):
+ value = client.get_measurement("bytesProduced").get_rate()
+ return fmt_rate(value, "byte", "sec")
+
+ def render_bytes_consumed(self, session, client):
+ value = client.get_measurement("bytesConsumed").get_rate()
+ return fmt_rate(value, "byte", "sec")
+
class ClientView(Widget):
def __init__(self, app, name):
super(ClientView, self).__init__(app, name)
@@ -87,7 +101,7 @@
def show_sessions(self, session):
return self.tabs.show_mode(session, self.sessions)
- def render_title(self, session, client):
+ def get_title(self, session, client):
return "Client '%s'" % client.address
def render_address(self, session, client):
@@ -109,7 +123,7 @@
self.add_tab(self.StatisticsCurrent(app, "current"))
self.add_tab(self.StatisticsHistory(app, "history"))
- def render_title(self, session, client):
+ def get_title(self, session, client):
return "Statistics"
class StatisticsCurrent(Widget):
@@ -118,11 +132,11 @@
self.add_child(MeasurementSet(app, "general_stats",
"general"))
- def render_title(self, session, client):
+ def get_title(self, session, client):
return "Current"
class StatisticsHistory(Widget):
- def render_title(self, session, client):
+ def get_title(self, session, client):
return "History"
def render_produced_chart_url(self, session, client):
@@ -134,8 +148,8 @@
% client.id
class ClientSessionSet(ItemSet):
- def render_title(self, session, client):
- return "Sessions (%i)" % len(client.session_items())
+ def get_title(self, session, client):
+ return "Sessions %s" % fmt_count(len(client.session_items()))
def get_items(self, session, client):
return sorted_by(client.session_items())
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/client.strings 2007-11-08 04:26:36 UTC (rev 1266)
@@ -32,6 +32,31 @@
<td>{item_status}</td>
</tr>
+[ClientStatus.html]
+<div id="{id}" class="{class}">
+ <h2>Client Status</h2>
+
+ <div>{status_info}</div>
+
+ <table>
+ <tr>
+ <th></th>
+ <th style="width: 35%;"
class="ralign">Messages</th>
+ <th style="width: 35%;" class="ralign">Bytes</th>
+ </tr>
+ <tr>
+ <th>Produced</th>
+ <td class="ralign">{messages_produced}</td>
+ <td class="ralign">{bytes_produced}</td>
+ </tr>
+ <tr>
+ <th>Consumed</th>
+ <td class="ralign">{messages_consumed}</td>
+ <td class="ralign">{bytes_consumed}</td>
+ </tr>
+ </table>
+</div>
+
[ClientView.html]
{status}
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -39,7 +39,7 @@
self.unit = UnitSwitch(app, "unit")
self.add_child(self.unit)
- def render_title(self, session, vhost):
+ def get_title(self, session, vhost):
return "Exchanges (%s)" % len(vhost.exchange_items())
def render_unit_plural(self, session, vhost):
@@ -112,12 +112,32 @@
exchange.get_measurement("bindings").link_cb = show_bindings
return exchange
- def render_title(self, session, exchange):
+ def get_title(self, session, exchange):
return "Exchange '%s'" % exchange.name
class ExchangeStatus(CuminStatus):
- pass
+ def render_messages_received(self, session, exchange):
+ value = exchange.get_measurement("msgReceives").get_rate()
+ return fmt_rate(value, "msg", "sec")
+ def render_messages_routed(self, session, exchange):
+ value = exchange.get_measurement("msgRoutes").get_rate()
+ return fmt_rate(value, "msg", "sec")
+
+ def render_messages_dropped(self, session, exchange):
+ return exchange.get_measurement("msgDrops").get_value()
+
+ def render_bytes_received(self, session, exchange):
+ value = exchange.get_measurement("byteReceives").get_rate()
+ return fmt_rate(value, "byte", "sec")
+
+ def render_bytes_routed(self, session, exchange):
+ value = exchange.get_measurement("byteRoutes").get_rate()
+ return fmt_rate(value, "byte", "sec")
+
+ def render_bytes_dropped(self, session, exchange):
+ return exchange.get_measurement("byteDrops").get_value()
+
class ExchangeView(Widget):
def __init__(self, app, name):
super(ExchangeView, self).__init__(app, name)
@@ -142,7 +162,7 @@
def show_bindings(self, session):
self.tabs.show_mode(session, self.bindings);
- def render_title(self, session, exchange):
+ def get_title(self, session, exchange):
return "Exchange '%s'" % exchange.name
def render_name(self, session, exchange):
@@ -165,8 +185,8 @@
return fmt_datetime(datetime.utcnow())
class ExchangeBindingSet(ItemSet):
- def render_title(self, session, exchange):
- return "Queue Bindings (%i)" % len(exchange.binding_items())
+ def get_title(self, session, exchange):
+ return "Queue Bindings %s" % fmt_count(len(exchange.binding_items()))
def get_items(self, session, exchange):
return sorted_by(exchange.binding_items(), "id")
@@ -233,6 +253,9 @@
return error is None
class ExchangeAdd(ExchangeForm):
+ def get_title(self, session, vhost):
+ return "Add Exchange to Host Template '%s'" % vhost.name
+
def process_cancel(self, session, vhost):
branch = session.branch()
self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
@@ -255,10 +278,10 @@
self.page().show_exchange(branch, exchange).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def render_title(self, session, vhost):
- return "Add Exchange to Host Template '%s'" % vhost.name
-
class ExchangeEdit(ExchangeForm):
+ def get_title(self, session, exchange):
+ return "Edit Exchange '%s'" % exchange.name
+
def process_cancel(self, session, exchange):
branch = session.branch()
self.page().show_exchange(branch, exchange).show_view(branch)
@@ -279,10 +302,10 @@
self.exchange_name.set(session, exchange.name)
self.type.set(session, exchange.type)
- def render_title(self, session, exchange):
- return "Edit Exchange '%s'" % exchange.name
+class ExchangeRemove(CuminConfirmForm):
+ def get_title(self, session, exchange):
+ return "Remove Exchange '%s'" % exchange.name
-class ExchangeRemove(CuminConfirmForm):
def process_cancel(self, session, exchange):
branch = session.branch()
self.page().show_exchange(branch, exchange).show_view(branch)
@@ -297,9 +320,6 @@
self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def render_title(self, session, exchange):
- return "Remove Exchange '%s'" % exchange.name
-
def render_submit_content(self, session, exchange):
return "Yes, Remove Exchange '%s'" % exchange.name
@@ -313,7 +333,7 @@
self.add_tab(self.StatisticsCurrent(app, "current"))
self.add_tab(self.StatisticsHistory(app, "history"))
- def render_title(self, session, exchange):
+ def get_title(self, session, exchange):
return "Statistics"
class StatisticsCurrent(Widget):
@@ -322,11 +342,11 @@
self.add_child(MeasurementSet(app, "general_stats",
"general"))
- def render_title(self, session, exchange):
+ def get_title(self, session, exchange):
return "Current"
class StatisticsHistory(Widget):
- def render_title(self, session, queue):
+ def get_title(self, session, queue):
return "History"
def render_received_chart_url(self, session, queue):
@@ -340,8 +360,8 @@
% queue.id
class ExchangeProducerSet(ItemSet):
- def render_title(self, session, queue):
- return "Producers (%i)" % len(queue.producer_items())
+ def get_title(self, session, queue):
+ return "Producers %s" % fmt_count(len(queue.producer_items()))
def get_items(self, session, queue):
return sorted_by(queue.producer_items())
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-11-08 04:26:36 UTC (rev 1266)
@@ -83,6 +83,36 @@
}())
</script>
+[ExchangeStatus.html]
+<div id="{id}" class="{class}">
+ <h2>Exchange Status</h2>
+
+ <div>{status_info}</div>
+
+ <table>
+ <tr>
+ <th></th>
+ <th style="width: 35%;"
class="ralign">Messages</th>
+ <th style="width: 35%;" class="ralign">Bytes</th>
+ </tr>
+ <tr>
+ <th>Received</th>
+ <td class="ralign">{messages_received}</td>
+ <td class="ralign">{bytes_received}</td>
+ </tr>
+ <tr>
+ <th>Routed</th>
+ <td class="ralign">{messages_routed}</td>
+ <td class="ralign">{bytes_routed}</td>
+ </tr>
+ <tr>
+ <th>Dropped</th>
+ <td class="ralign">{messages_dropped}</td>
+ <td class="ralign">{bytes_dropped}</td>
+ </tr>
+ </table>
+</div>
+
[ExchangeView.html]
{status}
Modified: mgmt/cumin/python/cumin/formats.py
===================================================================
--- mgmt/cumin/python/cumin/formats.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/formats.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -2,6 +2,9 @@
from util import *
+def fmt_count(count):
+ return "<span class=\"count\">(%i)</count>" % count
+
def fmt_datetime(dtime):
return dtime.strftime("%d %b %Y %H:%M")
Modified: mgmt/cumin/python/cumin/measurement.strings
===================================================================
--- mgmt/cumin/python/cumin/measurement.strings 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/measurement.strings 2007-11-08 04:26:36 UTC (rev 1266)
@@ -13,7 +13,7 @@
[MeasurementSet.item_html]
<tr>
- <th class="label">{item_title}</th>
+ <th>{item_title}</th>
<td class="ralign">{item_value}</td>
<td class="ralign">{item_extra}</td>
</tr>
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/model.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -590,9 +590,8 @@
writer.write("<name>%s</name>" % self.name)
writer.write("<latency-priority>%s</latency-priority>" \
% self.latency_priority)
- writer.write("<message-count>%i</message-count>" %
self.message_count)
- writer.write("<error-count>%i</error-count>" %
self.error_count)
- writer.write("<warning-count>%i</warning-count>" %
self.warning_count)
+ writer.write("<error-count>%i</error-count>" %
len(self.errors))
+ writer.write("<warning-count>%i</warning-count>" %
len(self.warnings))
for realm in self.realm_items():
writer.write("<realm ref=\"realm-%i\"/>" %
realm.id)
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/page.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -129,7 +129,7 @@
self.show_view(branch)
return branch.marshal()
- def render_title(self, session, model):
+ def get_title(self, session, model):
return "Red Hat Messaging"
def render_frames(self, session, object):
@@ -164,21 +164,23 @@
mode.set_object(session, group)
return mode
- def render_title(self, session, model):
+ def get_title(self, session, model):
return "Red Hat Messaging"
class BrokerTab(BrokerBrowser):
- def render_title(self, session, model):
- return "Brokers (%i)" % len(model.get_brokers())
+ def get_title(self, session, model):
+ return "Brokers %s" % fmt_count(len(model.get_brokers()))
class BrokerProfileTab(BrokerProfileSet):
- def render_title(self, session, model):
- return "Broker Profiles (%i)" % len(model.get_broker_profiles())
+ def get_title(self, session, model):
+ return "Broker Profiles %s" % \
+ fmt_count(len(model.get_broker_profiles()))
class BrokerClusterTab(BrokerClusterSet):
- def render_title(self, session, model):
- return "Broker Clusters (%i)" % len(model.get_broker_clusters())
+ def get_title(self, session, model):
+ return "Broker Clusters %s" % \
+ fmt_count(len(model.get_broker_clusters()))
class TagTab(Widget):
- def render_title(self, session, model):
+ def get_title(self, session, model):
return "Tags"
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/page.strings 2007-11-08 04:26:36 UTC (rev 1266)
@@ -541,6 +541,11 @@
display: inline;
}
+span.count {
+ font-size: 0.9em;
+ color: #999;
+}
+
[CuminPage.html]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@@ -548,7 +553,9 @@
<head>
<title>{title}</title>
<link rel="stylesheet" type="text/css"
href="cumin.css"/>
+ <!-- XXX import this via cumin.js instead -->
<script src="resource?name=wooly.js"> </script>
+ <script src="cumin.js"> </script>
</head>
<body class="{class}">
<div id="head">
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -20,7 +20,7 @@
self.unit = UnitSwitch(app, "unit")
self.add_child(self.unit)
- def render_title(self, session, vhost):
+ def get_title(self, session, vhost):
return "Queues (%s)" % len(vhost.queue_items())
def render_unit_singular(self, session, vhost):
@@ -104,7 +104,7 @@
queue.get_measurement("bindings").link_cb = show_bindings
return queue
- def render_title(self, session, queue):
+ def get_title(self, session, queue):
return "Queue '%s'" % queue.name
class QueueStatus(CuminStatus):
@@ -114,11 +114,11 @@
def render_consumers(self, session, queue):
return queue.get_measurement("consumers").get_value()
- def render_message_enqueues(self, session, queue):
+ def render_messages_enqueued(self, session, queue):
value = queue.get_measurement("msgTotalEnqueues").get_rate()
return fmt_rate(value, "msg", "sec")
- def render_message_dequeues(self, session, queue):
+ def render_messages_dequeued(self, session, queue):
value = queue.get_measurement("msgTotalDequeues").get_rate()
return fmt_rate(value, "msg", "sec")
@@ -129,11 +129,11 @@
value = queue.get_measurement("msgDepth").get_rate()
return fmt_rate(value, "msg", "sec")
- def render_byte_enqueues(self, session, queue):
+ def render_bytes_enqueued(self, session, queue):
value = queue.get_measurement("byteTotalEnqueues").get_rate()
return fmt_rate(value, "byte", "sec")
- def render_byte_dequeues(self, session, queue):
+ def render_bytes_dequeued(self, session, queue):
value = queue.get_measurement("byteTotalDequeues").get_rate()
return fmt_rate(value, "byte", "sec")
@@ -168,7 +168,7 @@
def show_bindings(self, session):
self.tabs.show_mode(session, self.bindings);
- def render_title(self, session, queue):
+ def get_title(self, session, queue):
return "Queue '%s'" % queue.name
def render_name(self, session, queue):
@@ -187,8 +187,8 @@
return fmt_datetime(datetime.utcnow())
class QueueBindingSet(ItemSet):
- def render_title(self, session, queue):
- return "Exchange Bindings (%i)" % len(queue.binding_items())
+ def get_title(self, session, queue):
+ return "Exchange Bindings %s" % fmt_count(len(queue.binding_items()))
def get_items(self, session, queue):
return sorted_by(queue.binding_items(), "id")
@@ -277,7 +277,7 @@
self.page().show_queue(branch, queue).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def render_title(self, session, vhost):
+ def get_title(self, session, vhost):
return "Add Queue to Host Template '%s'" % vhost.name
class QueueEdit(QueueForm):
@@ -303,10 +303,13 @@
self.queue_name.set(session, queue.name)
self.latency_priority.set(session, queue.latency_priority)
- def render_title(self, session, queue):
+ def get_title(self, session, queue):
return "Edit Queue '%s'" % queue.name
class QueueRemove(CuminConfirmForm):
+ def get_title(self, session, queue):
+ return "Remove Queue '%s'" % queue.name
+
def process_cancel(self, session, queue):
branch = session.branch()
self.page().show_queue(branch, queue).show_view(branch)
@@ -321,9 +324,6 @@
self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def render_title(self, session, queue):
- return "Remove Queue '%s'" % queue.name
-
def render_submit_content(self, session, queue):
return "Yes, Remove Queue '%s'" % queue.name
@@ -340,7 +340,7 @@
self.binding_key = TextInput(app, "binding_key", self)
self.add_child(self.binding_key)
- def render_title(self, session, queue):
+ def get_title(self, session, queue):
return "Add Binding to Queue '%s'" % queue.name
def process_cancel(self, session, queue):
@@ -394,7 +394,7 @@
self.process_cancel(session, binding)
- def render_title(self, session, binding):
+ def get_title(self, session, binding):
return "Remove Binding"
def render_submit_content(self, session, binding):
@@ -410,7 +410,7 @@
self.add_tab(self.StatisticsCurrent(app, "current"))
self.add_tab(self.StatisticsHistory(app, "history"))
- def render_title(self, session, queue):
+ def get_title(self, session, queue):
return "Statistics"
class StatisticsCurrent(Widget):
@@ -427,11 +427,11 @@
self.add_child(MeasurementSet \
(app, "transaction_stats",
"transaction"))
- def render_title(self, session, queue):
+ def get_title(self, session, queue):
return "Current"
class StatisticsHistory(Widget):
- def render_title(self, session, queue):
+ def get_title(self, session, queue):
return "History"
def render_depth_chart_url(self, session, queue):
@@ -445,8 +445,8 @@
% queue.id
class QueueConsumerSet(ItemSet):
- def render_title(self, session, queue):
- return "Consumers (%i)" % len(queue.consumer_items())
+ def get_title(self, session, queue):
+ return "Consumers %s" % fmt_count(len(queue.consumer_items()))
def get_items(self, session, queue):
return sorted_by(queue.consumer_items())
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-08 04:26:36 UTC (rev 1266)
@@ -92,9 +92,6 @@
<script defer="defer">
(function() {
var updateStatus = function(xml, elem) {
- var mcount = xml.elems("message-count").next().text().get();
- var messages = mcount + " " + (mcount == "1" &&
"message" || "messages");
-
var ecount = xml.elems("error-count").next().text().get();
var errors = ecount + " " + (ecount == "1" &&
"error" || "errors");
@@ -102,19 +99,21 @@
var warnings = wcount + " " + (wcount == "1" &&
"warning" || "warnings");
if (ecount != "0") {
- elem.node.className = "QueueStatus mstatus red";
+ elem.node.className = "mstatus red";
} else if (wcount != "0") {
- elem.node.className = "QueueStatus mstatus yellow";
+ elem.node.className = "mstatus yellow";
} else {
- elem.node.className = "QueueStatus mstatus green";
+ elem.node.className = "mstatus green";
}
var divs = elem.elems("div");
- divs.next().set(messages + " in queue");
divs.next().set(errors + ", " + warnings);
+
+ // XXX
+ //wooly.doc().elem("{id}.menq").text().set("hmm")
}
- //wooly.setIntervalUpdate("{id}", "{url}", updateStatus, 3000);
+ wooly.setIntervalUpdate("{id}", "{url}", updateStatus, 3000);
}())
</script>
<div id="{id}" class="{class}">
@@ -129,24 +128,24 @@
<th style="width: 35%;" class="ralign">Bytes</th>
</tr>
<tr>
- <th>Enqueues</th>
- <td class="ralign">{message_enqueues}</td>
- <td class="ralign">{byte_enqueues}</td>
+ <th>Enqueued</th>
+ <td id="{id}.menq"
class="ralign">{messages_enqueued}</td>
+ <td id="{id}.benq"
class="ralign">{bytes_enqueued}</td>
</tr>
<tr>
- <th>Dequeues</th>
- <td class="ralign">{message_dequeues}</td>
- <td class="ralign">{byte_dequeues}</td>
+ <th>Dequeued</th>
+ <td id="{id}.mdeq"
class="ralign">{messages_dequeued}</td>
+ <td id="{id}.bdeq"
class="ralign">{bytes_dequeued}</td>
</tr>
<tr>
<th>Depth</th>
- <td class="ralign">{message_depth}</td>
- <td class="ralign">{byte_depth}</td>
+ <td id="{id}.mdep"
class="ralign">{message_depth}</td>
+ <td id="{id}.bdep"
class="ralign">{byte_depth}</td>
</tr>
<tr>
<th>Accel.</th>
- <td class="ralign">{message_depth_accel}</td>
- <td class="ralign">{byte_depth_accel}</td>
+ <td id="{id}.mdepaccel"
class="ralign">{message_depth_accel}</td>
+ <td id="{id}.bdepaccel"
class="ralign">{byte_depth_accel}</td>
</tr>
</table>
</div>
Modified: mgmt/cumin/python/cumin/realm.py
===================================================================
--- mgmt/cumin/python/cumin/realm.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/realm.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -10,8 +10,8 @@
strings = StringCatalog(__file__)
class RealmSet(ItemSet):
- def render_title(self, session, vhost):
- return "Realms (%i)" % len(vhost.realm_items())
+ def get_title(self, session, vhost):
+ return "Realms %s" % fmt_count(len(vhost.realm_items()))
def get_items(self, session, vhost):
return sorted_by(vhost.realm_items())
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/cumin/virtualhost.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -12,8 +12,9 @@
strings = StringCatalog(__file__)
class VirtualHostSet(ItemSet):
- def render_title(self, session, model):
- return "Functional Hosts (%i)" % len(model.get_virtual_hosts())
+ def get_title(self, session, model):
+ return "Functional Hosts %s" % \
+ fmt_count(len(model.get_virtual_hosts()))
def get_items(self, session, model):
return sorted_by(model.get_virtual_hosts())
@@ -56,7 +57,7 @@
self.client.set_object(session, client)
return self.show_mode(session, self.client)
- def render_title(self, session, vhost):
+ def get_title(self, session, vhost):
return "Functional Host '%s'" % vhost.name
class VirtualHostView(Widget):
@@ -70,7 +71,7 @@
self.tabs.add_tab(ExchangeSet(app, "exchanges"))
self.tabs.add_tab(ClientSet(app, "clients"))
- def render_title(self, session, vhost):
+ def get_title(self, session, vhost):
return "Functional Host '%s'" % vhost.name
def render_name(self, session, vhost):
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/wooly/__init__.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -84,13 +84,16 @@
self.parameters.append(parameter)
parameter.widget = self
+ @classmethod
+ def get_module_strings(cls):
+ module = sys.modules[cls.__module__]
+ return module.__dict__.get("strings")
+
def get_string(self, key):
for cls in self.__class__.__mro__:
str = None
- module = sys.modules[cls.__module__]
+ strs = cls.get_module_strings()
- strs = module.__dict__.get("strings")
-
if strs:
str = strs.get(cls.__name__ + "." + key)
@@ -159,6 +162,9 @@
return writer.to_string()
+ def get_title(self, session, object):
+ return None
+
def render_id(self, session, object):
return self.path()
@@ -169,7 +175,7 @@
return session.marshal()
def render_title(self, session, object):
- return None
+ return self.get_title(session, object)
def render_content(self, session, object):
writer = Writer()
@@ -321,10 +327,10 @@
Gets a list of parameters saved for this page and its current
frame.
- This, combined with *_current_frame, serves to discard state
- that is out of scope. The current pattern is to preserve the
- state of parameters in the current frame and all of its
- ancestor frames.
+ This, combined with [gs]et_current_frame, serves to discard
+ state that is out of scope. The current pattern is to
+ preserve the state of parameters in the current frame and all
+ of its ancestor frames.
"""
frame = self.get_current_frame(session)
@@ -350,11 +356,14 @@
self.widgets = list()
self.widget_index = None
+ self.widget_classes = set()
+
self.parameters = list()
self.parameter_index = None
self.finder = ResourceFinder()
self.cached_css = None
+ self.cached_javascript = None
self.debug = None
@@ -384,6 +393,7 @@
raise Exception()
self.widgets.append(widget)
+ self.widget_classes.add(widget.__class__)
def get_widget(self, key):
if not self.widget_index:
@@ -419,21 +429,43 @@
def get_resource(self, name):
return self.finder.find(name)
+ # XXX move this to CssPage
def get_css(self):
if not self.cached_css:
writer = Writer()
- for widget in self.widgets:
- css = widget.get_string("css")
+ for cls in sorted(self.widget_classes):
+ strs = cls.get_module_strings()
- if css:
- writer.write(css)
- writer.write("\r\n") # HTTP newline
+ if strs:
+ css = strs.get(cls.__name__ + ".css")
+ if css:
+ writer.write(css)
+ writer.write("\r\n") # HTTP newline
+
self.cached_css = writer.to_string()
return self.cached_css
+ def get_javascript(self):
+ if not self.cached_javascript:
+ writer = Writer()
+
+ for cls in sorted(self.widget_classes):
+ strs = cls.get_module_strings()
+
+ if strs:
+ javascript = strs.get(cls.__name__ + ".javascript")
+
+ if javascript:
+ writer.write(javascript)
+ writer.write("\r\n")
+
+ self.cached_javascript = writer.to_string()
+
+ return self.cached_javascript
+
def clear_caches(self):
self.cached_css = None
Modified: mgmt/cumin/python/wooly/pages.py
===================================================================
--- mgmt/cumin/python/wooly/pages.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/wooly/pages.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -17,6 +17,21 @@
def do_render(self, session, object):
return self.app.get_css()
+class JavascriptPage(Page):
+ def __init__(self, app, name):
+ super(JavascriptPage, self).__init__(app, name)
+
+ self.then = datetime.utcnow()
+
+ def get_last_modified(self, session):
+ return self.then
+
+ def get_content_type(self, session):
+ return "text/javascript"
+
+ def do_render(self, session, object):
+ return self.app.get_javascript()
+
class ResourcePage(Page):
def __init__(self, app, name):
super(ResourcePage, self).__init__(app, name)
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/wooly/widgets.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -10,7 +10,7 @@
self.modes = list()
- self.mode = Parameter(app, "mode")
+ self.mode = Parameter(app, "m")
self.add_parameter(self.mode)
def add_mode(self, mode):
@@ -75,7 +75,7 @@
return smode == mode and "selected" or ""
def render_tab_content(self, session, mode):
- return mode.render_title(session, self.object.get(session))
+ return mode.get_title(session, self.object.get(session))
class Link(Widget):
def update_session(self, session, object):
Modified: mgmt/cumin/python/wooly/widgets.strings
===================================================================
--- mgmt/cumin/python/wooly/widgets.strings 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/cumin/python/wooly/widgets.strings 2007-11-08 04:26:36 UTC (rev 1266)
@@ -2,7 +2,7 @@
{mode}
[TabSet.css]
-ul.TabSet.tabs {
+.TabSet.tabs {
padding: 0;
margin: 0;
list-style: none;
@@ -13,7 +13,7 @@
}
.TabSet.tabs li a {
- padding: 0.25em 0.5em;
+ padding: 0.275em 0.5em;
border-top: 1px solid #ccc;
border-right: 1px solid #ccc;
background-color: #f7f7f7;
Modified: mgmt/misc/boneyard.py
===================================================================
--- mgmt/misc/boneyard.py 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/misc/boneyard.py 2007-11-08 04:26:36 UTC (rev 1266)
@@ -17,8 +17,8 @@
def set_object(self, session, group):
return self.param.set(session, group)
- def render_title(self, session, group):
- return "Servers (%i)" % len(self.app.model.get_servers())
+ def get_title(self, session, group):
+ return "Servers %s" % fmt_count(len(self.app.model.get_servers()))
def render_all_servers_link(self, session, group):
class_ = group is None and "selected"
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-11-08 03:59:29 UTC (rev 1265)
+++ mgmt/notes/justin-todo.txt 2007-11-08 04:26:36 UTC (rev 1266)
@@ -4,29 +4,19 @@
* Queue: Add a msg enq rate msg deq rate chart
- * Right now, non cumin pages don't print their stack traces in the
- log
-
- * Right now we're calling render_title outside of render in order to
- produce tab labels, for instance. This is not good, especially in
- cases where get_object is overriden and that fact is not reflected
- in the render_title calls. Perhaps introduce a get_title to solve
- this.
-
- * Add totals to client msgs produced
-
- * Add rolled up stats for objs other than queues
-
* Pagination and sort in tables
* Ajaxify status boxes
* Ajaxify charts
- * Add a none option to the inital group select in broker register
-
Deferred
+ * Think about making css and jscript pages produce their document in
+ some kind of widget-tree traversal order
+
+ * We're generating lots of duplicate css rules
+
* The granularity of radio and checkbox disabling seems to be off
* Rename Widget.name to .__name