Author: eallen
Date: 2011-02-11 20:47:34 +0000 (Fri, 11 Feb 2011)
New Revision: 4522
Modified:
trunk/cumin/python/cumin/grid/job.py
trunk/cumin/python/cumin/grid/limit.py
trunk/cumin/python/cumin/grid/negotiator.py
trunk/cumin/python/cumin/grid/scheduler.py
trunk/cumin/python/cumin/grid/slot.py
trunk/cumin/python/cumin/grid/submission.py
trunk/cumin/python/cumin/grid/submitter.py
trunk/cumin/python/cumin/inventory/system.py
trunk/cumin/python/cumin/messaging/binding.py
trunk/cumin/python/cumin/messaging/brokerlink.py
trunk/cumin/python/cumin/messaging/connection.py
trunk/cumin/python/cumin/messaging/exchange.py
trunk/cumin/python/cumin/messaging/queue.py
trunk/cumin/python/cumin/messaging/subscription.py
trunk/cumin/python/cumin/objectselector.py
trunk/cumin/python/cumin/objectselector.strings
trunk/cumin/python/cumin/qmfadapter.py
trunk/cumin/python/cumin/usergrid/widgets.py
Log:
Implementing BZ 673180: Add search to all tables. This commit adds the ability to search
to the qmf backed tables. (List of Jobs for a submission, and the Limits table)
Also added text to the search field that prompts you to enter a search string. That text
disappears when you enter something in the search field.
Also fixed the problem with table checkboxes disappearing after the page auto updates.
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/grid/job.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -222,13 +222,12 @@
self.job_id_column.visible = False
self.add_column(self.job_id_column)
- #self.add_search_filter(cls.GlobalJobId)
-
JobSelectionHold(app, self, "held")
JobSelectionRelease(app, self, "released")
JobSelectionRemove(app, self, "removed")
self.enable_csv_export(submission)
+ self.add_search_filter(self.job_id_col)
def create_table(self, app, name, cls):
return JobSelectorTable(app, name, cls)
Modified: trunk/cumin/python/cumin/grid/limit.py
===================================================================
--- trunk/cumin/python/cumin/grid/limit.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/grid/limit.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -69,8 +69,8 @@
def __init__(self, app, name, cls):
super(LimitTable, self).__init__(app, name, cls)
- col = self.NameColumn(app, "name", cls.Name)
- self.add_column(col)
+ self.name_col = self.NameColumn(app, "name", cls.Name)
+ self.add_column(self.name_col)
col = self.UsageColumn(app, "curr", cls.Usage)
self.add_column(col)
@@ -114,6 +114,7 @@
super(LimitSelector, self).__init__(app, name, cls)
+ self.add_search_filter(self.table.name_col)
self.table.adapter = LimitAdapter(app, cls, collector)
self.enable_csv_export(collector)
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -34,6 +34,7 @@
frame = "main.grid.pool.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)
@@ -47,8 +48,6 @@
stat = MonitorSelfStatColumn(app, cls.MonitorSelfTime.name, cls.MonitorSelfTime)
self.add_column(stat)
- self.add_search_filter(cls.Name)
-
#self.start = DaemonSelectionStart(app, self, "NEGOTIATOR")
#self.stop = DaemonSelectionStop(app, self, "NEGOTIATOR")
Modified: trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- trunk/cumin/python/cumin/grid/scheduler.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/grid/scheduler.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -85,6 +85,7 @@
frame = "main.grid.pool.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)
@@ -100,8 +101,6 @@
stat = MonitorSelfStatColumn(app, cls.MonitorSelfTime.name, cls.MonitorSelfTime)
self.add_column(stat)
- self.add_search_filter(cls.Name)
-
#self.start = DaemonSelectionStart(app, self, "SCHEDD")
#self.stop = DaemonSelectionStop(app, self, "SCHEDD")
Modified: trunk/cumin/python/cumin/grid/slot.py
===================================================================
--- trunk/cumin/python/cumin/grid/slot.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/grid/slot.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -24,11 +24,11 @@
self.pool = pool
self.add_filter(self.pool, cls.Pool, cls.Pool)
- self.add_search_filter(cls.Name)
frame = "main.grid.pool.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)
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/grid/submission.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -75,8 +75,6 @@
self.add_attribute_column(cls.Completed)
self.add_attribute_column(cls.Held)
- self.add_search_filter(cls.Name)
-
class PoolSubmissionSelector(SubmissionSelector):
def __init__(self, app, name, pool):
super(PoolSubmissionSelector, self).__init__(app, name)
@@ -89,6 +87,7 @@
frame = "main.grid.pool.submission"
col = ObjectLinkColumn(app, "name", self.cls.Name, self.cls._id,
frame)
self.insert_column(1, col)
+ self.add_search_filter(col)
attr = self.cls.Owner
col = ObjectTableColumn(app, attr.name, attr)
Modified: trunk/cumin/python/cumin/grid/submitter.py
===================================================================
--- trunk/cumin/python/cumin/grid/submitter.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/grid/submitter.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -43,6 +43,7 @@
frame = "main.grid.pool.scheduler.submitter"
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.ScheddName)
@@ -50,8 +51,6 @@
self.add_attribute_column(cls.RunningJobs)
self.add_attribute_column(cls.HeldJobs)
- self.add_search_filter(cls.Name)
-
self.enable_csv_export(scheduler)
class SubmitterGeneralStatSet(StatSet):
Modified: trunk/cumin/python/cumin/inventory/system.py
===================================================================
--- trunk/cumin/python/cumin/inventory/system.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/inventory/system.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -1,18 +1,15 @@
-from mint import *
-from wooly import *
-from wooly.widgets import *
-from cumin.objectframe import *
-from cumin.objectselector import *
-from cumin.stat import *
-from cumin.widgets import *
-from cumin.parameters import *
-from cumin.formats import *
-from cumin.util import *
-from cumin.grid.slot import SlotFrame, SlotMap, SlotMapPage
+from slot import SlotMap, SlotMapPage
-from wooly import Session
-import main
+from cumin.objectselector import ObjectSelector, ObjectLinkColumn
+from cumin.objectframe import ObjectFrame
+from cumin.stat import StatSet, StatFlashChart
+from cumin.formats import fmt_bytes
+from cumin.model import CuminStatistic
+from cumin.parameters import RosemaryObjectParameter
+from wooly import Session, Widget
+from wooly.util import StringCatalog
+
strings = StringCatalog(__file__)
class SystemSelector(ObjectSelector):
@@ -24,14 +21,13 @@
frame = "main.inventory.system"
col = ObjectLinkColumn(app, "name", cls.nodeName, cls._id, frame)
self.add_column(col)
+ self.add_search_filter(col)
self.add_attribute_column(cls.osName)
self.add_attribute_column(cls.machine)
self.add_attribute_column(cls.memFree)
self.add_attribute_column(cls.loadAverage1Min)
- self.add_search_filter(cls.nodeName)
-
self.enable_csv_export()
class SystemFrame(ObjectFrame):
@@ -150,86 +146,6 @@
def render_slot_chart_height(self, session):
return 400
-class OldSystemView(CuminView):
- def __init__(self, app, name, system):
- super(OldSystemView, self).__init__(app, name, system)
-
- self.tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.tabs)
-
- self.tabs.add_tab(SystemStats(app, "stats", system))
- self.tabs.add_tab(SystemServices(app, "services", system))
- self.tabs.add_tab(CuminDetails(app, "details", system))
-
-class SystemServices(ItemSet):
- def __init__(self, app, name, system):
- super(SystemServices, self).__init__(app, name)
-
- self.system = system
-
- def render_title(self, session):
- return "Services"
-
- def do_get_items(self, session):
- system = self.system.get(session)
-
- daemons = list()
- daemon_types = [Scheduler, Collector, Negotiator]
- sql = "system = '%s'" % system.nodeName
-
- for daemon in daemon_types:
- system_daemons = daemon.select(sql)
- for devil in system_daemons:
- try:
- daemons.append(devil)
- except Exception, e:
- pass
-
- # using a loop instead of an sql select with an outer join
- brokers = Broker.select()
-
- for broker in brokers:
- if broker.system.nodeName == system.nodeName:
- daemons.append(broker)
-
- return daemons
-
- def render_item_content(self, session, item):
- if isinstance(item, Broker):
- broker = Identifiable(item.id)
- href = self.page.main.messaging.broker.get_href(session, broker)
- return fmt_link(href, item.port) # XXX item.port is too lame
- else:
- pool = Pool(item.Pool)
- self.page.main.grid.pool.object.set(session, pool)
- #self.page.main.show_grid_tab(session)
- daemon = Identifiable(item.id)
- if isinstance(item, Collector):
- self.page.main.grid.pool.view.collectors.show(session)
- href = self.page.main.grid.pool.collector.get_href \
- (session, daemon)
- elif isinstance(item, Scheduler):
- self.page.main.grid.pool.view.schedulers.show(session)
- href = self.page.main.grid.pool.scheduler.get_href \
- (session, daemon)
- elif isinstance(item, Negotiator):
- self.page.main.grid.pool.view.negotiators.show(session)
- href = self.page.main.grid.pool.negotiator.get_href \
- (session, daemon)
- return fmt_link(href, item.Name)
-
- def render_item_type(self, session, item):
- if isinstance(item, Collector):
- return "Collector"
- elif isinstance(item, Scheduler):
- return "Scheduler"
- elif isinstance(item, Negotiator):
- return "Negotiator"
- elif isinstance(item, Broker):
- return "Broker"
- else:
- return "Daemon"
-
class SystemSlotMapPage(SlotMapPage):
def __init__(self, app, name):
self.cls = app.model.com_redhat_sesame.Sysimage
Modified: trunk/cumin/python/cumin/messaging/binding.py
===================================================================
--- trunk/cumin/python/cumin/messaging/binding.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/messaging/binding.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -141,6 +141,7 @@
col = ObjectLinkColumn \
(app, "binding", binding.bindingKey, binding._id, frame)
self.add_column(col)
+ self.add_search_filter(col)
frame = "main.messaging.broker.exchange"
self.exchange_column = self.Exchange \
@@ -157,8 +158,6 @@
self.remove = BindingSelectionRemove(app, self)
- self.add_search_filter(binding.bindingKey)
-
self.enable_csv_export()
class Exchange(ObjectLinkColumn):
Modified: trunk/cumin/python/cumin/messaging/brokerlink.py
===================================================================
--- trunk/cumin/python/cumin/messaging/brokerlink.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/messaging/brokerlink.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -67,14 +67,13 @@
frame = "main.messaging.broker.link"
col = ObjectLinkColumn(app, "name", cls.host, cls._id, frame)
self.add_column(col)
+ self.add_search_filter(col)
self.add_attribute_column(cls.port)
self.add_attribute_column(cls.state)
self.add_attribute_column(cls.transport)
self.add_attribute_column(cls.durable)
- self.add_search_filter(cls.host)
-
self.remove = BrokerLinkSelectionRemove(app, self)
self.enable_csv_export(vhost)
@@ -96,14 +95,14 @@
self.add_reference_filter(self.link, cls.linkRef)
- self.add_attribute_column(cls.src)
+ col = self.add_attribute_column(cls.src)
+ self.add_search_filter(col)
+
self.add_attribute_column(cls.dest)
self.add_attribute_column(cls.key)
self.add_attribute_column(cls.tag)
self.add_attribute_column(cls.excludes)
- self.add_search_filter(cls.src)
-
self.remove = RouteSelectionRemove(app, self)
class RouteSelectionRemove(ObjectSelectorTask):
Modified: trunk/cumin/python/cumin/messaging/connection.py
===================================================================
--- trunk/cumin/python/cumin/messaging/connection.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/messaging/connection.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -63,6 +63,7 @@
frame = "main.messaging.broker.connection"
col = ObjectLinkColumn(app, "address", cls.address, cls._id, frame)
self.add_column(col)
+ self.add_search_filter(col)
col = ConnectionProcessColumn \
(app, "process", cls.remoteProcessName, cls.remotePid)
@@ -74,8 +75,6 @@
self.add_attribute_column(cls.bytesFromClient)
self.add_attribute_column(cls.bytesToClient)
- self.add_search_filter(cls.address)
-
self.close = ConnectionSelectionClose(app, self)
self.enable_csv_export(vhost)
@@ -192,14 +191,13 @@
frame = "main.messaging.broker.connection.session"
col = ObjectLinkColumn(app, "name", cls.name, cls._id, frame)
self.add_column(col)
+ self.add_search_filter(col)
self.add_attribute_column(cls.attached)
self.add_attribute_column(cls.detachedLifespan)
self.add_attribute_column(cls.framesOutstanding)
self.add_attribute_column(cls.clientCredit)
- self.add_search_filter(cls.name)
-
self.close = SessionSelectionClose(app, self)
self.detach = SessionSelectionDetach(app, self)
Modified: trunk/cumin/python/cumin/messaging/exchange.py
===================================================================
--- trunk/cumin/python/cumin/messaging/exchange.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/messaging/exchange.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -72,6 +72,7 @@
frame = "main.messaging.broker.exchange"
col = self.ExchangeNameColumn(app, "name", cls.name, cls._id, frame)
self.add_column(col)
+ self.add_search_filter(col)
self.add_attribute_column(cls.producerCount)
self.add_attribute_column(cls.bindingCount)
@@ -79,7 +80,6 @@
self.add_attribute_column(cls.byteRoutes)
self.add_reference_filter(vhost, cls.vhostRef)
- self.add_search_filter(cls.name)
self.remove = ExchangeSelectionRemove(app, self)
Modified: trunk/cumin/python/cumin/messaging/queue.py
===================================================================
--- trunk/cumin/python/cumin/messaging/queue.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/messaging/queue.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -72,6 +72,7 @@
frame = "main.messaging.broker.queue"
col = ObjectLinkColumn(app, "name", cls.name, cls._id, frame)
self.add_column(col)
+ self.add_search_filter(col)
self.add_attribute_column(cls.consumerCount)
self.add_attribute_column(cls.bindingCount)
@@ -79,7 +80,6 @@
self.add_attribute_column(cls.byteDepth)
self.add_reference_filter(vhost, cls.vhostRef)
- self.add_search_filter(cls.name)
self.remove = QueueSelectionRemove(app, self)
self.purge = QueueSelectionPurge(app, self)
Modified: trunk/cumin/python/cumin/messaging/subscription.py
===================================================================
--- trunk/cumin/python/cumin/messaging/subscription.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/messaging/subscription.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -16,13 +16,12 @@
frame = "main.messaging.broker.queue.subscription"
col = ObjectLinkColumn(app, "name", cls.name, cls._id, frame)
self.add_column(col)
+ self.add_search_filter(col)
self.add_attribute_column(cls.creditMode)
self.add_attribute_column(cls.arguments)
self.add_attribute_column(cls.delivered)
- self.add_search_filter(cls.name)
-
self.enable_csv_export(queue)
class SubscriptionFrame(ObjectFrame):
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/objectselector.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -35,7 +35,7 @@
# (RosemaryAttribute this, RosemaryAttribute that, Attribute object)
self.filter_specs = list()
- # ((RosemaryAttribute this, Attribute value, SqlLikeFilter.BEGINS)
+ # ((RosemaryAttribute this, Attribute value, SqlLikeFilter.CONTAINS)
self.like_specs = list()
def init(self):
@@ -47,8 +47,8 @@
for this, that, fobj in self.filter_specs:
self.adapter.add_value_filter(this)
- for this, vattr, type in self.like_specs:
- self.adapter.add_like_filter(this)
+ for column, vattr, type in self.like_specs:
+ self.adapter.add_like_filter(column.attr)
if self.sort.default is None:
for col in self.columns:
@@ -83,11 +83,11 @@
self.add_filter(attribute, this, that)
- def add_like_filter(self, attribute, this, type=SqlLikeFilter.CONTAINS):
+ def add_like_filter(self, attribute, column, type=SqlLikeFilter.CONTAINS):
assert isinstance(attribute, Attribute), attribute
- assert isinstance(this, RosemaryAttribute), this
+ assert isinstance(column, DataTableColumn), column
- self.like_specs.append((this, attribute, type))
+ self.like_specs.append((column, attribute, type))
def get_data_values(self, session):
values = dict()
@@ -105,7 +105,7 @@
pre = type == SqlLikeFilter.CONTAINS and "%%" or ""
else:
post = ""
- values[this.name] = "%s%s%s" % (pre, value, post)
+ values[this.attr.name] = "%s%s%s" % (pre, value, post)
return values
@@ -232,10 +232,15 @@
def add_search_filter(self, this):
search = StringInput(self.app, "search")
search.param.default = ""
+ search.title = "Enter search term"
self.table.add_like_filter(search.param, this)
self.filters.add_child(search)
+ def render_search_id(self, session):
+ if len(self.filters.children):
+ return self.filters.children[0].render_id(session)
+
def add_filter(self, attribute, this, that=None):
self.table.add_filter(attribute, this, that)
@@ -243,7 +248,7 @@
self.table.add_column(col)
def add_attribute_column(self, attr):
- self.table.add_attribute_column(attr)
+ return self.table.add_attribute_column(attr)
def add_reference_filter(self, attribute, ref):
self.table.add_reference_filter(attribute, ref)
@@ -258,6 +263,9 @@
if self.export:
return self.export.render(session)
+ def render_script(self, session):
+ return ""
+
def get_data_values(self, session):
return self.table.get_data_values(session)
@@ -539,6 +547,10 @@
self.details = QmfDetails(app, "details", self.status_msg)
self.add_child(self.details)
+ self.script = self.ObjectQmfSelectorScript(app, "script")
+ self.script.comments_enabled = False
+ self.add_child(self.script)
+
self.error_tmpl = WidgetTemplate(self, "error_html")
self.loading_tmpl = WidgetTemplate(self, "deferred_html")
@@ -586,20 +598,35 @@
def render_error_msg(self, session, msg):
return msg
-class ObjectQmfTable(ObjectTable):
+ def render_script(self, session):
+ return self.script.render(session)
+
+ class ObjectQmfSelectorScript(Widget):
+ def render_table_id(self, session):
+ return self.parent.table.render_id(session)
+
+ def render_selector_id(self, session):
+ return self.parent.render_id(session)
+
+class QmfValues(Widget):
def get_data_values(self, session):
- values = super(ObjectQmfTable, self).get_data_values(session)
+ values = super(QmfValues, self).get_data_values(session)
# session is needed to retrieve the qmf data
values['session'] = session
return values
-class ObjectQmSelectorfTable(ObjectSelectorTable):
- def get_data_values(self, session):
- values = super(ObjectQmSelectorfTable, self).get_data_values(session)
+ def get_data_options(self, session):
+ options = super(QmfValues, self).get_data_options(session)
- # session is needed to retrieve the qmf data
- values['session'] = session
+ # store the search filter in the options
+ setattr(options, "like_specs", self.like_specs)
- return values
+ return options
+
+class ObjectQmfTable(QmfValues, ObjectTable):
+ pass
+
+class ObjectQmSelectorfTable(QmfValues, ObjectSelectorTable):
+ pass
\ No newline at end of file
Modified: trunk/cumin/python/cumin/objectselector.strings
===================================================================
--- trunk/cumin/python/cumin/objectselector.strings 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/objectselector.strings 2011-02-11 20:47:34 UTC (rev 4522)
@@ -5,6 +5,11 @@
padding: 0;
}
+div.ObjectSelector label.overTxtLabel {
+ font-size: 12px;
+ color: #999;
+}
+
div.ObjectSelectorFilters {
float: right;
padding-bottom: 0.25em;
@@ -53,7 +58,10 @@
<div>{hidden_inputs}</div>
</form>
<script type="text/javascript">
- cumin.restoreTableCheckboxes();
+<![CDATA[
+ $(document.forms[0]).getElements('[type=text]').each(function(el){ new
OverText(el); });
+ {script}
+]]>
</script>
</div>
@@ -66,6 +74,9 @@
{footer}
<tbody>{rows}</tbody>
</table>
+ <script type="text/javascript">
+ cumin.restoreTableCheckboxes();
+ </script>
[ObjectSelectorControl.html]
<div class="{class}">
@@ -123,6 +134,21 @@
</div>
</div>
+[ObjectQmfSelectorScript.html]
+(function() {
+ // don't update the entire form anymore
+ // just update the table
+ var updateUrl = wooly.branchIntervalUpdate();
+
+ for (var i=0; i<updateUrl.widget.length; i++) {
+ if (updateUrl.widget[i] == "{selector_id}") {
+ updateUrl.widget[i] = "{table_id}";
+ wooly.restartIntervalUpdate(updateUrl.marshal());
+ break;
+ }
+ }
+}())
+
[QmfDetails.css]
div.QmfDetails span.DetailsLink {
font-size: 80%;
@@ -147,11 +173,11 @@
var details = $("{id}_details");
var show_hide = $("{id}_link");
if (details.style.display == "block") {
- show_hide.innerHTML = "show";
+ show_hide.set('text', "show");
details.style.display = "none";
delete branch["{details_path}"];
} else {
- show_hide.innerHTML = "hide";
+ show_hide.set('text', "hide");
details.style.display = "block";
branch["{details_path}"] = "1";
}
Modified: trunk/cumin/python/cumin/qmfadapter.py
===================================================================
--- trunk/cumin/python/cumin/qmfadapter.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/qmfadapter.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -1,7 +1,9 @@
from operator import itemgetter
from cumin.model import QmfCall
from wooly.datatable import DataAdapter, DataAdapterField
+import logging
+log = logging.getLogger("cumin.qmfadapter")
class QmfAdapter(DataAdapter):
def __init__(self, app, method):
super(QmfAdapter, self).__init__()
@@ -31,6 +33,7 @@
else:
rows = []
+ rows = self.filter_rows(rows, values, options)
rows = self.sort_rows(rows, options)
rows = self.limit_rows(rows, options)
@@ -81,6 +84,22 @@
field_data.append(val)
return field_data
+ def filter_rows(self, rows, values, options):
+ filtered = list(rows)
+ try:
+ session = values["session"]
+ for column, vattr, type in options.like_specs:
+ compare = vattr.get(session)
+ index = column.field.index
+ #TODO: handle more than the CONTAINS filter type
+ filtered = [x for x in rows
+ if compare in x[index]]
+ rows = filtered
+ except Exception, e:
+ log.exception(e)
+
+ return rows
+
def sort_rows(self, rows, options):
if len(rows) > self.max_sortable_records:
return rows
@@ -110,7 +129,9 @@
self.fields_by_attr = dict()
def add_like_filter(self, attr):
- #TODO: add sql LIKE filtering to QMF results
+ # qmf adapters don't need to add the like filter
+ # since the filtering is done after the records
+ # are returned in filter_rows
pass
class QmfField(DataAdapterField):
Modified: trunk/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- trunk/cumin/python/cumin/usergrid/widgets.py 2011-02-11 20:25:48 UTC (rev 4521)
+++ trunk/cumin/python/cumin/usergrid/widgets.py 2011-02-11 20:47:34 UTC (rev 4522)
@@ -114,6 +114,7 @@
frame = "main.submissions.submission"
col = ObjectLinkColumn(app, "name", self.cls.Name, self.cls._id,
frame)
self.insert_column(1, col)
+ self.add_search_filter(col)
link = TaskLink(app, "job_submit", app.grid.job_submit)
self.links.add_child(link)