[rhmessaging-commits] rhmessaging commits: r1119 - mgmt/cumin/python/cumin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Fri Oct 19 13:56:15 EDT 2007
Author: justi9
Date: 2007-10-19 13:56:15 -0400 (Fri, 19 Oct 2007)
New Revision: 1119
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Adds a ServerSetForm (that has begun to function as a form should) in
place of the static mockup we had before.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-19 15:37:15 UTC (rev 1118)
+++ mgmt/cumin/python/cumin/server.py 2007-10-19 17:56:15 UTC (rev 1119)
@@ -62,6 +62,43 @@
def render_item_load(self, session, server):
return "%.2f" % random()
+class ServerSetForm(ServerSet, Form):
+ def __init__(self, app, name):
+ super(ServerSetForm, self).__init__(app, name)
+
+ self.server = ServerParameter(app, "param")
+ self.add_parameter(self.server)
+ self.add_form_parameter(self.server)
+
+ self.servers = ListParameter(app, "ids", self.server)
+ self.add_parameter(self.servers)
+ self.add_form_parameter(self.servers)
+
+ self.submit = self.Submit(app, "submit", self)
+ self.add_child(self.submit)
+
+ def do_process(self, session, model):
+ if self.submit.get(session):
+ self.submit.set(session, False)
+
+ for server in self.servers.get(session):
+ print "server", server
+
+ session.set_redirect(session.marshal())
+
+ def render_item_checkbox_name(self, session, server):
+ return self.servers.path()
+
+ def render_item_checkbox_value(self, session, server):
+ return self.server.marshal(server)
+
+ def render_item_checkbox_checked_attr(self, session, server):
+ return server in self.servers.get(session) and "checked=\"checked\""
+
+ class Submit(FormButton):
+ def render_content(self, session, model):
+ return "Submit"
+
class ServerFrame(CuminFrame):
def __init__(self, app, name):
super(ServerFrame, self).__init__(app, name)
@@ -283,7 +320,7 @@
self.servers = self.BrowserServers(app, "servers")
self.add_child(self.servers)
- class BrowserServers(ServerSet):
+ class BrowserServers(ServerSetForm):
def get_items(self, session, model):
servers = sorted_by(model.get_servers())
group = self.parent.group.get(session)
@@ -291,7 +328,6 @@
cluster = self.parent.cluster.get(session)
for server in model.get_servers():
- # XXX simplify with a loop
if group and group not in server.server_group_items():
servers.remove(server)
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-19 15:37:15 UTC (rev 1118)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-19 17:56:15 UTC (rev 1119)
@@ -18,6 +18,49 @@
<td>0 errors, 0 warnings</td>
</tr>
+[ServerSetForm.html]
+<form id="{id}" method="post" action="?">
+ <!-- <select onchange="document.getElementById('{id}.submit').submit()"> -->
+ <select>
+ <option>Act on Selection...</option>
+ <optgroup label="Actions">
+ <option>Shutdown</option>
+ <option>Load Balance</option>
+ </optgroup>
+ <optgroup label="Add to Group">
+ <option>East Coast</option>
+ <option>West Coast</option>
+ <option>Marketing</option>
+ <option>Sales</option>
+ </optgroup>
+ </select>
+ {submit}
+ <br/><br/>
+
+ <table class="mobjects">
+ <tr>
+ <th></th>
+ <th>Server</th>
+ <th>Profile</th>
+ <th>Cluster</th>
+ <th>Status</th>
+ <th>Load</th>
+ </tr>
+
+ {items}
+ </table>
+</form>
+
+[ServerSetForm.item_html]
+<tr>
+ <td><input type="checkbox" name="{item_checkbox_name}" value="{item_checkbox_value}" {item_checkbox_checked_attr}/></td>
+ <td>{item_link}</td>
+ <td>{item_profile_link}</td>
+ <td>{item_cluster_link}</td>
+ <td>{item_status}</td>
+ <td>{item_load}</td>
+</tr>
+
[ServerConfigTab.css]
.ServerConfigTab.diff {
background-color: #ff9;
@@ -148,45 +191,3 @@
[ServerBrowser.cluster_html]
<li>{cluster_link}</li>
-
-[BrowserServers.html]
-<form>
-
-<select>
- <option>Act on Selection...</option>
- <optgroup label="Actions">
- <option>Shutdown</option>
- <option>Load Balance</option>
- </optgroup>
- <optgroup label="Add to Group">
- <option>East Coast</option>
- <option>West Coast</option>
- <option>Marketing</option>
- <option>Sales</option>
- </optgroup>
-</select>
-<br/><br/>
-
-<table class="mobjects">
- <tr>
- <th><input type="checkbox"/></th>
- <th>Server</th>
- <th>Profile</th>
- <th>Cluster</th>
- <th>Status</th>
- <th>Load</th>
- </tr>
-
- {items}
-</table>
-</form>
-
-[BrowserServers.item_html]
-<tr>
- <td><input type="checkbox"/ name="server" value="{item_id}"></td>
- <td>{item_link}</td>
- <td>{item_profile_link}</td>
- <td>{item_cluster_link}</td>
- <td>{item_status}</td>
- <td>{item_load}</td>
-</tr>
More information about the rhmessaging-commits
mailing list