Author: justi9
Date: 2007-10-15 10:45:01 -0400 (Mon, 15 Oct 2007)
New Revision: 1066
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/wooly/widgets.strings
Log:
Adds preliminary server group add/edit capability. Flattens out
MainView a little, making it a TabSet. Adds a min-height prop to the
tabs css.
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-15 13:09:45 UTC (rev 1065)
+++ mgmt/cumin/python/cumin/page.py 2007-10-15 14:45:01 UTC (rev 1066)
@@ -33,10 +33,10 @@
self.cluster = ClusterFrame(app, "cluster")
self.add_mode(self.cluster)
- self.group_add = ServerGroupAdd(app, "group_add")
+ self.group_add = ServerGroupAdd(app, "groupadd")
self.add_mode(self.group_add)
- self.group_edit = ServerGroupEdit(app, "group_edit")
+ self.group_edit = ServerGroupEdit(app, "groupedit")
self.add_mode(self.group_edit)
def save_session(self, session):
@@ -72,6 +72,12 @@
return self.page().set_current_frame(session, frame)
+ def show_server_group(self, session, group):
+ mode = self.show_view(session)
+ mode.show_server_group(session, group)
+ self.page().set_current_frame(session, self)
+ return mode
+
def show_server_group_add(self, session):
frame = self.show_mode(session, self.group_add)
return self.page().set_current_frame(session, frame)
@@ -139,18 +145,22 @@
object = frame.get_object(session, self.object.get(session))
return frame.render_title(session, object)
-class MainView(Widget):
+class MainView(TabSet):
def __init__(self, app, name):
super(MainView, self).__init__(app, name)
- self.tabs = TabSet(app, "tabs")
- self.add_child(self.tabs)
+ self.servers = self.ServerTab(app, "servers")
+ self.add_tab(self.servers)
- self.tabs.add_tab(self.ServerTab(app, "servers"))
- self.tabs.add_tab(self.ClusterTab(app, "clusters"))
+ self.add_tab(self.ClusterTab(app, "clusters"))
+ def show_server_group(self, session, group):
+ mode = self.show_mode(session, self.servers)
+ mode.set_server_group(session, group)
+ return mode
+
def render_title(self, session, model):
- return "Red Hat Messaging"
+ return "Red Hat Management"
class ServerTab(ServerBrowser):
pass
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-15 13:09:45 UTC (rev 1065)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-15 14:45:01 UTC (rev 1066)
@@ -381,7 +381,8 @@
<div class="oblock">
<h1>{title}</h1>
- {tabs}
+ <ul class="TabSet tabs">{tabs}</ul>
+ <div class="TabSet mode">{mode}</div>
</div>
[ClusterTab.html]
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-15 13:09:45 UTC (rev 1065)
+++ mgmt/cumin/python/cumin/server.py 2007-10-15 14:45:01 UTC (rev 1066)
@@ -240,6 +240,23 @@
self.group_name = TextInput(app, "name", self)
self.add_child(self.group_name)
+ def on_submit(self, session, object):
+ if object is self.app.model:
+ group = ServerGroup(object)
+ else:
+ group = object
+
+ group.lock()
+ try:
+ group.name = self.group_name.get(session)
+ group.set_type(self.app.model.get_server_group_types()[0])
+ finally:
+ group.unlock()
+
+ branch = session.branch()
+ self.page().show_server_group(branch, group)
+ session.set_redirect(branch.marshal())
+
def on_cancel(self, session, model):
branch = session.branch()
self.page().show_view(branch)
@@ -261,6 +278,10 @@
def set_server_group(self, session, group):
self.param.set(session, group)
-
+
+ def on_display(self, session, group):
+ self.group_name.set(session, group.name)
+
def render_title(self, session, group):
return "Edit Group '%s'" % group.name
+
Modified: mgmt/cumin/python/wooly/widgets.strings
===================================================================
--- mgmt/cumin/python/wooly/widgets.strings 2007-10-15 13:09:45 UTC (rev 1065)
+++ mgmt/cumin/python/wooly/widgets.strings 2007-10-15 14:45:01 UTC (rev 1066)
@@ -39,6 +39,7 @@
background-color: #fff;
position: relative;
z-index: 1;
+ min-height: 20em;
}
[TabSet.html]