rhmessaging commits: r1551 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-11 11:55:50 -0500 (Fri, 11 Jan 2008)
New Revision: 1551
Modified:
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
Log:
Adds variable durations to charts.
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-11 16:16:31 UTC (rev 1550)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-11 16:55:50 UTC (rev 1551)
@@ -75,6 +75,9 @@
self.stats_tmpl = Template(self, "stat_html")
+ self.duration = DurationSwitch(app, "duration")
+ self.add_child(self.duration)
+
def render_href(self, session, object):
params = list()
@@ -86,6 +89,13 @@
for stat in self.stats:
params.append("stat=%s" % stat)
+ duration = self.duration.get(session)
+
+ if duration == "h":
+ params.append("duration=%i" % 3600)
+ elif duration == "d":
+ params.append("duration=%i" % 86400)
+
return "stats.png?" + ";".join(params)
def render_stats(self, session, object):
@@ -123,6 +133,11 @@
self.mode = Parameter(app, "mode")
self.add_parameter(self.mode)
+ # In seconds
+ self.duration = IntegerParameter(app, "duration")
+ self.duration.default = 600
+ self.add_parameter(self.duration)
+
def get_object(self, session, object):
cls = self.class_.get(session).mint_class
id = self.id.get(session)
@@ -144,8 +159,10 @@
times = dict()
values = dict()
+ duration = self.duration.get(session)
+
for stat in stats:
- samples[stat] = stat.samples(object, 600)
+ samples[stat] = stat.samples(object, duration)
values[stat] = [x[1] for x in samples[stat]]
max_value = 0
@@ -168,7 +185,7 @@
max_value = max_value + (round - max_value % round)
- chart.set_x_max(600)
+ chart.set_x_max(duration)
chart.set_y_max(max_value)
chart.plot_x_axis(48)
@@ -184,3 +201,11 @@
writer = Writer()
chart.write(writer)
return writer.to_string()
+
+class DurationSwitch(StateSwitch):
+ def __init__(self, app, name):
+ super(DurationSwitch, self).__init__(app, name)
+
+ self.add_state("m", "10 minutes")
+ self.add_state("h", "1 hour")
+ self.add_state("d", "1 day")
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-01-11 16:16:31 UTC (rev 1550)
+++ mgmt/cumin/python/cumin/stat.strings 2008-01-11 16:55:50 UTC (rev 1551)
@@ -98,6 +98,8 @@
<td><img id="{id}" src="{href}" height="140" width="540"/></td>
<td>
{stats}
+ <br/>
+ {duration}
</td>
</tr>
</table>
@@ -107,3 +109,4 @@
[StatValueChart.stat_html]
<span class="swatch" style="background-color: {stat_color}"> </span> {stat_value}
+<br/>
16 years, 11 months
rhmessaging commits: r1550 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-11 11:16:31 -0500 (Fri, 11 Jan 2008)
New Revision: 1550
Modified:
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
Log:
Adds a legend with the current value of displayed stats to charts.
Removes boilerplate user account html.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2008-01-11 15:14:21 UTC (rev 1549)
+++ mgmt/cumin/python/cumin/page.strings 2008-01-11 16:16:31 UTC (rev 1550)
@@ -592,8 +592,10 @@
<body class="{class}">
<div id="head">
<ul id="whonav">
+ <!--
<li>Hi, <strong>nsantos</strong></li>
<li><a class="nav" href="">Log Out</a></li>
+ -->
</ul>
<!-- <a id="logo" href="{href}"><img src="resource?name=rhm-32x14.png"/></a> -->
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-11 15:14:21 UTC (rev 1549)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-11 16:16:31 UTC (rev 1550)
@@ -73,6 +73,8 @@
self.stats = ()
+ self.stats_tmpl = Template(self, "stat_html")
+
def render_href(self, session, object):
params = list()
@@ -86,6 +88,22 @@
return "stats.png?" + ";".join(params)
+ def render_stats(self, session, object):
+ writer = Writer()
+
+ for stat in self.stats:
+ self.stats_tmpl.render(session, (stat, object), writer)
+
+ return writer.to_string()
+
+ def render_stat_color(self, session, args):
+ return "rgb(255,0,0)"
+
+ def render_stat_value(self, session, args):
+ stat, object = args
+ cls = self.app.model.get_class_by_object(object)
+ return cls.get_stat(stat).value_html(object)
+
class StatChartPage(Page):
def __init__(self, app, name):
super(StatChartPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-01-11 15:14:21 UTC (rev 1549)
+++ mgmt/cumin/python/cumin/stat.strings 2008-01-11 16:16:31 UTC (rev 1550)
@@ -63,6 +63,10 @@
</tr>
[StatValueChart.javascript]
+function updateChart(id, object) {
+
+}
+
function updateChartImage(id, object) {
var img = wooly.doc().elembyid(id);
@@ -79,8 +83,27 @@
img.setattr("src", src);
}
+[StatValueChart.css]
+table.StatValueChart {
+ font-size: 0.9em;
+}
+
+table.StatValueChart span.swatch {
+ padding: 0 0.4em;
+}
+
[StatValueChart.html]
-<img id="{id}" src="{href}" height="140" width="540"/>
+<table class="StatValueChart">
+ <tr>
+ <td><img id="{id}" src="{href}" height="140" width="540"/></td>
+ <td>
+ {stats}
+ </td>
+ </tr>
+</table>
<script>
cumin.listeners["{id}"] = updateChartImage
</script>
+
+[StatValueChart.stat_html]
+<span class="swatch" style="background-color: {stat_color}"> </span> {stat_value}
16 years, 11 months
rhmessaging commits: r1549 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-11 10:14:21 -0500 (Fri, 11 Jan 2008)
New Revision: 1549
Modified:
mgmt/cumin/python/cumin/broker.py
Log:
Fixes bulk broker unregister.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-01-11 11:41:52 UTC (rev 1548)
+++ mgmt/cumin/python/cumin/broker.py 2008-01-11 15:14:21 UTC (rev 1549)
@@ -724,13 +724,15 @@
def __init__(self, app, name):
super(BrokerSetRemove, self).__init__(app, name)
- self.param = BrokerParameter(app, "param")
- self.add_parameter(self.param)
- self.add_form_parameter(self.param)
+ # Note that the params below are not "form params", so we
+ # don't use add_form_parameter to exclude them from the
+ # marshalled set
- self.brokers = ListParameter(app, "id", self.param)
+ param = BrokerParameter(app, "param")
+ self.add_parameter(param)
+
+ self.brokers = ListParameter(app, "id", param)
self.add_parameter(self.brokers)
- self.add_form_parameter(self.brokers)
def get_title(self, session, model):
return "Unregister Brokers"
@@ -746,11 +748,8 @@
def process_submit(self, session, model):
brokers = self.brokers.get(session)
- print "submit with brokers", brokers
-
for broker in brokers:
try:
- print "destroying broker reg", broker
broker.destroySelf()
except Exception, e:
# In an extra ui step, note any errors that arose
16 years, 11 months
rhmessaging commits: r1548 - in store/branches/java/M2/java/bdbstore: src/test/java/org/apache/qpid/server/store/berkeleydb and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: ritchiem
Date: 2008-01-11 06:41:52 -0500 (Fri, 11 Jan 2008)
New Revision: 1548
Modified:
store/branches/java/M2/java/bdbstore/pom.xml
store/branches/java/M2/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java
Log:
Patch to change the VirtualHost constructor to provide an empty configuration. This was causing a NPE due to the lack of configuration.
Modified: store/branches/java/M2/java/bdbstore/pom.xml
===================================================================
--- store/branches/java/M2/java/bdbstore/pom.xml 2008-01-10 22:37:28 UTC (rev 1547)
+++ store/branches/java/M2/java/bdbstore/pom.xml 2008-01-11 11:41:52 UTC (rev 1548)
@@ -22,14 +22,14 @@
<groupId>org.etp.qpid</groupId>
<artifactId>qpid-bdbstore</artifactId>
<packaging>jar</packaging>
- <version>1.0-incubating-M2-SNAPSHOT</version>
+ <version>1.0-incubating-M2</version>
<name>Qpid BDB Store</name>
<url>http://cwiki.apache.org/confluence/display/qpid</url>
<parent>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid</artifactId>
- <version>1.0-incubating-M2-SNAPSHOT</version>
+ <version>1.0-incubating-M2</version>
</parent>
<!-- Local repository for the BerkelyDB-je so we don't have to use the installer script -->
Modified: store/branches/java/M2/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java
===================================================================
--- store/branches/java/M2/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java 2008-01-10 22:37:28 UTC (rev 1547)
+++ store/branches/java/M2/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java 2008-01-11 11:41:52 UTC (rev 1548)
@@ -49,7 +49,7 @@
private static final Logger _log = Logger.getLogger(BDBStoreTest.class);
private BDBMessageStore _store;
-
+ private PropertiesConfiguration _env;
private StoreContext _storeContext = new StoreContext();
private VirtualHost _virtualHost;
@@ -80,7 +80,8 @@
_store.createEnvironment(bdbDir);
_store.openDatabases();
- _virtualHost = new VirtualHost("test", _store);
+ _env = new PropertiesConfiguration();
+ _virtualHost = new VirtualHost("test", _env, _store);
_store.setVirtualHost(_virtualHost);
_store.startCommitThread();
@@ -380,13 +381,11 @@
_store = new BDBMessageStore();
- PropertiesConfiguration env = new PropertiesConfiguration();
+ _env.addProperty("store.environment-path", "bdbTestEnv");
+ _env.addProperty("store.class", "org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
- env.addProperty("store.environment-path", "bdbTestEnv");
- env.addProperty("store.class", "org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
+ _virtualHost = new VirtualHost("test", _env);
- _virtualHost = new VirtualHost("test", env);
-
try
{
AMQQueue q1 = _virtualHost.getQueueRegistry().getQueue(QUEUE1);
16 years, 11 months
rhmessaging commits: r1547 - mgmt/cumin/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-10 17:37:28 -0500 (Thu, 10 Jan 2008)
New Revision: 1547
Added:
mgmt/cumin/bin/cumin
Log:
Adds "cumin", a startup script.
Copied: mgmt/cumin/bin/cumin (from rev 1539, mgmt/cumin/bin/cumin-test)
===================================================================
--- mgmt/cumin/bin/cumin (rev 0)
+++ mgmt/cumin/bin/cumin 2008-01-10 22:37:28 UTC (rev 1547)
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+
+import sys, os
+
+def usage():
+ print """
+Usage: cumin OPTIONS
+Options:
+ --port PORT
+ --data DATABASE-URL
+""",
+ sys.exit(1)
+
+from ConfigParser import SafeConfigParser
+
+def load_args(argv):
+ args = dict()
+
+ conf = SafeConfigParser()
+ conf.read(os.path.expanduser("/etc/cumin.conf"))
+
+ if (conf.has_section("main")):
+ for key, value in conf.items("main"):
+ args[key] = value
+
+ key = None
+
+ for arg in sys.argv:
+ if arg.startswith("--"):
+ key = arg[2:]
+ args[key] = None
+ elif key:
+ args[key] = arg
+ key = None
+
+ if args:
+ print "Parameters:"
+
+ for key in args:
+ print " %10s %s" % (key, args[key])
+
+ return args
+
+from sqlobject import *
+
+args = load_args(sys.argv)
+
+try:
+ connuri = args["data"]
+ conn = connectionForURI(connuri)
+ sqlhub.processConnection = conn
+except KeyError:
+ print "No data source"
+ usage()
+
+from wooly.server import WebServer
+from cumin import *
+
+def do_main(port):
+ app = Cumin()
+ app.enable_debug()
+
+ server = WebServer(app, port)
+ server.run()
+
+def main():
+ port = int(args.get("port", 80))
+
+ try:
+ do_main(port)
+ except KeyboardInterrupt:
+ pass
+
+if __name__ == "__main__":
+ main()
16 years, 11 months
rhmessaging commits: r1546 - store/trunk/cpp.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-01-10 15:41:19 -0500 (Thu, 10 Jan 2008)
New Revision: 1546
Modified:
store/trunk/cpp/rhm.spec.in
Log:
bump release to be in sync with brew
Modified: store/trunk/cpp/rhm.spec.in
===================================================================
--- store/trunk/cpp/rhm.spec.in 2008-01-10 15:07:50 UTC (rev 1545)
+++ store/trunk/cpp/rhm.spec.in 2008-01-10 20:41:19 UTC (rev 1546)
@@ -3,7 +3,7 @@
#
Name: rhm
Version: @VERSION@
-Release: 11%{?dist}
+Release: 12%{?dist}
Summary: Red Hat extensions to the Qpid messaging system
Group: System Environment/Libraries
License: LGPL
16 years, 11 months
rhmessaging commits: r1545 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-10 10:07:50 -0500 (Thu, 10 Jan 2008)
New Revision: 1545
Modified:
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/queue.py
Log:
Temporarily hides the producers and consumers tabs, as we don't have
data for them.
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-01-09 19:40:34 UTC (rev 1544)
+++ mgmt/cumin/python/cumin/exchange.py 2008-01-10 15:07:50 UTC (rev 1545)
@@ -122,6 +122,9 @@
return "Producers"
def render_content(self, session, data):
+ return data["producers"]
+
+ # Restore later
exchange = Identifiable(data["id"])
branch = session.branch()
frame = self.frame().show_exchange(branch, exchange)
@@ -235,8 +238,8 @@
self.tabs.add_tab(ExchangeStatistics(app, "stats"))
- self.producers = ExchangeProducerSet(app, "producers")
- self.tabs.add_tab(self.producers)
+ #self.producers = ExchangeProducerSet(app, "producers")
+ #self.tabs.add_tab(self.producers)
self.bindings = ExchangeBindingSet(app, "bindings")
self.tabs.add_tab(self.bindings)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-01-09 19:40:34 UTC (rev 1544)
+++ mgmt/cumin/python/cumin/queue.py 2008-01-10 15:07:50 UTC (rev 1545)
@@ -112,6 +112,9 @@
return "Consumers"
def render_content(self, session, data):
+ return data["consumers"]
+
+ # Restore later
queue = Identifiable(data["id"])
branch = session.branch()
frame = self.frame().show_queue(branch, queue)
@@ -241,8 +244,8 @@
self.tabs.add_tab(QueueStatistics(app, "stats"))
- self.consumers = QueueConsumerSet(app, "consumers")
- self.tabs.add_tab(self.consumers)
+ #self.consumers = QueueConsumerSet(app, "consumers")
+ #self.tabs.add_tab(self.consumers)
self.bindings = QueueBindingSet(app, "bindings")
self.tabs.add_tab(self.bindings)
16 years, 11 months
rhmessaging commits: r1544 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-09 14:40:34 -0500 (Wed, 09 Jan 2008)
New Revision: 1544
Modified:
mgmt/cumin/python/cumin/widgets.py
mgmt/notes/justin-todo.txt
Log:
A little optimization of the pageset boundary logic.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-09 19:31:42 UTC (rev 1543)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-09 19:40:34 UTC (rev 1544)
@@ -268,20 +268,14 @@
self.page_size = 15
self.pageset_size = 5
- # Another name for this would be get_page_bounds
def get_bounds(self, session):
page = self.__page.get(session)
- return (self.page_size * page, self.page_size * (page + 1))
+ return self.page_size * page, self.page_size * (page + 1)
def get_pageset_bounds(self, session):
pageset = self.__pageset.get(session)
+ return self.pageset_size * pageset, self.pageset_size * (pageset + 1)
- start = self.pageset_size * pageset
- end = self.pageset_size * (pageset + 1)
- page_count = self.get_page_count(session)
-
- return start, min(end, page_count)
-
def set_count(self, session, count):
return self.__count.set(session, count)
@@ -358,8 +352,9 @@
count = self.__count.get(session)
start, end = self.get_pageset_bounds(session)
+ page_count = self.get_page_count(session)
- return range(start, end)
+ return range(start, min(end, page_count))
def render_item_class_attr(self, session, page):
if self.__page.get(session) == page:
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-01-09 19:31:42 UTC (rev 1543)
+++ mgmt/notes/justin-todo.txt 2008-01-09 19:40:34 UTC (rev 1544)
@@ -26,14 +26,12 @@
- Add sort direction icon
- - Deal with large numbers of pages in paginators
-
- Change first-click sort to desc for number fields
- - Handle no pages in paginator
-
- Column justification
+ - Validate paginator current page and reset as necessary
+
* Div by zero error in queues view
Deferred
16 years, 11 months
rhmessaging commits: r1543 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-09 14:31:42 -0500 (Wed, 09 Jan 2008)
New Revision: 1543
Modified:
mgmt/cumin/python/cumin/widgets.py
Log:
Adds logic to advance the pager window with the current page.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-09 17:06:55 UTC (rev 1542)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-09 19:31:42 UTC (rev 1543)
@@ -268,10 +268,20 @@
self.page_size = 15
self.pageset_size = 5
+ # Another name for this would be get_page_bounds
def get_bounds(self, session):
page = self.__page.get(session)
return (self.page_size * page, self.page_size * (page + 1))
+ def get_pageset_bounds(self, session):
+ pageset = self.__pageset.get(session)
+
+ start = self.pageset_size * pageset
+ end = self.pageset_size * (pageset + 1)
+ page_count = self.get_page_count(session)
+
+ return start, min(end, page_count)
+
def set_count(self, session, count):
return self.__count.set(session, count)
@@ -292,8 +302,13 @@
if page < 1:
html = fmt_link(session.marshal(), "<", "pagenav disabled")
else:
+ page -= 1
+ pageset_start = self.get_pageset_bounds(session)[0]
+
branch = session.branch()
- self.__page.set(branch, page - 1)
+ self.__page.set(branch, page)
+ if page < pageset_start:
+ self.__pageset.set(branch, self.__pageset.get(session) - 1)
html = fmt_link(branch.marshal(), "<", "pagenav")
return html
@@ -301,13 +316,16 @@
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:
+ page += 1
+ pageset_end = self.get_pageset_bounds(session)[1]
+
branch = session.branch()
- self.__page.set(branch, page + 1)
+ self.__page.set(branch, page)
+ if page >= pageset_end: # XXX should be >? bounds func is funny
+ self.__pageset.set(branch, self.__pageset.get(session) + 1)
html = fmt_link(branch.marshal(), ">", "pagenav")
return html
@@ -338,12 +356,10 @@
def do_get_items(self, session, object):
count = self.__count.get(session)
- pageset = self.__pageset.get(session)
- start = self.pageset_size * pageset
- pend = self.pageset_size * (pageset + 1)
+ start, end = self.get_pageset_bounds(session)
- return range(start, min(pend, self.get_page_count(session)))
+ return range(start, end)
def render_item_class_attr(self, session, page):
if self.__page.get(session) == page:
16 years, 11 months
rhmessaging commits: r1542 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
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>
16 years, 11 months