overview.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 container">
  13. <br>
  14. <div class="ui stackable grid">
  15. <div class="six wide column">
  16. <div class="ui fluid card">
  17. <div class="image">
  18. <img id="avator" src="../../SystemAO/users/img/user.svg">
  19. </div>
  20. <div class="content">
  21. <a id="username" class="header">USER</a>
  22. <div class="meta">
  23. <span id="usergroup" class="date">@usergroup</span>
  24. </div>
  25. </div>
  26. <div class="extra content">
  27. <a href="#" onclick="parent.logout();">
  28. <i class="logout icon"></i>
  29. Logout
  30. </a>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="ten wide column">
  35. <div class="ui segment">
  36. <h3 class="ui header"><i class="yellow folder icon"></i> Storage</h3>
  37. <div class="ui divider"></div>
  38. <div class="ui grid">
  39. <div class="six wide column">
  40. Used Space
  41. </div>
  42. <div class="ten wide column" id="usedStorage">
  43. Loading...
  44. </div>
  45. <div class="six wide column">
  46. Total Space
  47. </div>
  48. <div class="ten wide column" id="totalStorage">
  49. Loading...
  50. </div>
  51. </div>
  52. </div>
  53. <div class="ui segment">
  54. <h3 class="ui header"><i class="blue globe icon"></i> Personal Homepage</h3>
  55. <div class="ui divider"></div>
  56. <div class="ui grid">
  57. <div class="six wide column">
  58. Status:
  59. </div>
  60. <div class="ten wide column" id="homepageStatus">
  61. Loading...
  62. </div>
  63. </div>
  64. </div>
  65. <div class="ui segment">
  66. <h3 class="ui header"><i class="teal clock icon"></i> Operation Time</h3>
  67. <div class="ui divider"></div>
  68. <div class="ui grid">
  69. <div class="six wide column">
  70. Online Since:
  71. </div>
  72. <div class="ten wide column" id="startup">
  73. Loading...
  74. </div>
  75. <div class="six wide column">
  76. Up Time :
  77. </div>
  78. <div class="ten wide column" id="operation">
  79. Loading...
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="ui divider"></div>
  87. <div style="float: right; text-align: right; color: #9c9c9c; margin-right: 1.5em;" >
  88. <p><span id="hostname"></span><br>
  89. <span id="version"></span></p>
  90. </div>
  91. <img class="ui small image" id="icon"></img>
  92. <br>
  93. </body>
  94. <script>
  95. $(document).ready(function() {
  96. $.getJSON("../../system/info/getRuntimeInfo", function(data){
  97. $("#startup").text(ao_module_utils.timeConverter(data.StartupTime));
  98. $("#operation").text(ao_module_utils.durationConverter(data.ContinuesRuntime));
  99. $("#operation").attr("startunix", data.StartupTime);
  100. accumulateOperationTime();
  101. });
  102. initHostInfo();
  103. initUserInfo();
  104. initStorageInfo();
  105. initHomepageState();
  106. });
  107. function initHostInfo(){
  108. $.get("../../system/info/getArOZInfo?icon=true", function(data){
  109. $("#icon").attr('src', 'data:image/png;base64,' + data.VendorIcon);
  110. $("#hostname").text(data.HostName);
  111. $("#version").text(data.BuildVersion);
  112. });
  113. }
  114. function initUserInfo(){
  115. $.get("../../system/users/userinfo", function(data){
  116. $("#username").text(data.Username);
  117. $("#usergroup").text("@" + data.Usergroup.join(","));
  118. if (data.Icondata != ""){
  119. $("#avator").attr("src", data.Icondata);
  120. }
  121. });
  122. }
  123. function initStorageInfo(){
  124. $.get("../../system/disk/quota/quotaInfo", function(data){
  125. let percentageText = "0%";
  126. if (data.Total == -1){
  127. $("#totalStorage").text("Unlimited");
  128. }else if (data.Total == 0){
  129. $("#totalStorage").text("Read Only");
  130. percentageText = "100%";
  131. }else{
  132. $("#totalStorage").text(ao_module_utils.formatBytes(data.Total, 2));
  133. percentageText = parseInt((data.Used / data.Total) * 100).toFixed(2) + "%";
  134. }
  135. $("#usedStorage").text(ao_module_utils.formatBytes(data.Used, 2) + ` ( ${percentageText} )`);
  136. });
  137. }
  138. function initHomepageState(){
  139. $.get("../../system/network/www/toggle", function(data){
  140. if (data == true){
  141. $("#homepageStatus").html(`<h5><i class="green circle icon"></i> Online</h5>`);
  142. }else{
  143. $("#homepageStatus").html(`<h5><i class="red circle icon"></i> Offline</h5>`);
  144. }
  145. });
  146. }
  147. function accumulateOperationTime(){
  148. setTimeout(function(){
  149. if ($("#operation").length > 0){
  150. var startUnix = $("#operation").attr("startunix");
  151. startUnix = parseInt(startUnix);
  152. var newOprTime = parseInt(Date.now()/1000) - startUnix
  153. $("#operation").text(ao_module_utils.durationConverter(newOprTime));
  154. accumulateOperationTime();
  155. }
  156. }, 1000);
  157. }
  158. //https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string/10420404
  159. function humanFileSize(bytes, si) {
  160. var thresh = si ? 1000 : 1024;
  161. if (Math.abs(bytes) < thresh) {
  162. return bytes + ' B';
  163. }
  164. var units = si ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
  165. var u = -1;
  166. do {
  167. bytes /= thresh;
  168. ++u;
  169. } while (Math.abs(bytes) >= thresh && u < units.length - 1);
  170. return bytes.toFixed(1) + ' ' + units[u];
  171. }
  172. </script>
  173. </html>