- collapse run log data blocks whose pretty-printed JSON exceeds a byte or line limit, with a per-block toggle and an expand/collapse-all button next to the Logs heading - align data blocks and toggles with the context/message column - add a "Copy logs" button that copies the filtered logs as plain text with every data block expanded - add GET /manifest.json with the app name, version and run log data limits (RUN_LOG_DATA_COLLAPSE_BYTES / RUN_LOG_DATA_COLLAPSE_LINES) - load the manifest in the client stale-while-revalidate: localStorage copy first, refetched per page load and on tab focus after a while - show the server version in the sidebar footer, with a reload hint when it differs from the client build Closes #3
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { INestApplication } from "@nestjs/common";
|
|
import request from "supertest";
|
|
import { appPackage } from "../src/common/app-package";
|
|
import { buildTestApp } from "./app.harness";
|
|
|
|
describe("GET /manifest.json", () => {
|
|
let app: INestApplication;
|
|
|
|
afterEach(async () => {
|
|
delete process.env.RUN_LOG_DATA_COLLAPSE_BYTES;
|
|
delete process.env.RUN_LOG_DATA_COLLAPSE_LINES;
|
|
await app?.close();
|
|
});
|
|
|
|
it("returns the app version and default run log data limits", async () => {
|
|
app = await buildTestApp();
|
|
const res = await request(app.getHttpServer())
|
|
.get("/manifest.json")
|
|
.expect(200);
|
|
|
|
expect(res.body).toEqual({
|
|
name: appPackage().name,
|
|
version: appPackage().version,
|
|
runLogs: { dataLimits: { bytes: 256, lines: 5 } },
|
|
});
|
|
expect(res.headers["cache-control"]).toBe("no-cache");
|
|
expect(res.headers["etag"]).toBeDefined();
|
|
});
|
|
|
|
it("takes the run log data limits from the configuration", async () => {
|
|
process.env.RUN_LOG_DATA_COLLAPSE_BYTES = "1024";
|
|
process.env.RUN_LOG_DATA_COLLAPSE_LINES = "20";
|
|
app = await buildTestApp();
|
|
const res = await request(app.getHttpServer())
|
|
.get("/manifest.json")
|
|
.expect(200);
|
|
|
|
expect(res.body.runLogs.dataLimits).toEqual({ bytes: 1024, lines: 20 });
|
|
});
|
|
});
|