Author: justi9
Date: 2007-10-13 22:50:40 -0400 (Sat, 13 Oct 2007)
New Revision: 1057
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
mgmt/cumin/python/wooly/__init__.py
Log:
Add a preliminary version of the server group form.
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-14 02:47:50 UTC (rev 1056)
+++ mgmt/cumin/python/cumin/page.py 2007-10-14 02:50:40 UTC (rev 1057)
@@ -115,6 +115,9 @@
self.cluster = ClusterFrame(app, "cluster")
self.add_child(self.cluster)
+ self.group_add = ServerGroupAdd(app, "group_add")
+ self.add_child(self.group_add)
+
def get_object(self, session):
return self.app.model
@@ -133,6 +136,9 @@
self.cluster.set_cluster(session, cluster)
return self.show_mode(session, self.cluster)
+ def show_group_add(self, session):
+ return self.show_mode(session, self.group_add)
+
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 02:47:50 UTC (rev 1056)
+++ mgmt/cumin/python/cumin/server.py 2007-10-14 02:50:40 UTC (rev 1057)
@@ -169,6 +169,11 @@
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)
@@ -215,45 +220,20 @@
def do_marshal(self, group):
return str(group.id)
-class ServerGroupFrame(CuminFrame):
+class ServerGroupForm(CuminForm):
def __init__(self, app, name):
- super(ServerGroupFrame, self).__init__(app, name)
+ super(ServerGroupForm, self).__init__(app, name)
- self.param = ServerGroupParameter(app, "id")
- self.add_parameter(self.param)
- self.set_object_attribute(self.param)
+ self.group_name = TextInput(app, "name", self)
+ self.add_child(self.group_name)
- self.view = ServerGroupView(app, "view")
- self.add_child(self.view)
+class ServerGroupAdd(ServerGroupForm):
+ def render_title(self, session, model):
+ return "Add Group"
- def set_server_group(self, session, group):
- self.param.set(session, group)
+ def on_cancel(self, session, model):
+ pass
- def show_view(self, session):
- self.show_mode(session, self.view)
-
-class ServerGroupView(Widget):
- def __init__(self, app, name):
- super(ServerGroupView, self).__init__(app, name)
-
- self.pgroups = self.GroupParents(app, "parent_groups")
- self.add_child(self.pgroups)
-
- self.tabs = TabSet(app, "tabs")
- self.add_child(self.tabs)
-
- self.tabs.add_child(self.GroupServers(app, "servers"))
-
+class ServerGroupEdit(ServerGroupForm):
def render_title(self, session, group):
- return "Server Group '%s'" % group.name
-
- class GroupParents(ServerGroupSet):
- def get_items(self, session, group):
- return sorted(group.parent_items(), cmp, lambda x: x.name)
-
- class GroupServers(ServerSet):
- def get_items(self, session, group):
- return sorted(group.server_items(), cmp, lambda x: x.name)
-
- def render_title(self, session, group):
- return "Servers (%i)" % len(group.server_items())
+ return "Edit Group '%s'" % group.name
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-14 02:47:50 UTC (rev 1056)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-14 02:50:40 UTC (rev 1057)
@@ -37,9 +37,6 @@
{tabs}
</div>
-[ServerServerGroups.html]
-<ul class="comma">{items}</ul>
-
[ConfigTab.html]
<ul class="actions">
<li><a href="">Edit This Configuration</a></li>
@@ -111,7 +108,7 @@
{types}
<ul class="actions">
- <li><a href="">Add Group</a>
+ <li><a href="{add_group_href}">Add Group</a>
</ul>
[BrowserGroups.type_html]
@@ -120,3 +117,28 @@
[BrowserGroups.group_html]
<li>{group_link}</li>
+
+[ServerGroupForm.html]
+<form id="{id}" class="ServerGroupForm mform"
method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <span class="legend">Name</span>
+ <fieldset>{name}</fieldset>
+
+ {hidden_inputs}
+ </div>
+ <div class="foot">
+ <div style="display: block; float:
left;"><button>Help</button></div>
+ {cancel}
+ {submit}
+ </div>
+</form>
+<script defer="defer">
+(function() {
+ var elem = wooly.doc().elem("{id}").node.elements[1];
+ elem.focus();
+ elem.select();
+}())
+</script>
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-10-14 02:47:50 UTC (rev 1056)
+++ mgmt/cumin/python/wooly/__init__.py 2007-10-14 02:50:40 UTC (rev 1057)
@@ -500,9 +500,6 @@
def set_redirect(self, redirect):
self.redirect = redirect
- def save_parameters(self, params):
- self.saved_parameters.extend(params)
-
def marshal(self):
page = self.marshal_page()
vars = self.marshal_url_vars()