Add API endpoints for stats and audits, implement data collection functions, and enhance index view with skeleton context

This commit is contained in:
2026-02-06 17:21:00 +03:00
parent e3a9500352
commit 30c08d497f
6 changed files with 1141 additions and 677 deletions

View File

@@ -1,3 +1,13 @@
// Format bytes to GB (matches Django convert_bytes filter default)
function formatBytes(bytes, targetUnit = 'GB') {
if (bytes == null || isNaN(Number(bytes))) return '0';
const b = Number(bytes);
const factors = { B: 1, KB: 1024, MB: 1024 * 1024, GB: 1024 ** 3, TB: 1024 ** 4 };
const unit = (targetUnit || 'GB').toUpperCase();
const factor = factors[unit] || factors.GB;
return (b / factor).toFixed(1);
}
// Color utilities
const getCSSVar = (varName) => {
return getComputedStyle(document.documentElement).getPropertyValue(varName).trim();