moduleList.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <html>
  2. <head>
  3. <title>Module List</title>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
  6. <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
  7. <script type="text/javascript" src="../../script/jquery.min.js"></script>
  8. <script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
  9. <!-- <script type="text/javascript" src="../../script/ao_module.js"></script> -->
  10. </head>
  11. <body>
  12. <div class="ui container">
  13. <div style="width: 100%; overflow-y: auto;">
  14. <table class="ui basic celled structured unstackable table">
  15. <thead>
  16. <tr>
  17. <th rowspan="2">Module</th>
  18. <th rowspan="2">Group</th>
  19. <th rowspan="2">Supported Extensions</th>
  20. <th colspan="3">Supported Mode</th>
  21. </tr>
  22. <tr>
  23. <th>Default</th>
  24. <th>FloatWindow</th>
  25. <th>Embedded</th>
  26. </tr>
  27. </thead>
  28. <tbody id="moduleList">
  29. </tbody>
  30. </table>
  31. </div>
  32. <div class="ui divider"></div>
  33. <p>If you have installed WebApps manually, you can click the "Reload WebApps" button to load it without restarting ArozOS.</p>
  34. <button id="reloadWebappButton" class="ui basic small blue button" onclick="reloadWebapps();">
  35. <i class="refresh icon"></i> Reload WebApps
  36. </button>
  37. <br><br>
  38. </div>
  39. <script>
  40. initModuleList();
  41. function reloadWebapps(){
  42. let moduleListBackup = $("#moduleList").html();
  43. $("#moduleList").html(`<tr><td colspan="6"><i class="ui loading spinner icon"></i> Reloading...</tr></td>`);
  44. $.ajax({
  45. url: "../../system/modules/reload",
  46. success: function(data){
  47. initModuleList();
  48. },
  49. error: function(){
  50. //Reload failed (Permission denied?)
  51. $("#moduleList").html(moduleListBackup);
  52. $("#reloadWebappButton").addClass("disabled").html("<i class='ui remove icon'></i> No Permission");
  53. }
  54. });
  55. }
  56. function initModuleList(){
  57. $("#moduleList").html("");
  58. $.ajax({
  59. url: "../../system/modules/list",
  60. success: function(data){
  61. console.log(data);
  62. for (var i =0; i < data.length; i++){
  63. var thisModule = data[i];
  64. var iconURL = "../../img/system/service.png";
  65. if (thisModule.IconPath !== ""){
  66. iconURL = "../../" + thisModule.IconPath;
  67. }
  68. var supportMode = ['<i class="large red remove icon"></i>', '<i class="large red remove icon"></i>', '<i class="large red remove icon"></i>'];
  69. var group = "Unknown";
  70. if (thisModule.Group != ""){
  71. group = thisModule.Group;
  72. }
  73. if (thisModule.StartDir != ""){
  74. supportMode[0] = '<i class="large green checkmark icon"></i>';
  75. }
  76. if (thisModule.SupportFW == true){
  77. supportMode[1] = '<i class="large green checkmark icon"></i>';
  78. }
  79. if (thisModule.SupportEmb == true){
  80. supportMode[2] = '<i class="large green checkmark icon"></i>';
  81. }
  82. var supportedExt = "N/A";
  83. if (thisModule.SupportedExt !== null){
  84. supportedExt = thisModule.SupportedExt.join("<br>");
  85. }
  86. $("#moduleList").append(`<tr>
  87. <td>
  88. <h4 class="ui image header" style="white-space: nowrap;">
  89. <img src="${iconURL}" class="ui mini rounded image">
  90. <div class="content">
  91. ${thisModule.Name}
  92. <div class="sub header">Version: ${thisModule.Version} </div>
  93. </div>
  94. </h4>
  95. </td>
  96. <td>
  97. ${group}
  98. </td>
  99. <td>
  100. ${supportedExt}
  101. </td>
  102. <td>
  103. ${supportMode[0]}
  104. </td>
  105. <td>
  106. ${supportMode[1]}
  107. </td>
  108. <td>
  109. ${supportMode[2]}
  110. </td>
  111. </tr>`);
  112. }
  113. }
  114. });
  115. }
  116. </script>
  117. </body>
  118. </html>