diff --git a/netbox_access_lists/api/serializers.py b/netbox_access_lists/api/serializers.py index da21dc9..3d262fc 100644 --- a/netbox_access_lists/api/serializers.py +++ b/netbox_access_lists/api/serializers.py @@ -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' ) diff --git a/netbox_access_lists/forms/models.py b/netbox_access_lists/forms/models.py index 8fbe20f..5867b54 100644 --- a/netbox_access_lists/forms/models.py +++ b/netbox_access_lists/forms/models.py @@ -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, diff --git a/netbox_access_lists/migrations/0001_initial.py b/netbox_access_lists/migrations/0001_initial.py index 9f040fe..52179da 100644 --- a/netbox_access_lists/migrations/0001_initial.py +++ b/netbox_access_lists/migrations/0001_initial.py @@ -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')), diff --git a/netbox_access_lists/models.py b/netbox_access_lists/models.py index 21ece64..9efbecb 100644 --- a/netbox_access_lists/models.py +++ b/netbox_access_lists/models.py @@ -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, diff --git a/netbox_access_lists/tables.py b/netbox_access_lists/tables.py index d2f14b2..e2b670f 100644 --- a/netbox_access_lists/tables.py +++ b/netbox_access_lists/tables.py @@ -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 = ( diff --git a/netbox_access_lists/templates/netbox_access_lists/aclextendedrule.html b/netbox_access_lists/templates/netbox_access_lists/aclextendedrule.html index 2448d63..fc3b3c9 100644 --- a/netbox_access_lists/templates/netbox_access_lists/aclextendedrule.html +++ b/netbox_access_lists/templates/netbox_access_lists/aclextendedrule.html @@ -13,6 +13,10 @@ {{ object.access_list }} + + Description + {{ object.description|placeholder }} + Index {{ object.index }} diff --git a/netbox_access_lists/templates/netbox_access_lists/aclstandardrule.html b/netbox_access_lists/templates/netbox_access_lists/aclstandardrule.html index 1a013e0..41a13bb 100644 --- a/netbox_access_lists/templates/netbox_access_lists/aclstandardrule.html +++ b/netbox_access_lists/templates/netbox_access_lists/aclstandardrule.html @@ -17,6 +17,10 @@ Index {{ object.index }} + + Description + {{ object.description|placeholder }} +