overview.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="icon" href="favicon.ico?v=$COMMIT_HASH" 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:700px;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="statusflow" ></div>
  54. <div id="timestamp" ></div>
  55. <div id="cputemp" ></div>
  56. <div id="rssi" ></div>
  57. <div>
  58. <span id="uptime" ></span>
  59. <span id="round" ></span>
  60. </div>
  61. </td>
  62. </tr>
  63. </table>
  64. <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
  65. <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
  66. <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
  67. <script type="text/javascript">
  68. function addZero(i) {
  69. if (i < 10) {
  70. i = "0" + i;
  71. }
  72. return i;
  73. }
  74. $(document).ready(function() {
  75. LoadData();
  76. LoadROIImage();
  77. });
  78. function LoadData(){
  79. loadValue("value", "value");
  80. loadValue("raw", "raw");
  81. loadValue("prevalue", "prevalue");
  82. loadValue("error", "error", "font-size:8px");
  83. loadStatus();
  84. loadCPUTemp();
  85. loadRSSI();
  86. loadUptime();
  87. loadRoundCounter();
  88. }
  89. function LoadROIImage(){
  90. var d = new Date();
  91. var timestamp = d.getTime();
  92. var h = addZero(d.getHours());
  93. var m = addZero(d.getMinutes());
  94. var s = addZero(d.getSeconds());
  95. $('#img').html('<img src=' + getDomainname() + '/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'" max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
  96. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  97. }
  98. function Refresh() {
  99. setTimeout (function() {
  100. LoadData();
  101. LoadROIImage();
  102. Refresh();
  103. }, 300000);
  104. }
  105. function loadStatus() {
  106. url = domainname + '/statusflow';
  107. var xhttp = new XMLHttpRequest();
  108. xhttp.onreadystatechange = function() {
  109. if (this.readyState == 4 && this.status == 200) {
  110. var _rsp = xhttp.responseText;
  111. $('#statusflow').html("State: " + _rsp);
  112. }
  113. }
  114. xhttp.open("GET", url, true);
  115. xhttp.send();
  116. }
  117. function loadCPUTemp() {
  118. url = domainname + '/cpu_temperature';
  119. var xhttp = new XMLHttpRequest();
  120. xhttp.onreadystatechange = function() {
  121. if (this.readyState == 4 && this.status == 200) {
  122. var _rsp = xhttp.responseText;
  123. $('#cputemp').html("CPU Temperature: " +_rsp + "°C");
  124. }
  125. }
  126. xhttp.open("GET", url, true);
  127. xhttp.send();
  128. }
  129. function loadRSSI() {
  130. url = domainname + '/rssi';
  131. var xhttp = new XMLHttpRequest();
  132. xhttp.onreadystatechange = function() {
  133. if (this.readyState == 4 && this.status == 200) {
  134. var _rsp = xhttp.responseText;
  135. if (_rsp >= -55) {
  136. $('#rssi').html("WIFI Signal: Excellent (" + _rsp + "dBm)");
  137. }
  138. else if (_rsp < -55 && _rsp >= -67) {
  139. $('#rssi').html("WIFI Signal: Good (" + _rsp + "dBm)");
  140. }
  141. else if (_rsp < -67 && _rsp >= -78) {
  142. $('#rssi').html("WIFI Signal: Fair (" + _rsp + "dBm)");
  143. }
  144. else if (_rsp < -78 && _rsp >= -85) {
  145. $('#rssi').html("WIFI Signal: Weak (" + _rsp + "dBm)");
  146. }
  147. else {
  148. $('#rssi').html("WIFI Signal: Unreliable (" + _rsp + "dBm)");
  149. }
  150. }
  151. }
  152. xhttp.open("GET", url, true);
  153. xhttp.send();
  154. }
  155. function loadUptime() {
  156. url = domainname + '/uptime';
  157. var xhttp = new XMLHttpRequest();
  158. xhttp.onreadystatechange = function() {
  159. if (this.readyState == 4 && this.status == 200) {
  160. var _rsp = xhttp.responseText;
  161. $('#uptime').html("Uptime: " + _rsp);
  162. }
  163. }
  164. xhttp.open("GET", url, true);
  165. xhttp.send();
  166. }
  167. function loadRoundCounter() {
  168. url = domainname + '/info?type=Round';
  169. var xhttp = new XMLHttpRequest();
  170. xhttp.onreadystatechange = function() {
  171. if (this.readyState == 4 && this.status == 200) {
  172. var _rsp = xhttp.responseText;
  173. $('#round').html("(Round: " + _rsp + ")");
  174. }
  175. }
  176. xhttp.open("GET", url, true);
  177. xhttp.send();
  178. }
  179. function loadValue(_type, _div, _style) {
  180. url = domainname + '/value?all=true&type=' + _type;
  181. var xhttp = new XMLHttpRequest();
  182. xhttp.onreadystatechange = function() {
  183. if (this.readyState == 4 && this.status == 200) {
  184. var _rsp = xhttp.responseText;
  185. var _split = _rsp.split("\r");
  186. if (typeof _style == undefined)
  187. out = "<table>";
  188. else
  189. out = "<table style=\"" + _style + "\">";
  190. if (_split.length == 1)
  191. {
  192. var _zer = ZerlegeZeile(_split[0], "\t")
  193. if (_zer.length > 1)
  194. out = _zer[1];
  195. else
  196. out = "";
  197. }
  198. else
  199. {
  200. for (var j = 0; j < _split.length; ++j)
  201. {
  202. var _zer = ZerlegeZeile(_split[j], "\t")
  203. if (_zer.length == 1)
  204. out = out + "<tr><td>" + _zer[0] + "</td><td> </td></tr>";
  205. else
  206. out = out + "<tr><td>" + _zer[0] + "</td><td>" + _zer[1] + "</td></tr>";
  207. }
  208. out = out + "</table>"
  209. }
  210. document.getElementById(_div).innerHTML = out;
  211. }
  212. };
  213. xhttp.open("GET", url, true);
  214. xhttp.send();
  215. }
  216. function init(){
  217. domainname = getDomainname();
  218. Refresh();
  219. }
  220. init();
  221. </script>
  222. </body>
  223. </html>