Author: justi9
Date: 2007-10-10 09:34:25 -0400 (Wed, 10 Oct 2007)
New Revision: 993
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/cluster.strings
mgmt/cumin/python/cumin/page.py
Log:
Improves navigation to cluster servers.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-09 20:41:26 UTC (rev 992)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-10 13:34:25 UTC (rev 993)
@@ -20,6 +20,19 @@
return mlink(branch.marshal(), "Cluster", cluster.name)
+class ClusterServerSet(ItemSet):
+ def render_title(self, session, cluster):
+ return "Servers (%i)" % len(cluster.server_items())
+
+ def get_items(self, session, cluster):
+ return sorted(cluster.server_items(), cmp, lambda x: x.name)
+
+ def render_item_link(self, session, server):
+ branch = session.branch()
+ self.page().show_cluster_server(branch, server).show_view(branch)
+
+ return mlink(branch.marshal(), "Server", server.name)
+
class ClusterParameter(Parameter):
def do_unmarshal(self, string):
return self.app.model.get_cluster(int(string))
@@ -38,14 +51,22 @@
self.view = ClusterView(app, "view")
self.add_child(self.view)
+ self.server = ServerFrame(app, "server")
+ self.add_child(self.server)
+
def set_cluster(self, session, cluster):
self.param.set(session, cluster)
def show_view(self, session):
return self.show_mode(session, self.view)
+ def show_server(self, session, server):
+ self.server.set_server(session, server)
+ return self.show_mode(session, self.server)
+
def render_href(self, session, cluster):
branch = session.branch()
+ self.page().show_cluster(branch, cluster).show_view(branch)
return branch.marshal()
def render_title(self, session, cluster):
@@ -67,13 +88,9 @@
def render_name(self, session, cluster):
return cluster.name
- class ServerTab(ServerSet):
- def render_title(self, session, cluster):
- return "Servers (%i)" % len(cluster.server_items())
+ class ServerTab(ClusterServerSet):
+ pass
- def get_items(self, session, cluster):
- return sorted(cluster.server_items(), cmp, lambda x: x.name)
-
class VirtualHostTab(VirtualHostSet):
def render_title(self, session, cluster):
return "Virtual Hosts (%i)" % len(cluster.virtual_host_items())
Modified: mgmt/cumin/python/cumin/cluster.strings
===================================================================
--- mgmt/cumin/python/cumin/cluster.strings 2007-10-09 20:41:26 UTC (rev 992)
+++ mgmt/cumin/python/cumin/cluster.strings 2007-10-10 13:34:25 UTC (rev 993)
@@ -25,13 +25,16 @@
<dt>Name</dt><dd>{name}</dd>
</dl>
+ <ul class="actions">
+ <li><a href="">Shutdown Cluster</a></li>
+ </ul>
+
{tabs}
</div>
[ServerTab.html]
<ul class="actions">
<li><a href="">Add Server</a></li>
- <li><a href="">Shutdown Servers</a></li>
</ul>
<table class="mobjects">
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-09 20:41:26 UTC (rev 992)
+++ mgmt/cumin/python/cumin/page.py 2007-10-10 13:34:25 UTC (rev 993)
@@ -45,6 +45,10 @@
def show_cluster(self, session, cluster):
return self.main.show_cluster(session, cluster)
+ def show_cluster_server(self, session, server):
+ frame = self.main.show_cluster(session, server.get_cluster())
+ return frame.show_server(session, server)
+
def show_virtual_host(self, session, vhost):
return self.main.show_virtual_host(session, vhost)