Add experiment logs to the monitoring page

This commit is contained in:
Twirre
2026-01-28 10:15:58 +00:00
committed by Björn Otgaar
parent 78901ee25b
commit 835de03a29
25 changed files with 619 additions and 124 deletions

View File

@@ -11,8 +11,6 @@ const loggingStoreRef: { current: null | { setState: (state: Partial<LoggingSett
type LoggingSettingsState = {
showRelativeTime: boolean;
setShowRelativeTime: (show: boolean) => void;
scrollToBottom: boolean;
setScrollToBottom: (scroll: boolean) => void;
};
jest.mock("zustand", () => {
@@ -59,8 +57,8 @@ type LoggingComponent = typeof import("../../../src/components/Logging/Logging.t
let Logging: LoggingComponent;
beforeAll(async () => {
if (!Element.prototype.scrollIntoView) {
Object.defineProperty(Element.prototype, "scrollIntoView", {
if (!Element.prototype.scrollTo) {
Object.defineProperty(Element.prototype, "scrollTo", {
configurable: true,
writable: true,
value: function () {},
@@ -84,7 +82,6 @@ afterEach(() => {
function resetLoggingStore() {
loggingStoreRef.current?.setState({
showRelativeTime: false,
scrollToBottom: true,
});
}
@@ -151,7 +148,7 @@ describe("Logging component", () => {
];
mockUseLogs.mockReturnValue({filteredLogs: logs, distinctNames: new Set()});
const scrollSpy = jest.spyOn(Element.prototype, "scrollIntoView").mockImplementation(() => {});
const scrollSpy = jest.spyOn(Element.prototype, "scrollTo").mockImplementation(() => {});
const user = userEvent.setup();
const view = render(<Logging/>);
@@ -175,7 +172,7 @@ describe("Logging component", () => {
const logCell = makeCell({message: "Initial", firstRelativeCreated: 42});
mockUseLogs.mockReturnValue({filteredLogs: [logCell], distinctNames: new Set()});
const scrollSpy = jest.spyOn(Element.prototype, "scrollIntoView").mockImplementation(() => {});
const scrollSpy = jest.spyOn(Element.prototype, "scrollTo").mockImplementation(() => {});
render(<Logging/>);
await waitFor(() => {
@@ -209,7 +206,7 @@ describe("Logging component", () => {
const initialMap = firstProps.filterPredicates;
expect(initialMap).toBeInstanceOf(Map);
expect(initialMap.size).toBe(0);
expect(initialMap.size).toBe(1); // Initially, only filter out experiment logs
expect(mockUseLogs).toHaveBeenCalledWith(initialMap);
const updatedPredicate: LogFilterPredicate = {