Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 26 additions & 29 deletions netbox_acls/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ class Meta(NetBoxTable.Meta):
)


class ACLStandardRuleTable(NetBoxTable):
class ACLRuleTable(NetBoxTable):
"""
Defines the table view for the ACLStandardRule model.
Abstract table for all ACL rules.
"""

access_list = tables.Column(
Expand All @@ -140,9 +140,11 @@ class ACLStandardRuleTable(NetBoxTable):
tags = columns.TagColumn(
url_name="plugins:netbox_acls:aclstandardrule_list",
)
source_prefix = tables.Column(
linkify=True,
)

class Meta(NetBoxTable.Meta):
model = ACLStandardRule
fields = (
"pk",
"id",
Expand All @@ -159,52 +161,47 @@ class Meta(NetBoxTable.Meta):
"index",
"action",
"remark",
"source_prefix",
"tags",
"source_prefix",
)


class ACLExtendedRuleTable(NetBoxTable):
class ACLStandardRuleTable(ACLRuleTable):
"""
Defines the table view for the ACLStandardRule model.
"""

class Meta(ACLRuleTable.Meta):
model = ACLStandardRule


class ACLExtendedRuleTable(ACLRuleTable):
"""
Defines the table view for the ACLExtendedRule model.
"""

access_list = tables.Column(
linkify=True,
source_ports = columns.ArrayColumn(
verbose_name=_("Source Ports"),
empty_values=([],),
)
index = tables.Column(
destination_prefix = tables.Column(
linkify=True,
)
action = ChoiceFieldColumn()
tags = columns.TagColumn(
url_name="plugins:netbox_acls:aclextendedrule_list",
destination_ports = columns.ArrayColumn(
verbose_name=_("Destination Ports"),
empty_values=([],),
)
protocol = ChoiceFieldColumn()

class Meta(NetBoxTable.Meta):
class Meta(ACLRuleTable.Meta):
model = ACLExtendedRule
fields = (
"pk",
"id",
"access_list",
"index",
"action",
"remark",
"tags",
"description",
"source_prefix",
fields = ACLRuleTable.Meta.fields + (
"source_ports",
"destination_prefix",
"destination_ports",
"protocol",
)
default_columns = (
"access_list",
"index",
"action",
"remark",
"tags",
"source_prefix",
default_columns = ACLRuleTable.Meta.default_columns + (
"source_ports",
"destination_prefix",
"destination_ports",
Expand Down