Query log wording: N answers so far, each kept for 7 days
"The query log holds 7 answers (stats.retention.queries)" read like 7 days' worth. The dashboard and the Statistics page now say how many answers it holds and how long each is kept; the dashboard's storage info has query_log_retention. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1b102a78f6
commit
250e734046
4 files changed
+23
-4
No files matched your search
@@ -157,7 +157,7 @@ function storageCard(sg) {
|
||||
function storagePanel(sg) {
|
||||
const dbRows = sg.databases.map((d) => [h("dt", null, d.label),
|
||||
h("dd", null, h("strong", null, bytes(d.bytes)), " ", h("span", { class: "mono small muted" }, d.path),
|
||||
d.query_log_rows != null ? h("div", { class: "small muted" }, "the query log holds " + d.query_log_rows.toLocaleString() + " answers (stats.retention.queries)") : null)]);
|
||||
d.query_log_rows != null ? h("div", { class: "small muted" }, "query log: " + d.query_log_rows.toLocaleString() + (d.query_log_rows === 1 ? " answer" : " answers") + " so far, each kept for " + retentionWords(d.query_log_retention) + " (stats.retention.queries)") : null)]);
|
||||
return h("div", { class: "panel", id: "storage" },
|
||||
h("h2", null, "Storage"),
|
||||
h("dl", { class: "kv" }, dbRows, h("dt", null, "Together"), h("dd", null, h("strong", null, bytes(sg.total)))),
|
||||
@@ -183,3 +183,11 @@ function bytes(n) {
|
||||
while (n >= 1024 && i < units.length - 1) { n /= 1024; i++; }
|
||||
return (n >= 100 || i === 0 ? Math.round(n) : n.toFixed(1)) + " " + units[i];
|
||||
}
|
||||
|
||||
// retentionWords: "7d" -> "7 days".
|
||||
function retentionWords(r) {
|
||||
const m = /^(\d+)([dhm])$/.exec(r || "");
|
||||
if (!m) return r || "a while";
|
||||
const word = { d: "day", h: "hour", m: "minute" }[m[2]];
|
||||
return m[1] + " " + word + (m[1] === "1" ? "" : "s");
|
||||
}
|
||||
@@ -319,7 +319,7 @@ function exploreSince(since) {
|
||||
function dbTile(db, status) {
|
||||
const keep = ((status || {}).retention || {}).queries;
|
||||
const sub = db.query_log_rows != null
|
||||
? "the query log holds " + compact(db.query_log_rows) + " answers (" + keep + ")"
|
||||
? "query log: " + compact(db.query_log_rows) + (db.query_log_rows === 1 ? " answer" : " answers") + " so far, each kept for " + retentionWords(keep)
|
||||
: "counters and top lists; no query log";
|
||||
return h("a", { class: "card link", href: "#/", title: db.path + " · all of Jarl's databases: Dashboard → Storage" },
|
||||
h("div", { class: "label" }, "Statistics database"), h("div", { class: "value" }, bytes(db.bytes)), h("div", { class: "sub" }, sub));
|
||||
@@ -335,3 +335,11 @@ function diskTile(d) {
|
||||
h("div", { class: "seg other" + (u > 0.9 ? " full" : ""), style: { width: u * 100 + "%" } })),
|
||||
h("div", { class: "sub" }, h("span", { class: u > 0.9 ? "warn-text" : "" }, Math.round(u * 100) + "% of " + bytes(d.total) + " used"), ", for " + d.holds.join(", ")));
|
||||
}
|
||||
|
||||
// retentionWords: "7d" -> "7 days".
|
||||
function retentionWords(r) {
|
||||
const m = /^(\d+)([dhm])$/.exec(r || "");
|
||||
if (!m) return r || "a while";
|
||||
const word = { d: "day", h: "hour", m: "minute" }[m[2]];
|
||||
return m[1] + " " + word + (m[1] === "1" ? "" : "s");
|
||||
}
|
||||
Reference in new issue
Block a user