[rhmessaging-commits] rhmessaging commits: r1542 - mgmt/cumin/python/cumin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Wed Jan 9 12:06:56 EST 2008
Author: justi9
Date: 2008-01-09 12:06:55 -0500 (Wed, 09 Jan 2008)
New Revision: 1542
Modified:
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/cumin/widgets.strings
Log:
Makes our paginator much nicer. Adds a page window so we can avoid
listing 300 page links for large sets. Adds window navigation. Makes
things prettier.
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-01-08 17:04:53 UTC (rev 1541)
+++ mgmt/cumin/python/cumin/queue.py 2008-01-09 17:06:55 UTC (rev 1542)
@@ -542,18 +542,18 @@
def __init__(self, app, name):
super(QueueStatistics.StatisticsHistory, self).__init__(app, name)
- chart = StatValueChart(app, "depth")
- chart.stats = ("msgDepth", "byteDepth")
+ chart = StatValueChart(app, "mdepth")
+ chart.stats = ("msgDepth",)
self.add_child(chart)
+ chart = StatValueChart(app, "bdepth")
+ chart.stats = ("byteDepth",)
+ self.add_child(chart)
+
chart = StatValueChart(app, "consumers")
chart.stats = ("consumers",)
self.add_child(chart)
- chart = StatValueChart(app, "transactions")
- chart.stats = ("enqueueTxnCount", "dequeueTxnCount")
- self.add_child(chart)
-
def get_title(self, session, queue):
return "History"
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-01-08 17:04:53 UTC (rev 1541)
+++ mgmt/cumin/python/cumin/queue.strings 2008-01-09 17:06:55 UTC (rev 1542)
@@ -1,6 +1,7 @@
[QueueSet.html]
<form>
<div class="rfloat">{phase}</div>
+
{unit}
<div class="sactions">
@@ -241,15 +242,15 @@
</table>
[StatisticsHistory.html]
-<h2>Depth</h2>
-<div class="iblock chart">{depth}</div>
+<h2>Message Depth</h2>
+<div class="iblock chart">{mdepth}</div>
+<h2>Byte Depth</h2>
+<div class="iblock chart">{bdepth}</div>
+
<h2>Consumers</h2>
<div class="iblock chart">{consumers}</div>
-<h2>Transactions</h2>
-<div class="iblock chart">{transactions}</div>
-
[QueueConsumerSet.html]
<div class="sactions">
<h2>Act on Selected Consumers:</h2>
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-08 17:04:53 UTC (rev 1541)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-09 17:06:55 UTC (rev 1542)
@@ -247,46 +247,111 @@
super(PhaseSwitch, self).__init__(app, name)
self.add_state("a", "Active")
- self.add_state("i", "Inactive")
+ self.add_state("i", "Idle")
self.add_state("d", "Deleted")
class Paginator(ItemSet):
def __init__(self, app, name):
super(Paginator, self).__init__(app, name)
- self.param = IntegerParameter(app, "param")
- self.param.set_default(0)
- self.add_parameter(self.param)
+ self.__page = IntegerParameter(app, "page")
+ self.__page.default = 0
+ self.add_parameter(self.__page)
- self.count = Attribute(app, "count")
- self.add_attribute(self.count)
+ self.__pageset = IntegerParameter(app, "pageset")
+ self.__pageset.default = 0
+ self.add_parameter(self.__pageset)
+ self.__count = Attribute(app, "count")
+ self.add_attribute(self.__count)
+
self.page_size = 15
+ self.pageset_size = 5
- def get(self, session):
- return self.param.get(session)
-
- def set(self, session, value):
- return self.param.set(session, value)
-
def get_bounds(self, session):
- page = self.get(session)
+ page = self.__page.get(session)
return (self.page_size * page, self.page_size * (page + 1))
def set_count(self, session, count):
- self.count.set(session, count)
+ return self.__count.set(session, count)
+ def get_count(self, session):
+ return self.__count.get(session)
+
+ def get_page_count(self, session):
+ count = self.get_count(session)
+ return int(ceil(count / float(self.page_size)))
+
+ def get_pageset_count(self, session):
+ page_count = self.get_page_count(session)
+ return int(ceil(page_count / float(self.pageset_size)))
+
+ def render_prev_page_link(self, session, object):
+ page = self.__page.get(session)
+
+ if page < 1:
+ html = fmt_link(session.marshal(), "<", "pagenav disabled")
+ else:
+ branch = session.branch()
+ self.__page.set(branch, page - 1)
+ html = fmt_link(branch.marshal(), "<", "pagenav")
+
+ return html
+
+ def render_next_page_link(self, session, object):
+ page = self.__page.get(session)
+
+ print "page", page, self.get_page_count(session)
+
+ if page >= self.get_page_count(session) - 1:
+ html = fmt_link(session.marshal(), ">", "pagenav disabled")
+ else:
+ branch = session.branch()
+ self.__page.set(branch, page + 1)
+ html = fmt_link(branch.marshal(), ">", "pagenav")
+
+ return html
+
+ def render_prev_pageset_link(self, session, object):
+ pageset = self.__pageset.get(session)
+
+ if pageset < 1:
+ html = fmt_link(session.marshal(), "<<", "pagenav disabled")
+ else:
+ branch = session.branch()
+ self.__pageset.set(branch, pageset - 1)
+ html = fmt_link(branch.marshal(), "<<", "pagenav")
+
+ return html
+
+ def render_next_pageset_link(self, session, object):
+ pageset = self.__pageset.get(session)
+
+ if pageset >= self.get_pageset_count(session) - 1:
+ html = fmt_link(session.marshal(), ">>", "pagenav disabled")
+ else:
+ branch = session.branch()
+ self.__pageset.set(branch, pageset + 1)
+ html = fmt_link(branch.marshal(), ">>", "pagenav")
+
+ return html
+
def do_get_items(self, session, object):
- count = self.count.get(session)
- return range(0, int(ceil(count / float(self.page_size))))
+ count = self.__count.get(session)
+ pageset = self.__pageset.get(session)
+ start = self.pageset_size * pageset
+ pend = self.pageset_size * (pageset + 1)
+
+ return range(start, min(pend, self.get_page_count(session)))
+
def render_item_class_attr(self, session, page):
- if self.get(session) == page:
+ if self.__page.get(session) == page:
return " class=\"selected\""
def render_item_href(self, session, page):
branch = session.branch()
- self.set(branch, page)
+ self.__page.set(branch, page)
return branch.marshal()
def render_item_content(self, session, page):
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2008-01-08 17:04:53 UTC (rev 1541)
+++ mgmt/cumin/python/cumin/widgets.strings 2008-01-09 17:06:55 UTC (rev 1542)
@@ -88,18 +88,44 @@
<li>{item_link}</li>
[Paginator.css]
-div.Paginator ul {
+ul.Paginator {
display: inline;
+ font-size: 0.9em;
}
-div.Paginator li {
+ul.Paginator li {
display: inline;
+ margin: 0 0.1em;
}
+ul.Paginator a {
+ padding: 0.075em 0.25em;
+ border: 1px solid #f7f7f7;
+}
+
+ul.Paginator a:hover {
+ border: 1px solid #ddd;
+ background-color: white;
+}
+
+ul.Paginator a.pagenav {
+ border: 1px solid #ddd;
+ font-size: 0.9em;
+ color: black;
+}
+
+ul.Paginator a.disabled {
+ color: #ccc;
+}
+
+ul.Paginator a.pagenav:hover {
+ background-color: white;
+}
+
[Paginator.html]
-<div class="Paginator">
- Page <ul class="comma">{items}</ul>
-</div>
+<ul class="Paginator">
+ <li>{prev_pageset_link}</li><li>{prev_page_link}</li>{items}<li>{next_page_link}</li><li>{next_pageset_link}</li>
+</ul>
[Paginator.item_html]
<li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
More information about the rhmessaging-commits
mailing list