From c1d9018e2174a3144c6babba86b4959dd77448d2 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 26 Sep 2024 10:34:28 +0200 Subject: templates: show real sizes in cache inspector Use real free and available cache in cache_inspector.html --- ogcp/templates/cache_inspector.html | 8 +++----- ogcp/templates/disk_inspector.html | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'ogcp/templates') diff --git a/ogcp/templates/cache_inspector.html b/ogcp/templates/cache_inspector.html index 42dd983..8e64cd4 100644 --- a/ogcp/templates/cache_inspector.html +++ b/ogcp/templates/cache_inspector.html @@ -100,9 +100,9 @@ } function updateChart(ip) { - var totalCache = toGiB(storageData[ip].total, 3); + var totalCache = toGiB(storageData[ip].used + storageData[ip].free, 3); var usedCache = toGiB(storageData[ip].used, 3); - var freeCache = toGiB(storageData[ip].total - storageData[ip].used, 3) + var freeCache = toGiB(storageData[ip].free, 3); cacheChart.data.datasets[0].data = [ usedCache, @@ -134,9 +134,7 @@ $('.badge-pill').each(function(index) { for (var ip in storageData) { if ($(this).html().includes(ip)) { - var totalCache = storageData[ip].total; - var usedCache = storageData[ip].used; - var freeCache = toGiB(totalCache - usedCache, 1) + var freeCache = toGiB(storageData[ip].free, 1) $(this).html($(this).html() + '
free: ' + freeCache + ' GiB'); break; } diff --git a/ogcp/templates/disk_inspector.html b/ogcp/templates/disk_inspector.html index f3f190a..2f1b3dc 100644 --- a/ogcp/templates/disk_inspector.html +++ b/ogcp/templates/disk_inspector.html @@ -180,7 +180,12 @@ let freeSpace = diskSize; let partNum = 1; $('#partitionsTable tr').each(function() { + {% if readonly_disk_inspector is defined %} + let partitionSize = parseInt($(this).find('td').eq(3).text().trim()); + {% else %} let partitionSize = parseInt($(this).find('td').eq(3).find('input').val().trim()); + {% endif %} + if (isNaN(partitionSize)) { partitionSize = 0; } -- cgit v1.2.3-18-g5258