add ACL rule description back

This commit is contained in:
ryanmerolle 2022-07-20 05:10:05 +00:00
parent b8d9994f08
commit 0a9260bfc4
7 changed files with 22 additions and 8 deletions

View File

@ -115,7 +115,7 @@ class ACLStandardRuleSerializer(NetBoxModelSerializer):
"""
model = ACLStandardRule
fields = (
'id', 'url', 'display', 'access_list', 'index', 'action', 'tags',
'id', 'url', 'display', 'access_list', 'index', 'action', 'tags', 'description',
'created', 'custom_fields', 'last_updated', 'source_prefix'
)
@ -149,7 +149,7 @@ class ACLExtendedRuleSerializer(NetBoxModelSerializer):
"""
model = ACLExtendedRule
fields = (
'id', 'url', 'display', 'access_list', 'index', 'action', 'tags',
'id', 'url', 'display', 'access_list', 'index', 'action', 'tags', 'description',
'created', 'custom_fields', 'last_updated', 'source_prefix', 'source_ports',
'destination_prefix', 'destination_ports', 'protocol'
)

View File

@ -122,7 +122,7 @@ class ACLStandardRuleForm(NetBoxModelForm):
)
fieldsets = (
('Access-List Details', ('access_list', 'tags')),
('Access-List Details', ('access_list', 'description', 'tags')),
('Rule Definition', ('index', 'action', 'remark', 'source_prefix')),
)
@ -130,7 +130,7 @@ class ACLStandardRuleForm(NetBoxModelForm):
model = ACLStandardRule
fields = (
'access_list', 'index', 'action', 'remark', 'source_prefix',
'tags',
'tags', 'description'
)
help_texts = {
'index': 'Determines the order of the rule in the ACL processing.',
@ -189,7 +189,7 @@ class ACLExtendedRuleForm(NetBoxModelForm):
label='Destination Prefix',
)
fieldsets = (
('Access-List Details', ('access_list', 'tags')),
('Access-List Details', ('access_list', 'description', 'tags')),
('Rule Definition', ('index', 'action', 'remark', 'source_prefix', 'source_ports', 'destination_prefix', 'destination_ports', 'protocol',)),
)
@ -198,7 +198,7 @@ class ACLExtendedRuleForm(NetBoxModelForm):
fields = (
'access_list', 'index', 'action', 'remark', 'source_prefix',
'source_ports', 'destination_prefix', 'destination_ports', 'protocol',
'tags'
'tags', 'description'
)
help_texts = {
'destination_ports': acl_rule_logic_help,

View File

@ -51,6 +51,7 @@ class Migration(migrations.Migration):
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
('access_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='aclstandardrules', to='netbox_access_lists.accesslist')),
('index', models.PositiveIntegerField()),
('description', models.CharField(blank=True, max_length=500)),
('action', models.CharField(max_length=30)),
('remark', models.CharField(blank=True, null=True, max_length=500)),
('source_prefix', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='ipam.prefix')),
@ -70,6 +71,7 @@ class Migration(migrations.Migration):
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
('access_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='aclstandardrules', to='netbox_access_lists.accesslist')),
('index', models.PositiveIntegerField()),
('description', models.CharField(blank=True, max_length=500)),
('action', models.CharField(max_length=30)),
('remark', models.CharField(blank=True, null=True, max_length=500)),
('source_prefix', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='ipam.prefix')),

View File

@ -78,6 +78,10 @@ class ACLRule(NetBoxModel):
blank=True,
null=True
)
description = models.CharField(
max_length=500,
blank=True
)
action = models.CharField(
choices=ACLRuleActionChoices,
max_length=30,

View File

@ -57,7 +57,7 @@ class ACLStandardRuleTable(NetBoxTable):
class Meta(NetBoxTable.Meta):
model = ACLStandardRule
fields = (
'pk', 'id', 'access_list', 'index', 'action', 'actions', 'remark', 'tags'
'pk', 'id', 'access_list', 'index', 'action', 'actions', 'remark', 'tags', 'description',
)
default_columns = (
'access_list', 'index', 'action', 'actions', 'remark', 'tags'
@ -83,7 +83,7 @@ class ACLExtendedRuleTable(NetBoxTable):
class Meta(NetBoxTable.Meta):
model = ACLExtendedRule
fields = (
'pk', 'id', 'access_list', 'index', 'action', 'actions', 'remark', 'tags',
'pk', 'id', 'access_list', 'index', 'action', 'actions', 'remark', 'tags', 'description',
'source_prefix', 'source_ports', 'destination_prefix', 'destination_ports', 'protocol'
)
default_columns = (

View File

@ -13,6 +13,10 @@
<a href="{{ object.access_list.get_absolute_url }}">{{ object.access_list }}</a>
</td>
</tr>
<tr>
<th scope="row">Description</th>
<td>{{ object.description|placeholder }}</td>
</tr>
<tr>
<th scope="row">Index</th>
<td>{{ object.index }}</td>

View File

@ -17,6 +17,10 @@
<th scope="row">Index</th>
<td>{{ object.index }}</td>
</tr>
<tr>
<th scope="row">Description</th>
<td>{{ object.description|placeholder }}</td>
</tr>
</table>
</div>
</div>