diff --git a/templates/system.html b/templates/system.html
index f306507..e351230 100644
--- a/templates/system.html
+++ b/templates/system.html
@@ -155,6 +155,7 @@
+
{% if integrity_history %}
{% endif %}
+
{% else %}
@@ -383,6 +387,101 @@
return (i === 0 ? b : b.toFixed(1)) + ' ' + units[i];
}
+ function formatTimestamp(ts) {
+ var d = new Date(ts * 1000);
+ var pad = function (n) { return n < 10 ? '0' + n : '' + n; };
+ return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) +
+ ' ' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ' UTC';
+ }
+
+ var _gcHistoryIcon = '
';
+
+ function _gcRefreshHistory() {
+ fetch('{{ url_for("ui.system_gc_history") }}?limit=10', {
+ headers: {'X-CSRFToken': csrfToken}
+ })
+ .then(function (r) { return r.json(); })
+ .then(function (hist) {
+ var container = document.getElementById('gcHistoryContainer');
+ if (!container) return;
+ var execs = hist.executions || [];
+ if (execs.length === 0) {
+ container.innerHTML = '
No executions recorded yet.
';
+ return;
+ }
+ var html = '
' +
+ _gcHistoryIcon + ' Recent Executions
' +
+ '
' +
+ '| Time | Cleaned | ' +
+ 'Freed | Mode |
';
+ execs.forEach(function (exec) {
+ var r = exec.result || {};
+ var cleaned = (r.temp_files_deleted || 0) + (r.multipart_uploads_deleted || 0) +
+ (r.lock_files_deleted || 0) + (r.orphaned_metadata_deleted || 0) +
+ (r.orphaned_versions_deleted || 0) + (r.empty_dirs_removed || 0);
+ var freed = (r.temp_bytes_freed || 0) + (r.multipart_bytes_freed || 0) +
+ (r.orphaned_version_bytes_freed || 0);
+ var mode = exec.dry_run
+ ? 'Dry run'
+ : 'Live';
+ html += '| ' + formatTimestamp(exec.timestamp) + ' | ' +
+ '' + cleaned + ' | ' +
+ '' + formatBytes(freed) + ' | ' +
+ '' + mode + ' |
';
+ });
+ html += '
';
+ container.innerHTML = html;
+ })
+ .catch(function () {});
+ }
+
+ function _integrityRefreshHistory() {
+ fetch('{{ url_for("ui.system_integrity_history") }}?limit=10', {
+ headers: {'X-CSRFToken': csrfToken}
+ })
+ .then(function (r) { return r.json(); })
+ .then(function (hist) {
+ var container = document.getElementById('integrityHistoryContainer');
+ if (!container) return;
+ var execs = hist.executions || [];
+ if (execs.length === 0) {
+ container.innerHTML = '
';
+ return;
+ }
+ var html = '
' +
+ _gcHistoryIcon + ' Recent Scans
' +
+ '
' +
+ '| Time | Scanned | ' +
+ 'Issues | Healed | ' +
+ 'Mode |
';
+ execs.forEach(function (exec) {
+ var r = exec.result || {};
+ var issues = (r.corrupted_objects || 0) + (r.orphaned_objects || 0) +
+ (r.phantom_metadata || 0) + (r.stale_versions || 0) +
+ (r.etag_cache_inconsistencies || 0) + (r.legacy_metadata_drifts || 0);
+ var issueHtml = issues > 0
+ ? '' + issues + ''
+ : '0';
+ var mode = exec.dry_run
+ ? 'Dry'
+ : (exec.auto_heal
+ ? 'Heal'
+ : 'Scan');
+ html += '| ' + formatTimestamp(exec.timestamp) + ' | ' +
+ '' + (r.objects_scanned || 0) + ' | ' +
+ '' + issueHtml + ' | ' +
+ '' + (r.issues_healed || 0) + ' | ' +
+ '' + mode + ' |
';
+ });
+ html += '
';
+ container.innerHTML = html;
+ })
+ .catch(function () {});
+ }
+
var _gcPollTimer = null;
var _gcLastDryRun = false;
@@ -447,6 +546,7 @@
_gcPollTimer = setTimeout(_gcPoll, 2000);
} else {
_gcSetScanning(false);
+ _gcRefreshHistory();
fetch('{{ url_for("ui.system_gc_history") }}?limit=1', {
headers: {'X-CSRFToken': csrfToken}
})
@@ -576,6 +676,7 @@
_integrityPollTimer = setTimeout(_integrityPoll, 2000);
} else {
_integritySetScanning(false);
+ _integrityRefreshHistory();
fetch('{{ url_for("ui.system_integrity_history") }}?limit=1', {
headers: {'X-CSRFToken': csrfToken}
})