Add API endpoints for stats and audits, implement data collection functions, and enhance index view with skeleton context
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user