This commit is contained in:
Mateusz Gruszczyński committed 2026-11-07 13:13:25 +01:00
1 parent 3a384baa6b
commit 672c84bc13
21 files changed
+450 -70

No files matched your search

+12 -3
View File
@@ -1,6 +1,6 @@
"use strict";
(() => {
let loading = false, offset = 0, generation = 0;
let loading = false, offset = 0, generation = 0, staticData = null, staticRevision = null;
let liveChartScope = "", liveChartPrevious = null, liveChartPreviousAt = null, liveChartGeneration = null;
const liveChartSamples = { hits: [], misses: [], bypasses: [] };
const LIVE_CHART_LIMITS = new Set([60, 120, 300, 600]);
@@ -229,7 +229,16 @@
const query = new URLSearchParams({ offset: String(offset), limit: "50" });
if (scope() !== "*") query.set("vhost", scope());
try {
const data = await api(`/api/cache?${query}`, { signal });
const base = `/api/cache?${query}`;
if (staticData) query.set("view", "live");
let data = await api(`/api/cache?${query}`, { signal });
if (staticData && data.revision !== staticRevision) data = await api(base, { signal });
if (data.settings && Array.isArray(data.vhosts)) {
staticData = { settings: data.settings, vhosts: data.vhosts };
staticRevision = data.revision;
} else if (staticData) {
data = { ...staticData, ...data };
}
if (isCurrent() && token === generation) render(data);
} catch (error) {
if (error?.name !== "AbortError" && epoch === authEpoch && isCurrent()) {
@@ -343,7 +352,7 @@
$("cache-live")?.addEventListener("change", () => rustProxyRefresh.sync());
window.rustProxyCachePanel = {
refresh, configure, reason, reset() {
generation++; offset = 0; resetLiveChart(); closeInvalidation(); closeBans();
generation++; offset = 0; staticData = null; staticRevision = null; resetLiveChart(); closeInvalidation(); closeBans();
$("cache-domain-rows").replaceChildren(); $("cache-object-rows").replaceChildren(); $("cache-ban-rows").replaceChildren();
$("cache-panel-state").textContent = ""; operationMessage("cache-invalidation-status"); operationMessage("cache-bans-status"); operationMessage("cache-toolbar-operation-status");
}