Author: justi9
Date: 2007-10-10 13:04:51 -0400 (Wed, 10 Oct 2007)
New Revision: 998
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/widgets.py
Log:
Adds an all-servers link to the browser. Makes link and mlink a
little more generic.
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-10 16:02:30 UTC (rev 997)
+++ mgmt/cumin/python/cumin/page.py 2007-10-10 17:04:51 UTC (rev 998)
@@ -218,6 +218,13 @@
def render_title(self, session, model):
return "Servers (%i)" % len(model.get_servers())
+ def render_show_all_link(self, session, model):
+ class_ = self.param.get(session) is None and "selected"
+
+ branch = session.branch()
+ self.param.set(branch, None)
+ return link(branch.marshal(), "Show All", class_)
+
class BrowserGroups(ItemSet):
def __init__(self, app, name):
super(ServerBrowser.BrowserGroups, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-10 16:02:30 UTC (rev 997)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-10 17:04:51 UTC (rev 998)
@@ -422,6 +422,10 @@
[ServerBrowser.html]
<div class="ServerBrowser groups">
-{groups}
+ {show_all_link}
+
+ <br/><br/>
+
+ {groups}
</div>
<div class="ServerBrowser servers">{servers}</div>
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-10 16:02:30 UTC (rev 997)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-10 17:04:51 UTC (rev 998)
@@ -4,12 +4,12 @@
strings = StringCatalog(__file__)
-def link(href, name):
- return "<a href=\"%s\">%s</a>" % (href, name)
+def link(href, content, class_=""):
+ return "<a %s href=\"%s\">%s</a>" % \
+ (class_ and "class=\"%s\"" % class_ or "", href,
content)
def mlink(href, variety, name, selected=False):
- return "<a %s href=\"%s\">%s</a>" % \
- (selected and "class=\"selected\"" or "", href,
name)
+ return link(href, name, selected and "selected")
def none():
return "<span class=\"none\">None</span>"