moduleList.html 5.5 KB

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