index.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <!DOCTYPE html>
  2. <html ng-app="App">
  3. <head>
  4. <title>System Info</title>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
  7. <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
  8. <script type="text/javascript" src="../../script/jquery.min.js"></script>
  9. <script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
  10. </head>
  11. <body>
  12. <div class="ui vertical masthead left aligned segment">
  13. <div class="ui container">
  14. <div>
  15. <h1 id="modelname"></h1>
  16. </div>
  17. <div>
  18. <div style="display:inline-block;" id="build"></div>
  19. <div style="float:right !important;" id="manufacturer"></div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="ui container">
  24. <br>
  25. <h3 class="ui header">Specifications</h3>
  26. <div class="ui grid">
  27. <div class="six wide column">
  28. Model :
  29. </div>
  30. <div class="ten wide column" id="model">
  31. Loading...
  32. </div>
  33. <div class="six wide column">
  34. Frequency :
  35. </div>
  36. <div class="ten wide column" id="freq">
  37. Loading...
  38. </div>
  39. <div class="six wide column">
  40. Instruction :
  41. </div>
  42. <div class="ten wide column" id="instruction">
  43. Loading...
  44. </div>
  45. <div class="six wide column">
  46. Hardware :
  47. </div>
  48. <div class="ten wide column" id="hardware">
  49. Loading...
  50. </div>
  51. <div class="six wide column">
  52. Revision :
  53. </div>
  54. <div class="ten wide column" id="revision">
  55. Loading...
  56. </div>
  57. <div class="six wide column">
  58. Memory :
  59. </div>
  60. <div class="ten wide column" id="ram">
  61. Loading...
  62. </div>
  63. <div class="six wide column">
  64. NIC :
  65. </div>
  66. <div class="ten wide column" id="nic">
  67. Loading...
  68. </div>
  69. <div class="six wide column">
  70. Drive :
  71. </div>
  72. <div class="ten wide column" id="drive">
  73. Loading...
  74. </div>
  75. <div class="six wide column">
  76. USB :
  77. </div>
  78. <div class="ten wide column" id="usb">
  79. Loading...
  80. </div>
  81. </div>
  82. <br>
  83. <h3 class="ui header">Operation Time</h3>
  84. <div class="ui grid">
  85. <div class="six wide column">
  86. Boot Time:
  87. </div>
  88. <div class="ten wide column" id="startup">
  89. Loading...
  90. </div>
  91. <div class="six wide column">
  92. Up Time :
  93. </div>
  94. <div class="ten wide column" id="operation">
  95. Loading...
  96. </div>
  97. </div>
  98. </div>
  99. <div class="ui divider"></div>
  100. <img class="ui small image" id="icon"></img>
  101. <br>
  102. </body>
  103. <script>
  104. $(document).ready(function() {
  105. initSystemInfo();
  106. });
  107. function initSystemInfo() {
  108. $.getJSON("../../system/info/getArOZInfo?icon=true", function(data) {
  109. $("#modelname").html(data["DeviceModel"]);
  110. $("#icon").attr("src", "data:image/png;base64," + data["VendorIcon"]);
  111. $("#build").html(data["BuildVersion"]);
  112. $("#manufacturer").html(data["DeviceVendor"]);
  113. });
  114. $.getJSON("../../system/info/getCPUinfo", function(data) {
  115. $("#model").html(data["Model"]);
  116. $("#freq").html(data["Freq"] + "MHz");
  117. $("#instruction").html(data["Instruction"]);
  118. $("#hardware").html(data["Hardware"]);
  119. $("#revision").html(data["Revision"]);
  120. });
  121. $.get("../../system/info/getRAMinfo", function(data) {
  122. $("#ram").html(humanFileSize(data, false));
  123. });
  124. $.getJSON("../../system/info/ifconfig", function(data) {
  125. $("#nic").html("");
  126. $(data).each(function(index, item) {
  127. $("#nic").append(item + "<br>");
  128. });
  129. });
  130. $.getJSON("../../system/info/getDriveStat", function(data) {
  131. $("#drive").html("");
  132. $(data).each(function(index, item) {
  133. $("#drive").append(item["DriveLetter"] + " (" + item["FileSystem"] + ") " + humanFileSize(item["FreeSpace"], true) + "<br>");
  134. });
  135. });
  136. $.getJSON("../../system/info/usbPorts", function(data) {
  137. $("#usb").html("");
  138. $(data).each(function(index, item) {
  139. $("#usb").append(item + "<br>");
  140. });
  141. });
  142. $.getJSON("../../system/info/getRuntimeInfo", function(data){
  143. $("#startup").text(ao_module_utils.timeConverter(data.StartupTime));
  144. $("#operation").text(ao_module_utils.durationConverter(data.ContinuesRuntime));
  145. $("#operation").attr("startunix", data.StartupTime);
  146. accumulateOperationTime();
  147. });
  148. }
  149. function accumulateOperationTime(){
  150. setTimeout(function(){
  151. if ($("#operation").length > 0){
  152. var startUnix = $("#operation").attr("startunix");
  153. startUnix = parseInt(startUnix);
  154. var newOprTime = parseInt(Date.now()/1000) - startUnix
  155. $("#operation").text(ao_module_utils.durationConverter(newOprTime));
  156. accumulateOperationTime();
  157. }
  158. }, 1000);
  159. }
  160. //https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string/10420404
  161. function humanFileSize(bytes, si) {
  162. var thresh = si ? 1000 : 1024;
  163. if (Math.abs(bytes) < thresh) {
  164. return bytes + ' B';
  165. }
  166. var units = si ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
  167. var u = -1;
  168. do {
  169. bytes /= thresh;
  170. ++u;
  171. } while (Math.abs(bytes) >= thresh && u < units.length - 1);
  172. return bytes.toFixed(1) + ' ' + units[u];
  173. }
  174. </script>
  175. </html>