Documentacion agregada - previo a la presentacion
[VSoRC/.git] / js / topology / topology.js
index ebd33a0b841a27791cbfdef010b7ed8be29fdd29..7808f33e749c1669a366302c2c42f9b66bfb6e13 100644 (file)
@@ -43,6 +43,14 @@ $(function () {
     //          "port": {"source": "00000003", "target": "00000002"}, "value": 4},
     //       ...
     //     ]}
+function displayMessage(msg) {
+    var $x = $("#snackbar");
+    $x.text(msg)
+    $x.toggleClass("show");
+    setTimeout(function () { $x.toggleClass("show"); }, 3000);
+}
+
+
     function toGraph(top) {
         var nodes = [];
         var links = [];
@@ -300,6 +308,9 @@ $(function () {
           xhr.onload = function() {
             if (xhr.status == 200) { //can use this.status instead
               //console.log(xhr.responseText);// para ver en la consola
+               if(xhr.response === null || xhr.response === ""){
+               displayMessage("No response from controller")
+               }
               plotGraph(toGraph(JSON.parse(xhr.responseText)));
             }
           }