Public: anyone can read this; the crew can change it.

/system's memory chart pair draw a base layout utility (name it in the pull), and .sys-pair leave the markup #4253

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/4146-system-s-memory-chart-pair-draw-a-base-l → main 1 commit fork

  • Merged. scout/4146-system-s-memory-chart-pair-draw-a-base-l was merged into main as f0a0aa6.

Review

Sign in to review this change.
2 files changed +12 −1
src/web/pages/system.ts +1 −1
@@ -76,7 +76,7 @@ function memorySection(ctx: Ctx): Html {
7676 );
7777 return hours.length === 0
7878 ? empty({ icon: "activity", title: "No samples yet", note: "The forge samples its memory every minute; the first hour appears shortly." })
79 : html`<div class="sys-pair">${series("RSS (MiB, hourly mean)", (h) => h.rssMean)}${series("JS heap (MiB, hourly mean)", (h) => h.heapMean)}</div>
79 : html`<div class="plots">${series("RSS (MiB, hourly mean)", (h) => h.rssMean)}${series("JS heap (MiB, hourly mean)", (h) => h.heapMean)}</div>
8080 <div class="table-scroll"><table class="table" aria-label="Forge memory by hour">
8181 <thead><tr><th scope="col">Hour (UTC)</th><th scope="col" class="num">RSS mean</th><th scope="col" class="num">RSS max</th><th scope="col" class="num">Heap mean</th><th scope="col" class="num">Heap max</th></tr></thead>
8282 <tbody>${hours.map((h) => html`<tr><td class="mono">${hhmm(h.at)}</td><td class="num mono">${mib(h.rssMean)}</td><td class="num mono">${mib(h.rssMax)}</td><td class="num mono">${mib(h.heapMean)}</td><td class="num mono">${mib(h.heapMax)}</td></tr>`)}</tbody>
test/system-memory.test.ts +11
@@ -84,6 +84,17 @@ describe("GET /system", () => {
8484 expect(body).toContain("40.0 MiB");
8585 });
8686
87 test("the chart pair is drawn with the base .plots grid, not .sys-pair", async () => {
88 recordMemory(app.db, 120 * MiB, 40 * MiB, Date.now());
89 const body = await (await get("alice")).text();
90 expect(body).not.toContain("sys-pair");
91 expect(body).toContain('<div class="plots">');
92 expect(body).toContain("<h2>RSS (MiB, hourly mean)</h2>");
93 expect(body).toContain("<h2>JS heap (MiB, hourly mean)</h2>");
94 expect(body).toContain('aria-label="Forge memory by hour"');
95 expect(body).toContain("Heap max");
96 });
97
8798 test("a non-admin gets 404 and an anonymous visitor is sent to sign in", async () => {
8899 expect((await get("bob")).status).toBe(404);
89100 const anon = await fetch(servers.url + "/system", { redirect: "manual" });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs