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
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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()

+2 −2
Original line number Diff line number Diff line
@@ -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