diff --git a/netbox_access_lists/models.py b/netbox_access_lists/models.py index f64df7e..2ba2cdd 100644 --- a/netbox_access_lists/models.py +++ b/netbox_access_lists/models.py @@ -46,6 +46,9 @@ class AccessList(NetBoxModel): def get_absolute_url(self): return reverse('plugins:netbox_access_lists:accesslist', args=[self.pk]) + def get_default_action_color(self): + return ActionChoices.colors.get(self.default_action) + class AccessListRule(NetBoxModel): access_list = models.ForeignKey( @@ -101,3 +104,9 @@ class AccessListRule(NetBoxModel): def get_absolute_url(self): return reverse('plugins:netbox_access_lists:accesslistrule', args=[self.pk]) + + def get_protocol_color(self): + return ProtocolChoices.colors.get(self.protocol) + + def get_action_color(self): + return ActionChoices.colors.get(self.action) diff --git a/netbox_access_lists/tables.py b/netbox_access_lists/tables.py index cd0bbc2..754a7c1 100644 --- a/netbox_access_lists/tables.py +++ b/netbox_access_lists/tables.py @@ -1,6 +1,6 @@ import django_tables2 as tables -from netbox.tables import NetBoxTable +from netbox.tables import NetBoxTable, ChoiceFieldColumn from .models import AccessList, AccessListRule @@ -8,6 +8,7 @@ class AccessListTable(NetBoxTable): name = tables.Column( linkify=True ) + default_action = ChoiceFieldColumn() rule_count = tables.Column() class Meta(NetBoxTable.Meta): @@ -23,6 +24,8 @@ class AccessListRuleTable(NetBoxTable): index = tables.Column( linkify=True ) + protocol = ChoiceFieldColumn() + action = ChoiceFieldColumn() class Meta(NetBoxTable.Meta): model = AccessListRule