overview.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="icon" href="favicon.ico" type="image/x-icon">
  5. <title>Overview</title>
  6. <meta charset="utf-8">
  7. <style>
  8. .tg {border-collapse:collapse;border-spacing:0;width:100%;color: darkslategray;border: inset;height:585px;}
  9. .tg td{font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
  10. .tg th{height: 50px;font-size:24px;font-weight:bold;text-align:left;padding:0px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;background-color:#f0f0f0}
  11. .tg .tg-1{width:77%;font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
  12. .tg .tg-2{font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
  13. .tg .tg-3{height: 15px;font-size:14px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
  14. </style>
  15. </head>
  16. <body style="font-family: arial">
  17. <table class="tg">
  18. <tr>
  19. <td class="tg-1" rowspan="9" style="vertical-align: top"><div id="img"></div></td>
  20. <th class="th">Value:</th>
  21. </tr>
  22. <tr>
  23. <td class="tg-2">
  24. <div id="value"></div>
  25. </td>
  26. </tr>
  27. <tr>
  28. <th class="th">Previous Value:</th>
  29. </tr>
  30. <tr>
  31. <td class="tg-2">
  32. <div id="prevalue"></div>
  33. </td>
  34. </tr>
  35. <tr>
  36. <th class="th">Raw Value:</th>
  37. </tr>
  38. <tr>
  39. <td class="tg-2">
  40. <div id="raw"></div>
  41. </td>
  42. </tr>
  43. <tr>
  44. <th class="th">Status:</th>
  45. </tr>
  46. <tr>
  47. <td class="tg-2">
  48. <div id="error"></div>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="tg-3">
  53. <div id="timestamp" ></div>
  54. <div id="statusflow" ></div>
  55. <div id="cputemp" ></div>
  56. <div id="rssi" ></div>
  57. <div id="uptime" ></div>
  58. </td>
  59. </tr>
  60. </table>
  61. <script src="/jquery-3.6.0.min.js"></script>
  62. <script type="text/javascript" src="./gethost.js"></script>
  63. <script type="text/javascript" src="./readconfigcommon.js"></script>
  64. <script type="text/javascript">
  65. function addZero(i) {
  66. if (i < 10) {
  67. i = "0" + i;
  68. }
  69. return i;
  70. }
  71. $(document).ready(function() {
  72. var d = new Date();
  73. var h = addZero(d.getHours());
  74. var m = addZero(d.getMinutes());
  75. var s = addZero(d.getSeconds());
  76. $('#img').html('<img src="/img_tmp/alg_roi.jpg" style="max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
  77. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  78. loadStatus();
  79. loadCPUTemp();
  80. loadRSSI();
  81. loadUptime();
  82. refresh();
  83. });
  84. function refresh() {
  85. setTimeout (function() {
  86. var time = new Date();
  87. var timestamp = new Date().getTime();
  88. var d = new Date();
  89. var h = addZero(d.getHours());
  90. var m = addZero(d.getMinutes());
  91. var s = addZero(d.getSeconds());
  92. // reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp
  93. $('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'"max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
  94. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  95. init();
  96. refresh();
  97. }, 300000);
  98. }
  99. var basepath = "http://192.168.178.22";
  100. function loadStatus() {
  101. url = basepath + '/statusflow';
  102. var xhttp = new XMLHttpRequest();
  103. xhttp.onreadystatechange = function() {
  104. if (this.readyState == 4 && this.status == 200) {
  105. var _rsp = xhttp.responseText;
  106. _rsp = "Status: " + _rsp;
  107. $('#statusflow').html("Status: " + _rsp);
  108. }
  109. }
  110. xhttp.open("GET", url, true);
  111. xhttp.send();
  112. }
  113. function loadCPUTemp() {
  114. url = basepath + '/cpu_temperature';
  115. var xhttp = new XMLHttpRequest();
  116. xhttp.onreadystatechange = function() {
  117. if (this.readyState == 4 && this.status == 200) {
  118. var _rsp = xhttp.responseText;
  119. $('#cputemp').html("CPU Temperature: " +_rsp);
  120. }
  121. }
  122. xhttp.open("GET", url, true);
  123. xhttp.send();
  124. }
  125. function loadRSSI() {
  126. url = basepath + '/rssi';
  127. var xhttp = new XMLHttpRequest();
  128. xhttp.onreadystatechange = function() {
  129. if (this.readyState == 4 && this.status == 200) {
  130. var _rsp = xhttp.responseText;
  131. $('#rssi').html("RSSI: " + _rsp);
  132. }
  133. }
  134. xhttp.open("GET", url, true);
  135. xhttp.send();
  136. }
  137. function loadUptime() {
  138. url = basepath + '/uptime';
  139. var xhttp = new XMLHttpRequest();
  140. xhttp.onreadystatechange = function() {
  141. if (this.readyState == 4 && this.status == 200) {
  142. var _rsp = xhttp.responseText;
  143. $('#uptime').html("Uptime: " + _rsp);
  144. }
  145. }
  146. xhttp.open("GET", url, true);
  147. xhttp.send();
  148. }
  149. function loadValue(_type, _div, _style) {
  150. url = basepath + '/value?all=true&type=' + _type;
  151. var xhttp = new XMLHttpRequest();
  152. xhttp.onreadystatechange = function() {
  153. if (this.readyState == 4 && this.status == 200) {
  154. var _rsp = xhttp.responseText;
  155. var _split = _rsp.split("\r");
  156. if (typeof _style == undefined)
  157. out = "<table>";
  158. else
  159. out = "<table style=\"" + _style + "\">";
  160. if (_split.length == 1)
  161. {
  162. var _zer = ZerlegeZeile(_split[0], "\t")
  163. if (_zer.length > 1)
  164. out = _zer[1];
  165. else
  166. out = "";
  167. }
  168. else
  169. {
  170. for (var j = 0; j < _split.length; ++j)
  171. {
  172. var _zer = ZerlegeZeile(_split[j], "\t")
  173. if (_zer.length == 1)
  174. out = out + "<tr><td>" + _zer[0] + "</td><td> </td></tr>";
  175. else
  176. out = out + "<tr><td>" + _zer[0] + "</td><td>" + _zer[1] + "</td></tr>";
  177. }
  178. out = out + "</table>"
  179. }
  180. document.getElementById(_div).innerHTML = out;
  181. }
  182. };
  183. xhttp.open("GET", url, true);
  184. xhttp.send();
  185. }
  186. function init(){
  187. basepath = getbasepath();
  188. loadValue("value", "value");
  189. loadValue("raw", "raw");
  190. loadValue("prevalue", "prevalue");
  191. loadValue("error", "error", "font-size:8px");
  192. loadStatus();
  193. loadCPUTemp();
  194. loadRSSI();
  195. loadUptime();
  196. }
  197. init();
  198. </script>
  199. </body>
  200. </html>