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
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/4146-system-s-memory-chart-pair-draw-a-base-l → main 1 commit fork
2 files
changed +12
−1
src/web/pages/system.ts +1 −1
| @@ -76,7 +76,7 @@ function memorySection(ctx: Ctx): Html { | ||
| 76 | 76 | ); |
| 77 | 77 | return hours.length === 0 |
| 78 | 78 | ? 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> | |
| 80 | 80 | <div class="table-scroll"><table class="table" aria-label="Forge memory by hour"> |
| 81 | 81 | <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> |
| 82 | 82 | <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", () => { | ||
| 84 | 84 | expect(body).toContain("40.0 MiB"); |
| 85 | 85 | }); |
| 86 | 86 | |
| 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 | ||
| 87 | 98 | test("a non-admin gets 404 and an anonymous visitor is sent to sign in", async () => { |
| 88 | 99 | expect((await get("bob")).status).toBe(404); |
| 89 | 100 | const anon = await fetch(servers.url + "/system", { redirect: "manual" }); |
new above
offline