Author: justi9
Date: 2007-10-14 13:55:07 -0400 (Sun, 14 Oct 2007)
New Revision: 1062
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Adds navigation to the group edit form.
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-14 14:32:02 UTC (rev 1061)
+++ mgmt/cumin/python/cumin/page.py 2007-10-14 17:55:07 UTC (rev 1062)
@@ -124,6 +124,9 @@
self.group_add = ServerGroupAdd(app, "group_add")
self.add_child(self.group_add)
+ self.group_edit = ServerGroupEdit(app, "group_edit")
+ self.add_child(self.group_edit)
+
def get_object(self, session, object):
return self.app.model
@@ -145,6 +148,9 @@
def show_group_add(self, session):
return self.show_mode(session, self.group_add)
+ def show_group_edit(self, session):
+ return self.show_mode(session, self.group_edit)
+
def render_title(self, session, model):
return "<img src=\"resource?name=logo.png\"/>"
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-14 14:32:02 UTC (rev 1061)
+++ mgmt/cumin/python/cumin/server.py 2007-10-14 17:55:07 UTC (rev 1062)
@@ -147,28 +147,42 @@
self.servers = self.BrowserServers(app, "servers")
self.add_child(self.servers)
- def render_title(self, session, model):
- return "Servers (%i)" % len(model.get_servers())
+ def get_object(self, session, object):
+ return self.param.get(session)
- def render_all_servers_link(self, session, model):
- class_ = self.param.get(session) is None and "selected"
+ def set_server_group(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 render_all_servers_link(self, session, group):
+ class_ = group is None and "selected"
+
branch = session.branch()
- self.param.set(branch, None)
+ self.set_server_group(branch, None)
return link(branch.marshal(), "All Servers", class_)
- def render_add_group_href(self, session, model):
+ def render_edit_group_href(self, session, group):
+ if group:
+ branch = session.branch()
+ frame = self.page().main.show_group_edit(branch)
+ frame.set_server_group(branch, group)
+ return branch.marshal()
+
+ def render_add_group_href(self, session, group):
branch = session.branch()
self.page().main.show_group_add(branch)
return branch.marshal()
- def render_remove_group_href(self, session, model):
- group = self.param.get(session)
-
+ def render_remove_group_href(self, session, group):
if group:
branch = session.branch()
return branch.marshal()
+ def render_groups(self, session, group):
+ return self.groups.render(session, self.app.model)
+
class BrowserGroups(Widget):
def __init__(self, app, name):
super(ServerBrowser.BrowserGroups, self).__init__(app, name)
@@ -207,13 +221,11 @@
return mlink(branch.marshal(), "ServerGroup", group.name,
selected)
class BrowserServers(ServerSet):
- def get_items(self, session, model):
- group = self.parent.param.get(session)
-
+ def get_items(self, session, group):
if group:
- return sorted(group.server_items(), cmp, lambda x: x.name)
+ return csorted(group.server_items())
else:
- return sorted(model.get_servers(), cmp, lambda x: x.name)
+ return csorted(self.app.model.get_servers())
class ServerGroupParameter(Parameter):
def do_unmarshal(self, string):
@@ -245,7 +257,7 @@
self.param = ServerGroupParameter(app, "id")
self.add_parameter(self.param)
- def get_object(self, session):
+ def get_object(self, session, object):
return self.param.get(session)
def set_server_group(self, session, group):
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-14 14:32:02 UTC (rev 1061)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-14 17:55:07 UTC (rev 1062)
@@ -102,9 +102,6 @@
<ul class="actions">
<li><a href="{add_group_href}">Add Group</a></li>
- </ul>
-
- <ul class="actions">
<li><a href="{edit_group_href}">Edit
Group</a></li>
<li><a href="{remove_group_href}">Remove
Group</a></li>
</ul>