diff --git a/src/webui/service/main/routes.py b/src/webui/service/main/routes.py index 02706c8585847f4eaaa1ef142ad7e972aa76251b..30ed5291103f89f7bd1fbd680f045d4213451abb 100644 --- a/src/webui/service/main/routes.py +++ b/src/webui/service/main/routes.py @@ -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() diff --git a/src/webui/service/templates/js/topology.js b/src/webui/service/templates/js/topology.js index 29156224da2245cd1db75c4384c66b6643130f4c..adcabf62cd4cf59bb11fda3584a1e367836e45e1 100644 --- a/src/webui/service/templates/js/topology.js +++ b/src/webui/service/templates/js/topology.js @@ -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