rhmessaging commits: r1561 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-14 08:36:20 -0500 (Mon, 14 Jan 2008)
New Revision: 1561
Modified:
mgmt/cumin/python/cumin/widgets.strings
Log:
Style adjustment to CuminTable set navigation.
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2008-01-14 13:34:00 UTC (rev 1560)
+++ mgmt/cumin/python/cumin/widgets.strings 2008-01-14 13:36:20 UTC (rev 1561)
@@ -136,7 +136,6 @@
ul.Paginator a.pagenav {
border: 1px solid #ddd;
- font-size: 0.9em;
color: black;
}
@@ -156,6 +155,11 @@
[Paginator.item_html]
<li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
+[CuminTable.css]
+table.mobjects th.setnav {
+ font-size: 0.9em;
+}
+
[CuminTable.html]
<table class="mobjects">
<thead>
17 years, 2 months
rhmessaging commits: r1560 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-14 08:34:00 -0500 (Mon, 14 Jan 2008)
New Revision: 1560
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/queue.py
Log:
Instead of generic language, use specific verbiage for each bulk
action.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-01-14 13:20:15 UTC (rev 1559)
+++ mgmt/cumin/python/cumin/broker.py 2008-01-14 13:34:00 UTC (rev 1560)
@@ -726,6 +726,11 @@
def get_title(self, session, model):
return "Unregister Brokers"
+ def process_return(self, session, id):
+ branch = session.branch()
+ self.frame().show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
def process_item(self, session, id):
try:
broker = BrokerRegistration.get(id)
@@ -734,10 +739,5 @@
# In an extra ui step, note any errors that arose
print e
- def process_return(self, session, id):
- branch = session.branch()
- self.frame().show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
-
def render_item_content(self, session, id):
return "Unregister Broker '%s'" % BrokerRegistration.get(id).name
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-01-14 13:20:15 UTC (rev 1559)
+++ mgmt/cumin/python/cumin/client.py 2008-01-14 13:34:00 UTC (rev 1560)
@@ -223,6 +223,9 @@
except Exception, e:
self.add_error(session, e)
+ def render_item_content(self, session, id):
+ return "Close Client %s" % Client.get(id).address
+
class ClientStatus(CuminStatus):
def render_frames_from(self, session, client):
stat = self.app.model.client.get_stat("framesFromClient")
@@ -319,6 +322,11 @@
def get_title(self, session, object):
return "Detach Sessions"
+ def process_return(self, session, object):
+ branch = session.branch()
+ self.frame().show_view(branch).show_sessions(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
def process_item(self, session, id):
try:
session_ = Session.get(id)
@@ -326,18 +334,18 @@
except Exception, e:
self.add_error(session, e)
- def process_cancel(self, session, object):
- branch = session.branch()
- self.frame().show_view(branch).show_sessions(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ def render_item_content(self, session, id):
+ return "Detach Session '%s'" % Session.get(id).name
- def process_return(self, session, object):
- self.process_cancel(session, object)
-
class ClientSessionSetClose(CuminBulkActionForm, Frame):
def get_title(self, session, object):
return "Close Sessions"
+ def process_return(self, session, object):
+ branch = session.branch()
+ self.frame().show_view(branch).show_sessions(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
def process_item(self, session, id):
try:
session_ = Session.get(id)
@@ -345,14 +353,9 @@
except Exception, e:
self.add_error(session, e)
- def process_cancel(self, session, object):
- branch = session.branch()
- self.frame().show_view(branch).show_sessions(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ def render_item_content(self, session, id):
+ return "Close Session '%s'" % Session.get(id).name
- def process_return(self, session, object):
- self.process_cancel(session, object)
-
class ClientSessionSet(CuminTable, Form):
def __init__(self, app, name):
super(ClientSessionSet, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-01-14 13:20:15 UTC (rev 1559)
+++ mgmt/cumin/python/cumin/queue.py 2008-01-14 13:34:00 UTC (rev 1560)
@@ -470,7 +470,6 @@
def process_return(self, session, object):
branch = session.branch()
self.frame().show_view(branch)
- # XXX need to set current frame here?
self.page().set_redirect_url(session, branch.marshal())
def process_item(self, session, id):
@@ -480,6 +479,9 @@
except Exception, e:
self.add_error(session, e)
+ def render_item_content(self, session, id):
+ return "Purge Queue '%s'" % Queue.get(id).name
+
class QueueBindingAdd(CuminForm):
def __init__(self, app, name):
super(QueueBindingAdd, self).__init__(app, name)
17 years, 2 months
rhmessaging commits: r1559 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-14 08:20:15 -0500 (Mon, 14 Jan 2008)
New Revision: 1559
Modified:
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
Log:
Fixes up charts a bit. Makes the current value display a live-updated
one.
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2008-01-14 04:45:16 UTC (rev 1558)
+++ mgmt/cumin/python/cumin/client.strings 2008-01-14 13:20:15 UTC (rev 1559)
@@ -125,10 +125,10 @@
</table>
[StatisticsHistory.html]
-<h2>Sent</h2>
+<h2>Bytes Sent</h2>
<div class="iblock chart">{sent}</div>
-<h2>Received</h2>
+<h2>Bytes Received</h2>
<div class="iblock chart">{received}</div>
[ClientSessionSet.html]
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2008-01-14 04:45:16 UTC (rev 1558)
+++ mgmt/cumin/python/cumin/exchange.strings 2008-01-14 13:20:15 UTC (rev 1559)
@@ -200,13 +200,13 @@
</table>
[StatisticsHistory.html]
-<h2>Received</h2>
+<h2>Messages Received</h2>
<div class="iblock chart">{received}</div>
-<h2>Routed</h2>
+<h2>Messages Routed</h2>
<div class="iblock chart">{routed}</div>
-<h2>Dropped</h2>
+<h2>Messages Dropped</h2>
<div class="iblock chart">{dropped}</div>
[ExchangeProducerSet.html]
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-14 04:45:16 UTC (rev 1558)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-14 13:20:15 UTC (rev 1559)
@@ -103,6 +103,9 @@
return "stats.png?" + ";".join(params)
+ def render_mode(self, session, object):
+ return self.mode
+
def render_stats(self, session, object):
writer = Writer()
@@ -126,10 +129,9 @@
return html
- def render_stat_unit(self, session, args):
+ def render_stat_name(self, session, args):
stat, object = args
- value = stat.value(object)
- return "%s%s" % (stat.unit, ess(value))
+ return stat.name
class StatChartPage(Page):
def __init__(self, app, name):
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-01-14 04:45:16 UTC (rev 1558)
+++ mgmt/cumin/python/cumin/stat.strings 2008-01-14 13:20:15 UTC (rev 1559)
@@ -64,12 +64,9 @@
[StatValueChart.javascript]
function updateChart(id, object) {
-
-}
+ var chart = wooly.doc().elembyid(id);
-function updateChartImage(id, object) {
- var img = wooly.doc().elembyid(id);
-
+ var img = chart.elem("img")
var src = img.getattr("src");
var sep = src.lastIndexOf(";");
var time = new Date().getTime();
@@ -81,6 +78,15 @@
}
img.setattr("src", src);
+
+ var ph = chart.elem("span", "class", "ph")
+ var statname = ph.getattr("statname")
+ var statmode = ph.getattr("statmode")
+ if (statmode == "rate") {
+ ph.text().set(object.stat[statname].rate)
+ } else {
+ ph.text().set(object.stat[statname].value)
+ }
}
[StatValueChart.css]
@@ -97,7 +103,7 @@
}
[StatValueChart.html]
-<table class="StatValueChart">
+<table class="StatValueChart" id="{id}">
<tr>
<td><img id="{id}" src="{href}" height="140" width="540"/></td>
<td>
@@ -108,11 +114,11 @@
</tr>
</table>
<script>
- cumin.listeners["{id}"] = updateChartImage
+ cumin.listeners["{id}"] = updateChart
</script>
[StatValueChart.stat_html]
<li>
<span class="swatch" style="background-color: {stat_color}"> </span>
- {stat_value} {stat_unit}
+ <span class="ph" statname="{stat_name}" statmode="{mode}">{stat_value}</span>
</li>
17 years, 2 months
rhmessaging commits: r1558 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-13 23:45:16 -0500 (Sun, 13 Jan 2008)
New Revision: 1558
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
Log:
Repairs the broker group assign button.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-01-13 21:19:22 UTC (rev 1557)
+++ mgmt/cumin/python/cumin/broker.py 2008-01-14 04:45:16 UTC (rev 1558)
@@ -46,6 +46,9 @@
self.__unregister = self.Unregister(app, "unregister", self)
self.add_child(self.__unregister)
+ self.groupify = self.Groupify(app, "groupify", self)
+ self.add_child(self.groupify)
+
def get_title(self, session, model):
count = BrokerRegistration.select().count()
return "Brokers %s" % fmt_count(count)
@@ -66,16 +69,24 @@
frame.ids.set(branch, ids)
self.page().set_redirect_url(session, branch.marshal())
+ class BrokerSetGroupInput(BrokerGroupInput):
+ def render_submit_id(self, session, model):
+ return self.parent.groupify.path()
+
class Groupify(FormButton):
def render_content(self, session, model):
- return "Add to Group"
+ return "Add"
def process_submit(self, session, model):
group = self.parent.groups.get(session)
if group:
- for broker in brokers:
+ ids = self.parent.ids.get(session)
+ self.parent.ids.clear(session)
+
+ for id in ids:
try:
+ broker = BrokerRegistration.get(id)
broker.addBrokerGroup(group)
except IntegrityError:
pass
@@ -120,9 +131,6 @@
return link
- class BrokerSetGroupInput(BrokerGroupInput):
- pass
-
class BrokerFrame(CuminFrame):
def __init__(self, app, name):
super(BrokerFrame, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-01-13 21:19:22 UTC (rev 1557)
+++ mgmt/cumin/python/cumin/broker.strings 2008-01-14 04:45:16 UTC (rev 1558)
@@ -3,11 +3,13 @@
<!-- <select onchange="document.getElementById('{id}.submit').submit()"> -->
<div class="sactions">
- <h2>Act on Selected Brokers:</h2>
+ <h2>Act on Selection:</h2>
{unregister}
+
+
<h2>Add to Group:</h2>
- {groups}
+ {groups} {groupify}
</div>
<table class="mobjects">
@@ -31,7 +33,7 @@
}
[BrokerSetGroupInput.html]
-<select name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="submit()">
+<select name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="getElementById('{submit_id}').click()">
<option value="">Choose Group...</option>
{items}
</select>
17 years, 2 months
rhmessaging commits: r1557 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-13 16:19:22 -0500 (Sun, 13 Jan 2008)
New Revision: 1557
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/charts.py
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/util.py
Log:
Adds a rate mode to charts and uses it for some client and exchange
charts.
Makes all the charts chart only one value series, for now.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-01-13 18:57:33 UTC (rev 1556)
+++ mgmt/cumin/python/cumin/broker.py 2008-01-13 21:19:22 UTC (rev 1557)
@@ -89,13 +89,16 @@
def render_content(self, session, data):
broker = Identifiable(data["id"])
branch = session.branch()
- self.frame().show_broker(branch, broker).show_view(branch)
+ self.page().show_broker(branch, broker).show_view(branch)
return fmt_olink(branch, broker, name=data["name"])
class GroupsColumn(SqlTableColumn):
def get_title(self, session, model):
return "Groups"
+ def get_orderby_sql(self, session):
+ return None
+
def render_content(self, session, data):
broker = BrokerRegistration.get(data["id"])
count = broker.groups.count()
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2008-01-13 18:57:33 UTC (rev 1556)
+++ mgmt/cumin/python/cumin/charts.py 2008-01-13 21:19:22 UTC (rev 1557)
@@ -52,6 +52,7 @@
cr.set_line_width(0.2)
cr.set_source_rgb(0.6, 0.6, 0.6)
+ absmax = self.x_max - self.x_min
i = 0
for x in range(self.width, 0 - interval, -interval):
@@ -59,7 +60,7 @@
cr.line_to(x, self.height + 10)
if i % step == 0:
- value = self.x_max - (self.x_max * x / float(self.width))
+ value = absmax - (absmax * x / float(self.width))
cr.show_text(fmt_duration_brief(value))
i += 1
@@ -73,15 +74,19 @@
i = 0
- for y in range(self.height, 0 - interval, -interval):
+ for y in range(0, self.height, interval):
cr.move_to(0, y)
cr.line_to(self.width + 2, y)
if i % step == 0:
- value = self.y_max - (self.y_max * y / float(self.height))
+ fraction = (self.height - y) / float(self.height)
+ value = fraction * self.y_max - self.y_min
+ value = value + self.y_min
- if value < 10:
- svalue = "%0.0f" % value
+ if value == 0:
+ svalue = "0"
+ elif value < 10:
+ svalue = str(value)
elif value > 10000:
svalue = "%ik" % int(round(value / 1000, -1))
else:
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-01-13 18:57:33 UTC (rev 1556)
+++ mgmt/cumin/python/cumin/client.py 2008-01-13 21:19:22 UTC (rev 1557)
@@ -303,11 +303,13 @@
super(ClientStatistics.StatisticsHistory, self).__init__(app, name)
chart = StatValueChart(app, "sent")
- chart.stats = ("framesFromClient", "bytesFromClient")
+ chart.stats = ("bytesFromClient",)
+ chart.mode = "rate"
self.add_child(chart)
chart = StatValueChart(app, "received")
- chart.stats = ("framesToClient", "bytesToClient")
+ chart.stats = ("bytesToClient",)
+ chart.mode = "rate"
self.add_child(chart)
def get_title(self, session, client):
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-01-13 18:57:33 UTC (rev 1556)
+++ mgmt/cumin/python/cumin/exchange.py 2008-01-13 21:19:22 UTC (rev 1557)
@@ -434,15 +434,17 @@
(app, name)
chart = StatValueChart(app, "received")
- chart.stats = ("msgReceives", "byteReceives")
+ chart.stats = ("msgReceives",)
+ chart.mode = "rate"
self.add_child(chart)
chart = StatValueChart(app, "routed")
- chart.stats = ("msgRoutes", "byteRoutes")
+ chart.stats = ("msgRoutes",)
+ chart.mode = "rate"
self.add_child(chart)
chart = StatValueChart(app, "dropped")
- chart.stats = ("msgDrops", "byteDrops")
+ chart.stats = ("msgDrops",)
self.add_child(chart)
def get_title(self, session, queue):
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-13 18:57:33 UTC (rev 1556)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-13 21:19:22 UTC (rev 1557)
@@ -71,6 +71,8 @@
def __init__(self, app, name):
super(StatValueChart, self).__init__(app, name)
+ self.mode = None
+
self.stats = ()
self.stats_tmpl = Template(self, "stat_html")
@@ -96,6 +98,9 @@
elif duration == "d":
params.append("duration=%i" % 86400)
+ if self.mode:
+ params.append("mode=%s" % self.mode)
+
return "stats.png?" + ";".join(params)
def render_stats(self, session, object):
@@ -113,8 +118,14 @@
def render_stat_value(self, session, args):
stat, object = args
- return stat.value_html(object)
+ if self.mode == "rate":
+ html = stat.rate_html(object)
+ else:
+ html = stat.value_html(object)
+
+ return html
+
def render_stat_unit(self, session, args):
stat, object = args
value = stat.value(object)
@@ -162,26 +173,53 @@
stats = [cls.get_stat(x) for x in self.stats.get(session)]
samples = dict()
- times = dict()
values = dict()
duration = self.duration.get(session)
+ if self.mode.get(session) == "rate":
+ for stat in stats:
+ os = stat.samples(object, duration)
+ ns = list()
+ prev = None
+
+ for sample in reversed(os):
+ if prev is None:
+ ns.insert(0, (sample[0], 0.0))
+ else:
+ rate = calc_rate(sample[1], prev[1],
+ secs(sample[0]), secs(prev[0]))
+
+ ns.insert(0, (sample[0], rate))
+
+ prev = sample
+
+ samples[stat] = ns
+ else:
+ for stat in stats:
+ samples[stat] = stat.samples(object, duration)
+
for stat in stats:
- samples[stat] = stat.samples(object, duration)
values[stat] = [x[1] for x in samples[stat]]
- max_value = 0
+ max_value = 1
+ min_value = 0
for stat in stats:
vals = values[stat]
if vals:
max_value = max(max(vals), max_value)
+ min_value = min(min(vals), min_value)
- max_value = int(max_value * 1.1) + 1
+ max_value = round(max_value * 1.1 + 1)
+ if min_value < 0:
+ min_value = round(min_value * 1.1 - 1)
+
chart.x_max = duration
+ chart.x_min = 0
chart.y_max = max_value
+ chart.y_min = min_value
x_interval = 40
x_step = 2
Modified: mgmt/cumin/python/cumin/util.py
===================================================================
--- mgmt/cumin/python/cumin/util.py 2008-01-13 18:57:33 UTC (rev 1556)
+++ mgmt/cumin/python/cumin/util.py 2008-01-13 21:19:22 UTC (rev 1557)
@@ -14,7 +14,9 @@
def calc_rate(curr, prev, csecs, psecs):
if None not in (curr, prev, csecs, psecs):
- return (curr - prev) / float(csecs - psecs)
+ secs = csecs - psecs
+ if secs > 0:
+ return (curr - prev) / float(secs)
def secs(dt):
if dt is not None:
17 years, 2 months
rhmessaging commits: r1556 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-13 13:57:33 -0500 (Sun, 13 Jan 2008)
New Revision: 1556
Modified:
mgmt/cumin/python/cumin/charts.py
mgmt/cumin/python/cumin/stat.py
Log:
Simplifies and improves the "abbreviation" of x-axis values.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2008-01-13 18:56:33 UTC (rev 1555)
+++ mgmt/cumin/python/cumin/charts.py 2008-01-13 18:57:33 UTC (rev 1556)
@@ -12,14 +12,10 @@
self.surface = ImageSurface(FORMAT_ARGB32, width + 60, height + 20)
self.surface.set_device_offset(0.5, 8.5)
self.x_max = 1
+ self.x_min = 0
self.y_max = 1
+ self.y_min = 0
- def set_x_max(self, value):
- self.x_max = value
-
- def set_y_max(self, value):
- self.y_max = value
-
def plot_values(self, samples, color=(0, 0, 0)):
cr = Context(self.surface)
cr.set_line_width(2)
@@ -82,12 +78,14 @@
cr.line_to(self.width + 2, y)
if i % step == 0:
- value = int(self.y_max - (self.y_max * y / float(self.height)))
+ value = self.y_max - (self.y_max * y / float(self.height))
- if value > 10000:
- svalue = "%ik" % (value / 1000)
+ if value < 10:
+ svalue = "%0.0f" % value
+ elif value > 10000:
+ svalue = "%ik" % int(round(value / 1000, -1))
else:
- svalue = str(value)
+ svalue = str(int(round(value, -1)))
cr.show_text(svalue)
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-13 18:56:33 UTC (rev 1555)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-13 18:57:33 UTC (rev 1556)
@@ -178,31 +178,26 @@
if vals:
max_value = max(max(vals), max_value)
- max_value = int(max_value * 1.1)
+ max_value = int(max_value * 1.1) + 1
- if max_value < 10:
- round = 6
- elif max_value < 100:
- round = 60
- elif max_value < 10000:
- round = 600
- else:
- round = 6000
+ chart.x_max = duration
+ chart.y_max = max_value
- max_value = max_value + (round - max_value % round)
-
- chart.set_x_max(duration)
- chart.set_y_max(max_value)
-
x_interval = 40
- step = 2
+ x_step = 2
- if duration == 600:
+ if chart.x_max == 600:
x_interval = 48
- chart.plot_x_axis(x_interval, step)
- chart.plot_y_axis(20, 2)
+ y_interval = 15
+ y_step = 2
+ if chart.y_max < 4:
+ y_step = 4
+
+ chart.plot_x_axis(x_interval, x_step)
+ chart.plot_y_axis(y_interval, y_step)
+
colors = ((1,0,0), (0,0,1), (0,1,0))
for stat, color in zip(stats, colors):
17 years, 2 months
rhmessaging commits: r1555 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-13 13:56:33 -0500 (Sun, 13 Jan 2008)
New Revision: 1555
Modified:
mgmt/cumin/python/cumin/page.strings
Log:
Widens property sheets a little so that lifecycle dates don't wrap as
readily.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2008-01-12 22:35:40 UTC (rev 1554)
+++ mgmt/cumin/python/cumin/page.strings 2008-01-13 18:56:33 UTC (rev 1555)
@@ -170,7 +170,7 @@
table.props {
margin: 0 0 1.5em 0;
- width: 30em;
+ width: 32em;
border-collapse: collapse;
}
17 years, 2 months
rhmessaging commits: r1554 - in mgmt: cumin/python/wooly and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-12 17:35:40 -0500 (Sat, 12 Jan 2008)
New Revision: 1554
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/parameters.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/cumin/widgets.strings
mgmt/cumin/python/wooly/parameters.py
mgmt/cumin/python/wooly/tables.py
mgmt/notes/errors.txt
mgmt/notes/justin-todo.txt
Log:
Adds bulk operation support:
- Purge queues
- Close clients
- Close sessions
- Detach sessions
- Unregister brokers
Converts the brokers table to a custom-sql backing.
Adds a CuminBulkActionForm for confirming some bulk actions.
Adds a CheckboxIdColumn for creating checkboxable lists of items to
act on.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/broker.py 2008-01-12 22:35:40 UTC (rev 1554)
@@ -16,130 +16,107 @@
strings = StringCatalog(__file__)
-class BrokerSet(PaginatedItemSet, Form, Frame):
+class BrokerSet(CuminTable, Form):
def __init__(self, app, name):
super(BrokerSet, self).__init__(app, name)
- self.broker = BrokerParameter(app, "param")
- self.add_parameter(self.broker)
- self.add_form_parameter(self.broker)
+ self.table_sql = "broker_registration as b"
- self.brokers = ListParameter(app, "id", self.broker)
- self.add_parameter(self.brokers)
- self.add_form_parameter(self.brokers)
+ self.add_sql_column("id", "b.id")
+ self.add_sql_column("name", "b.name")
- self.action = Parameter(app, "action")
- self.add_parameter(self.action)
- self.add_form_parameter(self.action)
+ self.ids = CheckboxIdColumn(app, "id")
+ self.add_column(self.ids)
+ self.add_form_parameter(self.ids)
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
+
+ col = self.GroupsColumn(app, "groups")
+ self.add_column(col)
+
self.groups = self.BrokerSetGroupInput(app, "groups", self)
self.add_child(self.groups)
+ # XXX get rid of this
self.submit = BooleanParameter(app, "submit")
self.add_parameter(self.submit)
self.add_form_parameter(self.submit)
+ self.__unregister = self.Unregister(app, "unregister", self)
+ self.add_child(self.__unregister)
+
def get_title(self, session, model):
- return "Brokers %s" % fmt_count(self.get_item_count(session, model))
+ count = BrokerRegistration.select().count()
+ return "Brokers %s" % fmt_count(count)
def get_item_count(self, session, model):
return BrokerRegistration.select().count()
- def do_get_items(self, session, model):
- start, end = self.get_bounds(session)
- return BrokerRegistration.select(orderBy="name")[start:end]
+ class Unregister(FormButton):
+ def render_content(self, session, model):
+ return "Unregister"
- def do_process(self, session, model):
- super(BrokerSet, self).do_process(session, model)
+ def process_submit(self, session, model):
+ ids = self.parent.ids.get(session)
+ self.parent.ids.clear(session)
- if self.submit.get(session):
- self.submit.set(session, False)
+ branch = session.branch()
+ frame = self.frame().show_brokers_remove(branch)
+ frame.ids.set(branch, ids)
+ self.page().set_redirect_url(session, branch.marshal())
- brokers = self.brokers.get(session)
- action = self.action.get(session)
+ class Groupify(FormButton):
+ def render_content(self, session, model):
+ return "Add to Group"
- if action == "remove":
- branch = session.branch()
- frame = self.page().show_broker_set_remove(branch)
- frame.set_brokers(branch, brokers)
- self.page().set_redirect_url(session, branch.marshal())
- else:
- group = self.groups.get(session)
+ def process_submit(self, session, model):
+ group = self.parent.groups.get(session)
- if group:
- for broker in brokers:
- try:
- broker.addBrokerGroup(group)
- except IntegrityError:
- pass
+ if group:
+ for broker in brokers:
+ try:
+ broker.addBrokerGroup(group)
+ except IntegrityError:
+ pass
- self.page().set_redirect_url(session, session.marshal())
+ self.page().set_redirect_url(session, session.marshal())
- def render_action_param_name(self, session, broker):
- return self.action.path()
+ class NameColumn(SqlTableColumn):
+ def get_title(self, session, model):
+ return "Name"
- def render_submit_param_name(self, session, broker):
- return self.submit.path()
+ def render_content(self, session, data):
+ broker = Identifiable(data["id"])
+ branch = session.branch()
+ self.frame().show_broker(branch, broker).show_view(branch)
+ return fmt_olink(branch, broker, name=data["name"])
- def render_item_checkbox_name(self, session, broker):
- return self.brokers.path()
+ class GroupsColumn(SqlTableColumn):
+ def get_title(self, session, model):
+ return "Groups"
- def render_item_checkbox_value(self, session, broker):
- return self.broker.marshal(broker)
+ def render_content(self, session, data):
+ broker = BrokerRegistration.get(data["id"])
+ count = broker.groups.count()
- def render_item_checkbox_checked_attr(self, session, broker):
- return broker in self.brokers.get(session) and "checked=\"checked\""
+ if count == 0:
+ link = fmt_none()
+ elif count < 3:
+ links = list()
- def render_item_link(self, session, broker):
- branch = session.branch()
- self.page().show_broker(branch, broker).show_view(branch)
- return fmt_olink(branch, broker)
+ for group in broker.groups[:2]:
+ branch = session.branch()
+ frame = self.frame().show_broker_group(branch, group)
+ frame.show_view(branch)
+ links.append(fmt_olink(branch, group))
- def render_item_group_links(self, session, broker):
- count = broker.groups.count()
+ link = ", ".join(links)
+ else:
+ link = "%i groups" % count
- if count == 0:
- link = fmt_none()
- elif count < 3:
- links = list()
+ return link
- for group in broker.groups[:2]:
- branch = session.branch()
- self.page().show_broker_group(branch, group).show_view(branch)
- links.append(fmt_olink(branch, group))
-
- link = ", ".join(links)
- else:
- link = "%i groups" % count
-
- return link
-
- def render_item_profile_link(self, session, broker):
- profile = broker.profile
-
- if profile:
- branch = session.branch()
- self.page().show_broker_profile(branch, profile).show_view(branch)
- return fmt_olink(branch, profile)
- else:
- return fmt_none()
-
- def render_item_cluster_link(self, session, broker):
- cluster = broker.cluster
-
- if cluster:
- branch = session.branch()
- self.page().show_broker_cluster(branch, cluster).show_view(branch)
- return fmt_olink(branch, cluster)
- else:
- return fmt_none()
-
- def render_item_status(self, session, broker):
- return fmt_ostatus(broker)
-
- def render_item_load(self, session, broker):
- return "%.2f" % random()
-
class BrokerSetGroupInput(BrokerGroupInput):
pass
@@ -165,12 +142,18 @@
self.queue = QueueFrame(app, "queue")
self.add_mode(self.queue)
+ self.queues_purge = QueueSetPurge(app, "queuespurge")
+ self.add_mode(self.queues_purge)
+
self.exchange = ExchangeFrame(app, "exchange")
self.add_mode(self.exchange)
self.client = ClientFrame(app, "client")
self.add_mode(self.client)
+ self.clients_close = ClientSetClose(app, "clientsclose")
+ self.add_mode(self.clients_close)
+
def show_config_property(self, session, prop):
self.prop.set_config_property(session, prop)
self.page().set_current_frame(session, self.prop)
@@ -181,6 +164,10 @@
self.page().set_current_frame(session, self.queue)
return self.show_mode(session, self.queue)
+ def show_queues_purge(self, session):
+ self.page().set_current_frame(session, self.queues_purge)
+ return self.show_mode(session, self.queues_purge)
+
def show_exchange(self, session, exchange):
self.exchange.set_object(session, exchange)
self.page().set_current_frame(session, self.exchange)
@@ -191,6 +178,10 @@
self.page().set_current_frame(session, self.client)
return self.show_mode(session, self.client)
+ def show_clients_close(self, session):
+ self.page().set_current_frame(session, self.clients_close)
+ return self.show_mode(session, self.clients_close)
+
def get_title(self, session, broker):
return "Broker '%s'" % broker.name
@@ -720,45 +711,22 @@
def render_cancel_content(self, session, broker):
return "No, Cancel"
-class BrokerSetRemove(CuminActionSetForm, Frame):
- def __init__(self, app, name):
- super(BrokerSetRemove, self).__init__(app, name)
-
- # Note that the params below are not "form params", so we
- # don't use add_form_parameter to exclude them from the
- # marshalled set
-
- param = BrokerParameter(app, "param")
- self.add_parameter(param)
-
- self.brokers = ListParameter(app, "id", param)
- self.add_parameter(self.brokers)
-
+class BrokerSetRemove(CuminBulkActionForm, Frame):
def get_title(self, session, model):
return "Unregister Brokers"
- def set_brokers(self, session, brokers):
- self.brokers.set(session, brokers)
+ def process_item(self, session, id):
+ try:
+ broker = BrokerRegistration.get(id)
+ broker.destroySelf()
+ except Exception, e:
+ # In an extra ui step, note any errors that arose
+ print e
- def process_cancel(self, session, model):
+ def process_return(self, session, id):
branch = session.branch()
- self.page().show_view(branch)
+ self.frame().show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def process_submit(self, session, model):
- brokers = self.brokers.get(session)
-
- for broker in brokers:
- try:
- broker.destroySelf()
- except Exception, e:
- # In an extra ui step, note any errors that arose
- print e
-
- self.process_cancel(session, model)
-
- def get_items(self, session, model):
- return self.brokers.get(session)
-
- def render_item_content(self, session, broker):
- return "Unregister Broker '%s'" % broker.name
+ def render_item_content(self, session, id):
+ return "Unregister Broker '%s'" % BrokerRegistration.get(id).name
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/broker.strings 2008-01-12 22:35:40 UTC (rev 1554)
@@ -2,51 +2,29 @@
<form id="{id}" method="post" action="?">
<!-- <select onchange="document.getElementById('{id}.submit').submit()"> -->
- <div style="float: right; position: relative; top: -2em;">{page}</div>
-
<div class="sactions">
<h2>Act on Selected Brokers:</h2>
+ {unregister}
- <select name="{action_param_name}" onchange="submit()">
- <option value="">Choose Action...</option>
- <option value="remove">Unregister</option>
- </select>
-
<h2>Add to Group:</h2>
-
{groups}
</div>
<table class="mobjects">
- <tr>
- <th></th>
- <th>Name</th>
-<!--
- <th>Profile</th>
- <th>Cluster</th>
--->
- <th>Groups</th>
- <th>Status</th>
- </tr>
-
- {items}
+ <thead>
+ <tr>
+ <th class="setnav" colspan="0">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
+ </tr>
+ <tr>{headers}</tr>
+ </thead>
+ <tbody>{items}</tbody>
</table>
- <input type="hidden" name="{submit_param_name}" value="t"/>
{hidden_inputs}
</form>
-[BrokerSet.item_html]
-<tr>
- <td><input type="checkbox" name="{item_checkbox_name}" value="{item_checkbox_value}" {item_checkbox_checked_attr}/></td>
- <td>{item_link}</td>
-<!--
- <td>{item_profile_link}</td>
- <td>{item_cluster_link}</td>
--->
- <td>{item_group_links}</td>
- <td>{item_status}</td>
-</tr>
-
[BrokerConfigTab.css]
.BrokerConfigTab.diff {
background-color: #ff9;
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/client.py 2008-01-12 22:35:40 UTC (rev 1554)
@@ -11,7 +11,7 @@
strings = StringCatalog(__file__)
-class ClientSet(CuminTable):
+class ClientSet(CuminTable, Form):
def __init__(self, app, name):
super(ClientSet, self).__init__(app, name)
@@ -35,13 +35,13 @@
"(c.frames_to_client - p.frames_to_client)" +
" / extract(epoch from (c.rec_time - p.rec_time))");
- col = CheckboxColumn(app, "id")
- self.add_column(col)
+ self.ids = CheckboxIdColumn(app, "id")
+ self.add_column(self.ids)
col = self.AddressColumn(app, "addr")
self.add_column(col)
- self.set_selected_column(col)
+ self.set_default_column(col)
#col = self.SessionsColumn(app, "sess")
#self.add_column(col)
@@ -57,9 +57,12 @@
self.unit.add_state("f", "Frames")
self.add_child(self.unit)
- self.phase = PhaseSwitch(app, "phase")
- self.add_child(self.phase)
+ self.__phase = PhaseSwitch(app, "phase")
+ self.add_child(self.__phase)
+ self.__close = self.Close(app, "close", self)
+ self.add_child(self.__close)
+
def get_title(self, session, vhost):
return "Clients %s" % fmt_count(vhost.clients.count())
@@ -70,7 +73,7 @@
elems = list()
elems.append("l.vhost_id = %(id)r")
- phase = self.phase.get(session)
+ phase = self.__phase.get(session)
if phase == "a":
elems.append("c.rec_time > now() - interval '10 minutes'")
@@ -85,6 +88,19 @@
def get_sql_values(self, session, vhost):
return {"id": vhost.id}
+ class Close(FormButton):
+ def render_content(self, session, object):
+ return "Close"
+
+ def process_submit(self, session, model):
+ ids = self.parent.ids.get(session)
+ self.parent.ids.clear(session)
+
+ branch = session.branch()
+ frame = self.frame().show_clients_close(branch)
+ frame.ids.set(branch, ids)
+ self.page().set_redirect_url(session, branch.marshal())
+
class AddressColumn(SqlTableColumn):
def get_title(self, session, vhost):
return "Address"
@@ -145,15 +161,28 @@
self.close = ClientClose(app, "close")
self.add_mode(self.close)
+ self.sessions_detach = ClientSessionSetDetach(app, "sessionsdetach")
+ self.add_mode(self.sessions_detach)
+
+ self.sessions_close = ClientSessionSetClose(app, "sessionsclose")
+ self.add_mode(self.sessions_close)
+
def show_close(self, session):
return self.show_mode(session, self.close)
+ def show_sessions_detach(self, session):
+ return self.show_mode(session, self.sessions_detach)
+
+ def show_sessions_close(self, session):
+ return self.show_mode(session, self.sessions_close)
+
def get_title(self, session, client):
return "Client %s" % client.address
def doit(error, args):
- print error, args
- print "did it!"
+ pass
+ #print error, args
+ #print "did it!"
class ClientClose(CuminConfirmForm):
def get_title(self, session, client):
@@ -161,7 +190,7 @@
def process_cancel(self, session, client):
branch = session.branch()
- self.page().show_client(branch, client).show_view(branch)
+ self.frame().show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, client):
@@ -178,6 +207,22 @@
def render_cancel_content(self, session, client):
return "No, Cancel"
+class ClientSetClose(CuminBulkActionForm):
+ def get_title(self, session, object):
+ return "Close Clients"
+
+ def process_return(self, session, object):
+ branch = session.branch()
+ self.frame().show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_item(self, session, id):
+ try:
+ client = Client.get(id)
+ client.close(self.app.model.data, client.managedBroker, doit)
+ except Exception, e:
+ self.add_error(session, e)
+
class ClientStatus(CuminStatus):
def render_frames_from(self, session, client):
stat = self.app.model.client.get_stat("framesFromClient")
@@ -268,7 +313,45 @@
def get_title(self, session, client):
return "History"
-class ClientSessionSet(CuminTable):
+class ClientSessionSetDetach(CuminBulkActionForm, Frame):
+ def get_title(self, session, object):
+ return "Detach Sessions"
+
+ def process_item(self, session, id):
+ try:
+ session_ = Session.get(id)
+ session_.detach(self.app.model.data, session_.managedBroker, doit)
+ except Exception, e:
+ self.add_error(session, e)
+
+ def process_cancel(self, session, object):
+ branch = session.branch()
+ self.frame().show_view(branch).show_sessions(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_return(self, session, object):
+ self.process_cancel(session, object)
+
+class ClientSessionSetClose(CuminBulkActionForm, Frame):
+ def get_title(self, session, object):
+ return "Close Sessions"
+
+ def process_item(self, session, id):
+ try:
+ session_ = Session.get(id)
+ session_.close(self.app.model.data, session_.managedBroker, doit)
+ except Exception, e:
+ self.add_error(session, e)
+
+ def process_cancel(self, session, object):
+ branch = session.branch()
+ self.frame().show_view(branch).show_sessions(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_return(self, session, object):
+ self.process_cancel(session, object)
+
+class ClientSessionSet(CuminTable, Form):
def __init__(self, app, name):
super(ClientSessionSet, self).__init__(app, name)
@@ -277,22 +360,34 @@
self.add_sql_join("session_stats as c", "c.id", "s.stats_curr_id")
self.add_sql_join("session_stats as p", "p.id", "s.stats_curr_id")
+ self.add_sql_column("id", "s.id")
self.add_sql_column("name", "s.name")
self.add_sql_column("expires", "c.expire_time")
self.add_sql_column("status", "c.attached")
+ self.ids = CheckboxIdColumn(app, "id")
+ self.add_column(self.ids)
+
col = self.NameColumn(app, "name")
self.add_column(col)
+ self.set_default_column(col)
+
col = self.ExpiresColumn(app, "expires")
self.add_column(col)
col = self.StatusColumn(app, "status")
self.add_column(col)
- self.phase = PhaseSwitch(app, "phase")
- self.add_child(self.phase)
+ self.__phase = PhaseSwitch(app, "phase")
+ self.add_child(self.__phase)
+ self.__detach = self.Detach(app, "detach", self)
+ self.add_child(self.__detach)
+
+ self.__close = self.Close(app, "close", self)
+ self.add_child(self.__close)
+
def get_title(self, session, client):
return "Sessions %s" % fmt_count(client.sessions.count())
@@ -300,7 +395,7 @@
elems = list()
elems.append("s.client_id = %(id)r")
- phase = self.phase.get(session)
+ phase = self.__phase.get(session)
if phase == "a":
elems.append("c.rec_time > now() - interval '10 minutes'")
@@ -315,6 +410,34 @@
def get_sql_values(self, session, client):
return {"id": client.id}
+ class Detach(FormButton):
+ def render_content(self, session, object):
+ return "Detach"
+
+ def process_submit(self, session, model):
+ ids = self.parent.ids.get(session)
+ self.parent.ids.clear(session)
+
+ branch = session.branch()
+ frame = self.frame().show_sessions_detach(branch)
+ frame.ids.set(branch, ids)
+ self.page().set_current_frame(branch, frame)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ class Close(FormButton):
+ def render_content(self, session, object):
+ return "Close"
+
+ def process_submit(self, session, model):
+ ids = self.parent.ids.get(session)
+ self.parent.ids.clear(session)
+
+ branch = session.branch()
+ frame = self.frame().show_sessions_close(branch)
+ frame.ids.set(branch, ids)
+ self.page().set_current_frame(branch, frame)
+ self.page().set_redirect_url(session, branch.marshal())
+
class NameColumn(SqlTableColumn):
def get_title(self, session, object):
return "Name"
@@ -328,8 +451,11 @@
class StatusColumn(SqlTableColumn):
def get_title(self, session, object):
- return "Status"
+ return "Attached?"
+ def render_value(self, session, value):
+ return fmt_predicate(value)
+
class ClientXmlPage(CuminXmlPage):
def __init__(self, app, name):
super(ClientXmlPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/client.strings 2008-01-12 22:35:40 UTC (rev 1554)
@@ -1,13 +1,12 @@
[ClientSet.html]
-<form>
+<form id="{id}" method="post" action="?">
<div class="rfloat">{phase}</div>
{unit}
<div class="sactions">
<h2>Act on Selected Clients:</h2>
- <button>Close</button>
- <button>Detach</button>
+ {close}
</div>
<table class="mobjects">
@@ -22,6 +21,7 @@
</thead>
<tbody>{items}</tbody>
</table>
+ {hidden_inputs}
</form>
[ClientStatus.javascript]
@@ -132,17 +132,15 @@
<div class="iblock chart">{received}</div>
[ClientSessionSet.html]
-<form>
+<form id="{id}" method="post" action="?">
<div class="rfloat">{phase}</div>
- <ul class="radiotabs"><li> </li></ul>
+ <ul class="radiotabs"><li> </li></ul>
<div class="sactions">
<h2>Act on Selected Sessions:</h2>
- <button>Solicit Ack</button>
- <button>Reset Lifespan</button>
- <button>Detach</button>
- <button>Close</button>
+ {detach}
+ {close}
</div>
<table class="mobjects">
@@ -157,4 +155,5 @@
</thead>
<tbody>{items}</tbody>
</table>
+ {hidden_inputs}
</form>
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/page.py 2008-01-12 22:35:40 UTC (rev 1554)
@@ -35,8 +35,8 @@
self.broker_add = BrokerAdd(app, "brokeradd")
self.add_mode(self.broker_add)
- self.broker_set_remove = BrokerSetRemove(app, "brokersrem")
- self.add_mode(self.broker_set_remove)
+ self.brokers_remove = BrokerSetRemove(app, "brokersremove")
+ self.add_mode(self.brokers_remove)
self.group = BrokerGroupFrame(app, "group")
self.add_mode(self.group)
@@ -93,8 +93,8 @@
frame = self.show_mode(session, self.broker_add)
return self.set_current_frame(session, frame)
- def show_broker_set_remove(self, session):
- frame = self.show_mode(session, self.broker_set_remove)
+ def show_brokers_remove(self, session):
+ frame = self.show_mode(session, self.brokers_remove)
return self.set_current_frame(session, frame)
def show_broker_group(self, session, group):
Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/parameters.py 2008-01-12 22:35:40 UTC (rev 1554)
@@ -69,6 +69,13 @@
def do_marshal(self, queue):
return str(queue.id)
+class SessionParameter(Parameter):
+ def do_unmarshal(self, string):
+ return Session.get(int(string))
+
+ def do_marshal(self, session):
+ return str(session.id)
+
class VirtualHostParameter(Parameter):
def do_unmarshal(self, string):
return Vhost.get(int(string))
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/queue.py 2008-01-12 22:35:40 UTC (rev 1554)
@@ -16,7 +16,7 @@
strings = StringCatalog(__file__)
-class QueueSet(CuminTable):
+class QueueSet(CuminTable, Form):
def __init__(self, app, name):
super(QueueSet, self).__init__(app, name)
@@ -46,13 +46,13 @@
self.add_sql_column("mdepthaccel", "1")
self.add_sql_column("bdepthaccel", "1")
- col = CheckboxColumn(app, "id")
- self.add_column(col)
+ self.ids = CheckboxIdColumn(app, "id")
+ self.add_column(self.ids)
col = self.NameColumn(app, "name")
self.add_column(col)
- self.set_selected_column(col)
+ self.set_default_column(col)
col = self.ConsumersColumn(app, "consumers")
self.add_column(col)
@@ -75,6 +75,9 @@
self.phase = PhaseSwitch(app, "phase")
self.add_child(self.phase)
+ self.__purge = self.Purge(app, "purge", self)
+ self.add_child(self.__purge)
+
def get_title(self, session, vhost):
return "Queues %s" % fmt_count(vhost.queues.count())
@@ -97,6 +100,19 @@
def get_sql_values(self, session, vhost):
return {"id": vhost.id}
+ class Purge(FormButton):
+ def process_submit(self, session, object):
+ ids = self.parent.ids.get(session)
+ self.parent.ids.clear(session)
+
+ branch = session.branch()
+ frame = self.frame().show_queues_purge(branch)
+ frame.ids.set(branch, ids)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def render_content(self, session, object):
+ return "Purge"
+
class NameColumn(SqlTableColumn):
def get_title(self, session, object):
return "Name"
@@ -430,7 +446,7 @@
def process_cancel(self, session, queue):
branch = session.branch()
- self.page().show_queue(branch, queue).show_view(branch)
+ self.frame().show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, queue):
@@ -447,6 +463,23 @@
def render_cancel_content(self, session, queue):
return "No, Cancel"
+class QueueSetPurge(CuminBulkActionForm):
+ def get_title(self, session, object):
+ return "Purge Queues"
+
+ def process_return(self, session, object):
+ branch = session.branch()
+ self.frame().show_view(branch)
+ # XXX need to set current frame here?
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_item(self, session, id):
+ try:
+ queue = Queue.get(id)
+ queue.purge(self.app.model.data, queue.managedBroker, doit)
+ except Exception, e:
+ self.add_error(session, e)
+
class QueueBindingAdd(CuminForm):
def __init__(self, app, name):
super(QueueBindingAdd, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/queue.strings 2008-01-12 22:35:40 UTC (rev 1554)
@@ -1,12 +1,12 @@
[QueueSet.html]
-<form>
+<form id="{id}" method="post" action="?">
<div class="rfloat">{phase}</div>
{unit}
<div class="sactions">
<h2>Act on Selected Queues:</h2>
- <button>Purge Messages</button>
+ {purge}
</div>
<table class="mobjects">
@@ -21,6 +21,7 @@
</thead>
<tbody>{items}</tbody>
</table>
+ {hidden_inputs}
</form>
[QueueForm.html]
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-12 22:35:40 UTC (rev 1554)
@@ -138,6 +138,39 @@
def __init__(self, app, name):
super(CuminActionSetForm, self).__init__(app, name)
+class CuminBulkActionForm(ItemSet, CuminForm, Frame):
+ def __init__(self, app, name):
+ super(CuminBulkActionForm, self).__init__(app, name)
+
+ param = IntegerParameter(app, "param")
+ self.add_parameter(param)
+
+ self.ids = ListParameter(app, "id", param)
+ self.add_parameter(self.ids)
+
+ def get_items(self, session, object):
+ return self.ids.get(session)
+
+ def process_submit(self, session, object):
+ items = self.get_items(session, object)
+
+ for item in items:
+ self.process_item(session, item)
+
+ self.process_return(session, object)
+
+ def process_item(self, session, item):
+ print "processing item", item
+
+ def process_return(self, session, object):
+ pass
+
+ def process_cancel(self, session, object):
+ self.process_return(session, object)
+
+ def render_item_content(self, session, id):
+ return "Act on object %i" % id
+
class CuminStatus(Widget):
def render_class(self, session, object):
if hasattr(object, "errors"):
@@ -452,3 +485,27 @@
def render_item_messages_matched_rate(self, session, binding):
stat = self.app.model.binding.get_stat("msgMatched")
return fmt_rate(stat.rate(binding), "msg", "sec")
+
+class CheckboxIdColumn(SqlTableColumn):
+ def __init__(self, app, name):
+ super(CheckboxIdColumn, self).__init__(app, name)
+
+ param = IntegerParameter(app, "param")
+ self.add_parameter(param)
+
+ self.__list = ListParameter(app, "id", param)
+ self.add_parameter(self.__list)
+
+ def get(self, session):
+ return self.__list.get(session)
+
+ def clear(self, session):
+ self.__list.set(session, list())
+
+ def do_render(self, session, data):
+ name = self.__list.path()
+ id = data[self.name]
+ attr = id in self.__list.get(session) and "checked=\"checked\"" or ""
+ t = "<td><input type=\"checkbox\" name=\"%s\" value=\"%i\" %s/></td>"
+
+ return t % (name, id, attr)
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/cumin/widgets.strings 2008-01-12 22:35:40 UTC (rev 1554)
@@ -40,6 +40,32 @@
[CuminActionSetForm.item_html]
<li>{item_content}</li>
+[CuminBulkActionForm.html]
+<form id="{id}" class="mform" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <span class="legend">Actions</span>
+ <fieldset>
+ <ul>{items}</ul>
+ </fieldset>
+
+ {hidden_inputs}
+ </div>
+ <div class="foot">
+ <div style="display: block; float: left;"><button>Help</button></div>
+ {cancel}
+ {submit}
+ </div>
+</form>
+<script>
+ wooly.doc().elembyid("{id}").node.elements[0].focus();
+</script>
+
+[CuminBulkActionForm.item_html]
+<li>{item_content}</li>
+
[CuminStatus.javascript]
function updateStatus(id, object) {
var status = wooly.doc().elembyid(id);
Modified: mgmt/cumin/python/wooly/parameters.py
===================================================================
--- mgmt/cumin/python/wooly/parameters.py 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/wooly/parameters.py 2008-01-12 22:35:40 UTC (rev 1554)
@@ -11,6 +11,9 @@
self.is_collection = True
+ def set_element_parameter(self, param):
+ self.param = param
+
def get_default(self, session):
return copy(self.default)
Modified: mgmt/cumin/python/wooly/tables.py
===================================================================
--- mgmt/cumin/python/wooly/tables.py 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/cumin/python/wooly/tables.py 2008-01-12 22:35:40 UTC (rev 1554)
@@ -33,7 +33,7 @@
if column.name == name:
return column
- def set_selected_column(self, column):
+ def set_default_column(self, column):
self.scolumn.default = column.name
def is_reversed(self, session):
@@ -171,8 +171,13 @@
self.get_orderby_sql(session),
self.get_limit_sql(session))
- return self.build_sql(elems)
+ sql = self.build_sql(elems)
+ #print "sql -----------------------"
+ #print sql
+
+ return sql
+
def get_count_sql(self, session):
elems = ("select count(*)",
self.get_from_sql(session),
@@ -293,7 +298,7 @@
dir = self.parent.is_reversed(session) and "desc" or "asc"
return "order by %s %s" % (key, dir)
-class CheckboxColumn(ItemTableColumn):
+class CheckboxColumn(SqlTableColumn):
def do_render(self, session, data):
return "<td><input type=\"checkbox\" name=\"%s\"/></td>" % \
data[self.name]
Modified: mgmt/notes/errors.txt
===================================================================
--- mgmt/notes/errors.txt 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/notes/errors.txt 2008-01-12 22:35:40 UTC (rev 1554)
@@ -1,3 +1,34 @@
[justin@localhost cumindev]$ cumindev-etags
/home/justin/cumindev/cumin/python/cumin/.#model.py: No such file or directory
+APPLICATION ERROR
+
+----- python trace -----
+Traceback (most recent call last):
+ File "/home/jross/mgmt/cumin/python/wooly/server.py", line 83, in service
+ response = page.render(session, None)
+ File "/home/jross/mgmt/cumin/python/wooly/__init__.py", line 255, in render
+ string = self.do_render(session, object)
+ File "/home/jross/mgmt/cumin/python/wooly/__init__.py", line 265, in do_render
+ self.__main_tmpl.render(session, object, writer)
+ File "/home/jross/mgmt/cumin/python/wooly/__init__.py", line 791, in render
+ result = elem(self.widget, session, object)
+ File "/home/jross/mgmt/cumin/python/wooly/widgets.py", line 45, in render_mode
+ return mode.render(session, object)
+ File "/home/jross/mgmt/cumin/python/wooly/__init__.py", line 255, in render
+ string = self.do_render(session, object)
+ File "/home/jross/mgmt/cumin/python/wooly/__init__.py", line 265, in do_render
+ self.__main_tmpl.render(session, object, writer)
+ File "/home/jross/mgmt/cumin/python/wooly/__init__.py", line 791, in render
+ result = elem(self.widget, session, object)
+ File "/home/jross/mgmt/cumin/python/cumin/broker.py", line 616, in render_fields
+ self.field_tmpl.render(session, i, writer)
+ File "/home/jross/mgmt/cumin/python/wooly/__init__.py", line 791, in render
+ result = elem(self.widget, session, object)
+ File "/home/jross/mgmt/cumin/python/cumin/broker.py", line 643, in render_groups
+ self.group_tmpl.render(session, (index, group), writer)
+ File "/home/jross/mgmt/cumin/python/wooly/__init__.py", line 791, in render
+ result = elem(self.widget, session, object)
+ File "/home/jross/mgmt/cumin/python/cumin/broker.py", line 658, in render_group_selected_attr
+ if len(groups) > index and group.id == groups[index].id:
+AttributeError: 'NoneType' object has no attribute 'id'
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-01-11 17:43:52 UTC (rev 1553)
+++ mgmt/notes/justin-todo.txt 2008-01-12 22:35:40 UTC (rev 1554)
@@ -4,14 +4,8 @@
- Add javascript for the check-all behavior
- - "purge messages from queues"
-
* Improve charts
- - Add legends to charts
-
- - Display current values on right-side and according to color
-
- Add a "rate" mode to charts
* Mgmtd-broker interaction
@@ -34,6 +28,8 @@
* Div by zero error in queues view
+ * Make column sort disableable
+
Deferred
* Add "slowest views" tracking to --bench
17 years, 2 months
rhmessaging commits: r1553 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-11 12:43:52 -0500 (Fri, 11 Jan 2008)
New Revision: 1553
Modified:
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
Log:
Display the unit with the current value.
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-11 17:30:05 UTC (rev 1552)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-11 17:43:52 UTC (rev 1553)
@@ -101,7 +101,9 @@
def render_stats(self, session, object):
writer = Writer()
- for stat in self.stats:
+ for name in self.stats:
+ cls = self.app.model.get_class_by_object(object)
+ stat = cls.get_stat(name)
self.stats_tmpl.render(session, (stat, object), writer)
return writer.to_string()
@@ -111,9 +113,13 @@
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)
+ return stat.value_html(object)
+ def render_stat_unit(self, session, args):
+ stat, object = args
+ value = stat.value(object)
+ return "%s%s" % (stat.unit, ess(value))
+
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 17:30:05 UTC (rev 1552)
+++ mgmt/cumin/python/cumin/stat.strings 2008-01-11 17:43:52 UTC (rev 1553)
@@ -114,5 +114,5 @@
[StatValueChart.stat_html]
<li>
<span class="swatch" style="background-color: {stat_color}"> </span>
- {stat_value}
+ {stat_value} {stat_unit}
</li>
17 years, 2 months
rhmessaging commits: r1552 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-11 12:30:05 -0500 (Fri, 11 Jan 2008)
New Revision: 1552
Modified:
mgmt/cumin/python/cumin/charts.py
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
Log:
Improvements to the x axis display in charts.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2008-01-11 16:55:50 UTC (rev 1551)
+++ mgmt/cumin/python/cumin/charts.py 2008-01-11 17:30:05 UTC (rev 1552)
@@ -51,7 +51,7 @@
self.stroke(cr)
- def plot_x_axis(self, interval):
+ def plot_x_axis(self, interval, step):
cr = Context(self.surface)
cr.set_line_width(0.2)
cr.set_source_rgb(0.6, 0.6, 0.6)
@@ -62,7 +62,7 @@
cr.move_to(x, 0)
cr.line_to(x, self.height + 10)
- if i % 2 == 0:
+ if i % step == 0:
value = self.x_max - (self.x_max * x / float(self.width))
cr.show_text(fmt_duration_brief(value))
@@ -70,7 +70,7 @@
self.stroke(cr)
- def plot_y_axis(self, interval):
+ def plot_y_axis(self, interval, step):
cr = Context(self.surface)
cr.set_line_width(0.2)
cr.set_source_rgb(0.6, 0.6, 0.6)
@@ -81,7 +81,7 @@
cr.move_to(0, y)
cr.line_to(self.width + 2, y)
- if i % 2 == 0:
+ if i % step == 0:
value = int(self.y_max - (self.y_max * y / float(self.height)))
if value > 10000:
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-11 16:55:50 UTC (rev 1551)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-11 17:30:05 UTC (rev 1552)
@@ -188,9 +188,15 @@
chart.set_x_max(duration)
chart.set_y_max(max_value)
- chart.plot_x_axis(48)
- chart.plot_y_axis(20)
+ x_interval = 40
+ step = 2
+ if duration == 600:
+ x_interval = 48
+
+ chart.plot_x_axis(x_interval, step)
+ chart.plot_y_axis(20, 2)
+
colors = ((1,0,0), (0,0,1), (0,1,0))
for stat, color in zip(stats, colors):
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-01-11 16:55:50 UTC (rev 1551)
+++ mgmt/cumin/python/cumin/stat.strings 2008-01-11 17:30:05 UTC (rev 1552)
@@ -92,12 +92,16 @@
padding: 0 0.4em;
}
+table.StatValueChart ul.radiotabs li {
+ display: block;
+}
+
[StatValueChart.html]
<table class="StatValueChart">
<tr>
<td><img id="{id}" src="{href}" height="140" width="540"/></td>
<td>
- {stats}
+ <ul>{stats}</ul>
<br/>
{duration}
</td>
@@ -108,5 +112,7 @@
</script>
[StatValueChart.stat_html]
-<span class="swatch" style="background-color: {stat_color}"> </span> {stat_value}
-<br/>
+<li>
+ <span class="swatch" style="background-color: {stat_color}"> </span>
+ {stat_value}
+</li>
17 years, 2 months