overview.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <!DOCTYPE html>
  2. <html lang="en" xml:lang="en">
  3. <head>
  4. <meta charset="UTF-8"/>
  5. <title>Overview</title>
  6. <style>
  7. .tg {
  8. border-collapse:collapse;
  9. border-spacing:0;
  10. width:100%;
  11. min-width:600px;
  12. height:100%;
  13. color:darkslategray;
  14. }
  15. .tg th{
  16. min-width:325px;
  17. width:325px;
  18. height:20px;
  19. font-size:18px;
  20. text-align:left;
  21. font-weight:bold;
  22. padding:5px 10px 5px 10px;
  23. overflow:hidden;
  24. word-break:normal;
  25. background-color:lightgrey;
  26. }
  27. .tg td{
  28. font-size:15px;
  29. padding:5px 10px 5px 10px;
  30. overflow:hidden;
  31. word-break:normal;
  32. }
  33. .tg .tg-1{
  34. font-size:15px;
  35. vertical-align: top;
  36. font-family:Arial, Helvetica, sans-serif !important;
  37. }
  38. .tg .tg-2{
  39. height:52px;
  40. font-size:15px;
  41. padding:3px 0px 3px 10px;
  42. vertical-align:middle;
  43. font-family:Arial, Helvetica, sans-serif !important;
  44. }
  45. .tg .tg-3{
  46. height:45px;
  47. font-size:15px;
  48. padding:3px 10px 3px 10px;
  49. vertical-align:middle;
  50. font-family:Arial, Helvetica, sans-serif !important;
  51. }
  52. .tg .tg-4{
  53. height:fit-content;
  54. font-size:15px;
  55. padding:5px 10px 5px 10px;
  56. vertical-align:text-top;
  57. font-family:Arial, Helvetica, sans-serif !important;
  58. }
  59. </style>
  60. <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
  61. <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
  62. <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
  63. <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
  64. <script type="text/javascript">var domainname = getDomainname();</script>
  65. </head>
  66. <body style="font-family: arial">
  67. <table class="tg">
  68. <tr>
  69. <th class="th">Value</th>
  70. <td class="tg-1" rowspan="13">
  71. <img style="padding-left: 5px; padding-top: 0px; max-width:100%; width:100%; height:auto;" id="img" src="">
  72. </td>
  73. </tr>
  74. <tr>
  75. <td class="tg-2">
  76. <div id="value"></div>
  77. </td>
  78. </tr>
  79. <tr>
  80. <th class="th">Previous Value</th>
  81. </tr>
  82. <tr>
  83. <td class="tg-2">
  84. <div id="prevalue"></div>
  85. </td>
  86. </tr>
  87. <tr>
  88. <th class="th">Raw Value</th>
  89. </tr>
  90. <tr>
  91. <td class="tg-2">
  92. <div id="raw"></div>
  93. </td>
  94. </tr>
  95. <tr>
  96. <th class="th">Value Status</th>
  97. </tr>
  98. <tr>
  99. <td class="tg-2">
  100. <div id="error"></div>
  101. </td>
  102. </tr>
  103. <tr>
  104. <th class="th">Process State</th>
  105. </tr>
  106. <tr>
  107. <td class="tg-3">
  108. <div id="statusflow" ></div>
  109. </td>
  110. </tr>
  111. <tr>
  112. <th class="th">System Info</th>
  113. </tr>
  114. <tr>
  115. <td class="tg-4">
  116. <div id="sntp_date" ></div>
  117. <div id="timestamp" ></div>
  118. <div id="cputemp" ></div>
  119. <div id="rssi" ></div>
  120. <div>
  121. <span id="uptime" ></span>
  122. <span id="round" ></span>
  123. </div>
  124. </td>
  125. </tr>
  126. </table>
  127. <script type="text/javascript">
  128. function addZero(i) {
  129. if (i < 10) {
  130. i = "0" + i;
  131. }
  132. return i;
  133. }
  134. $(document).ready(function() {
  135. LoadData();
  136. LoadROIImage();
  137. });
  138. function LoadData(){
  139. loadValue("value", "value", "border-collapse: collapse; width: 100%");
  140. loadValue("raw", "raw", "border-collapse: collapse; width: 100%");
  141. loadValue("prevalue", "prevalue", "border-collapse: collapse; width: 100%");
  142. loadValue("error", "error", "border-collapse: collapse; width: 100%");
  143. loadStatus();
  144. loadSntpDate();
  145. loadCPUTemp();
  146. loadRSSI();
  147. loadUptime();
  148. loadRoundCounter();
  149. }
  150. function LoadROIImage(){
  151. var d = new Date();
  152. var timestamp = d.getTime();
  153. var h = addZero(d.getHours());
  154. var m = addZero(d.getMinutes());
  155. var s = addZero(d.getSeconds());
  156. document.getElementById("img").src = domainname + '/img_tmp/alg_roi.jpg?timestamp=' + timestamp;
  157. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  158. }
  159. function Refresh() {
  160. setTimeout (function() {
  161. LoadData();
  162. LoadROIImage();
  163. Refresh();
  164. }, 300000);
  165. }
  166. function loadStatus() {
  167. url = domainname + '/statusflow';
  168. var xhttp = new XMLHttpRequest();
  169. xhttp.onreadystatechange = function() {
  170. if (this.readyState == 4 && this.status == 200) {
  171. var _rsp = xhttp.responseText;
  172. $('#statusflow').html(_rsp);
  173. }
  174. }
  175. xhttp.open("GET", url, true);
  176. xhttp.send();
  177. }
  178. function loadCPUTemp() {
  179. url = domainname + '/cpu_temperature';
  180. var xhttp = new XMLHttpRequest();
  181. xhttp.onreadystatechange = function() {
  182. if (this.readyState == 4 && this.status == 200) {
  183. var _rsp = xhttp.responseText;
  184. $('#cputemp').html("CPU Temperature: " +_rsp + "°C");
  185. }
  186. }
  187. xhttp.open("GET", url, true);
  188. xhttp.send();
  189. }
  190. function loadRSSI() {
  191. url = domainname + '/rssi';
  192. var xhttp = new XMLHttpRequest();
  193. xhttp.onreadystatechange = function() {
  194. if (this.readyState == 4 && this.status == 200) {
  195. var _rsp = xhttp.responseText;
  196. if (_rsp >= -55) {
  197. $('#rssi').html("WIFI Signal: Excellent (" + _rsp + "dBm)");
  198. }
  199. else if (_rsp < -55 && _rsp >= -67) {
  200. $('#rssi').html("WIFI Signal: Good (" + _rsp + "dBm)");
  201. }
  202. else if (_rsp < -67 && _rsp >= -78) {
  203. $('#rssi').html("WIFI Signal: Fair (" + _rsp + "dBm)");
  204. }
  205. else if (_rsp < -78 && _rsp >= -85) {
  206. $('#rssi').html("WIFI Signal: Weak (" + _rsp + "dBm)");
  207. }
  208. else {
  209. $('#rssi').html("WIFI Signal: Unreliable (" + _rsp + "dBm)");
  210. }
  211. }
  212. }
  213. xhttp.open("GET", url, true);
  214. xhttp.send();
  215. }
  216. function loadSntpDate() {
  217. url = domainname + '/date';
  218. var xhttp = new XMLHttpRequest();
  219. xhttp.onreadystatechange = function () {
  220. if (this.readyState == 4 && this.status == 200) {
  221. var _rsp = xhttp.responseText;
  222. $('#sntp_date').html("Date/Time on device: " + _rsp);
  223. }
  224. }
  225. xhttp.open("GET", url, true);
  226. xhttp.send();
  227. }
  228. function loadUptime() {
  229. url = domainname + '/uptime';
  230. var xhttp = new XMLHttpRequest();
  231. xhttp.onreadystatechange = function() {
  232. if (this.readyState == 4 && this.status == 200) {
  233. var _rsp = xhttp.responseText;
  234. $('#uptime').html("Uptime: " + _rsp);
  235. }
  236. }
  237. xhttp.open("GET", url, true);
  238. xhttp.send();
  239. }
  240. function loadRoundCounter() {
  241. url = domainname + '/info?type=Round';
  242. var xhttp = new XMLHttpRequest();
  243. xhttp.onreadystatechange = function() {
  244. if (this.readyState == 4 && this.status == 200) {
  245. var _rsp = xhttp.responseText;
  246. $('#round').html("(Round: " + _rsp + ")");
  247. }
  248. }
  249. xhttp.open("GET", url, true);
  250. xhttp.send();
  251. }
  252. function loadValue(_type, _div, _style) {
  253. url = domainname + '/value?all=true&type=' + _type;
  254. var xhttp = new XMLHttpRequest();
  255. xhttp.onreadystatechange = function() {
  256. if (this.readyState == 4 && this.status == 200) {
  257. var _rsp = xhttp.responseText;
  258. var _split = _rsp.split("\r");
  259. if (typeof _style == undefined) {
  260. out = "<table>";
  261. }
  262. else {
  263. out = "<table style=\"" + _style + "\">";
  264. }
  265. if (_split.length == 1) {
  266. var _zer = split_line(_split[0], "\t")
  267. if (_zer.length > 1) {
  268. out = _zer[1];
  269. }
  270. else {
  271. out = "";
  272. }
  273. }
  274. else {
  275. for (var j = 0; j < _split.length; ++j) {
  276. var _zer = split_line(_split[j], "\t")
  277. if (_zer.length == 1) {
  278. out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
  279. _zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\"> </td></tr>";
  280. }
  281. else {
  282. out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
  283. _zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\" >" + _zer[1] + "</td></tr>";
  284. }
  285. }
  286. out = out + "</table>"
  287. }
  288. document.getElementById(_div).innerHTML = out;
  289. }
  290. };
  291. xhttp.open("GET", url, true);
  292. xhttp.send();
  293. }
  294. function init(){
  295. Refresh();
  296. }
  297. init();
  298. </script>
  299. </body>
  300. </html>