Author: justi9
Date: 2007-10-08 17:47:52 -0400 (Mon, 08 Oct 2007)
New Revision: 972
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/cluster.strings
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/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
mgmt/cumin/python/cumin/virtualhost.py
mgmt/cumin/python/cumin/virtualhost.strings
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/model.py
Log:
* Add an alphabetical sort to lists
* Change demo object naming to sort better
* Make nav links consistent
* Add some functions to wooly/widgets.py for common page content:
link, mlink, none
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-08 21:47:52 UTC (rev 972)
@@ -16,13 +16,11 @@
def get_items(self, session, model):
return sorted(model.get_clusters(), cmp, lambda x: x.name)
- def render_item_href(self, session, cluster):
+ def render_item_link(self, session, cluster):
branch = session.branch()
self.page().show_cluster(branch, cluster).show_view(branch)
- return branch.marshal()
- def render_item_name(self, session, cluster):
- return cluster.name
+ return mlink(branch.marshal(), "Cluster", cluster.name)
class ClusterParameter(Parameter):
def do_unmarshal(self, string):
Modified: mgmt/cumin/python/cumin/cluster.strings
===================================================================
--- mgmt/cumin/python/cumin/cluster.strings 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/cluster.strings 2007-10-08 21:47:52 UTC (rev 972)
@@ -1,14 +1,14 @@
[ClusterSet.html]
<table class="ClusterSet mobjects">
<tr>
- <th>Name</th>
+ <th>Cluster</th>
</tr>
{items}
</table>
[ClusterSet.item_html]
<tr>
- <td><a href="{item_href}">{item_name}</a></td>
+ <td>{item_link}</td>
</tr>
[ClusterView.html]
@@ -45,7 +45,7 @@
[ClusterServers.item_html]
<tr>
- <td><a href="{item_href}">{item_name}</a></td>
+ <td>{item_link}</td>
<td>0 errors, 0 warnings</td>
<td><a class="action"
href="">Remove</a></td>
</tr>
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/exchange.py 2007-10-08 21:47:52 UTC (rev 972)
@@ -42,20 +42,15 @@
def get_items(self, session, vhost):
return sorted(vhost.exchange_items(), cmp, lambda x: x.name)
- def render_item_href(self, session, exchange):
+ def render_item_link(self, session, exchange):
branch = session.branch()
self.page().show_exchange(branch, exchange).show_view(branch)
- return branch.marshal()
- def render_item_name(self, session, exchange):
- return exchange.name
+ return mlink(branch.marshal(), "Exchange", exchange.name)
- def render_item_flags(self, session, exchange):
- flags = list()
- return ", ".join(flags)
-
def render_item_config(self, session, exchange):
- return "%i bindings" % len(exchange.binding_items())
+ count = len(exchange.binding_items())
+ return "%i %s" % (count, count == 1 and "binding" or
"bindings")
def render_item_status(self, session, exchange):
return "2 errors"
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-10-08 21:47:52 UTC (rev 972)
@@ -14,7 +14,7 @@
[ExchangeSet.html]
<table class="ExchangeSet mobjects">
<tr>
- <th>Name</th>
+ <th>Exchange</th>
<th>Configuration</th>
<th>Status</th>
</tr>
@@ -23,7 +23,7 @@
[ExchangeSet.item_html]
<tr>
- <td><a href="{item_href}">{item_name}</a></td>
+ <td>{item_link}</a></td>
<td>{item_config}</td>
<td>{item_status}</td>
</tr>
@@ -75,7 +75,7 @@
<h1><img src="resource?name=exchange-36.png"> {title}</h1>
<dl class="properties">
- <dt>Exchange Name</dt><dd>{exchange_name}</dd>
+ <dt>Name</dt><dd>{exchange_name}</dd>
<dt>Type</dt><dd>{type}</dd>
</dl>
@@ -99,7 +99,7 @@
[ExchangeBindingSet.item_html]
<tr>
- <td><a href="{item_href}">{item_name}</a></td>
+ <td><a href="{item_href}">Queue
'{item_name}'</a></td>
<td>{item_routing_key}</td>
<td><a class="action"
href="">Remove</a></td>
</tr>
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-08 21:47:52 UTC (rev 972)
@@ -26,8 +26,8 @@
color: #06c;
}
-#head, #foot {
- padding: 0.5em 0.75em 0.4em 0.75em;
+#head {
+ padding: 0.4em 0.75em 0.2em 0.75em;
}
#head {
@@ -39,7 +39,7 @@
}
#logo {
- vertical-align: -15%;
+ vertical-align: -20%;
}
h1, h2 {
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-08 21:47:52 UTC (rev 972)
@@ -34,41 +34,19 @@
def get_items(self, session, vhost):
return sorted(vhost.queue_items(), cmp, lambda x: x.name)
- def render_item_href(self, session, queue):
+ def render_item_link(self, session, queue):
branch = session.branch()
self.page().show_queue(branch, queue).show_view(branch)
- return branch.marshal()
+ return mlink(branch.marshal(), "Queue", queue.name)
+
def render_item_name(self, session, queue):
return queue.name
- def render_item_flags(self, session, queue):
- flags = list()
-
- if queue.is_durable:
- flags.append("Durable")
-
- if queue.is_auto_delete:
- flags.append("Auto Delete")
-
- return ", ".join(flags)
-
def render_item_config(self, session, queue):
- bindings = list()
-
- for binding in sorted(queue.binding_items()):
- name = binding.get_exchange().name
- key = binding.routing_key
+ count = len(queue.binding_items())
+ return "%i %s" % (count, count == 1 and "binding" or
"bindings")
- branch = session.branch()
- self.page().show_exchange(branch, binding.get_exchange())
- href = branch.marshal()
-
- bindings.append("<a href=\"%s\">exchange
'%s'</a> with key '%s'"
- % (href, name, key))
-
- return ", ".join(bindings)
-
def render_item_status(self, session, queue):
return "%i messages in queue<br/>%i errors, %i warnings" \
% (queue.message_count, queue.error_count, queue.warning_count)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-08 21:47:52 UTC (rev 972)
@@ -8,8 +8,8 @@
[QueueSet.html]
<table class="QueueSet mobjects">
<tr>
- <th>Name</th>
- <th>Exchanges</th>
+ <th>Queue</th>
+ <th>Configuration</th>
<th>Status</th>
</tr>
{items}
@@ -17,7 +17,7 @@
[QueueSet.item_html]
<tr>
- <td><a href="{item_href}">{item_name}</a></td>
+ <td>{item_link}</a></td>
<td>{item_config}</td>
<td>{item_status}</td>
</tr>
@@ -109,7 +109,7 @@
<h1><img src="resource?name=queue-36.png"> {title}</h1>
<dl class="properties">
- <dt>Queue Name</dt><dd>{queue_name}</dd>
+ <dt>Name</dt><dd>{queue_name}</dd>
<dt>Latency Tuning</dt><dd>{latency_tuning}</dd>
</dl>
@@ -134,7 +134,7 @@
[QueueBindingSet.item_html]
<tr>
- <td><a href="{item_href}">exchange
'{item_name}'</a></td>
+ <td><a href="{item_href}">Exchange
'{item_name}'</a></td>
<td>{item_routing_key}</td>
<td><a class="action"
href="{item_remove_href}">Remove</a></td>
</tr>
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/server.py 2007-10-08 21:47:52 UTC (rev 972)
@@ -13,28 +13,23 @@
def get_items(self, session, model):
return sorted(model.get_servers(), cmp, lambda x: x.name)
- def render_item_href(self, session, server):
+ def render_item_link(self, session, server):
branch = session.branch()
self.page().show_server(branch, server).show_view(branch)
- return branch.marshal()
- def render_item_name(self, session, server):
- return server.name
+ return mlink(branch.marshal(), "Server", server.name)
- def render_item_cluster_name(self, session, server):
+ def render_item_cluster_link(self, session, server):
cluster = server.get_cluster()
if cluster:
- return cluster.name
-
- def render_item_cluster_href(self, session, server):
- cluster = server.get_cluster()
-
- if cluster:
branch = session.branch()
self.page().show_cluster(branch, cluster).show_view(branch)
- return branch.marshal()
+ return mlink(branch.marshal(), "Cluster", cluster.name)
+ else:
+ return none()
+
class ServerParameter(Parameter):
def do_unmarshal(self, string):
return self.app.model.get_server(int(string))
@@ -101,6 +96,19 @@
def render_name(self, session, server):
return server.name
+ def render_cluster_link(self, session, server):
+ html = None
+ cluster = server.get_cluster()
+
+ if cluster:
+ branch = session.branch()
+ self.page().show_cluster(session, cluster).show_view(branch)
+ html = mlink(branch.marshal(), "Cluster", cluster.name)
+ else:
+ html = none()
+
+ return html
+
class ServerLog(Widget):
def render_title(self, session, server):
return "Log Messages"
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-08 21:47:52 UTC (rev 972)
@@ -1,7 +1,7 @@
[ServerSet.html]
<table class="ServerSet mobjects">
<tr>
- <th>Name</th>
+ <th>Server</th>
<th>Cluster</th>
<th>Status</th>
</tr>
@@ -10,8 +10,8 @@
[ServerSet.item_html]
<tr>
- <td><a href="{item_href}">{item_name}</a></td>
- <td><a
href="{item_cluster_href}">{item_cluster_name}</a></td>
+ <td>{item_link}</td>
+ <td>{item_cluster_link}</td>
<td>0 errors, 0 warnings</td>
</tr>
@@ -27,6 +27,7 @@
<dl class="properties">
<dt>Name</dt><dd>{name}</dd>
+ <dt>Cluster</dt><dd>{cluster_link}</dd>
</dl>
<ul class="actions">
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/virtualhost.py 2007-10-08 21:47:52 UTC (rev 972)
@@ -15,13 +15,11 @@
def get_items(self, session, server):
return sorted(server.virtual_host_items(), cmp, lambda x: x.name)
- def render_item_href(self, session, vhost):
+ def render_item_link(self, session, vhost):
branch = session.branch()
self.page().show_virtual_host(branch, vhost)
- return branch.marshal()
- def render_item_name(self, session, vhost):
- return vhost.name
+ return mlink(branch.marshal(), "Virtual Host", vhost.name)
class VirtualHostFrame(CuminFrame):
def __init__(self, app, name):
Modified: mgmt/cumin/python/cumin/virtualhost.strings
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.strings 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/virtualhost.strings 2007-10-08 21:47:52 UTC (rev 972)
@@ -1,7 +1,7 @@
[VirtualHostSet.html]
<table class="VirtualHostSet mobjects">
<tr>
- <th>Name</th>
+ <th>Virtual Host</th>
<th>Configuration</th>
<th>Status</th>
</tr>
@@ -10,7 +10,7 @@
[VirtualHostSet.item_html]
<tr>
- <td><a href="{item_href}">{item_name}</a></td>
+ <td>{item_link}</td>
<td>10 queues, 5 exchanges</td>
<td>2 errors, 10 warnings</td>
</tr>
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-08 21:47:52 UTC (rev 972)
@@ -4,6 +4,15 @@
strings = StringCatalog(__file__)
+def link(href, name):
+ return "<a href=\"%s\">%s</a>" % (href, name)
+
+def mlink(href, variety, name):
+ return "<a href=\"%s\">%s</a>" % (href, name)
+
+def none():
+ return "<em>None</em>"
+
class CuminFrame(Frame, ModeSet):
def do_process(self, session, object):
self.page().get_frames(session).append(self)
Modified: mgmt/cumin/python/wooly/model.py
===================================================================
--- mgmt/cumin/python/wooly/model.py 2007-10-08 20:01:52 UTC (rev 971)
+++ mgmt/cumin/python/wooly/model.py 2007-10-08 21:47:52 UTC (rev 972)
@@ -83,10 +83,8 @@
def remove(self, this, that):
if self.is_scalar():
- print "is_scalar"
self.set_scalar(this, None)
else:
- print "items(%s).remove(%s)" % (this.id, that.id)
self.items(this).remove(that)
def object_items(self, this):