r5453 - branches
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-31 17:43:13 +0000 (Fri, 31 Aug 2012)
New Revision: 5453
Added:
branches/tmckay/
Log:
Reusable personal branch for experimentation
11 years, 8 months
r5452 - trunk/cumin/python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-30 15:57:10 +0000 (Thu, 30 Aug 2012)
New Revision: 5452
Modified:
trunk/cumin/python/cumin/model.py
Log:
Name of StartdIpAddr was wrong in job ad metadata list
Modified: trunk/cumin/python/cumin/model.py
===================================================================
--- trunk/cumin/python/cumin/model.py 2012-08-29 17:59:33 UTC (rev 5451)
+++ trunk/cumin/python/cumin/model.py 2012-08-30 15:57:10 UTC (rev 5452)
@@ -633,7 +633,7 @@
"RequestDisk", "NumShadowStarts", "NumJobStarts", "AutoClusterId",
"NumJobMatches", "DiskUsage_RAW", "JobRunCount", "RemoteSlotID",
"OrigMaxHosts", "TransferFiles", "RemoteSysCpu", "ImageSize_RAW",
- "CurrentHosts", "ClaimId", "PublicClaimId", "StartIpAddr", "StartdPrincipal",
+ "CurrentHosts", "ClaimId", "PublicClaimId", "StartdIpAddr", "StartdPrincipal",
"RemoteHost", "NumShadowExceptions", "LastRemoteHost", "LastPuclicClaimId",
"BytesRecvd", "RemoteWallClockTime", "BytesSent", "CumulativeSlotTime")
11 years, 8 months
r5451 - trunk/cumin/python/cumin/grid
by croberts@fedoraproject.org
Author: croberts
Date: 2012-08-29 17:59:33 +0000 (Wed, 29 Aug 2012)
New Revision: 5451
Modified:
trunk/cumin/python/cumin/grid/negotiator.py
trunk/cumin/python/cumin/grid/scheduler.py
trunk/cumin/python/cumin/grid/slotvis.py
trunk/cumin/python/cumin/grid/submission.py
Log:
For BZ 705358 (making search column selectable), this adds the requested functionality to the submission, slot, scheduler and negotiator tables. (Limits, Quotas and Configuration tabs are NOT included since they are built on a different set of widgets due to their non-database storage).
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2012-08-23 17:07:18 UTC (rev 5450)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2012-08-29 17:59:33 UTC (rev 5451)
@@ -3,11 +3,11 @@
from cumin.objectframe import ObjectFrame, ObjectFrameTask,\
ObjectFrameTaskForm
from cumin.objectselector import ObjectSelector, ObjectLinkColumn,\
- MonitorSelfStatColumn, ObjectTable, MonitorSelfAgeColumn
+ MonitorSelfStatColumn, ObjectTable, MonitorSelfAgeColumn, SelectableSearchObjectTable
from wooly import Widget, Attribute, Parameter
from parsley.stringex import rpartition
from cumin.parameters import RosemaryObjectParameter
-from wooly.parameters import ListParameter
+from wooly.parameters import ListParameter, StringParameter
from wooly.template import WidgetTemplate
from cumin.stat import StatFlashChart
from sage.util import call_async
@@ -30,7 +30,6 @@
frame = "main.grid.negotiator"
col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
- self.add_search_filter(col)
self.add_attribute_column(cls.Machine)
self.add_attribute_column(cls.System)
@@ -42,6 +41,12 @@
stat = MonitorSelfStatColumn(app, cls.MonitorSelfImageSize.name, cls.MonitorSelfImageSize)
self.add_column(stat)
+ self.field_param = StringParameter(app, "field_param")
+ self.add_parameter(self.field_param)
+
+ self.select_input = self.NegotiatorFieldOptions(app, self.field_param)
+ self.add_selectable_search_filter(self.select_input)
+
#self.start = DaemonSelectionStart(app, self, "NEGOTIATOR")
#self.stop = DaemonSelectionStop(app, self, "NEGOTIATOR")
@@ -49,7 +54,16 @@
def create_table(self, app, name, cls):
# avoid the checkboxes
- return ObjectTable(app, name, cls)
+ return SelectableSearchObjectTable(app, name, cls)
+
+ class NegotiatorFieldOptions(SelectableSearchObjectTable.SearchFieldOptions):
+ def __init__(self, app, param):
+ super(NegotiatorSelector.NegotiatorFieldOptions, self).__init__(app, param)
+ self.cls = app.model.com_redhat_grid.Negotiator
+
+ def do_get_items(self, session):
+ return [self.cls.Name, self.cls.Machine, self.cls.MonitorSelfAge, \
+ self.cls.MonitorSelfCPUUsage, self.cls.MonitorSelfImageSize, self.cls.System]
class GroupHelper(Widget):
def __init__(self, app, name, negotiator):
Modified: trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- trunk/cumin/python/cumin/grid/scheduler.py 2012-08-23 17:07:18 UTC (rev 5450)
+++ trunk/cumin/python/cumin/grid/scheduler.py 2012-08-29 17:59:33 UTC (rev 5451)
@@ -9,7 +9,7 @@
from submitter import SubmitterFrame, SubmitterSelector
from submission import PoolSubmissionSelector
from cumin.objectselector import ObjectSelectorTable, ObjectSelector,\
- ObjectLinkColumn, MonitorSelfStatColumn, ObjectTable, MonitorSelfAgeColumn
+ ObjectLinkColumn, MonitorSelfStatColumn, ObjectTable, MonitorSelfAgeColumn, SelectableSearchObjectTable
from cumin.grid.submission import SubmissionFrame
strings = StringCatalog(__file__)
@@ -79,12 +79,17 @@
frame = "main.grid.scheduler"
col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
- self.add_search_filter(col)
self.add_attribute_column(cls.NumUsers)
self.add_attribute_column(cls.TotalIdleJobs)
self.add_attribute_column(cls.TotalRunningJobs)
self.add_attribute_column(cls.TotalHeldJobs)
+
+ self.field_param = StringParameter(app, "field_param")
+ self.add_parameter(self.field_param)
+
+ self.select_input = self.SchedulerFieldOptions(app, self.field_param)
+ self.add_selectable_search_filter(self.select_input)
stat = MonitorSelfAgeColumn(app, cls.MonitorSelfAge.name, cls.MonitorSelfAge)
self.add_column(stat)
@@ -100,7 +105,17 @@
def create_table(self, app, name, cls):
# avoid the checkboxes
- return ObjectTable(app, name, cls)
+ return SelectableSearchObjectTable(app, name, cls)
+
+ class SchedulerFieldOptions(SelectableSearchObjectTable.SearchFieldOptions):
+ def __init__(self, app, param):
+ super(SchedulerSelector.SchedulerFieldOptions, self).__init__(app, param)
+ self.cls = app.model.com_redhat_grid.Scheduler
+
+ def do_get_items(self, session):
+ return [self.cls.Name, self.cls.NumUsers, self.cls.TotalIdleJobs, \
+ self.cls.TotalRunningJobs, self.cls.TotalHeldJobs, self.cls.MonitorSelfAge, \
+ self.cls.MonitorSelfCPUUsage, self.cls.MonitorSelfImageSize]
class SchedulerOverview(RadioModeSet):
def __init__(self, app, name, scheduler):
Modified: trunk/cumin/python/cumin/grid/slotvis.py
===================================================================
--- trunk/cumin/python/cumin/grid/slotvis.py 2012-08-23 17:07:18 UTC (rev 5450)
+++ trunk/cumin/python/cumin/grid/slotvis.py 2012-08-29 17:59:33 UTC (rev 5451)
@@ -4,12 +4,13 @@
from wooly import Session, Widget
from wooly.util import StringCatalog
from wooly.widgets import RadioModeSet
+from wooly.parameters import StringParameter
from cumin.parameters import RosemaryObjectParameter
from cumin.widgets import StateSwitch
from cumin.stat import FlashFullPage
from cumin.objectselector import ObjectSelector, ObjectLinkColumn,\
- ObjectTableColumn, ObjectTable
+ ObjectTableColumn, ObjectTable, SelectableSearchObjectTable
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.slotvis")
@@ -32,7 +33,6 @@
frame = "main.grid.slot"
col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
- self.add_search_filter(col)
self.add_attribute_column(cls.Activity)
self.add_attribute_column(cls.State)
@@ -40,13 +40,27 @@
col = ObjectTableColumn(app, cls.LoadAvg.name, cls.LoadAvg)
self.add_column(col)
self.table.set_default_sort_column(col)
+
+ self.field_param = StringParameter(app, "field_param")
+ self.add_parameter(self.field_param)
+
+ self.select_input = self.SlotFieldOptions(app, self.field_param)
+ self.add_selectable_search_filter(self.select_input)
self.enable_csv_export()
def create_table(self, app, name, cls):
# avoid the checkboxes
- return ObjectTable(app, name, cls)
+ return SelectableSearchObjectTable(app, name, cls)
def render_title(self, session):
return "Slot table"
+
+ class SlotFieldOptions(SelectableSearchObjectTable.SearchFieldOptions):
+ def __init__(self, app, param):
+ super(SlotSelector.SlotFieldOptions, self).__init__(app, param)
+ self.cls = app.model.com_redhat_grid.Slot
+
+ def do_get_items(self, session):
+ return [self.cls.Name, self.cls.Activity, self.cls.State, self.cls.LoadAvg]
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2012-08-23 17:07:18 UTC (rev 5450)
+++ trunk/cumin/python/cumin/grid/submission.py 2012-08-29 17:59:33 UTC (rev 5451)
@@ -8,19 +8,20 @@
from cumin.objectframe import ObjectFrame, ObjectView, ObjectViewSummary, ObjectViewContext
from cumin.sqladapter import ObjectSqlAdapter
from cumin.objectselector import ObjectSelector, ObjectLinkColumn,\
- ObjectTableColumn, ObjectTable
+ ObjectTableColumn, ObjectTable, SelectableSearchObjectTable
from cumin.task import TaskLink, Task, ObjectTaskForm
from cumin.parameters import ObjectAttribute
from cumin.util import xml_escape
-from rosemary.sqlfilter import SqlFilter
+from rosemary.sqlfilter import SqlFilter, SqlLikeFilter, SqlValueFilter, SqlDateValueFilter
from rosemary.sqlquery import SqlInnerJoin
-from wooly import Attribute, Parameter
+from wooly.util import StringCatalog
from wooly.forms import StringField, ScalarField, FormError, OptionInputSet,\
MultilineStringField, FormField, IntegerField, LabelFormField, NoXMLStringField
-from wooly.parameters import IntegerParameter
+from wooly.parameters import IntegerParameter, StringParameter
+
log = logging.getLogger("cumin.grid.submission")
class SubmissionFrame(ObjectFrame):
@@ -118,11 +119,13 @@
self.add_attribute_column(cls.Completed)
self.add_attribute_column(cls.Held)
self.add_attribute_column(cls.Suspended)
-
- def create_table(self, app, name, cls):
- # avoid the checkboxes
- return ObjectTable(app, name, cls)
-
+
+ self.field_param = StringParameter(app, "field_param")
+ self.add_parameter(self.field_param)
+
+ self.select_input = self.SubmissionFieldOptions(app, self.field_param)
+ self.add_selectable_search_filter(self.select_input)
+
class QDateColumn(ObjectTableColumn):
def _get_raw_content(self, session, data):
d = super(SubmissionSelector.QDateColumn, self).\
@@ -145,13 +148,22 @@
def render_cell_title(self, session, data):
return self._get_raw_content(session, data)
+ class SubmissionFieldOptions(SelectableSearchObjectTable.SearchFieldOptions):
+ def __init__(self, app, param):
+ super(SubmissionSelector.SubmissionFieldOptions, self).__init__(app, param)
+ self.cls = app.model.com_redhat_grid.Submission
+
+ def do_get_items(self, session):
+ return [self.cls.Name, self.cls.Owner, self.cls.QDate, self.cls.Idle, \
+ self.cls.Running, self.cls.Completed, self.cls.Held, self.cls.Suspended]
+
class PoolSubmissionSelector(SubmissionSelector):
def __init__(self, app, name, frame="main.grid.submission"):
super(PoolSubmissionSelector, self).__init__(app, name)
col = self.PoolSubmissionObjectLinkColumn(app, "name", self.cls.Name, self.cls._id, frame)
self.insert_column(0, col)
- self.add_search_filter(col)
+ #self.add_search_filter(col)
attr = self.cls.Owner
col = ObjectTableColumn(app, attr.name, attr)
@@ -169,13 +181,17 @@
link = TaskLink(app, "vm_job_submit", app.grid.vm_job_submit)
self.links.add_child(link)
-
+
+
+ def create_table(self, app, name, cls):
+ return SelectableSearchObjectTable(app, name, cls)
+
class PoolSubmissionObjectLinkColumn(ObjectLinkColumn):
def render_cell_content(self, session, record):
retval = len(record) > 0 and record[self.field.index] or ""
if(len(record[self.field.index]) > 50):
retval = record[self.field.index][:50] + "..." #indicate that we truncated the name
- return retval
+ return retval
class PoolSubmissionJoinSelector(PoolSubmissionSelector):
def __init__(self, app, name):
@@ -184,7 +200,7 @@
scheduler = app.model.com_redhat_grid.Scheduler
self.SchedulerJoin(app, self.table.adapter.query, self.cls.sql_table,
self.cls.jobserverRef.sql_column, "jid")
-
+
#frame = "main.grid.scheduler"
#col = self.SchedulerColumn(app, "Scheduler", scheduler.Name, scheduler._id, frame)
#self.insert_column(2, col)
11 years, 8 months
r5450 - trunk/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-23 17:07:18 +0000 (Thu, 23 Aug 2012)
New Revision: 5450
Modified:
trunk/cumin/python/cumin/grid/job.py
Log:
Removed jobs should not be editable, along with Completed jobs.
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2012-08-16 19:06:30 UTC (rev 5449)
+++ trunk/cumin/python/cumin/grid/job.py 2012-08-23 17:07:18 UTC (rev 5450)
@@ -766,7 +766,8 @@
if "property" in item:
if item["name"] == "JobStatus":
status = item["value"]
- if JobStatusInfo.get_status_string(status) == "Completed":
+ if JobStatusInfo.get_status_string(status) in {"Completed",
+ "Removed"}:
render = False
break
return render and not error and self.edit_button.render(session) or ""
11 years, 8 months
r5449 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-08-16 19:06:30 +0000 (Thu, 16 Aug 2012)
New Revision: 5449
Modified:
trunk/cumin/python/cumin/objectselector.py
trunk/cumin/python/cumin/objectselector.strings
Log:
More UI refinements for BZ705358
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2012-08-16 16:46:10 UTC (rev 5448)
+++ trunk/cumin/python/cumin/objectselector.py 2012-08-16 19:06:30 UTC (rev 5449)
@@ -311,6 +311,7 @@
search = StringInput(self.app, "search")
search.param.default = ""
search.title = "Search in column"
+ search.size = 35
self.selectablefilters.add_child(search)
self.selectablefilters.add_child(inputSet)
Modified: trunk/cumin/python/cumin/objectselector.strings
===================================================================
--- trunk/cumin/python/cumin/objectselector.strings 2012-08-16 16:46:10 UTC (rev 5448)
+++ trunk/cumin/python/cumin/objectselector.strings 2012-08-16 19:06:30 UTC (rev 5449)
@@ -308,12 +308,15 @@
function operator_toggle(select_box) {
field_type = select_box[select_box.selectedIndex].getAttribute("type");
+ select_width = select_box.getWidth();
+ adjust_pixels_noops = 27 + select_width;
+ adjust_pixels_ops = 72 + select_width;
if (field_type != "int8" && field_type != "float8") {
select_box.getNext().setAttribute("style", "display:none");
- select_box.getParent().getElement("label").setStyle("left","114px")
+ select_box.getParent().getElement("label").setStyle("left", adjust_pixels_noops + "px")
} else {
select_box.getNext().setAttribute("style", "display:inline");
- select_box.getParent().getElement("label").setStyle("left","159px")
+ select_box.getParent().getElement("label").setStyle("left", adjust_pixels_ops + "px")
}
}
11 years, 8 months
r5448 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-08-16 16:46:10 +0000 (Thu, 16 Aug 2012)
New Revision: 5448
Modified:
trunk/cumin/python/cumin/objectselector.py
trunk/cumin/python/cumin/objectselector.strings
Log:
Now handling searching float columns with the basic operators for BZ705358
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2012-08-15 19:50:50 UTC (rev 5447)
+++ trunk/cumin/python/cumin/objectselector.py 2012-08-16 16:46:10 UTC (rev 5448)
@@ -390,7 +390,7 @@
if sql_column.type.literal == "timestamp":
self.adapter.query.add_filter(self.SelectableFieldDateValueFilter(sql_column, customvalue))
- elif sql_column.type.literal == "int8":
+ elif sql_column.type.literal == "int8" or sql_column.type.literal == "float8":
if operator == ">=":
self.adapter.query.add_filter(self.SelectableFieldValueFilter(sql_column, ">="))
elif operator == ">":
Modified: trunk/cumin/python/cumin/objectselector.strings
===================================================================
--- trunk/cumin/python/cumin/objectselector.strings 2012-08-15 19:50:50 UTC (rev 5447)
+++ trunk/cumin/python/cumin/objectselector.strings 2012-08-16 16:46:10 UTC (rev 5448)
@@ -308,7 +308,7 @@
function operator_toggle(select_box) {
field_type = select_box[select_box.selectedIndex].getAttribute("type");
- if (field_type != "int8") {
+ if (field_type != "int8" && field_type != "float8") {
select_box.getNext().setAttribute("style", "display:none");
select_box.getParent().getElement("label").setStyle("left","114px")
} else {
11 years, 8 months
r5447 - in trunk: cumin/python/cumin rosemary/python/rosemary wooly/python/wooly
by croberts@fedoraproject.org
Author: croberts
Date: 2012-08-15 19:50:50 +0000 (Wed, 15 Aug 2012)
New Revision: 5447
Modified:
trunk/cumin/python/cumin/objectselector.py
trunk/cumin/python/cumin/objectselector.strings
trunk/rosemary/python/rosemary/sqlfilter.py
trunk/wooly/python/wooly/forms.py
trunk/wooly/python/wooly/forms.strings
Log:
Ground work for completing BZ705358 (Allow search column(s) to be selectable).
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2012-08-15 18:44:54 UTC (rev 5446)
+++ trunk/cumin/python/cumin/objectselector.py 2012-08-15 19:50:50 UTC (rev 5447)
@@ -4,14 +4,14 @@
from cumin.util import Identifiable, xml_escape
from rosemary.model import RosemaryClass, RosemaryAttribute, RosemaryReference
-from rosemary.sqlfilter import SqlLikeFilter
+from rosemary.sqlfilter import SqlFilter, SqlLikeFilter, SqlValueFilter, SqlDateValueFilter
from wooly.util import StringCatalog, Writer, escape_entity
from wooly.datatable import DataTable, DataTableColumn
from wooly import Attribute, Widget, SessionAttribute, Parameter
-from wooly.forms import Form, StringInput, FoldingFieldSubmitForm
+from wooly.forms import Form, StringInput, FoldingFieldSubmitForm, OptionInputSet
from cumin.objecttask import ObjectTaskButton, ObjectTask
-from wooly.parameters import IntegerParameter, ListParameter
+from wooly.parameters import IntegerParameter, ListParameter, StringParameter
from wooly.table import CheckboxColumnCell, CheckboxColumnHeader,\
CheckboxColumnInput, LinkColumn
from wooly.widgets import WidgetSet, ItemSet
@@ -91,7 +91,7 @@
def add_like_filter(self, attribute, column, type=SqlLikeFilter.CONTAINS):
assert isinstance(attribute, Attribute), attribute
- assert isinstance(column, DataTableColumn), column
+# assert isinstance(column, DataTableColumn), column
self.like_specs.append((column, attribute, type))
@@ -260,6 +260,9 @@
self.switches = ObjectSelectorSwitches(app, "switches")
self.add_child(self.switches)
+ self.selectablefilters = ObjectSelectorSelectableFilters(app, "selectablefilters")
+ self.add_child(self.selectablefilters)
+
self.filters = ObjectSelectorFilters(app, "filters")
self.add_child(self.filters)
@@ -303,7 +306,16 @@
self.table.add_like_filter(search.param, this)
self.filters.add_child(search)
+
+ def add_selectable_search_filter(self, inputSet):
+ search = StringInput(self.app, "search")
+ search.param.default = ""
+ search.title = "Search in column"
+ self.selectablefilters.add_child(search)
+ self.selectablefilters.add_child(inputSet)
+
+
def render_search_id(self, session):
if len(self.filters.children):
return self.filters.children[0].render_id(session)
@@ -351,7 +363,121 @@
self.checkbox_column = ObjectCheckboxColumn \
(app, "id", cls._id, self.ids)
self.add_column(self.checkbox_column)
+
+class SelectableSearchObjectTable(ObjectTable):
+ def __init__(self, app, name, cls):
+ super(SelectableSearchObjectTable, self).__init__(app, name, cls)
+
+ ## think about a do_process that will set up values from the URL maybe??
+ def get_data_values(self, session):
+ values = dict()
+ customfield = self.parent.select_input.get(session)
+ customvalue = self.parent.selectablefilters.children_by_name['search'].get(session)
+ operator = self.parent.select_input.operator_param.get(session)
+
+ #since these are added at runtime, we need to clear out the old ones each time around
+ self.adapter.query.filters = [filter for filter in self.adapter.query.filters if not isinstance(filter, self.SelectableFieldFilter)]
+ if customfield is None or customvalue is None or customvalue == "":
+ return values
+ try:
+ sql_column = self.cls._properties_by_name[customfield].sql_column
+ except:
+ sql_column = self.cls._statistics_by_name[customfield].sql_column
+
+ pre = ""
+ post = ""
+
+ if sql_column.type.literal == "timestamp":
+ self.adapter.query.add_filter(self.SelectableFieldDateValueFilter(sql_column, customvalue))
+ elif sql_column.type.literal == "int8":
+ if operator == ">=":
+ self.adapter.query.add_filter(self.SelectableFieldValueFilter(sql_column, ">="))
+ elif operator == ">":
+ self.adapter.query.add_filter(self.SelectableFieldValueFilter(sql_column, ">"))
+ elif operator == "<=":
+ self.adapter.query.add_filter(self.SelectableFieldValueFilter(sql_column, "<="))
+ elif operator == "<":
+ self.adapter.query.add_filter(self.SelectableFieldValueFilter(sql_column, "<"))
+ else:
+ self.adapter.query.add_filter(self.SelectableFieldValueFilter(sql_column))
+ else:
+ post = "%"
+ self.adapter.query.add_filter(self.SelectableFieldLikeFilter(sql_column))
+
+ if not "%" in customvalue:
+ pre = type == SqlLikeFilter.CONTAINS and "%%" or ""
+ else:
+ post = ""
+ values[customfield] = "%s%s%s" % (pre, customvalue, post)
+
+ return values
+
+ class SearchFieldOptions(OptionInputSet):
+ def __init__(self, app, param):
+ super(SelectableSearchObjectTable.SearchFieldOptions, self).__init__(app, "select_input", param)
+
+ self.operator_param = StringParameter(app, "operator_param")
+ self.add_parameter(self.operator_param)
+
+ self.operator_selector = self.SearchOperatorOptions(app, self.operator_param)
+ self.add_child(self.operator_selector)
+
+ def do_get_items(self, session):
+ return []
+
+ def render_item_value(self, session, item):
+ return item.name
+
+ def render_item_content(self, session, item):
+ return xml_escape(item.title)
+
+ def render_item_selected_attr(self, session, item):
+ if item.name == self.param.get(session):
+ return "selected=\"selected\""
+
+ def render_onchange(self, session):
+ search_box_name = self.parent.children_by_name['search'].param.path
+ return "change_input_text(this, '%s');" % search_box_name
+
+ def render_item_type(self, session, item):
+ return item.sql_column.type.literal
+
+ def render_select_box(self, session):
+ return self.parent.children_by_name['search'].path
+
+ class SearchOperatorOptions(OptionInputSet):
+ def __init__(self, app, param):
+ super(SelectableSearchObjectTable.SearchFieldOptions.SearchOperatorOptions, self).__init__(app, "operator_input", param)
+
+ def do_get_items(self, session):
+ return ["=", ">", ">=", "<", "<="]
+
+ def render_item_value(self, session, item):
+ return xml_escape(item)
+
+ def render_item_content(self, session, item):
+ return xml_escape(item)
+
+ def render_item_selected_attr(self, session, item):
+ if item == self.param.get(session):
+ return "selected=\"selected\""
+
+ def render_onchange(self, session):
+ return ""
+
+ class SelectableFieldFilter(object):
+ pass
+
+ class SelectableFieldLikeFilter(SqlLikeFilter, SelectableFieldFilter):
+ pass
+
+ class SelectableFieldValueFilter(SqlValueFilter, SelectableFieldFilter):
+ pass
+
+ class SelectableFieldDateValueFilter(SqlDateValueFilter, SelectableFieldFilter):
+ pass
+
class ObjectCheckboxColumn(ObjectTableColumn):
def __init__(self, app, name, attr, selection):
super(ObjectCheckboxColumn, self).__init__(app, name, attr)
@@ -431,6 +557,9 @@
class ObjectSelectorFilters(ObjectSelectorControl):
pass
+class ObjectSelectorSelectableFilters(ObjectSelectorControl):
+ pass
+
class ObjectSelectorButtons(ObjectSelectorControl):
pass
Modified: trunk/cumin/python/cumin/objectselector.strings
===================================================================
--- trunk/cumin/python/cumin/objectselector.strings 2012-08-15 18:44:54 UTC (rev 5446)
+++ trunk/cumin/python/cumin/objectselector.strings 2012-08-15 19:50:50 UTC (rev 5447)
@@ -24,6 +24,20 @@
font-size: 0.75em;
}
+div.ObjectSelectorSelectableFilters {
+ float: left;
+ padding-bottom: 0.25em;
+}
+
+div.ObjectSelectorSelectableFilters ul {
+ float: left;
+ margin: 0;
+}
+
+div.ObjectSelectorSelectableFilters input,select {
+ font-size: 0.75em;
+}
+
div.ObjectSelectorButtons {
background-color: #e7e7f7;
padding: 0.35em 0.75em;
@@ -50,6 +64,7 @@
<form id="{id}.form" method="post" action="?">
{filters}
+ {selectablefilters}
{buttons}
{table}
@@ -136,6 +151,40 @@
<input type="submit" value="Search" onclick="return clearOffsetInput(this.form)" tabindex="100"/><input type="submit" value="Clear" onclick="return clearSearchInput('{id}')" tabindex="100"/>
</div><div style="margin-bottom: 0.5em; clear:both;"></div>
+[ObjectSelectorSelectableFilters.javascript]
+function clearSearchInput(id) {
+ var parent = $(id);
+ if (parent) {
+ var searchInput = parent.getElement("input");
+ if (searchInput) {
+ searchInput.value = "";
+ }
+ }
+ return true;
+}
+
+function clearOffsetInput(id) {
+ if (id) {
+ var regex = new RegExp("\.offset$");
+ var inputs = id.getElements("input");
+ if(inputs) {
+ for (i = 0; i < inputs.length; i++) {
+ var input_name = inputs[i].name;
+ var match = regex.exec(input_name);
+ if(match != null) {
+ inputs[i].value = 0;
+ }
+ }
+ }
+ }
+ return true;
+}
+
+
+[ObjectSelectorSelectableFilters.html]
+<div id="{id}" class="{class}">
+ <ul>{select_input}{search}</ul><input type="submit" value="Search" onclick="return clearOffsetInput(this.form)" tabindex="100"/><input type="submit" value="Clear" onclick="return clearSearchInput('{id}')" tabindex="100"/></div><div style="margin-bottom: 0.5em; clear:both;"></div>
+
[ExportButton.css]
div.ExportButton {
float:right;
@@ -249,3 +298,37 @@
a.TableColumnHeader span.down {
background: url(resource?name=sort-arrow-down.png) right 4px no-repeat;
}
+
+[SearchFieldOptions.javascript]
+function change_input_text(select_box, text) {
+ operator_toggle(select_box);
+ newText = "Search in " + select_box.options[select_box.selectedIndex].text + " column";
+ select_box.getParent().getElement("label").textContent = newText;
+}
+
+function operator_toggle(select_box) {
+ field_type = select_box[select_box.selectedIndex].getAttribute("type");
+ if (field_type != "int8") {
+ select_box.getNext().setAttribute("style", "display:none");
+ select_box.getParent().getElement("label").setStyle("left","114px")
+ } else {
+ select_box.getNext().setAttribute("style", "display:inline");
+ select_box.getParent().getElement("label").setStyle("left","159px")
+ }
+}
+
+[SearchFieldOptions.html]
+ <script type="text/javascript">
+//<![CDATA[
+ window.addEvent('domready', function () {
+ select_box = $("{select_box}").getParent().getElement("select")
+ newText = "Search in " + select_box.options[select_box.selectedIndex].text + " column";
+ $("{select_box}").getParent().getElement("label").textContent = newText;
+ operator_toggle(select_box);
+ });
+//]]>
+ </script>
+<select id="{id}" name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="{onchange}">{items}</select>{operator_input}
+
+[SearchFieldOptions.item_html]
+<option value="{item_value}" type="{item_type}" {item_selected_attr}>{item_content}</option>
\ No newline at end of file
Modified: trunk/rosemary/python/rosemary/sqlfilter.py
===================================================================
--- trunk/rosemary/python/rosemary/sqlfilter.py 2012-08-15 18:44:54 UTC (rev 5446)
+++ trunk/rosemary/python/rosemary/sqlfilter.py 2012-08-15 19:50:50 UTC (rev 5447)
@@ -38,3 +38,16 @@
CONTAINS = "C"
def __init__(self, this, operator="like"):
super(SqlLikeFilter, self).__init__(this, operator)
+
+class SqlDateValueFilter(SqlFilter):
+ def __init__(self, this, that, operator="="):
+ super(SqlDateValueFilter, self).__init__()
+
+ assert isinstance(operator, str)
+
+ self.this = getattr(this, "identifier", this)
+ self.that = getattr(that, "identifier", that)
+ self.operator = operator
+
+ def emit(self):
+ return "date_trunc('day', %s) %s date_trunc('day', date('%s'))" % (self.this, self.operator, self.that)
\ No newline at end of file
Modified: trunk/wooly/python/wooly/forms.py
===================================================================
--- trunk/wooly/python/wooly/forms.py 2012-08-15 18:44:54 UTC (rev 5446)
+++ trunk/wooly/python/wooly/forms.py 2012-08-15 19:50:50 UTC (rev 5447)
@@ -352,7 +352,10 @@
def render_item_selected_attr(self, session, item):
return None
-
+
+ def render_onchange(self, session):
+ return None
+
class FormField(Widget):
def __init__(self, app, name):
super(FormField, self).__init__(app, name)
Modified: trunk/wooly/python/wooly/forms.strings
===================================================================
--- trunk/wooly/python/wooly/forms.strings 2012-08-15 18:44:54 UTC (rev 5446)
+++ trunk/wooly/python/wooly/forms.strings 2012-08-15 19:50:50 UTC (rev 5447)
@@ -70,7 +70,7 @@
<button class="{class}" type="{type}" tabindex="{tab_index}" {disabled_attr} name="{name}" value="{value}" onclick="return {onclick}('{name}', '{value}')">{content}</button>
[ScalarInput.html]
-<input type="text" name="{name}" value="{value}" tabindex="{tab_index}" {disabled_attr} size="{size}" {title}/>
+<input type="text" id="{id}" name="{name}" value="{value}" tabindex="{tab_index}" {disabled_attr} size="{size}" {title}/>
[MultilineStringInput.html]
<textarea name="{name}" tabindex="{tab_index}" {disabled_attr} rows="{rows}" cols="{columns}">{value}</textarea>
@@ -147,7 +147,7 @@
</tr>
[OptionInputSet.html]
-<select name="{name}" tabindex="{tab_index}" {disabled_attr}>{items}</select>
+<select id="{id}" name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="{onchange}">{items}</select>
[OptionInputSet.item_html]
<option value="{item_value}" {item_selected_attr}>{item_content}</option>
11 years, 8 months
r5446 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-08-15 18:44:54 +0000 (Wed, 15 Aug 2012)
New Revision: 5446
Modified:
trunk/cumin/python/cumin/stat.py
Log:
Small fix for the accounting group history chart for the "<none>" choice.
Modified: trunk/cumin/python/cumin/stat.py
===================================================================
--- trunk/cumin/python/cumin/stat.py 2012-08-15 14:26:57 UTC (rev 5445)
+++ trunk/cumin/python/cumin/stat.py 2012-08-15 18:44:54 UTC (rev 5446)
@@ -519,9 +519,9 @@
adapters = dict()
for stat in stats:
filters = list()
- if self.user_selection.get(session) is not None and self.user_selection.get(session).lower() != "none" and self.user_selection.get(session) != "":
+ if self.user_selection.get(session) is not None and self.user_selection.get(session).lower() != "<none>" and self.user_selection.get(session) != "":
filters.append(self.UserFilter(rosemary_class, self.user_selection.get(session)))
- if self.group_selection.get(session) is not None and self.group_selection.get(session).lower() != "none" and self.group_selection.get(session) != "":
+ if self.group_selection.get(session) is not None and self.group_selection.get(session).lower() != "<none>" and self.group_selection.get(session) != "":
filters.append(self.UserFilter(rosemary_class, self.group_selection.get(session)))
adapters[stat] = SamplesSqlAdapter(self.app, rosemary_class, signature, session, filters)
11 years, 8 months
r5445 - trunk/sage/python/sage/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-15 14:26:57 +0000 (Wed, 15 Aug 2012)
New Revision: 5445
Modified:
trunk/sage/python/sage/aviary/aviaryoperations.py
Log:
Aviaryoperations needs to allow unspecified fields in the basic param
set for a submission. Downstream code will generate appropriate errors.
BZ848344
Modified: trunk/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- trunk/sage/python/sage/aviary/aviaryoperations.py 2012-08-13 17:00:17 UTC (rev 5444)
+++ trunk/sage/python/sage/aviary/aviaryoperations.py 2012-08-15 14:26:57 UTC (rev 5445)
@@ -296,7 +296,12 @@
args = list()
basic_attrs = ("Cmd", "Args", "Owner", "Iwd", "Submission")
for attr in basic_attrs:
- args.append(ad[attr])
+ try:
+ args.append(ad[attr])
+ except:
+ # Someone may be unhappy if this is a required param!
+ # Let the downstream code generate an error
+ pass
# Add empty list for Aviary's basic requirement value...
args.append([])
11 years, 8 months
r5444 - branches/stability/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-13 17:00:17 +0000 (Mon, 13 Aug 2012)
New Revision: 5444
Modified:
branches/stability/wooly/python/wooly/util.py
Log:
BZ807970
svn merge -c 5384 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk .
svn merge -c 5401 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk .
svn merge -c 5436 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk .
Modified: branches/stability/wooly/python/wooly/util.py
===================================================================
--- branches/stability/wooly/python/wooly/util.py 2012-08-13 16:56:57 UTC (rev 5443)
+++ branches/stability/wooly/python/wooly/util.py 2012-08-13 17:00:17 UTC (rev 5444)
@@ -19,8 +19,13 @@
from parsley.collectionsex import *
+quote_entities = {'"': """,
+ "'": "'"}
+
def xml_escape(string, entities=None):
if type(string) in (str, unicode):
+ if entities is None:
+ entities = quote_entities
return escape(string, entities)
return string
11 years, 8 months