Explorar el Código

fix(ui): define formatBytes helper and bump cache buster to v8.1

Proxmox Router hace 1 semana
padre
commit
7ac164c012
Se han modificado 2 ficheros con 10 adiciones y 1 borrados
  1. 9 0
      internal/web/static/app.js
  2. 1 1
      internal/web/static/index.html

+ 9 - 0
internal/web/static/app.js

@@ -59,6 +59,15 @@ function escapeHtml(str) {
     .replace(/'/g, ''');
 }
 
+function formatBytes(bytes) {
+  if (bytes === undefined || bytes === null || isNaN(bytes) || bytes === 0) return '0 B';
+  const k = 1024;
+  const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
+  const i = Math.floor(Math.log(bytes) / Math.log(k));
+  if (i < 0 || i >= sizes.length) return `${bytes} B`;
+  return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
+}
+
 // Initialize on page load
 document.addEventListener('DOMContentLoaded', () => {
   const hash = window.location.hash.replace('#', '') || 'dashboard';

+ 1 - 1
internal/web/static/index.html

@@ -9578,6 +9578,6 @@
   </div>
 
   <datalist id="fw-addrlist-datalist"></datalist>
-  <script src="app.js?v=8.0"></script>
+  <script src="app.js?v=8.1"></script>
 </body>
 </html>