Update for support of netbox deployments, which are not in the webserver root (e.g. /netbox/)

This commit is contained in:
Johannes Kreuzer
2020-05-14 15:52:47 +02:00
parent d608d63207
commit 8a6f1660f0
2 changed files with 11 additions and 11 deletions
+4 -4
View File
@@ -66,12 +66,12 @@ class SearchViewSet(ViewSet):
node = {}
node["id"] = device.id
node["name"] = device.name
node["label"] = device.name + device.device_type.display_name
node["label"] = device.name + " " + device.device_type.display_name
node["shape"] = 'image'
if device.device_role.slug in settings.PLUGINS_CONFIG["netbox_topology_views"]["device_img"]:
node["image"] = '/static/netbox_topology_views/img/' + device.device_role.slug + ".png"
node["image"] = '../../static/netbox_topology_views/img/' + device.device_role.slug + ".png"
else:
node["image"] = "/static/netbox_topology_views/img/role-unknown.png"
node["image"] = "../../static/netbox_topology_views/img/role-unknown.png"
for device_custom_field in device.custom_field_values.all():
if device_custom_field.field.name == "coordinates":
@@ -86,4 +86,4 @@ class SearchViewSet(ViewSet):
results["nodes"] = nodes
results["edges"] = edges
return Response(results)
return Response(results)