X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=js%2Ftopology%2Ftopology.js;h=45040e107c1709d4bfd6353d5f94950520fc3a07;hb=ea20f018c05bcc4e56b2dfa3eee30af0d6ffabf3;hp=14bfb2e5fb985fb2730c8b25ffef5a2d51989426;hpb=dbac5cb460f04625bc2a9e414e51900c9777d3ae;p=VSoRC%2F.git diff --git a/js/topology/topology.js b/js/topology/topology.js index 14bfb2e..45040e1 100644 --- a/js/topology/topology.js +++ b/js/topology/topology.js @@ -74,8 +74,9 @@ $(function () { } lst = top.hosts; + console.log(top.hosts); for (var i = 0; i < lst.length; i++) { - nodes.push({ "id": lst[i].mac, "type": "host" }); + nodes.push({ "id": lst[i].mac, "type": "host","ip": lst[i].ipv4}); links.push({ "source": lst[i].port.dpid, "target": lst[i].mac, "value": 2, "port": { "source": lst[i].port.port_no, "target": 0 } @@ -139,7 +140,7 @@ $(function () { node.append("image") .attr("xlink:href", function (d) { if (d.type === "switch") { - return "img/switch.svg" + return "img/switch.png" } else if (d.type === "cloud") { return "img/cloud.svg" } else { @@ -153,6 +154,12 @@ $(function () { .attr("class", "label") .attr("dy", size + 14) .text(function (d) { return d.id; }); + + + node.append("text") + .attr("class", "label") + .attr("dy", size + 26) + .text(function (d) { if (d.type === "host")return (d.ip); }); // .text(function (d) { return d.id.replace(/^0+/, ''); }); @@ -276,7 +283,7 @@ $(function () { function getTopology() { tabObj.buildTabs("#main", ["Graph", "Tables"], "Nothing to show!"); - var $svg = $(''); + var $svg = $(''); var $data = $('
'); tabObj.buildContent('Graph', $svg); tabObj.buildContent('Tables', $data);