trick/trick_source/web/apps/vs_connections.html
jmpenn 95c6659733
Incorporate Webserver into Trick, so one only has to include HttpServ… (#886)
* Incorporate Webserver into Trick, so one only has to include HttpServer.sm

* Tweaks in default index.html file

* Rename HTTPServer.sm to WebServer.sm

* Rename http_server to WebServer

* Add --retry to curl invocations in HttpServer makefile.

* Fix #include in VariableServerVariable.hh

* Include cleanup and curl tweaks in the hopes of making Jenkins happy.

* Doh! problem in makefile masked by preinstalled mongoose in usr/local/lib

* DIE Make Bug DIE

* Fix include in WebServer.sm

* WebServer.sm constructor name

* Don't SWIG mongoose.h

* Compile with -std=c++11

* Attempt to fix race condition in makefile

* makefie tweek

* Fix trick library name problem for Centos and Redhat
2019-10-23 11:58:19 -05:00

75 lines
2.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Variable Server Connections</title>
</head>
<style>
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px; }
tr:nth-child(even){background-color: #f2f2f2}
th { background-color: #562399; color: white; }
</style>
<body>
<header>
</header>
<section>
</section>
<script type="text/javascript">
function showHeader() {
let para = document.createElement('p');
para.textContent = `URL: ${document.URL}`;
header.appendChild(para);
let label = document.createElement('h2');
label.textContent = 'Variable Server Connections';
header.appendChild(label);
}
function showVSConnections(myObj) {
let mytable = document.createElement('table');
let trow = document.createElement('tr');
let table_headings = ['Name', 'Address', 'Port', 'Format', 'Rate'];
for (let i = 0; i < table_headings.length ; i++) {
let th = document.createElement('th');
th.textContent = table_headings[i];
trow.appendChild(th);
}
mytable.appendChild(trow);
for (let i = 0; i < myObj.variable_server_connections.length; i++) {
let trow = document.createElement('tr');
let td1 = document.createElement('td');
td1.textContent = myObj.variable_server_connections[i].connection.client_tag;
let td2 = document.createElement('td');
td2.textContent = myObj.variable_server_connections[i].connection.client_IP_address;
let td3 = document.createElement('td');
td3.textContent = myObj.variable_server_connections[i].connection.client_port;
let td4 = document.createElement('td');
td4.textContent = myObj.variable_server_connections[i].connection.format;
let td5 = document.createElement('td');
td5.textContent = myObj.variable_server_connections[i].connection.update_rate;
trow.appendChild(td1);
trow.appendChild(td2);
trow.appendChild(td3);
trow.appendChild(td4);
trow.appendChild(td5);
mytable.appendChild(trow);
}
section.appendChild(mytable);
}
var header = document.querySelector('header');
var section = document.querySelector('section');
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
var myObj = JSON.parse(xhr.responseText);
showHeader();
showVSConnections(myObj);
}
}
xhr.open('GET', '/api/http/vs_connections');
xhr.send(null);
</script>
</body>
</html>