backups.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="mobile-web-app-capable" content="yes">
  5. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  6. <meta charset="UTF-8">
  7. <title>Backup Disk</title>
  8. <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
  9. <script src="../../script/jquery.min.js"></script>
  10. <script src="../../script/semantic/semantic.min.js"></script>
  11. <style>
  12. .hidden{
  13. display:none;
  14. }
  15. .disabled{
  16. opacity: 0.5;
  17. pointer-events: none;
  18. }
  19. td.green{
  20. color: #5cad8b;
  21. }
  22. td.red{
  23. color: #ff5c59;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class="ui container">
  29. <div class="ui basic segment">
  30. <h3 class="ui header">
  31. Backup Disk
  32. <div class="sub header">Virtual Roots managed by Hybrid Backup Manager</div>
  33. </h3>
  34. </div>
  35. <table class="ui celled table">
  36. <thead>
  37. <tr><th>Backup Disk (UUID)</th>
  38. <th>Source Disk (UUID)</th>
  39. <th>Mode</th>
  40. <th>Last Cycle Time</th>
  41. <th>Cycle Counter*</th>
  42. <th>Status</th>
  43. <th>Action</th>
  44. </tr></thead>
  45. <tbody id="diskTable">
  46. </tbody>
  47. </table>
  48. <small>*Cycle counter is not equal to the number of times the backup has executed. It is a reference number for developer only.</small>
  49. <div class="ui divider"></div>
  50. <button class="ui tiny right floated green button" onclick="initBackupDiskList();"><i class="refresh icon"></i> Refresh List</button>
  51. <button class="ui tiny basic button" onclick="toggleModeInfo();"><i class="question icon"></i> Know more about backup modes</button>
  52. <div class="ui message" id="modeInfo" style="display:none;">
  53. <div class="header">
  54. <i class="refresh icon"></i> Backup & Restore Modes
  55. </div>
  56. <p>There are 3 backup Modes under the ArozOS Hybrid Backup Manager. </p>
  57. <ul class="list">
  58. <li>Basic (Recommended)
  59. <ul class="list">
  60. <li>Backup newly created files within 5 minutes</li>
  61. <li>Deleted files will be kept 24 hours before it is deleted from backup storage</li>
  62. <li><i class="green checkmark icon"></i> Changes are backed up in near real time</li>
  63. <li><i class="green checkmark icon"></i> Suitable for recovering accidentally deleted files from other access methods (e.g. Samba delete)</li>
  64. <li><i class="red remove icon"></i> Only for disk with small number of files</li>
  65. <li><i class="red remove icon"></i> Frequent READ operations on disk (Recommended for SSD / SD cards only)</li>
  66. </ul>
  67. </li>
  68. <li>Nightly
  69. <ul class="list">
  70. <li>Backup newly created files every 24 hours</li>
  71. <li>Deleted files will be kept 24 - 48 hours before it is deleted from backup storage</li>
  72. <li><i class="green checkmark icon"></i> Allowing user to restore selected file vs (snapshot) restore the whole virtual root folder</li>
  73. <li><i class="green checkmark icon"></i> Suitable for recovering accidentally deleted files from other access methods (e.g. Samba delete)</li>
  74. <li><i class="red remove icon"></i> Changes might take 24 hours to back up</li>
  75. </ul>
  76. </li>
  77. <li>Version (Experimental)
  78. <ul class="list">
  79. <li>Snapshot based backup method</li>
  80. <li>All file changes are kept on disk</li>
  81. <li><i class="green checkmark icon"></i> Allowing user to restore to a specific snapshot</li>
  82. <li><i class="green checkmark icon"></i> Newly created files will be kept, files exists in snapshot will be restored / overwritten</li>
  83. <li><i class="red remove icon"></i> Require a lot of storage space</li>
  84. <li><i class="red remove icon"></i> Computational and IO access heavy, might not suitable for ARM SBCs.</li>
  85. </ul>
  86. </li>
  87. </ul>
  88. </div>
  89. </div>
  90. <script>
  91. function toggleModeInfo(){
  92. $("#modeInfo").slideToggle('fast');
  93. }
  94. initBackupDiskList();
  95. function initBackupDiskList(){
  96. $("#diskTable").html(``);
  97. $.get(`../../system/backup/listAll`, function(data){
  98. if (data.error !== undefined){
  99. alert(data.error);
  100. }else{
  101. //Render the list
  102. data.forEach(disk => {
  103. var statusText = `<i class="checkmark icon"></i> Normal`;
  104. var statusColor = "green";
  105. if (disk.Error == true){
  106. //Task execution error.
  107. statusText = `<i class="exclamation triangle icon"></i> Stopped <br> ` + disk.ErrorMessage;
  108. statusColor = "red";
  109. }
  110. $("#diskTable").append(`<tr>
  111. <td data-label=""><img class="ui avatar image" style="border-radius: 0px;" src="../../img/system/drive-backup.svg"> ${disk.DiskName} (${disk.DiskUID}:/)</td>
  112. <td data-label=""><img class="ui avatar image" style="border-radius: 0px;" src="../../img/system/drive-virtual.svg"> ${disk.ParentName} (${disk.ParentUID}:/)</td>
  113. <td data-label="">${disk.BackupMode}</td>
  114. <td data-label="">${ao_module_utils.timeConverter(disk.LastBackupCycleTime)}</td>
  115. <td data-label="">${disk.BackupCycleCount}</td>
  116. <td class="${statusColor}" data-label="">${statusText}</td>
  117. <td data-label=""><button class="ui teal tiny button" onclick="openRestore('${disk.ParentUID}');">Restore Settings</button></td>
  118. </tr> `);
  119. });
  120. if (data.length == 0){
  121. $('#diskTable').append(`<tr>
  122. <td data-label=""col="5"><i class="red remove icon"></i> No backup disk found on this system</td>
  123. </tr> `);
  124. }
  125. }
  126. });
  127. }
  128. function openRestore(diskUUID){
  129. var rootname = [diskUUID + ":/"];
  130. console.log(rootname);
  131. var hashPassthrough = encodeURIComponent(JSON.stringify(rootname));
  132. ao_module_newfw({
  133. url: "SystemAO/disk/disk_restore.html#" + hashPassthrough,
  134. width: 410,
  135. height: 580,
  136. appicon: "img/system/backup.svg",
  137. title: "Backup & Restore",
  138. });
  139. }
  140. </script>
  141. </body>
  142. </html>