[rhmessaging-commits] rhmessaging commits: r1102 - in mgmt: notes and 1 other directory.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Wed Oct 17 11:21:55 EDT 2007
Author: justi9
Date: 2007-10-17 11:21:55 -0400 (Wed, 17 Oct 2007)
New Revision: 1102
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/cluster.strings
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/notes/Todo
Log:
Makes the clusters tab a browser. I kept the older cluster tab around
for discussion.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-17 13:31:32 UTC (rev 1101)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-17 15:21:55 UTC (rev 1102)
@@ -130,3 +130,51 @@
def render_title(self, session, cluster):
return "Log Messages"
+class ClusterBrowser(ItemSet):
+ def __init__(self, app, name):
+ super(ClusterBrowser, self).__init__(app, name)
+
+ self.param = ClusterParameter(app, "cluster")
+ self.add_parameter(self.param)
+
+ self.view = ClusterView(app, "view")
+ self.add_child(self.view)
+
+ def get_items(self, session, model):
+ return sorted_by(model.get_clusters())
+
+ def render_item_link(self, session, cluster):
+ class_ = self.param.get(session) is cluster and "selected"
+
+ branch = session.branch()
+ self.param.set(branch, cluster)
+ return link(branch.marshal(), cluster.name, class_)
+
+ def render_add_cluster_href(self, session, cluster):
+ branch = session.branch()
+ #self.page().show_cluster_add(branch)
+ return branch.marshal()
+
+ def render_edit_cluster_href(self, session, cluster):
+ if cluster:
+ branch = session.branch()
+ #self.page().show_cluster_edit(branch, cluster)
+ return branch.marshal()
+
+ def render_remove_cluster_href(self, session, cluster):
+ if cluster:
+ branch = session.branch()
+ return branch.marshal()
+
+ def render_view(self, session, model):
+ object = self.param.get(session)
+
+ if object:
+ html = self.view.render(session, object)
+ else:
+ html = self.render_none(session, model)
+
+ return html
+
+ def render_none(self, session, model):
+ return none()
Modified: mgmt/cumin/python/cumin/cluster.strings
===================================================================
--- mgmt/cumin/python/cumin/cluster.strings 2007-10-17 13:31:32 UTC (rev 1101)
+++ mgmt/cumin/python/cumin/cluster.strings 2007-10-17 15:21:55 UTC (rev 1102)
@@ -37,25 +37,23 @@
<div class="serverlight {server_status}"></div>
[ClusterView.html]
-<div class="oblock">
- <div class="mstatus green" id="{id}">
- <h2>Cluster Status</h2>
+<div class="mstatus green" id="{id}">
+ <h2>Cluster Status</h2>
- <div>0 errors, 0 warnings</div>
- </div>
+ <div>0 errors, 0 warnings</div>
+</div>
- <h1>{title}</h1>
+<h1>{title}</h1>
- <dl class="properties">
- <dt>Name</dt><dd>{name}</dd>
- </dl>
+<dl class="properties">
+ <dt>Name</dt><dd>{name}</dd>
+</dl>
- <ul class="actions">
- <li><a href="">Shutdown This Cluster</a></li>
- </ul>
+<ul class="actions">
+ <li><a href="">Shutdown This Cluster</a></li>
+</ul>
- {tabs}
-</div>
+{tabs}
[ServerTab.html]
<ul class="actions">
@@ -126,3 +124,49 @@
}
}
</pre>
+
+[ClusterBrowser.css]
+.browser {
+ width: 100%;
+}
+
+.browser .nav {
+ width: 20%;
+}
+
+.browser .nav ul {
+ margin: 0 0 1em 0;
+}
+
+.ClusterBrowser.groups h2 {
+ color: #564979;
+ font-size: 0.9em;
+ border-bottom: 1px dotted #ddd;
+ width: 80%;
+ margin: 0 0 0.5em 0;
+}
+
+.browser .view {
+ width: 80%;
+}
+
+[ClusterBrowser.html]
+<table class="browser">
+ <tr>
+ <td class="nav">
+ <ul class="slist">{items}</ul>
+
+ <ul class="actions">
+ <li><a href="{add_cluster_href}">Add Cluster</a></li>
+ <li><a href="{edit_cluster_href}">Edit Cluster</a></li>
+ <li><a href="{remove_cluster_href}">Remove Cluster</a></li>
+ </ul>
+ </td>
+ <td class="view">
+ {view}
+ </td>
+ </tr>
+</div>
+
+[ClusterBrowser.item_html]
+<li>{item_link}</li>
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-17 13:31:32 UTC (rev 1101)
+++ mgmt/cumin/python/cumin/page.py 2007-10-17 15:21:55 UTC (rev 1102)
@@ -161,6 +161,7 @@
self.add_tab(self.servers)
self.add_tab(self.ClusterTab(app, "clusters"))
+ self.add_tab(self.ClusterTabII(app, "clusters2"))
self.add_tab(self.ProfileTab(app, "profiles"))
def show_server_group(self, session, group):
@@ -172,17 +173,16 @@
return "Red Hat Messaging"
class ServerTab(ServerBrowser):
- pass
+ def render_title(self, session, model):
+ return "Servers (%i)" % len(model.get_servers())
- class ClusterTab(Widget):
- def __init__(self, app, name):
- super(MainView.ClusterTab, self).__init__(app, name)
+ class ClusterTab(ClusterBrowser):
+ def render_title(self, session, model):
+ return "Clusters (%i)" % len(model.get_clusters())
- self.clusters = ClusterSet(app, "clusters")
- self.add_child(self.clusters)
-
+ class ClusterTabII(ClusterSet):
def render_title(self, session, model):
- return self.clusters.render_title(session, model)
+ return "Clusters II (%i)" % len(model.get_clusters())
class ProfileTab(Widget):
def __init__(self, app, name):
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-17 13:31:32 UTC (rev 1101)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-17 15:21:55 UTC (rev 1102)
@@ -42,6 +42,10 @@
padding: 1em;
}
+tr {
+ vertical-align: top;
+}
+
span.none {
font-style: italic;
color: #999;
@@ -351,6 +355,16 @@
content: ""
}
+ul.slist a:before {
+ content: url(resource?name=radio-button.png);
+ vertical-align: -10%;
+ margin: 0 0.5em 0 0;
+}
+
+ul.slist a.selected:before {
+ content: url(resource?name=radio-button-checked.png);
+}
+
[CuminPage.html]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@@ -386,10 +400,3 @@
<ul class="TabSet tabs">{tabs}</ul>
<div class="TabSet mode">{mode}</div>
</div>
-
-[ClusterTab.html]
-<ul class="actions">
- <li><a href="">Add Cluster</a></li>
-</ul>
-
-{clusters}
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-17 13:31:32 UTC (rev 1101)
+++ mgmt/notes/Todo 2007-10-17 15:21:55 UTC (rev 1102)
@@ -94,3 +94,8 @@
* Add group type to group add,edit
* Add the marshal side of ListParameter
+
+ * Consider making add_child, add_param, add_mode, add_tab,
+ etc. return their argument
+
+ * Add a CuminItemSet with add/edit/remove href parts
More information about the rhmessaging-commits
mailing list