Merge "added filter for keypair and security and access tables"
This commit is contained in:
commit
26d6f0dd19
@ -78,6 +78,15 @@ class CreateKeyPair(tables.LinkAction):
|
|||||||
return True
|
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):
|
class KeypairsTable(tables.DataTable):
|
||||||
detail_link = "horizon:project:access_and_security:keypairs:detail"
|
detail_link = "horizon:project:access_and_security:keypairs:detail"
|
||||||
|
|
||||||
@ -91,5 +100,6 @@ class KeypairsTable(tables.DataTable):
|
|||||||
class Meta(object):
|
class Meta(object):
|
||||||
name = "keypairs"
|
name = "keypairs"
|
||||||
verbose_name = _("Key Pairs")
|
verbose_name = _("Key Pairs")
|
||||||
table_actions = (CreateKeyPair, ImportKeyPair, DeleteKeyPairs,)
|
table_actions = (CreateKeyPair, ImportKeyPair, DeleteKeyPairs,
|
||||||
|
KeypairsFilterAction,)
|
||||||
row_actions = (DeleteKeyPairs,)
|
row_actions = (DeleteKeyPairs,)
|
||||||
|
@ -128,6 +128,15 @@ class ManageRules(policy.PolicyTargetMixin, tables.LinkAction):
|
|||||||
return POLICY_CHECK(policy, request, policy_target)
|
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):
|
class SecurityGroupsTable(tables.DataTable):
|
||||||
name = tables.Column("name", verbose_name=_("Name"))
|
name = tables.Column("name", verbose_name=_("Name"))
|
||||||
description = tables.Column("description", verbose_name=_("Description"))
|
description = tables.Column("description", verbose_name=_("Description"))
|
||||||
@ -138,7 +147,7 @@ class SecurityGroupsTable(tables.DataTable):
|
|||||||
class Meta(object):
|
class Meta(object):
|
||||||
name = "security_groups"
|
name = "security_groups"
|
||||||
verbose_name = _("Security Groups")
|
verbose_name = _("Security Groups")
|
||||||
table_actions = (CreateGroup, DeleteGroup)
|
table_actions = (CreateGroup, DeleteGroup, SecurityGroupsFilterAction)
|
||||||
row_actions = (ManageRules, EditGroup, DeleteGroup)
|
row_actions = (ManageRules, EditGroup, DeleteGroup)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user