moduleList.html 6.3 KB

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