Skip to content
Snippets Groups Projects
Commit d8a8c635 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

WebUI component:

- added human-readable names to Topology graph
parent 6be7bd98
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!34Context Scalability extensions using CockroachDB + Removal of Stateful database inside Device + other
......@@ -136,7 +136,7 @@ def topology():
if device.device_id.device_uuid.uuid not in topo_device_uuids: continue
devices.append({
'id': device.device_id.device_uuid.uuid,
'name': device.device_id.device_uuid.uuid,
'name': device.name,
'type': device.device_type,
})
......@@ -150,13 +150,15 @@ def topology():
continue
links.append({
'id': link.link_id.link_uuid.uuid,
'name': link.name,
'source': link.link_endpoint_ids[0].device_id.device_uuid.uuid,
'target': link.link_endpoint_ids[1].device_id.device_uuid.uuid,
})
return jsonify({'devices': devices, 'links': links})
except:
except: # pylint: disable=bare-except
LOGGER.exception('Error retrieving topology')
return jsonify({'devices': [], 'links': []})
finally:
context_client.close()
......
......@@ -88,9 +88,9 @@ d3.json("{{ url_for('main.topology') }}", function(data) {
.call(d3.drag().on("start", dragstarted).on("drag", dragged).on("end", dragended));
// node tooltip
node.append("title").text(function(d) { return d.id; });
node.append("title").text(function(n) { return n.name + ' (' + n.id + ')'; });
// link tooltip
link.append("title").text(function(d) { return d.id; });
link.append("title").text(function(l) { return l.name + ' (' + l.id + ')'; });
// link style
link
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment