Author: justi9
Date: 2007-10-14 00:30:43 -0400 (Sun, 14 Oct 2007)
New Revision: 1058
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Hook up the group add form to main view links.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-14 02:50:40 UTC (rev 1057)
+++ mgmt/cumin/python/cumin/server.py 2007-10-14 04:30:43 UTC (rev 1058)
@@ -155,6 +155,11 @@
self.param.set(branch, None)
return link(branch.marshal(), "All Servers", class_)
+ def render_add_group_href(self, session, model):
+ branch = session.branch()
+ self.page().main.show_group_add(branch)
+ return branch.marshal()
+
def render_remove_group_link(self, session, model):
group = self.param.get(session)
@@ -169,11 +174,6 @@
self.type_tmpl = Template(self, "type_html")
self.group_tmpl = Template(self, "group_html")
- def render_add_group_href(self, session, model):
- branch = session.branch()
- self.page().main.show_group_add(branch)
- return branch.marshal()
-
def get_items(self, session, model):
return sorted(model.get_server_group_types(), cmp, lambda x: x.name)
@@ -220,6 +220,16 @@
def do_marshal(self, group):
return str(group.id)
+class ServerGroupFrame(CuminFrame):
+ def __init__(self, app, name):
+ super(ServerGroupFrame, self).__init__(app, name)
+
+ self.add = ServerGroupAdd(app, "add")
+ self.add_child(self.add)
+
+ self.edit = ServerGroupEdit(app, "edit")
+ self.add_child(self.edit)
+
class ServerGroupForm(CuminForm):
def __init__(self, app, name):
super(ServerGroupForm, self).__init__(app, name)
@@ -232,7 +242,9 @@
return "Add Group"
def on_cancel(self, session, model):
- pass
+ branch = session.branch()
+ self.page().main.show_view(branch)
+ session.set_redirect(branch.marshal())
class ServerGroupEdit(ServerGroupForm):
def render_title(self, session, group):
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-14 02:50:40 UTC (rev 1057)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-14 04:30:43 UTC (rev 1058)
@@ -92,7 +92,12 @@
[ServerBrowser.html]
<div class="ServerBrowser groups">
<ul><li>{all_servers_link}</li></ul>
+
{groups}
+
+ <ul class="actions">
+ <li><a href="{add_group_href}">Add Group</a>
+ </ul>
</div>
<div class="ServerBrowser servers">
<ul class="actions">
@@ -107,10 +112,6 @@
[BrowserGroups.html]
{types}
-<ul class="actions">
- <li><a href="{add_group_href}">Add Group</a>
-</ul>
-
[BrowserGroups.type_html]
<h2>{type_name}</h2>
<ul>{groups}</ul>