Adds color definitions to L2VPNStatusChoices

This commit is contained in:
Jason Novinger 2025-03-03 11:17:21 -06:00
parent 2fb16f969e
commit a2f3ad3479
2 changed files with 6 additions and 3 deletions

View File

@ -277,7 +277,7 @@ class L2VPNStatusChoices(ChoiceSet):
STATUS_DECOMMISSIONED = 'decommissioned' STATUS_DECOMMISSIONED = 'decommissioned'
CHOICES = [ CHOICES = [
(STATUS_PLANNED, _('Planned')), (STATUS_PLANNED, _('Planned'), 'cyan'),
(STATUS_ACTIVE, _('Active')), (STATUS_ACTIVE, _('Active'), 'green'),
(STATUS_DECOMMISSIONED, _('Decommissioned')), (STATUS_DECOMMISSIONED, _('Decommissioned'), 'red'),
] ]

View File

@ -74,6 +74,9 @@ class L2VPN(ContactsMixin, PrimaryModel):
return f'{self.name} ({self.identifier})' return f'{self.name} ({self.identifier})'
return f'{self.name}' return f'{self.name}'
def get_status_color(self):
return L2VPNStatusChoices.colors.get(self.status)
@cached_property @cached_property
def can_add_termination(self): def can_add_termination(self):
if self.type in L2VPNTypeChoices.P2P and self.terminations.count() >= 2: if self.type in L2VPNTypeChoices.P2P and self.terminations.count() >= 2: