diff --git a/netbox_acls/tables.py b/netbox_acls/tables.py index bc26a23..6fe53c4 100644 --- a/netbox_acls/tables.py +++ b/netbox_acls/tables.py @@ -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( @@ -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", @@ -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",