Added Colors to SVG for Front and Reaer Ports

Fix for feature request 10904 thanks to @TheZackCodec
This commit is contained in:
Derick Vigne 2022-11-13 18:28:01 -05:00
parent d59d23e308
commit 00cf5642a0
No known key found for this signature in database
GPG Key ID: DCD25AD041BCEBE4
2 changed files with 8 additions and 0 deletions

View File

@ -902,6 +902,9 @@ class FrontPort(ModularComponentModel, CabledObjectModel):
('rear_port', 'rear_port_position'),
)
def get_color(self):
return self.color
def get_absolute_url(self):
return reverse('dcim:frontport', kwargs={'pk': self.pk})
@ -948,6 +951,9 @@ class RearPort(ModularComponentModel, CabledObjectModel):
ordering = ('device', '_name')
unique_together = ('device', 'name')
def get_color(self):
return self.color
def get_absolute_url(self):
return reverse('dcim:rearport', kwargs={'pk': self.pk})

View File

@ -166,6 +166,8 @@ class CableTraceSVG:
"""
if hasattr(instance, 'parent_object'):
# Termination
if(hasattr(instance, 'get_color') and instance.get_color()):
return instance.get_color()
return 'f0f0f0'
if hasattr(instance, 'device_role'):
# Device