Author: justi9
Date: 2007-10-09 16:09:29 -0400 (Tue, 09 Oct 2007)
New Revision: 990
Modified:
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/virtualhost.py
Log:
Adds the templates concept to the UI and model.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-09 19:53:31 UTC (rev 989)
+++ mgmt/cumin/python/cumin/model.py 2007-10-09 20:09:29 UTC (rev 990)
@@ -96,6 +96,10 @@
def get_virtual_hosts(self):
return self.get_index(self.virtual_host).values()
+ def get_virtual_host_templates(self):
+ return [i for i in self.get_virtual_hosts() \
+ if not i.get_cluster() and not i.get_server()]
+
def get_virtual_host_group(self, id):
return self.get_index(self.virtual_host_group).get(id)
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-09 19:53:31 UTC (rev 989)
+++ mgmt/cumin/python/cumin/page.py 2007-10-09 20:09:29 UTC (rev 990)
@@ -167,11 +167,19 @@
def __init__(self, app, name):
super(MainView.VirtualHostTab, self).__init__(app, name)
- self.vhosts = VirtualHostSet(app, "vhosts")
+ self.vhosts = self.VirtualHostTemplateSet(app, "vhosts")
self.add_child(self.vhosts)
self.groups = VirtualHostGroupTree(app, "groups")
self.add_child(self.groups)
def render_title(self, session, model):
- return "Virtual Hosts (%i)" % len(model.get_virtual_hosts())
+ return "Virtual Hosts"
+
+ class VirtualHostTemplateSet(VirtualHostSet):
+ def get_items(self, session, model):
+ return model.get_virtual_host_templates()
+
+ def render_title(self, session, model):
+ return "Templates (%i)" % \
+ len(model.get_virtual_host_templates())
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-09 19:53:31 UTC (rev 989)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-09 20:09:29 UTC (rev 990)
@@ -358,22 +358,44 @@
{tabs}
</div>
-[VirtualHostTab.html]
-<ul class="VirtualHostTab radiotabs tabs">{tabs}</ul>
-<div class="VirtualHostTab mode">{mode}</div>
-
[ServerTab.html]
-<ul class="ServerTab radiotabs tabs">{tabs}</ul>
-<div class="ServerTab mode">{mode}</div>
+<ul class="radiotabs tabs">{tabs}</ul>
+<div class="mode">{mode}</div>
[ClusterTab.html]
<ul class="actions">
<li><a href="">Add Cluster</a></li>
</ul>
-<table class="ClusterTab mobjects">
+<table class="mobjects">
<tr>
<th>Cluster</th>
</tr>
{items}
</table>
+
+[VirtualHostTab.html]
+<ul class="radiotabs tabs">{tabs}</ul>
+<div class="mode">{mode}</div>
+
+[VirtualHostTemplateSet.html]
+<ul class="actions">
+ <li><a href="">Add Template</a></li>
+</ul>
+
+<table class="mobjects">
+ <tr>
+ <th>Template</th>
+ <th>Configuration</th>
+ <th></th>
+ </tr>
+
+ {items}
+</table>
+
+[VirtualHostTemplateSet.item_html]
+<tr>
+ <td>{item_link}</td>
+ <td>10 queues, 5 exchanges</td>
+ <td><a class="action"
href="">Remove</a></td>
+</tr>
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2007-10-09 19:53:31 UTC (rev 989)
+++ mgmt/cumin/python/cumin/virtualhost.py 2007-10-09 20:09:29 UTC (rev 990)
@@ -23,7 +23,7 @@
class VirtualHostGroupTree(ItemTree):
def render_title(self, session, model):
- return "Virtual Host Groups (%i)" \
+ return "Groups (%i)" \
% len(model.get_virtual_host_groups())
class VirtualHostFrame(CuminFrame):