mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 01:06:11 -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'),
|
('rear_port', 'rear_port_position'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_color(self):
|
||||||
|
return self.color
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('dcim:frontport', kwargs={'pk': self.pk})
|
return reverse('dcim:frontport', kwargs={'pk': self.pk})
|
||||||
|
|
||||||
@ -948,6 +951,9 @@ class RearPort(ModularComponentModel, CabledObjectModel):
|
|||||||
ordering = ('device', '_name')
|
ordering = ('device', '_name')
|
||||||
unique_together = ('device', 'name')
|
unique_together = ('device', 'name')
|
||||||
|
|
||||||
|
def get_color(self):
|
||||||
|
return self.color
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('dcim:rearport', kwargs={'pk': self.pk})
|
return reverse('dcim:rearport', kwargs={'pk': self.pk})
|
||||||
|
|
||||||
|
@ -166,6 +166,8 @@ class CableTraceSVG:
|
|||||||
"""
|
"""
|
||||||
if hasattr(instance, 'parent_object'):
|
if hasattr(instance, 'parent_object'):
|
||||||
# Termination
|
# Termination
|
||||||
|
if(hasattr(instance, 'get_color') and instance.get_color()):
|
||||||
|
return instance.get_color()
|
||||||
return 'f0f0f0'
|
return 'f0f0f0'
|
||||||
if hasattr(instance, 'device_role'):
|
if hasattr(instance, 'device_role'):
|
||||||
# Device
|
# Device
|
||||||
|
Loading…
Reference in New Issue
Block a user