added filter for keypair and security and access tables
client side filter is missing in keypair table and security and access table. this patch adding the client side filter on both of the above mentioned tables. Change-Id: I71a89fb7e1763eb1a6f242ae6d007d55afe51a68 Closes-Bug: #1419649
This commit is contained in:
parent
849961fb32
commit
693a78ceee
@ -78,6 +78,15 @@ class CreateKeyPair(tables.LinkAction):
|
||||
return True
|
||||
|
||||
|
||||
class KeypairsFilterAction(tables.FilterAction):
|
||||
|
||||
def filter(self, table, keypairs, filter_string):
|
||||
"""Naive case-insensitive search."""
|
||||
query = filter_string.lower()
|
||||
return [keypair for keypair in keypairs
|
||||
if query in keypair.name.lower()]
|
||||
|
||||
|
||||
class KeypairsTable(tables.DataTable):
|
||||
detail_link = "horizon:project:access_and_security:keypairs:detail"
|
||||
|
||||
@ -91,5 +100,6 @@ class KeypairsTable(tables.DataTable):
|
||||
class Meta(object):
|
||||
name = "keypairs"
|
||||
verbose_name = _("Key Pairs")
|
||||
table_actions = (CreateKeyPair, ImportKeyPair, DeleteKeyPairs,)
|
||||
table_actions = (CreateKeyPair, ImportKeyPair, DeleteKeyPairs,
|
||||
KeypairsFilterAction,)
|
||||
row_actions = (DeleteKeyPairs,)
|
||||
|
@ -128,6 +128,15 @@ class ManageRules(policy.PolicyTargetMixin, tables.LinkAction):
|
||||
return POLICY_CHECK(policy, request, policy_target)
|
||||
|
||||
|
||||
class SecurityGroupsFilterAction(tables.FilterAction):
|
||||
|
||||
def filter(self, table, security_groups, filter_string):
|
||||
"""Naive case-insensitive search."""
|
||||
query = filter_string.lower()
|
||||
return [security_group for security_group in security_groups
|
||||
if query in security_group.name.lower()]
|
||||
|
||||
|
||||
class SecurityGroupsTable(tables.DataTable):
|
||||
name = tables.Column("name", verbose_name=_("Name"))
|
||||
description = tables.Column("description", verbose_name=_("Description"))
|
||||
@ -138,7 +147,7 @@ class SecurityGroupsTable(tables.DataTable):
|
||||
class Meta(object):
|
||||
name = "security_groups"
|
||||
verbose_name = _("Security Groups")
|
||||
table_actions = (CreateGroup, DeleteGroup)
|
||||
table_actions = (CreateGroup, DeleteGroup, SecurityGroupsFilterAction)
|
||||
row_actions = (ManageRules, EditGroup, DeleteGroup)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user