Add filter feature in Scheduled Operations
Change-Id: Ibb82d3db0822b3ca2bc290346f865af557e00247 Closes-Bug: #1646664
This commit is contained in:
parent
33965e373a
commit
1d320b8a72
|
@ -17,6 +17,15 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from horizon import tables
|
||||
|
||||
|
||||
class ScheduledOperationFilterAction(tables.FilterAction):
|
||||
def filter(self, table, scheduledoperations, filter_string):
|
||||
"""Naive case-insensitive search."""
|
||||
query = filter_string.lower()
|
||||
return [scheduledoperation
|
||||
for scheduledoperation in scheduledoperations
|
||||
if query in scheduledoperation.name.lower()]
|
||||
|
||||
|
||||
class ScheduledOperationsTable(tables.DataTable):
|
||||
id = tables.Column(
|
||||
'id',
|
||||
|
@ -40,3 +49,4 @@ class ScheduledOperationsTable(tables.DataTable):
|
|||
class Meta(object):
|
||||
name = 'scheduledoperations'
|
||||
verbose_name = _('Scheduled Operations')
|
||||
table_actions = (ScheduledOperationFilterAction, )
|
||||
|
|
Loading…
Reference in New Issue