From 10efaaf539332e3d4c845e52b23b0d6260913321 Mon Sep 17 00:00:00 2001 From: Masco Kaliyamoorthy Date: Tue, 3 Feb 2015 12:09:25 +0530 Subject: [PATCH] added filter for stacks table client side filter is missing for stack table. this patch adding the filter for stack table. Change-Id: Iff87e45b65a2b5159a761cd4f7211b602080e2b1 Closes-Bug: #1417399 --- .../dashboards/project/stacks/tables.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/dashboards/project/stacks/tables.py b/openstack_dashboard/dashboards/project/stacks/tables.py index adce044f0e..0e88dd565e 100644 --- a/openstack_dashboard/dashboards/project/stacks/tables.py +++ b/openstack_dashboard/dashboards/project/stacks/tables.py @@ -171,6 +171,15 @@ class StacksUpdateRow(tables.Row): raise +class StacksFilterAction(tables.FilterAction): + + def filter(self, table, stacks, filter_string): + """Naive case-insensitive search.""" + query = filter_string.lower() + return [stack for stack in stacks + if query in stack.name.lower()] + + class StacksTable(tables.DataTable): STATUS_CHOICES = ( ("Complete", True), @@ -209,7 +218,8 @@ class StacksTable(tables.DataTable): CheckStack, SuspendStack, ResumeStack, - DeleteStack,) + DeleteStack, + StacksFilterAction,) row_actions = (CheckStack, SuspendStack, ResumeStack,