Author: eallen
Date: 2011-01-17 19:36:06 +0000 (Mon, 17 Jan 2011)
New Revision: 4472
Modified:
trunk/cumin/python/cumin/grid/job.py
trunk/wooly/python/wooly/datatable.strings
Log:
BZ 668985 : Fixed job hold/release/remove form for a selection of jobs (as opposed to an
individual job)
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2011-01-17 16:41:14 UTC (rev 4471)
+++ trunk/cumin/python/cumin/grid/job.py 2011-01-17 19:36:06 UTC (rev 4472)
@@ -222,16 +222,6 @@
JobSelectionRelease(app, self, "released")
JobSelectionRemove(app, self, "removed")
- def init_ids(self, app, cls):
- item = Parameter(app, "item")
-
- self.ids = ListParameter(app, "selection", item)
- self.add_parameter(self.ids)
-
- self.checkbox_column = ObjectCheckboxColumn \
- (app, "id", cls.JobId, self.ids)
- self.add_column(self.checkbox_column)
-
def create_table(self, app, name, cls):
return JobSelectorTable(app, name, cls)
@@ -270,6 +260,16 @@
self.qmf_response = Attribute(app, "qmf_response")
self.add_attribute(self.qmf_response)
+ def init_ids(self, app, cls):
+ item = Parameter(app, "item")
+
+ self.ids = ListParameter(app, "selection", item)
+ self.add_parameter(self.ids)
+
+ self.checkbox_column = ObjectCheckboxColumn \
+ (app, "id", cls.JobId, self.ids)
+ self.add_column(self.checkbox_column)
+
def get_data_values(self, session):
values = super(JobSelectorTable, self).get_data_values(session)
@@ -332,6 +332,10 @@
submission = self.selector.submission.get(osession)
self.form.submission_id.set(session, submission._id)
+ def get_item_content(self, session, item):
+ # item here is the unicode job id
+ return item
+
class JobSelectionHold(JobObjectSelectorTask):
def __init__(self, app, selector, verb):
super(JobSelectionHold, self).__init__(app, selector, verb)
@@ -366,9 +370,10 @@
self.submission_id = IntegerParameter(app, "sub")
self.add_parameter(self.submission_id)
- self.content = ReasonField(app, "fields")
- self.content.required = True
- self.replace_child(self.content)
+ self.reason = ReasonField(app, "reason")
+ self.reason.required = True
+ self.main_fields.add_field(self.reason)
+ self.add_child(self.reason)
self.verb = verb
@@ -380,7 +385,7 @@
def get_reason(self, session, verb):
""" returns <verb> by username[: <user input reason>]
"""
- reason = self.content.get(session)
+ reason = self.reason.get(session)
if reason:
reason = [reason]
user = session.client_session.attributes["login_session"].user
@@ -390,14 +395,18 @@
return ": ".join(reason)
def process_submit(self, session):
- selection = self.selection.get(session)
- reason = self.get_reason(session, self.verb)
+ self.validate(session)
- scheduler = self.get_scheduler(session)
+ errors = self.errors.get(session)
+ if not errors:
+ selection = self.selection.get(session)
+ reason = self.get_reason(session, self.verb)
- self.task.invoke(session, selection, scheduler, reason)
- self.task.exit_with_redirect(session)
+ scheduler = self.get_scheduler(session)
+ self.task.invoke(session, selection, scheduler, reason)
+ self.task.exit_with_redirect(session)
+
def get_scheduler(self, session):
submission_id = self.submission_id.get(session)
cls = self.app.model.com_redhat_grid.Submission
@@ -409,6 +418,11 @@
cls = self.app.model.com_redhat_grid.Scheduler
return cls.get_object(session.cursor, _id=job_server._schedulerRef_id)
+ def render_content(self, session, *args):
+ content = super(JobObjectSelectorTaskForm, self).render_content(session, *args)
+ reason = self.reason.render(session)
+ return "<table
class=\"FormFieldSet\"><tbody>%s</tbody></table>%s" %
(reason, content)
+
class JobAdsSet(PropertySet):
types = {0: "expression",
1: "integer",
Modified: trunk/wooly/python/wooly/datatable.strings
===================================================================
--- trunk/wooly/python/wooly/datatable.strings 2011-01-17 16:41:14 UTC (rev 4471)
+++ trunk/wooly/python/wooly/datatable.strings 2011-01-17 19:36:06 UTC (rev 4472)
@@ -9,8 +9,8 @@
margin: 0 0 0 2em;
}
-table.DataTable th.controls div.paginator span.selectorOptions {
- /* allow page number to wrap to next line */
+table.DataTable th.controls div.paginator {
+ /* allow page numbers to wrap to next line */
white-space: normal;
}
@@ -37,4 +37,4 @@
[DataTableSelector.html]
<span>{title}</span>
-<span class="selectorOptions">{options}</span>
+<span>{options}</span>