diff options
Diffstat (limited to 'ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html')
-rw-r--r-- | ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html | 155 |
1 files changed, 72 insertions, 83 deletions
diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html index aba0ad6..ec9bc60 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html @@ -21,7 +21,7 @@ <!DOCTYPE html> <html> <head> -<title>Cell Operations History</title> +<title>Netconf server details</title> <style> table, td, th { border: solid 1px #DDD; @@ -45,7 +45,7 @@ table, td, th { </head> <body onload="getOperationLogs()"> <center> - <h3>Cell Operations History</h3> + <h3>Netconf server details</h3> </center> <br> <p id="showData"></p> @@ -54,94 +54,83 @@ table, td, th { </body> <script> - function getOperationLogs() { - var xmlhttp = new XMLHttpRequest(); - xmlhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - var logs = JSON.parse(this.responseText); - var myJSON = JSON.stringify(logs); - console.log(myJSON); - drawTable(logs); - } - }; - xmlhttp.open("GET","/ransim/api/GetNetconfStatus", - true); - xmlhttp.send(); - } + function getOperationLogs() { + var xmlhttp = new XMLHttpRequest(); + xmlhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + var logs = JSON.parse(this.responseText); + var myJSON = JSON.stringify(logs); + console.log(myJSON); + drawTable(logs); + } + }; + xmlhttp.open("GET", "/ransim/api/GetNetconfStatus", true); + xmlhttp.send(); + } - function drawTable(myBooks) { - // EXTRACT VALUE FOR HTML HEADER. - var col = []; - for (var i = 0; i < myBooks.length; i++) { - console.log(myBooks[i]); - for (var key in myBooks[i]) { - if (col.indexOf(key) === -1) { - col.push(key); - } - } - } - - console.log(col); + function drawTable(data) { + // EXTRACT VALUE FOR HTML HEADER. + var col = []; + for (var i = 0; i < data.length; i++) { + console.log(data[i]); + for ( var key in data[i]) { + if (col.indexOf(key) === -1) { + col.push(key); + } + } + } - // CREATE DYNAMIC TABLE. - var table = document.createElement("table"); + console.log(col); - // CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE. + // CREATE DYNAMIC TABLE. + var table = document.createElement("table"); - var tr = table.insertRow(-1); // TABLE ROW. + // CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE. - //for (var i = 0; i < 4; i++) { - for (var i = 0; i < col.length; i++) { - - // if (i == 0) continue; - var th = document.createElement("th"); // TABLE HEADER. - if(i==2) - th.innerHTML = "PORT"; - else - th.innerHTML = col[i].toUpperCase(); - //console.log("th.style " + th.style); - tr.appendChild(th); - } + var tr = table.insertRow(-1); // TABLE ROW. - // ADD JSON DATA TO THE TABLE AS ROWS. - for (var i = 0; i < myBooks.length; i++) { + for (var i = 0; i < col.length; i++) { - tr = table.insertRow(-1); - //manipulate rows - if(i % 2 == 0){ - tr.className = "even"; - }else{ - tr.className = "odd"; - } + var th = document.createElement("th"); // TABLE HEADER. + if (i == 2) + th.innerHTML = "PORT"; + else + th.innerHTML = col[i].toUpperCase(); + tr.appendChild(th); + } - //for (var j = 0; j < 4; j++) { - for (var j = 0; j < col.length; j++) { - - //if (j == 0) continue; - var tabCell = tr.insertCell(-1); - //tabCell.style.setWidth("25%"); - //console.log("tabCell.style " + tabCell.style); - if(j==3) - { - var arr = ""; - for(var k = 0;k<myBooks[i][col[j]].length;k++) - { - console.log("nodeId" + myBooks[i][col[j]][k]["nodeId"]); - arr = arr + " " + myBooks[i][col[j]][k]["nodeId"]; - } - tabCell.innerHTML = arr; - tabCell.className = "WID"; - console.log("arr" + arr); - } - else - tabCell.innerHTML = myBooks[i][col[j]]; - console.log("checking my books , j " + j + " " + myBooks[i][col[j]]); - } - } - // FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER. - var divContainer = document.getElementById("showData"); - divContainer.innerHTML = ""; - divContainer.appendChild(table); - } + // ADD JSON DATA TO THE TABLE AS ROWS. + for (var i = 0; i < data.length; i++) { + + tr = table.insertRow(-1); + //manipulate rows + if (i % 2 == 0) { + tr.className = "even"; + } else { + tr.className = "odd"; + } + + for (var j = 0; j < col.length; j++) { + + var tabCell = tr.insertCell(-1); + if (j == 3) { + var arr = ""; + for (var k = 0; k < data[i][col[j]].length; k++) { + console.log("nodeId" + data[i][col[j]][k]["nodeId"]); + arr = arr + " " + data[i][col[j]][k]["nodeId"]; + } + tabCell.innerHTML = arr; + tabCell.className = "WID"; + console.log("arr" + arr); + } else + tabCell.innerHTML = data[i][col[j]]; + console.log("checking data , j " + j + " " + data[i][col[j]]); + } + } + // FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER. + var divContainer = document.getElementById("showData"); + divContainer.innerHTML = ""; + divContainer.appendChild(table); + } </script> </html> |