X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=js%2Ftopology%2Ftopology.js;h=c2baab70821adc21ce78f442b4e546ddaba5865c;hp=eb1d8d1e80aff94b9c842a811d9481190a8e9836;hb=6c19fe21cbfc617146dd8df2ffd48e430155bebb;hpb=1f2664ee622668b8d63ea5aba76e574d56677c20 diff --git a/js/topology/topology.js b/js/topology/topology.js index eb1d8d1..c2baab7 100644 --- a/js/topology/topology.js +++ b/js/topology/topology.js @@ -48,6 +48,7 @@ $(function () { var links = []; var lst = top.switches; + for (var i = 0; i < lst.length; i++) { nodes.push({ "id": lst[i].dpid, "type": "switch" }); } @@ -138,11 +139,11 @@ $(function () { node.append("image") .attr("xlink:href", function (d) { if (d.type === "switch") { - return "/home/img/switch.svg" + return "img/switch.svg" } else if (d.type === "cloud") { - return "/home/img/cloud.svg" + return "img/cloud.svg" } else { - return "/home/img/pc.svg" + return "img/pc.svg" } }) .on("mouseover", handleMouseOver) @@ -286,16 +287,16 @@ $(function () { function jsonget() { - const url = "http://"+location.hostname+":8080/topology" + let xhr = new XMLHttpRequest(); - xhr.open('GET', url , true); + xhr.open('GET', "/gettopo" , true); //console.log(xhr); //para ver en la consola xhr.onload = function() { if (xhr.status == 200) { //can use this.status instead //console.log(xhr.responseText);// para ver en la consola - data = JSON.parse(xhr.responseText) - listTopology(data) - plotGraph(toGraph(data)); + + listTopology(JSON.parse(xhr.responseText)); + plotGraph(toGraph(JSON.parse(xhr.responseText))); } } xhr.send();