mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
Added Colors to SVG for Front and Reaer Ports
Fix for feature request 10904 thanks to @TheZackCodec
This commit is contained in:
parent
d59d23e308
commit
00cf5642a0
@ -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})
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user