fshedit.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
  6. <script type="text/javascript" src="../../script/jquery.min.js"></script>
  7. <script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
  8. <script type="text/javascript" src="../../script/ao_module.js"></script>
  9. <title>Storage Pool Editor</title>
  10. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  11. <style>
  12. body{
  13. background-color:white;
  14. }
  15. .themebackground{
  16. background-color:#23916d !important;
  17. color:white !important;
  18. background-image: url("img/slate.png") !important;
  19. background-repeat: no-repeat !important;
  20. background-attachment: fixed !important;
  21. height:100px;
  22. border: 0px solid transparent !important;
  23. padding:24px !important;
  24. }
  25. .fshList{
  26. max-height: 300px;
  27. overflow-y: auto;
  28. }
  29. .controls{
  30. position: absolute;
  31. top: 12px;
  32. right: 12px;
  33. }
  34. a{
  35. cursor: pointer;
  36. }
  37. .false{
  38. color: #eb0909;
  39. }
  40. .true{
  41. color: #05b074;
  42. }
  43. </style>
  44. </head>
  45. <body>
  46. <div class="ui fluid attached segment themebackground" >
  47. <h24 class="ui inverted header">
  48. <i class="folder icon"></i>
  49. <div class="content">
  50. Edit File System Handler
  51. <div class="sub header">Edit the selected File System Handler (FSH)</div>
  52. </div>
  53. </h4>
  54. </div>
  55. <br>
  56. <div class="ui container">
  57. <form id="mainForm" class="ui form" action="../../system/storage/pool/edit?opr=set" method="POST">
  58. <div class="field" style="display: none;">
  59. <label>Group</label>
  60. <input type="text" name="group" id="groupfield" readonly="true">
  61. </div>
  62. <div class="field">
  63. <label>Name</label>
  64. <input type="text" name="name" placeholder="e.g. My Folder">
  65. </div>
  66. <div class="field">
  67. <label>UUID</label>
  68. <input type="text" name="uuid" placeholder="e.g. myfolder">
  69. </div>
  70. <div class="field">
  71. <label>Path</label>
  72. <input type="text" name="path" placeholder="e.g. /media/myfolder">
  73. </div>
  74. <div class="field">
  75. <label>Access Permission</label>
  76. <div id="accessfield" class="ui selection dropdown">
  77. <input type="hidden" name="access" value="readwrite">
  78. <i class="dropdown icon"></i>
  79. <div class="default text">Access Permission</div>
  80. <div class="menu">
  81. <div class="item" data-value="readonly">Read Only</div>
  82. <div class="item" data-value="readwrite">Read Write</div>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="field">
  87. <label>Storage Hierarchy</label>
  88. <div id="hierarchyfield" class="ui selection dropdown">
  89. <input type="hidden" name="hierarchy" value="user">
  90. <i class="dropdown icon"></i>
  91. <div class="default text">Storage Hierarchy</div>
  92. <div class="menu">
  93. <div class="item" data-value="user">Isolated User Folders</div>
  94. <div class="item" data-value="public">Public Access Folders</div>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="ui divider"></div>
  99. <p>Physical Disks Settings</p>
  100. <div class="field">
  101. <label>Filesystem Type</label>
  102. <div id="fstype" class="ui selection dropdown">
  103. <input type="hidden" name="filesystem" value="ntfs">
  104. <i class="dropdown icon"></i>
  105. <div class="default text">Filesystem Type</div>
  106. <div class="menu">
  107. <div class="item" data-value="ext4">EXT4</div>
  108. <div class="item" data-value="ext3">EXT3</div>
  109. <div class="item" data-value="ntfs">NTFS</div>
  110. <div class="item" data-value="vfat">VFAT</div>
  111. <div class="item" data-value="fat">FAT</div>
  112. </div>
  113. </div>
  114. </div>
  115. <div class="field">
  116. <label>Mount Device</label>
  117. <input type="text" name="mountdev" placeholder="e.g. /dev/sda1">
  118. </div>
  119. <div class="field">
  120. <label>Mount Point</label>
  121. <input type="text" name="mountpt" placeholder="e.g. /media/myfolder">
  122. </div>
  123. <div class="field">
  124. <div class="ui checkbox">
  125. <input type="checkbox" name="automount" tabindex="0" class="hidden">
  126. <label>Automount</label>
  127. </div>
  128. </div>
  129. <br>
  130. <div class="ui divider"></div>
  131. <p>Security Related (if any)</p>
  132. <div class="field">
  133. <label>Username</label>
  134. <input type="text" name="username" placeholder="">
  135. </div>
  136. <div class="field">
  137. <label>Password</label>
  138. <input type="password" name="password" placeholder="">
  139. </div>
  140. <button class="ui right floated button" onclick='handleCancel();'>Cancel</button>
  141. <button class="ui green right floated button" type="submit">Update</button>
  142. <br><br><br><br>
  143. </form>
  144. </div>
  145. <script>
  146. //Get target fsh uuid and group from hash
  147. var targetFSH = "";
  148. $(".ui.dropdown").dropdown();
  149. $(".ui.checkbox").checkbox();
  150. if (window.location.hash.length > 0){
  151. var input = JSON.parse(decodeURIComponent(window.location.hash.substr(1)));
  152. $("#groupfield").val(input.group);
  153. //Request server side to provide info on this FSH
  154. $.ajax({
  155. url: "../../system/storage/pool/edit",
  156. method: "GET",
  157. data: {opr: "get", uuid: input.uuid, group: input.group},
  158. success: function(data){
  159. renderOptionsToForm(data);
  160. }
  161. });
  162. $("#mainForm").attr("action", "../../system/storage/pool/edit?opr=set&uuid=" + input.uuid + "&group=" + input.group);
  163. }
  164. function renderOptionsToForm(option){
  165. console.log(option);
  166. $("input[name=name]").val(option.name);
  167. $("input[name=uuid]").val(option.uuid);
  168. $("input[name=path]").val(option.path);
  169. $("#accessfield").dropdown("set selected", option.access);
  170. $("#hierarchyfield").dropdown("set selected", option.hierarchy);
  171. $("#fstype").dropdown("set selected",option.filesystem);
  172. $("input[name=mountdev]").val(option.mountdev);
  173. $("input[name=mountpt]").val(option.mountpt);
  174. if (option.automount == true){
  175. $("input[name=automount]")[0].checked = true;
  176. }
  177. }
  178. function handleCancel(){
  179. ao_module_parentCallback(true);
  180. ao_module_close();
  181. }
  182. </script>
  183. </body>
  184. </html>