mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Colored nodes in topology maps
This commit is contained in:
parent
82d53a8c3d
commit
9f67da00d1
@ -337,9 +337,10 @@ class TopologyMap(models.Model):
|
||||
# Add each device to the graph
|
||||
devices = []
|
||||
for query in device_set.split(';'): # Split regexes on semicolons
|
||||
devices += Device.objects.filter(name__regex=query)
|
||||
devices += Device.objects.filter(name__regex=query).select_related('device_role')
|
||||
for d in devices:
|
||||
subgraph.node(d.name)
|
||||
fillcolor = '#{}'.format(d.device_role.color)
|
||||
subgraph.node(d.name, style='filled', fillcolor=fillcolor)
|
||||
|
||||
# Add an invisible connection to each successive device in a set to enforce horizontal order
|
||||
for j in range(0, len(devices) - 1):
|
||||
|
Loading…
Reference in New Issue
Block a user