small changes and modifications, also, some modules disapeareared in nod
[VSoRC/.git] / js / topology / topology.js
index eb1d8d1e80aff94b9c842a811d9481190a8e9836..0f6e1f1ba426019396ffcf5359281ef406f0cd9a 100644 (file)
@@ -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.png"
                 } 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)
@@ -275,7 +276,7 @@ $(function () {
 
     function getTopology() {
         tabObj.buildTabs("#main", ["Graph", "Tables"], "Nothing to show!");
-        var $svg = $('<svg width="1116" height="600"></svg>');
+        var $svg = $('<svg width="800" height="600"></svg>');
         var $data = $('<div id="data"></div>');
         tabObj.buildContent('Graph', $svg);
         tabObj.buildContent('Tables', $data);
@@ -283,19 +284,19 @@ $(function () {
 
 
 
-
+// La funcion jsonget fue creada para sustituir el metodo json de D3
 
         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();