Loading src/webui/service/templates/js/topology.js +18 −2 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ const svg = d3.select('#topology') ; // svg objects var link, node, optical_link; var link, node, optical_link, labels; // values for all forces forceProperties = { Loading Loading @@ -115,7 +115,18 @@ 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(n) { return n.name; }); //node.append("title").text(function(n) { return n.name; }); // persistent node labels labels = svg.append("g").attr("class", "labels") .selectAll("text") .data(data.devices) .enter() .append("text") .text(function(d) { return d.name; }) .attr("font-family", "sans-serif") .attr("font-size", 12) .attr("text-anchor", "middle") .attr("pointer-events", "none"); // link tooltip link.append("title").text(function(l) { return l.name; }); // optical link tooltip Loading Loading @@ -183,6 +194,11 @@ function ticked() { node .attr('x', function(d) { return d.x-icon_width/2; }) .attr('y', function(d) { return d.y-icon_height/2; }); if (labels) { labels .attr('x', function(d) { return d.x; }) .attr('y', function(d) { return d.y + icon_height/2 + 12; }); } } /******************** UI EVENTS ********************/ Loading Loading
src/webui/service/templates/js/topology.js +18 −2 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ const svg = d3.select('#topology') ; // svg objects var link, node, optical_link; var link, node, optical_link, labels; // values for all forces forceProperties = { Loading Loading @@ -115,7 +115,18 @@ 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(n) { return n.name; }); //node.append("title").text(function(n) { return n.name; }); // persistent node labels labels = svg.append("g").attr("class", "labels") .selectAll("text") .data(data.devices) .enter() .append("text") .text(function(d) { return d.name; }) .attr("font-family", "sans-serif") .attr("font-size", 12) .attr("text-anchor", "middle") .attr("pointer-events", "none"); // link tooltip link.append("title").text(function(l) { return l.name; }); // optical link tooltip Loading Loading @@ -183,6 +194,11 @@ function ticked() { node .attr('x', function(d) { return d.x-icon_width/2; }) .attr('y', function(d) { return d.y-icon_height/2; }); if (labels) { labels .attr('x', function(d) { return d.x; }) .attr('y', function(d) { return d.y + icon_height/2 + 12; }); } } /******************** UI EVENTS ********************/ Loading