From a2f3ad347930315e3f4c8dcbdd95556671c11919 Mon Sep 17 00:00:00 2001 From: Jason Novinger Date: Mon, 3 Mar 2025 11:17:21 -0600 Subject: [PATCH] Adds color definitions to L2VPNStatusChoices --- netbox/vpn/choices.py | 6 +++--- netbox/vpn/models/l2vpn.py | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/netbox/vpn/choices.py b/netbox/vpn/choices.py index 3c38a9901..90ec1af07 100644 --- a/netbox/vpn/choices.py +++ b/netbox/vpn/choices.py @@ -277,7 +277,7 @@ class L2VPNStatusChoices(ChoiceSet): STATUS_DECOMMISSIONED = 'decommissioned' CHOICES = [ - (STATUS_PLANNED, _('Planned')), - (STATUS_ACTIVE, _('Active')), - (STATUS_DECOMMISSIONED, _('Decommissioned')), + (STATUS_PLANNED, _('Planned'), 'cyan'), + (STATUS_ACTIVE, _('Active'), 'green'), + (STATUS_DECOMMISSIONED, _('Decommissioned'), 'red'), ] diff --git a/netbox/vpn/models/l2vpn.py b/netbox/vpn/models/l2vpn.py index 05d6ff4fb..7f43bf909 100644 --- a/netbox/vpn/models/l2vpn.py +++ b/netbox/vpn/models/l2vpn.py @@ -74,6 +74,9 @@ class L2VPN(ContactsMixin, PrimaryModel): return f'{self.name} ({self.identifier})' return f'{self.name}' + def get_status_color(self): + return L2VPNStatusChoices.colors.get(self.status) + @cached_property def can_add_termination(self): if self.type in L2VPNTypeChoices.P2P and self.terminations.count() >= 2: