Use proper Object methods

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
XhmikosR
2025-04-02 18:37:28 +03:00
parent 04760b55c8
commit ba3b76421b
5 changed files with 23 additions and 33 deletions

View File

@@ -60,16 +60,16 @@ function updateCachePie(data) {
data.empty.valid = cacheSize - cacheEntries;
// Fill chart with data
for (const item of Object.keys(data)) {
if (data[item].valid > 0) {
v.push((100 * data[item].valid) / cacheSize);
for (const [item, value] of Object.entries(data)) {
if (value.valid > 0) {
v.push((100 * value.valid) / cacheSize);
c.push(item !== "empty" ? THEME_COLORS[i++ % THEME_COLORS.length] : "#80808040");
k.push(item);
}
if (data[item].stale > 0) {
if (value.stale > 0) {
// There are no stale empty entries
v.push((100 * data[item].stale) / cacheSize);
v.push((100 * value.stale) / cacheSize);
c.push(THEME_COLORS[i++ % THEME_COLORS.length]);
k.push(item + " (stale)");
}