Skip to content

Commit 58e329c

Browse files
committed
feat(tables): Add generic src and dst columns for ACL rules
Introduces new columns for source and destination with support for generic objects in ACLStandardRule and ACLExtendedRule tables. Updates field and default column configurations for improved flexibility and alignment with the new data model.
1 parent a94e97b commit 58e329c

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

netbox_acls/tables.py

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ class ACLStandardRuleTable(NetBoxTable):
141141
url_name="plugins:netbox_acls:aclstandardrule_list",
142142
)
143143

144+
# Source
145+
source_type = columns.ContentTypeColumn(
146+
verbose_name=_("Source Type"),
147+
)
148+
source = tables.Column(
149+
verbose_name=_("Source"),
150+
orderable=False,
151+
linkify=True,
152+
)
153+
144154
class Meta(NetBoxTable.Meta):
145155
model = ACLStandardRule
146156
fields = (
@@ -152,14 +162,14 @@ class Meta(NetBoxTable.Meta):
152162
"remark",
153163
"tags",
154164
"description",
155-
"source_prefix",
165+
"source",
156166
)
157167
default_columns = (
158168
"access_list",
159169
"index",
160170
"action",
161171
"remark",
162-
"source_prefix",
172+
"source",
163173
"tags",
164174
)
165175

@@ -181,6 +191,26 @@ class ACLExtendedRuleTable(NetBoxTable):
181191
)
182192
protocol = ChoiceFieldColumn()
183193

194+
# Source
195+
source_type = columns.ContentTypeColumn(
196+
verbose_name=_("Source Type"),
197+
)
198+
source = tables.Column(
199+
verbose_name=_("Source"),
200+
orderable=False,
201+
linkify=True,
202+
)
203+
204+
# Destination
205+
destination_type = columns.ContentTypeColumn(
206+
verbose_name=_("Destination Type"),
207+
)
208+
destination = tables.Column(
209+
verbose_name=_("Destination"),
210+
orderable=False,
211+
linkify=True,
212+
)
213+
184214
class Meta(NetBoxTable.Meta):
185215
model = ACLExtendedRule
186216
fields = (
@@ -192,9 +222,9 @@ class Meta(NetBoxTable.Meta):
192222
"remark",
193223
"tags",
194224
"description",
195-
"source_prefix",
225+
"source",
196226
"source_ports",
197-
"destination_prefix",
227+
"destination",
198228
"destination_ports",
199229
"protocol",
200230
)
@@ -203,10 +233,10 @@ class Meta(NetBoxTable.Meta):
203233
"index",
204234
"action",
205235
"remark",
206-
"tags",
207-
"source_prefix",
236+
"protocol",
237+
"source",
208238
"source_ports",
209-
"destination_prefix",
239+
"destination",
210240
"destination_ports",
211-
"protocol",
241+
"tags",
212242
)

0 commit comments

Comments
 (0)