X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=js%2Ftopology%2Ftopology.js;fp=js%2Ftopology%2Ftopology.js;h=7808f33e749c1669a366302c2c42f9b66bfb6e13;hp=ebd33a0b841a27791cbfdef010b7ed8be29fdd29;hb=8bd25d906f766566ceee02d3d70e9890689a4c1a;hpb=4ff4cfab60fd88f431c88603d57612fc489dc62f diff --git a/js/topology/topology.js b/js/topology/topology.js index ebd33a0..7808f33 100644 --- a/js/topology/topology.js +++ b/js/topology/topology.js @@ -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))); } }