disk_snapshot.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Snapshot Summary</title>
  5. <meta name="mobile-web-app-capable" content="yes">
  6. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  7. <meta charset="UTF-8">
  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. <script type="text/javascript" src="../../script/ao_module.js"></script>
  12. <style>
  13. .unchaged{
  14. display:none;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <br>
  20. <div class="ui container">
  21. <h3 class="ui header">
  22. Snapshot <span id="snapshotName"></span>
  23. <div class="sub header">Snapshot Summary</div>
  24. </h3>
  25. <div class="ui divider"></div>
  26. <div id="content">
  27. <p><i class="question icon"></i> Snapshot summary is empty.</p>
  28. </div>
  29. <div id="summary" style="display:none;">
  30. <div class="ui checkbox">
  31. <input type="checkbox" onchange="toggleUnchageFileVisibility(this.checked);">
  32. <label>Show Unchanged Files</label>
  33. </div>
  34. <table class="ui striped celled green table">
  35. <thead>
  36. <tr>
  37. <th>#</th>
  38. <th>Relative Path</th>
  39. <th>Link To Snapshot</th>
  40. </tr>
  41. </thead>
  42. <tbody id="filelist">
  43. </tbody>
  44. </table>
  45. </div>
  46. <br>
  47. <button class="ui right floated button" onclick="ao_module_close();">Close</button>
  48. <br>
  49. </div>
  50. <br><br>
  51. <script>
  52. //Get window hash data and start the request
  53. if (window.location.hash.length > 1){
  54. var snapshotInfo = window.location.hash.substr(1);
  55. snapshotInfo = JSON.parse(decodeURIComponent(snapshotInfo));
  56. $("#snapshotName").text(snapshotInfo.SnapshotName);
  57. getSnapshotSummary(snapshotInfo.SnapshotDisk, snapshotInfo.SnapshotName);
  58. }else{
  59. //Invalid usage
  60. }
  61. function getSnapshotSummary(diskID, name){
  62. $.ajax({
  63. url: "../../system/backup/snapshotSummary",
  64. data: {bdid: diskID, snapshot: name},
  65. success: function(data){
  66. if (data.error !== undefined){
  67. $("#content").html(` <div class="ui red inverted segment">
  68. <h5><i class="remove icon"></i> ${data.error}</h5>
  69. </div>`);
  70. }else{
  71. console.log(data);
  72. $("#summary").show();
  73. $("#content").hide();
  74. $("#filelist").html("");
  75. var totalChangeCount = 0;
  76. for (let relpath in data.ChangedFiles){
  77. $("#filelist").append(`<tr class="positive changed">
  78. <td><i class="add icon"></i></td>
  79. <td>${relpath}</td>
  80. <td>${data.ChangedFiles[relpath]}</td>
  81. </tr>`);
  82. totalChangeCount++;
  83. }
  84. for (let relpath in data.DeletedFiles){
  85. $("#filelist").append(`<tr class="negative">
  86. <td><i class="minus icon"></i></td>
  87. <td>${relpath}</td>
  88. <td>${data.DeletedFiles[relpath]}</td>
  89. </tr>`);
  90. totalChangeCount++;
  91. }
  92. if (totalChangeCount == 0){
  93. $("#filelist").append(`<tr class="">
  94. <td><i class="clock outline icon"></i></td>
  95. <td>No Changed / Deleted File in this snapshot</td>
  96. <td></td>
  97. </tr>`);
  98. }
  99. for (let relpath in data.UnchangedFiles){
  100. $("#filelist").append(`<tr class="unchaged">
  101. <td></td>
  102. <td>${relpath}</td>
  103. <td>${data.UnchangedFiles[relpath]}</td>
  104. </tr>`);
  105. }
  106. }
  107. }
  108. });
  109. }
  110. $(".ui.checkbox").checkbox();
  111. function toggleUnchageFileVisibility(showUnchanged){
  112. if (showUnchanged){
  113. $(".unchaged").show();
  114. }else{
  115. $(".unchaged").hide();
  116. }
  117. }
  118. </script>
  119. </body>
  120. </html>