[rhmessaging-commits] rhmessaging commits: r3817 - mgmt/trunk/cumin/python/cumin/grid.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Mon Jan 25 14:06:04 EST 2010
Author: eallen
Date: 2010-01-25 14:06:04 -0500 (Mon, 25 Jan 2010)
New Revision: 3817
Modified:
mgmt/trunk/cumin/python/cumin/grid/slot.py
mgmt/trunk/cumin/python/cumin/grid/slot.strings
Log:
Change the png slot vis to show the slot page when a slot is clicked.
Modified: mgmt/trunk/cumin/python/cumin/grid/slot.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/slot.py 2010-01-25 15:15:05 UTC (rev 3816)
+++ mgmt/trunk/cumin/python/cumin/grid/slot.py 2010-01-25 19:06:04 UTC (rev 3817)
@@ -340,12 +340,10 @@
def get_scheduler_select(self, session):
raise Exception("Must implement get_scheduler_select")
- def render_slot_job_url(self, session):
- job = Identifiable("XXX")
- select = self.get_scheduler_select(session)
+ def render_slot_url(self, session):
+ slot = Identifiable("XXX")
try:
- scheduler = Scheduler.select(select)[0]
- return self.page.main.grid.pool.job.get_href(session, job, scheduler)
+ return self.page.main.grid.pool.slot.get_href(session, slot)
except:
pass
@@ -375,10 +373,13 @@
return state
class SlotInfo(ItemSet):
- display_names = {"job_id": "Job ID",
- "system": "System", "machine": "Machine",
- "state": "State", "activity": "Activity",
- "name": "Name"}
+ display_names = {"job_id": ("Job ID", "", ""),
+ "system": ("System", "", ""),
+ "machine": ("Machine", "", ""),
+ "state": ("State", "", ""),
+ "activity": ("Activity", "", ""),
+ "name": ("Name", "", ""),
+ "id": ("Slot_ID", "slotInfo_id", "hidden_row")}
def __init__(self, app, name):
super(SlotMap.SlotInfo, self).__init__(app, name)
@@ -427,17 +428,17 @@
def render_slot_info_index(self, session):
return self.index.path
- def render_item_title(self, session, item):
- return item[0]
-
def render_item_value(self, session, item):
return item[1]
- def render_item_job_id(self, session, item):
- return item[0] == "Job ID" and "id='job_id'" or ""
+ def render_item_title(self, session, item):
+ return item[0][0]
+ def render_item_id(self, session, item):
+ return item[0][1] and "id='%s'" % item[0][1] or ""
+
def render_item_row_class(self, session, item):
- return ""
+ return item[0][2] and "class='%s'" % item[0][2] or ""
class SlotActivities(ItemSet):
activities = (("Idle", "clear"),
Modified: mgmt/trunk/cumin/python/cumin/grid/slot.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/slot.strings 2010-01-25 15:15:05 UTC (rev 3816)
+++ mgmt/trunk/cumin/python/cumin/grid/slot.strings 2010-01-25 19:06:04 UTC (rev 3817)
@@ -2,6 +2,7 @@
select
s.id,
s.name,
+ s.pool,
s.machine,
s.system,
s.job_id,
@@ -638,19 +639,28 @@
function got_slot_info(xhtml, args) {
if (slot_last_index == -1) return;
var oInfo = $(slot_info_id);
- var for_jid = null;
+ var slot_clicked = null;
if (oInfo) {
oInfo.style.display = "none";
+ if (oInfo.slot_clicked) {
+ slot_clicked = oInfo.slot_clicked;
+ oInfo.slot_clicked = null;
+ }
}
wooly.updatePage(xhtml);
var oInfo = $(slot_info_id);
if (oInfo) {
oInfo.click_index = args.index;
+ oInfo.slot_clicked = null;
+ if (slot_clicked) {
+ clicks.doClick(slot_clicked.x, slot_clicked.y);
+ return;
+ }
document.body.appendChild(oInfo); // so position is absolute to entire page
- oInfo.style.left = "-1000px";
- oInfo.style.visibility = "hidden";
+ //oInfo.style.left = "-1000px";
+ //oInfo.style.visibility = "hidden";
oInfo.style.display = "block";
var oMap = document.getElementById(slot_current_id);
@@ -733,10 +743,28 @@
var click_info = vis.get_index(x, y);
var oInfo = $(slot_info_id);
if (oInfo && click_info) {
- // fetch the slot info so we can get the job id
- oInfo.for_jid = {fetching: true, x: x, y: y};
- vis.fire_slot_info(click_info.index);
+ if ((typeof oInfo.click_index != "undefined") &&
+ (oInfo.click_index == click_info.index)) {
+ // we already fetched the info for this slot
+ var oInfoCellId = document.getElementById("slotInfo_id");
+ if (oInfoCellId) {
+ var slotid = oInfoCellId.innerHTML;
+ if (slotid != "") {
+ go_to_slot(slotid);
+ return false;
+ }
+ }
+ } else {
+ // fetch the slot info so we can get the slot id
+ oInfo.slot_clicked = {fetching: true, x: x, y: y};
+ vis.fire_slot_info(click_info.index);
+ }
}
+ function go_to_slot(id) {
+ var branch = wooly.session.branch(show_slot_url);
+ branch[branch.frame + ".id"] = id;
+ window.location.href = branch.marshal();
+ }
}
}
@@ -1073,7 +1101,7 @@
theImage.src = "{image_href}";
}
var slot_current_id = "{id}";
- var show_slot_job_url = "{slot_job_url}";
+ var show_slot_url = "{slot_url}";
var slot_job_index = "{job_index_param}";
var slot_map_info = {size: 0, width: 0, height: 0, count: 0, rows: 0, cols: 0};
var slot_clip_size = {slot_clip_size};
@@ -1173,7 +1201,7 @@
[SlotInfo.item_html]
<tr {item_row_class}>
<td class="slot_info_title">{item_title}</td>
- <td {item_job_id} class="slot_info_value">{item_value}</td>
+ <td {item_id} class="slot_info_value">{item_value}</td>
</tr>
[SlotLegend.css]
More information about the rhmessaging-commits
mailing list