table.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <meta name="apple-mobile-web-app-capable" content="yes" />
  3. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=0.6, maximum-scale=0.6" />
  4. <html>
  5. <head>
  6. <meta charset="UTF-8">
  7. <script type='text/javascript' charset='utf-8'>
  8. // Hides mobile browser's address bar when page is done loading.
  9. window.addEventListener('load', function(e) {
  10. setTimeout(function() {
  11. window.scrollTo(0, 1);
  12. }, 1);
  13. }, false);
  14. </script>
  15. <title>ArOZ Onlineβ</title>
  16. <link rel="stylesheet" href="../../../script/tocas/tocas.css">
  17. <script src="../../../script/tocas/tocas.js"></script>
  18. <script src="../../../script/jquery.min.js"></script>
  19. <!--<script src="../../../script/ao_module.js"></script>-->
  20. </head>
  21. <body style="background-color: rgba(255, 255, 255,0.9)">
  22. <table class="ts celled striped table">
  23. <thead>
  24. <tr>
  25. <thead>
  26. <tr>
  27. <th>#</th>
  28. <th>Name</th>
  29. <th>Value</th>
  30. <th>Worst</th>
  31. <th>Raw Data</th>
  32. </tr>
  33. </thead>
  34. <tbody id="smartbody">
  35. </tbody>
  36. </table>
  37. <script>
  38. if (typeof ao_module_getAORootFromScriptPath !== "function") {
  39. $.getScript("../../../script/ao_module.js", function() {
  40. ao_module_setWindowSize(700, 500);
  41. });
  42. }
  43. $.getJSON("../../system/disk/smart/getSMARTTable?disk=" + get("disk"), function(data) {
  44. $.each(data, function(index, value) {
  45. if (value["id"] !== undefined) {
  46. var id = value["id"];
  47. } else {
  48. var id = "Unknown";
  49. }
  50. if (value["name"] !== undefined) {
  51. var name = value["name"];
  52. } else {
  53. var name = "Unknown";
  54. }
  55. if (value["value"] !== undefined) {
  56. var Svalue = value["value"];
  57. } else {
  58. var Svalue = "Unknown";
  59. }
  60. if (value["worst"] !== undefined) {
  61. var worst = value["worst"];
  62. } else {
  63. var worst = "Unknown";
  64. }
  65. if (typeof value["when_failed"] !== "undefined") {
  66. if (value["when_failed"] !== "") { //probabally FAILING_NOW, but not sure.
  67. var when_failed = "Failed";
  68. } else {
  69. var when_failed = "OK";
  70. }
  71. } else {
  72. var when_failed = "Unknown";
  73. }
  74. $("#smartbody").append('<tr><td>' + id + '</td><td>' + name + '</td><td>' + Svalue + '</td><td>' + worst + '</td><td>' + when_failed + '</td></tr>');
  75. });
  76. });
  77. //https://stackoverflow.com/questions/831030/how-to-get-get-request-parameters-in-javascript
  78. function get(name) {
  79. if (name = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)')).exec(location.search)) {
  80. return decodeURIComponent(name[1]);
  81. }
  82. }
  83. </script>
  84. </body>
  85. </html>