rhmessaging commits: r2729 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-03 08:43:01 -0500 (Mon, 03 Nov 2008)
New Revision: 2729
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Sanity check to avoid a possible exception.
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-11-01 22:27:51 UTC (rev 2728)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-11-03 13:43:01 UTC (rev 2729)
@@ -333,9 +333,10 @@
def process(self, session):
group = self.frame.get_args(session)[0]
- where_group = "custom_group = '%s'" % group.get_id()
- value = Job.select(where_group).count()
- self.jobs.set(session, value)
+ if group:
+ where_group = "custom_group = '%s'" % group.get_id()
+ value = Job.select(where_group).count()
+ self.jobs.set(session, value)
super(JobGroupStatSet, self).process(session)
def render_rate_text(self, session, args):
16 years, 2 months
rhmessaging commits: r2728 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-01 18:27:51 -0400 (Sat, 01 Nov 2008)
New Revision: 2728
Modified:
mgmt/trunk/cumin/python/cumin/stat.strings
Log:
Remove inefficiency in javascript
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 22:25:18 UTC (rev 2727)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 22:27:51 UTC (rev 2728)
@@ -212,14 +212,12 @@
if (oGrid) {
var left = this.get_left(oGrid);
var right = left + oGrid.offsetWidth;
- var rule = this.find_rule();
- if (rule) {
- var wwidth = 9999;
- if (window.innerWidth)
- wwidth = window.innerWidth;
- else if (document.documentElement)
- wwidth = document.documentElement.clientWidth;
- if (right + 310 > wwidth) {
+ var wwidth = 9999;
+ if (window.innerWidth)
+ wwidth = window.innerWidth;
+ if (right + 310 > wwidth) {
+ var rule = this.find_rule();
+ if (rule) {
rule.style.left = "";
rule.style.right = "50%";
}
16 years, 2 months
rhmessaging commits: r2727 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-01 18:25:18 -0400 (Sat, 01 Nov 2008)
New Revision: 2727
Modified:
mgmt/trunk/cumin/python/cumin/stat.strings
Log:
Fixup javascript that ensures the grid widget mouseover popup doesn't appear past the right side of the browser window.
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 18:53:36 UTC (rev 2726)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 22:25:18 UTC (rev 2727)
@@ -175,21 +175,15 @@
this.find_rule = function() {
if (document.styleSheets) {
for (var i=0; i<document.styleSheets.length; i++) {
- sheet = document.styleSheets[i];
+ var sheet = document.styleSheets[i];
if (sheet.href.indexOf("cumin.css") != -1) {
- rules = sheet.rules ? sheet.rules : sheet.cssRules;
- if (rules[0].selectorText) { // IE
+ if (sheet.cssRules) {
+ var rules = sheet.cssRules;
for (var j=0; j<rules.length; j++) {
- if (rules[j].selectorText == "DIV.sticky_note") {
+ if (rules[j].cssText.indexOf("div.sticky_note") != -1) {
return rules[j];
}
}
- } else {
- for (var j=0; j<rules.length; j++) {
- if (rules[j].cssText == "div.sticky_note") {
- return rules[j];
- }
- }
}
}
}
@@ -202,7 +196,7 @@
var true_left = o.offsetLeft;
while (p != null) {
- tag = p.tagName;
+ var tag = p.tagName;
if (p.clientLeft) {
if ( (tag != "TABLE") && (tag != "BODY") ) {
true_left += p.clientLeft;
@@ -220,12 +214,11 @@
var right = left + oGrid.offsetWidth;
var rule = this.find_rule();
if (rule) {
+ var wwidth = 9999;
if (window.innerWidth)
wwidth = window.innerWidth;
else if (document.documentElement)
wwidth = document.documentElement.clientWidth;
- else
- wwidth = 9999;
if (right + 310 > wwidth) {
rule.style.left = "";
rule.style.right = "50%";
16 years, 2 months
rhmessaging commits: r2726 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-01 14:53:36 -0400 (Sat, 01 Nov 2008)
New Revision: 2726
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
mgmt/trunk/cumin/python/cumin/system.py
Log:
Use Itemset for grid widget cells
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-11-01 18:52:43 UTC (rev 2725)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-11-01 18:53:36 UTC (rev 2726)
@@ -608,7 +608,7 @@
self.slot_set = self.ModelSystemSlotSet(cls.model.app, name)
def get_xml_response(self, session, system, *args):
- slots = self.get_slots(session, system)[0]
+ slots = self.get_slots(session, system)
writer = Writer()
writer.write("<slots>")
for slot in slots:
@@ -624,7 +624,7 @@
def get_slots(self, session, system):
cursor = self.slot_set.do_get_items(session, system)
slot_list = self.slot_set.cursor_to_rows(cursor)
- return (slot_list, )
+ return slot_list
class ModelSystemSlotSet(SystemSlotSet):
def render_sql_limit(self, session, *args):
@@ -1838,7 +1838,7 @@
def get_xml_response(self, session, pool, *args):
pool = self.model.get_main_pool()
- jobs = self.get_jobs(session, pool)[0]
+ jobs = self.get_jobs(session, pool)
writer = Writer()
writer.write("<jobs>")
for job in jobs:
@@ -1854,8 +1854,7 @@
def get_jobs(self, session, pool):
cursor = self.job_set.do_get_items(session, pool)
- job_list = self.job_set.cursor_to_rows(cursor)
- return (job_list, )
+ return self.job_set.cursor_to_rows(cursor)
class ModelSystemJobSet(JobSet):
def render_sql_limit(self, session, *args):
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-11-01 18:52:43 UTC (rev 2725)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-11-01 18:53:36 UTC (rev 2726)
@@ -259,34 +259,26 @@
return "Statistics"
class JobUtilizationGrid(StatUtilizationGrid):
- def get_args(self, session):
+ def get_cells(self, session):
pool = self.frame.get_args(session)[0]
action = self.app.model.pool.jobs
return action.get_jobs(session, pool)
- def render_title(self, session, jobs):
+ def render_title(self, session):
return ""
- def render_override_style(self, session, jobs):
- count = self.get_object_count(session, jobs)
- if count > 100:
- return "style=\"width: 15em; height: 15em;\""
-
def get_colors(self, session):
action = self.app.model.pool.jobs
return action.get_colors()
- def render_color(self, session, count, job):
+ def get_color(self, session, job):
action = self.app.model.pool.jobs
return action.get_color(job)
- def render_contents(self, session, count, job):
+ def get_contents(self, session, job):
return ""
- def render_cell_id(self, session, count, job):
- return "%i" % job["id"]
-
- def render_href(self, session, count, job):
+ def get_href(self, session, job):
branch = session.branch()
ojob = Job.get(job["id"])
return self.page.main.pool.job.get_href(branch, ojob)
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2008-11-01 18:52:43 UTC (rev 2725)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2008-11-01 18:53:36 UTC (rev 2726)
@@ -144,73 +144,105 @@
def __init__(self, app, name):
super(StatUtilizationGrid, self).__init__(app, name)
- self.stats_tmpl = Template(self, "cell_html")
+ cells = self.GridCells(app, "grid")
+ self.add_child(cells)
- self.sticky = self.Sticky(app, "sticky_info")
- self.add_child(self.sticky)
-
legend = self.Legend(app, "grid_legend")
self.add_child(legend)
ajax = self.Updater(app, "grid_updater")
self.add_child(ajax)
- def get_args(self, session):
- """ must return a sequence """
- return list()
-
- def render_title(self, session, objects):
+ def render_title(self, session):
return "Utilization"
- def render_grid(self, session, objects):
- writer = Writer()
+ class GridCells(ItemSet):
+ def __init__(self, app, name):
+ super(StatUtilizationGrid.GridCells, self).__init__(app, name)
+
+ self.width = Attribute(app, "width")
+ self.add_attribute(self.width)
- count = self.get_object_count(session, objects)
- for object in objects:
- self.stats_tmpl.render(writer, session, count, object)
- return writer.to_string()
+ self.sticky = self.Sticky(app, "sticky_info")
+ self.add_child(self.sticky)
- def get_object_count(self, session, objects):
- return len(objects)
+ def do_get_items(self, session):
+ cells = self.parent.get_cells(session)
+ self.width.set(session,
+ self.calculate_cell_width(len(cells)))
+ return cells
+
+ def render_cell_id(self, session, cell):
+ return cell["id"]
+
+ def render_cell_width(self, session, cell):
+ return self.width.get(session)
+
+ def calculate_cell_width(self, count):
+ sq = sqrt(count)
+ isq = int(sq)
+ if sq > isq:
+ isq = isq + 1
+
+ if count > 0:
+ return int(100 / isq)
+ else:
+ return 100
+
+ def render_href(self, session, cell):
+ return self.parent.get_href(session, cell)
+
+ def render_color(self, session, cell):
+ return self.parent.get_color(session, cell)
+
+ def render_contents(self, session, cell):
+ return self.parent.get_contents(session, cell)
- def render_override_style(self, session, objects):
- pass
+ def get_sticky_info(self, session):
+ return self.parent.get_sticky_info(session)
+
+ def render_sticky_rows(self, session, cell):
+ return self.sticky.render_items(session, cell)
- def render_cell_width(self, session, count, object):
- sq = sqrt(count)
- isq = int(sq)
- if sq > isq:
- isq = isq + 1
+ class Sticky(ItemSet):
+ def do_get_items(self, session, cell):
+ info = self.parent.get_sticky_info(session)
+ return [(inf, cell["id"]) for inf in info]
- if count > 0:
- return int(100 / isq)
- else:
- return 100
-
- def render_href(self, session, count, object):
+ def render_sticky_name(self, session, item):
+ return item[0][0]
+
+ def render_sticky_title(self, session, item):
+ return item[0][1]
+
+ def render_sticky_object_id(self, session, item):
+ return item[1]
+
+ def get_cells(self, session):
+ """ should return a list of dictionaries """
+ return list()
+
+ def get_href(self, session, cell):
return "#"
- def render_color(self, session, count, object):
+ def get_color(self, session, cell):
return "clear"
- def render_contents(self, session, count, object):
+ def get_contents(self, session, cell):
return ""
- def render_cell_id(self, session, count, object):
- return 1
-
def get_colors(self, session):
return ["clear"]
- def render_sticky_rows(self, session, count, object):
- return self.sticky.render_items(session, object)
-
def get_url(self, session):
""" returns something like
"call.xml?class=system;id=%i;method=slots" % system.id
"""
pass
+ def get_sticky_info(self, session):
+ return [("Name", "Display Title")]
+
def get_fn(self, session):
return self.name
@@ -220,9 +252,6 @@
def elem_id(self, session):
return self.name
- def get_sticky_info(self, session):
- return [("Name", "Display Title")]
-
class Legend(ItemSet):
def do_get_items(self, session, *args):
return self.parent.get_colors(session)
@@ -233,21 +262,6 @@
def render_legend_color(self, session, color):
return color[1]
- class Sticky(ItemSet):
- def do_get_items(self, session, *args):
- info = self.parent.get_sticky_info(session)
- object = args[0]
- return [(inf, self.parent.render_cell_id(session, 1, object)) for inf in info]
-
- def render_sticky_name(self, session, item):
- return item[0][0]
-
- def render_sticky_title(self, session, item):
- return item[0][1]
-
- def render_sticky_object_id(self, session, item):
- return item[1]
-
class Updater(AjaxField):
def do_render(self, session):
return self.render_script(session)
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 18:52:43 UTC (rev 2725)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 18:53:36 UTC (rev 2726)
@@ -323,7 +323,7 @@
<div class="StatUtilizationGrid" id="{id}">
<div class="visualization">
<h2>{title}</h2>
- <div id="StatGrid" class="StatGrid" {override_style}>
+ <div id="StatGrid" class="StatGrid">
{grid}
</div>
<div style="clear:left;"><!-- --></div>
@@ -334,7 +334,10 @@
</div>
{grid_updater}
-[StatUtilizationGrid.cell_html]
+[GridCells.html]
+{items}
+
+[GridCells.item_html]
<div id="{cell_id}" class="grid_cell"
style="width:{cell_width}%; height:{cell_width}%;"
onmouseover="over_cell(this)"
@@ -354,7 +357,6 @@
</tr>
[Legend.item_html]
-<div class="legend">
+<li>
<button class="btn {legend_color}" style="background-image: none; width:1em; height:1em;" ></button> {legend_text}
-</div>
-
\ No newline at end of file
+</li>
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-11-01 18:52:43 UTC (rev 2725)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-11-01 18:53:36 UTC (rev 2726)
@@ -59,26 +59,26 @@
return "Statistics"
class SlotUtilizationGrid(StatUtilizationGrid):
- def get_args(self, session):
+ def get_cells(self, session):
system = self.frame.get_args(session)[0]
action = self.app.model.system.slots
return action.get_slots(session, system)
- def render_title(self, session, slots):
+ def render_title(self, session):
return "Slot Utilization"
def get_colors(self, session):
action = self.app.model.system.slots
return action.get_colors()
- def render_color(self, session, count, slot):
+ def get_color(self, session, slot):
action = self.app.model.system.slots
return action.get_color(slot)
- def render_contents(self, session, count, slot):
+ def get_contents(self, session, slot):
return ""
- def render_href(self, session, count, slot):
+ def get_href(self, session, slot):
branch = session.branch()
try:
job = Job.select("custom_id = '%s'" % slot.JobId)[0]
@@ -86,9 +86,6 @@
return "#"
return self.page.main.pool.job.get_href(branch, job)
- def render_cell_id(self, session, count, slot):
- return "%i" % slot["id"]
-
def get_url(self, session):
system = self.parent.frame.get_args(session)[0]
return "call.xml?class=system;id=%i;method=slots" % system.id
16 years, 2 months
rhmessaging commits: r2725 - mgmt/trunk/cumin/resources.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-01 14:52:43 -0400 (Sat, 01 Nov 2008)
New Revision: 2725
Modified:
mgmt/trunk/cumin/resources/ie.css
Log:
Switched to <ul> for grid widget legend so style what no longer needed
Modified: mgmt/trunk/cumin/resources/ie.css
===================================================================
--- mgmt/trunk/cumin/resources/ie.css 2008-11-01 17:28:21 UTC (rev 2724)
+++ mgmt/trunk/cumin/resources/ie.css 2008-11-01 18:52:43 UTC (rev 2725)
@@ -20,6 +20,6 @@
background-image: url(resource?name=radio-button-checked.png);
}
-div#cell_legend button {
- top: 0px;
-}
+div.grid_cell div.sticky_note {
+ visibility: hidden; /* doesn't work over <button>s anyway */
+}
\ No newline at end of file
16 years, 2 months
rhmessaging commits: r2724 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-01 13:28:21 -0400 (Sat, 01 Nov 2008)
New Revision: 2724
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
Log:
Using ItemSet for grid widget legend
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-11-01 16:47:39 UTC (rev 2723)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-11-01 17:28:21 UTC (rev 2724)
@@ -1291,7 +1291,4 @@
@classmethod
def get_zipped_colors(cls):
- colors = dict()
- for stat in cls.stat_strings:
- colors[stat] = cls.stat_colors[cls.stat_strings.index(stat)]
- return colors
\ No newline at end of file
+ return zip(cls.stat_strings, cls.stat_colors)
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-11-01 16:47:39 UTC (rev 2723)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-11-01 17:28:21 UTC (rev 2724)
@@ -593,12 +593,14 @@
return object.nodeName
class VisSlots(CuminAction):
- load_colors = {"Idle": "clear",
- "Busy": "green",
- "Suspended": "red",
- "Vacating": "red",
- "Killing": "blue",
- "Benchmarking": "yellow" }
+ # list of status/colors in the order we want them displayed
+ # in the legend
+ load_colors = [("Idle", "clear"),
+ ("Busy", "green"),
+ ("Suspended", "red"),
+ ("Vacating", "red"),
+ ("Killing", "blue"),
+ ("Benchmarking", "yellow")]
def __init__(self, cls, name):
super(CuminSystem.VisSlots, self).__init__(cls, name)
@@ -633,9 +635,10 @@
def get_color(self, slot):
activity = slot["activity"]
- if activity in self.load_colors:
- return self.load_colors[activity]
- return "black"
+ for status, color in self.load_colors:
+ if status == activity:
+ return color
+ return "black"
def get_colors(self):
return self.load_colors
@@ -1871,7 +1874,7 @@
status = self.get_status(job)
color = JobStatusInfo.get_status_color(status)
if "Idle" == JobStatusInfo.get_status_string(status):
- color = "clear"
+ color = "clear" # instead of green
return color
def get_colors(self):
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2008-11-01 16:47:39 UTC (rev 2723)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2008-11-01 17:28:21 UTC (rev 2724)
@@ -145,13 +145,15 @@
super(StatUtilizationGrid, self).__init__(app, name)
self.stats_tmpl = Template(self, "cell_html")
- self.legend_tmpl = Template(self, "legend_html")
self.sticky = self.Sticky(app, "sticky_info")
self.add_child(self.sticky)
+
+ legend = self.Legend(app, "grid_legend")
+ self.add_child(legend)
- self.ajax = self.Updater(app, "grid_updater")
- self.add_child(self.ajax)
+ ajax = self.Updater(app, "grid_updater")
+ self.add_child(ajax)
def get_args(self, session):
""" must return a sequence """
@@ -174,21 +176,6 @@
def render_override_style(self, session, objects):
pass
- def render_legends(self, session, objects):
- colors = self.get_colors(session)
- writer = Writer()
-
- sorted_keys = sorted(colors.keys())
- for key in sorted_keys:
- self.legend_tmpl.render(writer, session, colors, key)
- return writer.to_string()
-
- def render_legend_color(self, session, colors, key):
- return colors[key]
-
- def render_legend_text(self, session, colors, key):
- return key
-
def render_cell_width(self, session, count, object):
sq = sqrt(count)
isq = int(sq)
@@ -212,6 +199,9 @@
def render_cell_id(self, session, count, object):
return 1
+ def get_colors(self, session):
+ return ["clear"]
+
def render_sticky_rows(self, session, count, object):
return self.sticky.render_items(session, object)
@@ -233,6 +223,16 @@
def get_sticky_info(self, session):
return [("Name", "Display Title")]
+ class Legend(ItemSet):
+ def do_get_items(self, session, *args):
+ return self.parent.get_colors(session)
+
+ def render_legend_text(self, session, color):
+ return color[0]
+
+ def render_legend_color(self, session, color):
+ return color[1]
+
class Sticky(ItemSet):
def do_get_items(self, session, *args):
info = self.parent.get_sticky_info(session)
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 16:47:39 UTC (rev 2723)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 17:28:21 UTC (rev 2724)
@@ -330,7 +330,7 @@
</div>
</div>
<div id="cell_legend">
- {legends}
+ {grid_legend}
</div>
{grid_updater}
@@ -353,10 +353,8 @@
<td class="sticky_values" nowrap="nowrap"><span id="cell_{sticky_name}_{sticky_object_id}"></span></td>
</tr>
-[StatUtilizationGrid.legend_html]
+[Legend.item_html]
<div class="legend">
<button class="btn {legend_color}" style="background-image: none; width:1em; height:1em;" ></button> {legend_text}
</div>
-
-
\ No newline at end of file
16 years, 2 months
rhmessaging commits: r2723 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-01 12:47:39 -0400 (Sat, 01 Nov 2008)
New Revision: 2723
Modified:
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
mgmt/trunk/cumin/python/cumin/system.py
Log:
Use an ItemSet for the grid widget's popup sticky notes
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-10-31 23:14:45 UTC (rev 2722)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-11-01 16:47:39 UTC (rev 2723)
@@ -295,16 +295,7 @@
pool = self.parent.frame.get_args(session)[0]
return "call.xml?class=pool;method=jobs"
- def get_fn(self, session):
- return self.parent.grid.name
-
- def got_fn(self, session):
- return self.parent.grid.name
-
- def elem_id(self, session):
- return self.parent.grid.name
-
- def do_get_sticky_info(self, session):
+ def get_sticky_info(self, session):
return [("name", "ID"), ("submitter", "Submitter"), ("status", "Status")]
class PoolStatSet(StatSet):
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2008-10-31 23:14:45 UTC (rev 2722)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2008-11-01 16:47:39 UTC (rev 2723)
@@ -145,10 +145,11 @@
super(StatUtilizationGrid, self).__init__(app, name)
self.stats_tmpl = Template(self, "cell_html")
- self.sticky_names_tmpl = Template(self, "sticky_name_html")
- self.sticky_values_tmpl = Template(self, "sticky_value_html")
self.legend_tmpl = Template(self, "legend_html")
+ self.sticky = self.Sticky(app, "sticky_info")
+ self.add_child(self.sticky)
+
self.ajax = self.Updater(app, "grid_updater")
self.add_child(self.ajax)
@@ -173,7 +174,7 @@
def render_override_style(self, session, objects):
pass
- def render_legends(self, session, slots):
+ def render_legends(self, session, objects):
colors = self.get_colors(session)
writer = Writer()
@@ -211,6 +212,9 @@
def render_cell_id(self, session, count, object):
return 1
+ def render_sticky_rows(self, session, count, object):
+ return self.sticky.render_items(session, object)
+
def get_url(self, session):
""" returns something like
"call.xml?class=system;id=%i;method=slots" % system.id
@@ -218,42 +222,32 @@
pass
def get_fn(self, session):
- return self.ajax.name
+ return self.name
def got_fn(self, session):
- return self.ajax.name
+ return self.name
def elem_id(self, session):
- return self.ajax.name
+ return self.name
- def render_sticky_names(self, session, count, object):
- names = self.do_get_sticky_info(session)
- writer = Writer()
-
- for name, desc in names:
- self.sticky_names_tmpl.render(writer, session, desc)
- return writer.to_string()
+ def get_sticky_info(self, session):
+ return [("Name", "Display Title")]
- def render_sticky_title(self, session, desc):
- return desc
-
- def render_sticky_values(self, session, count, object):
- names = self.do_get_sticky_info(session)
- writer = Writer()
+ class Sticky(ItemSet):
+ def do_get_items(self, session, *args):
+ info = self.parent.get_sticky_info(session)
+ object = args[0]
+ return [(inf, self.parent.render_cell_id(session, 1, object)) for inf in info]
- for name, desc in names:
- self.sticky_values_tmpl.render(writer, session, name, object)
- return writer.to_string()
+ def render_sticky_name(self, session, item):
+ return item[0][0]
+
+ def render_sticky_title(self, session, item):
+ return item[0][1]
+
+ def render_sticky_object_id(self, session, item):
+ return item[1]
- def render_sticky_name(self, session, name, object):
- return name
-
- def render_sticky_object_id(self, session, name, object):
- return self.render_cell_id(session, 1, object)
-
- def do_get_sticky_info(self, session):
- return [("Name", "Display Title")]
-
class Updater(AjaxField):
def do_render(self, session):
return self.render_script(session)
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-10-31 23:14:45 UTC (rev 2722)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 16:47:39 UTC (rev 2723)
@@ -180,15 +180,13 @@
rules = sheet.rules ? sheet.rules : sheet.cssRules;
if (rules[0].selectorText) { // IE
for (var j=0; j<rules.length; j++) {
- if (rules[j].selectorText.indexOf("sticky_note") != -1) {
- if (rules[j].selectorText.indexOf("position") != -1) {
- return rules[j];
- }
+ if (rules[j].selectorText == "DIV.sticky_note") {
+ return rules[j];
}
}
} else {
for (var j=0; j<rules.length; j++) {
- if (rules[j].cssText.indexOf("div.sticky_note.position") != -1) {
+ if (rules[j].cssText == "div.sticky_note") {
return rules[j];
}
}
@@ -237,6 +235,20 @@
}
+
+function over_cell(me) {
+ var id = me.id;
+ var onote = document.getElementById("note_"+id);
+ onote.style.display = "block";
+ if (document.all) {
+ me.title = onote.innerText;
+ }
+
+}
+function out_cell(me) {
+ var id = me.id;
+ document.getElementById("note_"+id).style.display = "none";
+}
addEvent(window, "resize", ensure_notes_visible);
addEvent(window, "load", ensure_notes_visible);
@@ -277,7 +289,7 @@
font-size: 0.8em;
position: absolute;
top: 120%;
-/* width: 25em; */
+ left: 50%;
padding: 1em;
background-color: #ffffaa;
background-image: url(resource?name=shade.png);
@@ -286,20 +298,15 @@
border: 1px solid #cccc99;
z-index: 1;
}
-/* this rule is separated in order to make it easier
- to change only this attribute in the onresize handler */
-div.grid_cell div.sticky_note.position {
- left: 50%;
+
+table.sticky_table {
+ border-collapse: collapse;
}
-
-div.sticky_names {
- float: left;
+td.sticky_names {
font-weight: bold;
line-height: 1em;
- margin-right: 1em;
}
-div.sticky_values {
- float: left;
+td.sticky_values {
line-height: 1em;
}
div#cell_legend {
@@ -327,34 +334,29 @@
</div>
{grid_updater}
-[StatUtilizationGrid.legend_html]
-<div class="legend">
- <button class="btn {legend_color}" style="background-image: none; width:1em; height:1em;" ></button> {legend_text}
-</div>
-
[StatUtilizationGrid.cell_html]
- <div class="grid_cell" style="width:{cell_width}%; height:{cell_width}%;"
- onmouseover="document.getElementById('note_{cell_id}').style.display='block';"
- onmouseout="document.getElementById('note_{cell_id}').style.display='none';">
+ <div id="{cell_id}" class="grid_cell"
+ style="width:{cell_width}%; height:{cell_width}%;"
+ onmouseover="over_cell(this)"
+ onmouseout="out_cell(this)" >
<a href="{href}"><button id="button_{cell_id}" class="btn {color}" >{contents}</button></a>
- <div id="note_{cell_id}" class="sticky_note position">
- <table cellpadding="0" cellspacing="0">
- <tr>
- <td><div class="sticky_names">
- {sticky_names}
- </div></td>
- <td><div class="sticky_values">
- {sticky_values}
- </div></td>
- </tr></table>
- <div style="clear:left;"><!-- --></div>
+ <div id="note_{cell_id}" class="sticky_note">
+ <table class="sticky_table">
+ {sticky_rows}
+ </table>
</div>
</div>
-[StatUtilizationGrid.sticky_name_html]
- <div>{sticky_title}:</div>
+[Sticky.item_html]
+<tr>
+ <td class="sticky_names" nowrap="nowrap">{sticky_title}: </td>
+ <td class="sticky_values" nowrap="nowrap"><span id="cell_{sticky_name}_{sticky_object_id}"></span></td>
+</tr>
-[StatUtilizationGrid.sticky_value_html]
- <div id="cell_{sticky_name}_{sticky_object_id}"></div>
+[StatUtilizationGrid.legend_html]
+<div class="legend">
+ <button class="btn {legend_color}" style="background-image: none; width:1em; height:1em;" ></button> {legend_text}
+</div>
+
\ No newline at end of file
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-31 23:14:45 UTC (rev 2722)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-11-01 16:47:39 UTC (rev 2723)
@@ -93,16 +93,7 @@
system = self.parent.frame.get_args(session)[0]
return "call.xml?class=system;id=%i;method=slots" % system.id
- def get_fn(self, session):
- return self.parent.grid.name
-
- def got_fn(self, session):
- return self.parent.grid.name
-
- def elem_id(self, session):
- return self.parent.grid.name
-
- def do_get_sticky_info(self, session):
+ def get_sticky_info(self, session):
return [("name", "Name"), ("machine", "Machine"), ("job", "Job")]
class SystemView(CuminView):
16 years, 2 months