Merge branch 'step07-navigation' into step08-filter-sets

This commit is contained in:
jeremystretch 2022-03-17 15:03:02 -04:00
commit ac21c41850
2 changed files with 13 additions and 1 deletions

View File

@ -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)

View File

@ -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