index.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!DOCTYPE html>
  2. <html lang="en" xml:lang="en">
  3. <head>
  4. <link rel="icon" href="favicon.ico?v=$COMMIT_HASH" type="image/x-icon">
  5. <title>AI on the edge</title>
  6. <meta charset="UTF-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1">
  8. <link rel="stylesheet" href="style.css?v=$COMMIT_HASH" type="text/css" >
  9. <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
  10. <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
  11. <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
  12. <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
  13. <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
  14. <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
  15. <script>
  16. var streamPopup;
  17. var streamFlashlight = false;
  18. var streamWindowFeatures =
  19. 'channelmode=no,directories=no,fullscreen=no,' +
  20. 'location=no,dependent=yes,menubar=no,resizable=no,scrollbars=no,' +
  21. 'status=no,toolbar=no,titlebar=no,' +
  22. 'left=10,top=250,width=640px,height=480px';
  23. async function loadPage(page) {
  24. if (streamPopup) // Ensure that stream popup is closed because it's blocking web interface
  25. streamPopup.close();
  26. console.log("loadPage(" + page + ")");
  27. document.cookie = "page="+page + "; path=/";
  28. document.getElementById('maincontent').src = page;
  29. [].forEach.call(document.querySelectorAll('.submenu'), function (el) {
  30. el.style.visibility = 'hidden';
  31. });
  32. }
  33. function resetMenu() {
  34. [].forEach.call(document.querySelectorAll('.submenu'), function (el) {
  35. el.style.visibility = 'visible';
  36. });
  37. }
  38. function getCookie(cname) {
  39. let name = cname + "=";
  40. let decodedCookie = decodeURIComponent(document.cookie);
  41. let ca = decodedCookie.split(';');
  42. for(let i = 0; i <ca.length; i++) {
  43. let c = ca[i];
  44. while (c.charAt(0) == ' ') {
  45. c = c.substring(1);
  46. }
  47. if (c.indexOf(name) == 0) {
  48. return c.substring(name.length, c.length);
  49. }
  50. }
  51. return "";
  52. }
  53. </script>
  54. </head>
  55. <body>
  56. <div class="main">
  57. <table style="border: none; width:100%">
  58. <tr>
  59. <td style="padding-right: 10px;"><img style="width:64px; height:64px" src="favicon.ico?v=$COMMIT_HASH"></td>
  60. <td><h1 id="id_title"> Digitizer - AI on the edge</h1>
  61. <h2>An ESP32 all inclusive neural network recognition system for meter digitalization</h2>
  62. </td>
  63. </tr>
  64. </table>
  65. <div class="menu" onmouseover="resetMenu()">
  66. <ul>
  67. <li><a href="#" onclick="loadPage('overview.html?v=$COMMIT_HASH');">Overview</a></li>
  68. <li><a>Settings <i class="arrow down"></i></a>
  69. <ul class="submenu">
  70. <li><a href="#" onclick="loadPage('prevalue_set.html?v=$COMMIT_HASH');">Set "Previous Value"</a></li>
  71. <li><a href="#" onclick="loadPage('edit_config_param.html?v=$COMMIT_HASH');">Configuration</a></li>
  72. <li><a>Alignment <i class="arrow right"></i></a>
  73. <ul>
  74. <li><a href="#" onclick="loadPage('edit_reference.html?v=$COMMIT_HASH');">Reference Image</a></li>
  75. <li><a href="#" onclick="loadPage('edit_alignment.html?v=$COMMIT_HASH');">Alignment Marker</a></li>
  76. </ul>
  77. </li>
  78. <li><a><strong>R</strong>egions <strong>O</strong>f <strong>I</strong>nterest <i class="arrow right"></i></a>
  79. <ul>
  80. <li><a href="#" onclick="loadPage('edit_digits.html?v=$COMMIT_HASH');">Digit ROI</a></li>
  81. <li><a href="#" onclick="loadPage('edit_analog.html?v=$COMMIT_HASH');">Analog ROI</a></li>
  82. </ul>
  83. </li>
  84. </ul>
  85. <li><a>Data<i class="arrow down"></i></a>
  86. <ul class="submenu">
  87. <li><a href="#" onclick="loadPage(getDomainname() + '/value?full');">Recognition</a></li>
  88. <li><a href="#" onclick="loadPage('graph.html?v=$COMMIT_HASH');">Data Graph</a></li>
  89. <li><a href="#" onclick="loadPage('data.html?v=$COMMIT_HASH');">Data Viewer</a></li>
  90. <li><a href="#" onclick="loadPage(getDomainname() + '/fileserver/log/data/');">Data Files</a></li>
  91. </ul>
  92. </li>
  93. <li><a>System <i class="arrow down"></i></a>
  94. <ul class="submenu">
  95. <li><a href="#" onclick="loadPage('backup.html?v=$COMMIT_HASH');">Backup/Restore</a></li>
  96. <li><a href="#" onclick="loadPage('ota_page.html?v=$COMMIT_HASH');">OTA Update</a></li>
  97. <li><a href="#" onclick="loadPage('log.html?v=$COMMIT_HASH');">Log Viewer</a></li>
  98. <li><a href="#" onclick="loadPage(getDomainname() + '/fileserver/');">File Server</a></li>
  99. <li><a>Livestream <i class="arrow right"></i></a>
  100. <ul>
  101. <li><a href="#" onclick="start_livestream(false);">Live Stream (Light off)</a></li>
  102. <li><a href="#" onclick="start_livestream(true);">Live Stream (Light on)</a></li>
  103. </ul>
  104. <li><a href="#" onclick="loadPage('reboot_page.html?v=$COMMIT_HASH');">Reboot</a></li>
  105. <li><a href="#" onclick="loadPage('info.html?v=$COMMIT_HASH');">Info</a></li>
  106. </ul>
  107. </li>
  108. <li><a>Manual Control <i class="arrow down"></i></a>
  109. <ul class="submenu">
  110. <li><a href="#" onclick="flow_start()">Start Round</a></li>
  111. <li id="HASendDiscovery" style="display:none;"><a href="#" onclick="HA_send_discovery()">Resend HA Discovery</a></li>
  112. </ul>
  113. </li>
  114. </ul>
  115. </div>
  116. <iframe title="maincontent" name="maincontent" class="iframe" id="maincontent"></iframe>
  117. <span id="Version" style="font-size: 10px; margin-top: -5px;padding-left: 10px;">Loading version...</span>
  118. <script type="text/javascript">
  119. LoadHostname();
  120. LoadFwVersion();
  121. LoadWebUiVersion();
  122. HA_send_discovery_visiblilty();
  123. if (getCookie("page") == "" || getCookie("page") == "reboot_page.html?v=$COMMIT_HASH") {
  124. document.cookie = "page=overview.html?v=$COMMIT_HASH" + "; path=/";
  125. }
  126. console.log("Loading page: " + getCookie("page"));
  127. document.getElementById('maincontent').src = getCookie("page");
  128. function flow_start() {
  129. var url = getDomainname() + '/flow_start';
  130. var xhttp = new XMLHttpRequest();
  131. xhttp.onreadystatechange = function() {
  132. if (this.readyState == 4 && this.status == 200) {
  133. if (xhttp.responseText.substring(0,3) == "001") {
  134. firework.launch('Flow start triggered', 'success', 5000);
  135. window.location.reload();
  136. }
  137. else if (xhttp.responseText.substring(0,3) == "002") {
  138. firework.launch('Flow start scheduled. Start after round is completed', 'success', 5000);
  139. }
  140. else if (xhttp.responseText.substring(0,3) == "099") {
  141. firework.launch('Flow start triggered, but start not possible (no flow task available)', 'danger', 5000);
  142. }
  143. }
  144. }
  145. xhttp.open("GET", url, true);
  146. xhttp.send();
  147. }
  148. function HA_send_discovery_visiblilty() {
  149. loadConfig(domainname);
  150. ParseConfig();
  151. category = getConfigCategory();
  152. param = getConfigParameters();
  153. if (category["MQTT"]["enabled"] && param["MQTT"]["HomeassistantDiscovery"]["value1"] == "true")
  154. document.getElementById("HASendDiscovery").style.display="";
  155. }
  156. function HA_send_discovery() {
  157. var url = getDomainname() + '/mqtt_publish_discovery';
  158. var xhttp = new XMLHttpRequest();
  159. xhttp.onreadystatechange = function() {
  160. if (this.readyState == 4 && this.status == 200) {
  161. firework.launch('Sending HA discovery topics scheduled. The sending will be processed in state "Publish to MQTT"', 'success', 5000);
  162. }
  163. }
  164. xhttp.open("GET", url, true);
  165. xhttp.send();
  166. }
  167. function start_livestream(streamFlashlight) {
  168. if (streamPopup)
  169. streamPopup.close();
  170. if (streamFlashlight)
  171. streamPopup = window.open(getDomainname() + '/stream?flashlight=true','LivestreamWithlight',streamWindowFeatures);
  172. else
  173. streamPopup = window.open(getDomainname() + '/stream','Livestream',streamWindowFeatures);
  174. streamPopup.focus();
  175. }
  176. </script>
  177. </body>
  178. </html>