Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2496358
feat(event-log): chart data for the Charts view (#846)
adamgell Oct 10, 2026
097e02a
feat(event-log): Charts view with KPI grid and four figures (#846)
adamgell Oct 10, 2026
2fd36e4
Merge Phase 3 (#829) into the Charts view branch
adamgell Oct 11, 2026
7f603fd
fix(event-log): Charts view placement, text-log scope, cap disclosure…
adamgell Oct 11, 2026
4275f54
feat(event-log): figure 4 uses VerticalStackedBarChart (#846)
adamgell Oct 11, 2026
5b65e83
feat(event-log): wire the lazy Charts view and capture it (#846)
adamgell Oct 11, 2026
41a72c0
test(event-log): give the lazy Charts view load a realistic timeout (…
adamgell Oct 11, 2026
b431b35
Merge Phase 3 fix round (#829) into the Charts view branch
adamgell Oct 11, 2026
cf6610c
fix(event-log): Charts entry uses Phase 3's Suspense boundary, no dup…
adamgell Oct 11, 2026
b0d6994
Revert "feat(event-log): figure 4 uses VerticalStackedBarChart (#846)"
adamgell Oct 11, 2026
6aa3f2b
feat(event-log): figure 4 as token-styled markup with HH:00 labels, c…
adamgell Oct 11, 2026
ee610a8
chore(screenshots): recapture the Charts view after Phase 3's fix rou…
adamgell Oct 11, 2026
96b18ac
fix(event-log): Charts data scope, text-log disclosure and RFC 3339 p…
adamgell Oct 11, 2026
6304a30
fix(event-log): wire real channel order, text-log sources, loaded cha…
adamgell Oct 11, 2026
c0a905f
chore(screenshots): Charts capture at 1440x900 plus a full Charts vie…
adamgell Oct 11, 2026
00b64b7
fix(event-log): Charts channel count, figure 4 note, RFC 3339 hours a…
adamgell Oct 11, 2026
c5c2c6a
Merge Phase 3 (PR #929) into the Charts view branch
adamgell Oct 11, 2026
5e8744a
chore(screenshots): recapture the Charts view after merging Phase 3 P…
adamgell Oct 11, 2026
136426e
Merge Phase 3 corrected head (2db6a83f) into the Charts view branch
adamgell Oct 11, 2026
d4ca3df
chore(screenshots): recapture the Charts view on Phase 3's corrected …
adamgell Oct 11, 2026
cecdd2e
fix(event-log): Charts loading state, day-of-month and minus-sign par…
adamgell Oct 11, 2026
cafb68a
fix(event-log): Charts update throttles from the first change instead…
adamgell Oct 11, 2026
ec99786
Merge Phase 3 (#929) at a0b70cd6 into feat/event-logs-charts-846
adamgell Oct 22, 2026
478dce2
fix(event-log): Charts load state, window label and clock settle with…
adamgell Oct 22, 2026
7904e5b
test(event-log): pin each throttled Charts field with a one-field cha…
adamgell Oct 22, 2026
d332b46
fix(event-log): Charts check minute, second and offset ranges before …
adamgell Oct 22, 2026
d1b09f1
fix(event-log): Charts trim timestamp text as the engine does, not as…
adamgell Oct 22, 2026
642b942
fix(event-log): Charts give Date.parse a three-digit fraction (#846)
adamgell Oct 22, 2026
1df5b46
test(event-log): Charts throttle applies the latest value and clears …
adamgell Oct 22, 2026
4e5430d
docs(event-log): Charts comments say throttled, not debounced (#846)
adamgell Oct 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions e2e/screenshots/event-logs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,35 @@ test.describe("event-logs screenshots", () => {
animations: "disabled",
});
});

test("event-logs charts view", async ({ page }) => {
await page.getByRole("tab", { name: "Charts" }).click();
await expect(page.getByRole("figure", { name: /^Events by channel/ })).toBeVisible({
timeout: 15_000,
});
// Chart data is throttled; wait for the settled KPI grid and all four figures.
await expect(page.getByRole("figure")).toHaveCount(4);
await expect(page.getByTestId("kpi-value-events")).not.toHaveText("0");
await assertNoHostPaths(page);
// The page capture stays at the harness's 1440x900; the view element is captured on its own
// (it scrolls inside the shell) so all four figures can be reviewed.
await page.screenshot({
path: outPath("event-logs-charts.png"),
animations: "disabled",
});
const view = page.getByTestId("evtx-charts-view");
// The element scrolls inside the shell; grow it to its content so one capture shows everything.
await view.evaluate((el) => {
el.style.overflow = "visible";
for (let parent = el.parentElement; parent && parent !== document.body; parent = parent.parentElement) {
parent.style.overflow = "visible";
parent.style.height = "auto";
parent.style.maxHeight = "none";
}
});
await view.screenshot({
path: outPath("event-logs-charts-view.png"),
animations: "disabled",
});
});
});
Binary file added screenshots/event-logs-charts-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/event-logs-charts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 132 additions & 2 deletions src/workspaces/event-log/EventLogWorkspace.layout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ vi.mock("./UnifiedTimelineView", () => ({

import { useLogStore } from "../../stores/log-store";
import { EventLogWorkspace, EvtxViewHost, type EvtxViewEntry } from "./EventLogWorkspace";
import { CHART_DATA_THROTTLE_MS } from "./EvtxChartsView";
import { EvtxViewBar } from "./EvtxViewBar";
import { requireElement, stubLayout } from "./evtx-test-dom";
import {
Expand All @@ -40,6 +41,7 @@ import {
} from "./evtx-layout-store";
import { useEvtxStore } from "./evtx-store";
import type { EvtxRecord } from "./types";
import type { LogEntry } from "../../types/log";

const RECORD: EvtxRecord = {
id: 1,
Expand Down Expand Up @@ -281,7 +283,7 @@ describe("EventLogWorkspace three-column shell", () => {
await useEvtxLayoutStore.persist.rehydrate();
render(<EventLogWorkspace />);
expect(screen.getByRole("tab", { name: "Charts" })).toHaveAttribute("aria-selected", "true");
expect(screen.getByText("Charts view")).toBeVisible();
expect(await screen.findByTestId("evtx-charts-view", {}, { timeout: 10_000 })).toBeVisible();
expect(region("channels")).not.toBeVisible();
expect(region("rail")).toHaveStyle({ width: "400px" });
expect(region("dock")).toHaveStyle({ height: "250px" });
Expand All @@ -303,7 +305,7 @@ describe("EventLogWorkspace three-column shell", () => {

it("shows a placeholder for views that are not built yet, behind the same tablist", () => {
render(<EventLogWorkspace />);
for (const name of ["Grouped", "Timeline", "Charts", "Correlation"]) {
for (const name of ["Grouped", "Timeline", "Correlation"]) {
fireEvent.click(screen.getByRole("tab", { name }));
expect(screen.getByRole("tablist", { name: "Layout" })).toBeInTheDocument();
expect(screen.getByRole("tab", { name })).toHaveAttribute("aria-selected", "true");
Expand All @@ -313,6 +315,15 @@ describe("EventLogWorkspace three-column shell", () => {
}
});

it("loads the Charts view lazily behind the same tablist", async () => {
render(<EventLogWorkspace />);
fireEvent.click(screen.getByRole("tab", { name: "Charts" }));
expect(screen.getByRole("tab", { name: "Charts" })).toHaveAttribute("aria-selected", "true");
expect(await screen.findByTestId("evtx-charts-view", {}, { timeout: 10_000 })).toBeVisible();
expect(screen.getAllByRole("figure")).toHaveLength(4);
expect(screen.getByTestId("records-table")).not.toBeVisible();
});

it("keeps selection and filters when switching views and returning to the table", () => {
useEvtxStore.setState({ selectedRecordId: RECORD.id, filterSearch: "kept" });
render(<EventLogWorkspace />);
Expand Down Expand Up @@ -360,3 +371,122 @@ describe("EventLogWorkspace three-column shell", () => {
expect(screen.getByRole("tablist", { name: "Layout" })).toBeInTheDocument();
});
});

describe("EventLogWorkspace Charts view wiring", () => {
const fresh = { ...RECORD, timestampEpoch: Date.now(), timestamp: new Date().toISOString() };

beforeEach(() => {
localStorage.clear();
useEvtxLayoutStore.setState({ ...sanitizeLayout(undefined), activeView: "charts" });
useEvtxStore.getState().reset();
useEvtxStore.setState({
records: [fresh],
channels: [
{ name: "Application", eventCount: 1, sourceType: "live" },
{ name: "System", eventCount: 0, sourceType: "live" },
{ name: "Setup", eventCount: 0, sourceType: "live" },
],
selectedChannels: new Set(["Application"]),
loadedChannels: new Set(["Application"]),
isLoading: false,
sourceMode: "files",
timeWindow: "all",
});
useLogStore.setState({ entries: [], activeSource: null, sourceOpenMode: "merged" });
});

afterEach(cleanup);

const eventsTile = async () => {
render(<EventLogWorkspace />);
await screen.findByTestId("evtx-charts-view", {}, { timeout: 10_000 });
return document.querySelector<HTMLElement>('[data-kpi="events"]')!;
};

const logLine = (filePath: string) => ({ filePath }) as unknown as LogEntry;

it("counts distinct event-record channels in files mode, and the window as all loaded", async () => {
const system = (id: number, sourceLabel: string): EvtxRecord => ({
...fresh,
id,
eventRecordId: 100 + id,
channel: "System",
sourceLabel,
});
const archivedLog: EvtxRecord = {
...fresh,
id: 9,
originKind: "log",
channel: "bundle.zip::logs/agent.log",
sourceLabel: "bundle.zip::logs/agent.log",
};
useEvtxStore.setState({
// Two files share the channel name "System"; an archived text log's channel is its label;
// the parse result also lists channels of files that contributed no records.
records: [fresh, system(2, "System.evtx"), system(3, "Archive-System-2026.evtx"), archivedLog],
});
const tile = await eventsTile();
expect(tile).toHaveTextContent("Events (all loaded)");
expect(tile).toHaveTextContent("2 channels · 1 text log");
});

it("counts completed loads (not enumerated channels) in live mode", async () => {
useEvtxStore.setState({ sourceMode: "live", timeWindow: "7d" });
const tile = await eventsTile();
expect(tile).toHaveTextContent("Events (7 d)");
expect(tile).toHaveTextContent("1 channel · 0 text logs");
});

it("counts text-log sources, not lines", async () => {
useLogStore.setState({
entries: [logLine("C:/logs/a.log"), logLine("C:/logs/a.log"), logLine("C:/logs/a.log")],
});
expect(await eventsTile()).toHaveTextContent("1 channel · 1 text log");
});

it("counts two text-log sources as text logs", async () => {
useLogStore.setState({ entries: [logLine("C:/logs/a.log"), logLine("C:/logs/b.log")] });
expect(await eventsTile()).toHaveTextContent("1 channel · 2 text logs");
});

it("shows a loading state, not 'no events', while a load runs with records present", async () => {
useEvtxStore.setState({ isLoading: true });
render(<EventLogWorkspace />);
await screen.findByText("Loading events...", {}, { timeout: 10_000 });
expect(screen.queryByText(/No events to chart/)).toBeNull();
});

it("does not say 'No events' between a load ending and its records being drawn", async () => {
useEvtxStore.setState({ isLoading: true });
render(<EventLogWorkspace />);
// Real timers until the lazy chunk has loaded; fake timers only for the flip.
await screen.findByText("Loading events...", {}, { timeout: 10_000 });
vi.useFakeTimers();
try {
// The visible rows come back in the same store update that ends the load.
act(() => {
useEvtxStore.setState({ isLoading: false });
});
expect(screen.queryByText(/No events to chart/)).toBeNull();
expect(screen.getByText("Loading events...")).toBeInTheDocument();
act(() => {
vi.advanceTimersByTime(CHART_DATA_THROTTLE_MS - 1);
});
expect(screen.queryByText(/No events to chart/)).toBeNull();
expect(screen.getByText("Loading events...")).toBeInTheDocument();
act(() => {
vi.advanceTimersByTime(1);
});
expect(screen.queryByText(/No events to chart/)).toBeNull();
expect(screen.queryByText("Loading events...")).toBeNull();
expect(screen.getByTestId("kpi-value-events")).toHaveTextContent("1");
} finally {
vi.useRealTimers();
}
});

it("shows n/a for the chains tile until a timeline page exists", async () => {
await eventsTile();
expect(screen.getByTestId("kpi-value-chains").textContent).toBe("n/a");
});
});
67 changes: 66 additions & 1 deletion src/workspaces/event-log/EventLogWorkspace.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
lazy,
useCallback,
useMemo,
useRef,
Expand Down Expand Up @@ -45,6 +46,14 @@ import {
import { selectVisibleRecords } from "./evtx-filter";
import { scopeLogEntries } from "./unified-timeline";
import { mergeDiagnosisCoverageGaps } from "./evtx-coverage";
import { buildCorrelationChains } from "./evtx-correlation-chains";
import {
chartWindowLabel,
countTextLogSources,
loadedChannelCountFor,
} from "./evtx-chart-data";
import { orderChannelNames } from "./evtx-channel-order";
import { useEvtxVisualTokens } from "./evtx-visual-tokens";
import type {
DiagnosisSummary,
EvtxCoverageGap,
Expand All @@ -55,6 +64,9 @@ import {
EventLogAnalysisCancelled,
} from "./event-analysis-session";

// The chart library stays out of the initial bundle (spec 8.10).
const EvtxChartsView = lazy(() => import("./EvtxChartsView"));

const DEFAULT_DETAIL_HEIGHT = 300;
const MIN_DETAIL_HEIGHT = 100;
const MAX_DETAIL_RATIO = 0.7;
Expand Down Expand Up @@ -592,11 +604,64 @@ export function EventLogWorkspace() {
</>
);

const visualTokens = useEvtxVisualTokens();
const logListFontSize = useUiStore((s) => s.logListFontSize);
const chartMetrics = useMemo(() => getLogListMetrics(logListFontSize), [logListFontSize]);
const chartChannelOrder = useMemo(
() => orderChannelNames(channels.map((c) => c.name)),
[channels],
);
const loadedChannels = useEvtxStore((s) => s.loadedChannels);
// Counted only while Charts is active, as `chartsViewChains` is, so a live tail does not rescan
// the records on every append in the other views.
const chartLoadedChannelCount = useMemo(
() =>
activeView === "charts"
? loadedChannelCountFor({ sourceMode, loadedChannels, records })
: 0,
[activeView, sourceMode, loadedChannels, records],
);
const chartTextLogCount = useMemo(
() => (activeView === "charts" ? countTextLogSources(scopedLogEntries, records) : 0),
[activeView, scopedLogEntries, records],
);
const chartHideRules = useMemo(() => [quickFilter], [quickFilter]);
// Phase 10c replaces this with the shared chain model. Until then the Charts chains KPI builds
// its own from the first timeline page and its bounded edge preview, only while Charts is
// active, so `edgeInputComplete` tells the tile when the count is a loaded subset.
const chartsViewChains = useMemo(
() =>
activeView === "charts" && initialTimelinePage
? buildCorrelationChains({
items: initialTimelinePage.items,
timelineEdges: initialTimelinePage.edgesPreview,
totalTimelineEdges: initialTimelinePage.totalEdges,
findings: [],
})
: null,
[activeView, initialTimelinePage],
);
const renderChartsView = () => (
<EvtxChartsView
records={visibleRecords}
chains={chartsViewChains}
hideRules={chartHideRules}
channelOrder={chartChannelOrder}
timeZoneMode={timeZoneMode}
loadedChannelCount={chartLoadedChannelCount}
textLogCount={chartTextLogCount}
loading={isLoading}
windowLabel={chartWindowLabel(timeWindow)}
metrics={chartMetrics}
visualTokens={visualTokens}
/>
);

const views: Record<EvtxViewId, EvtxViewEntry> = {
table: { keepAlive: true, render: renderTableView },
grouped: { keepAlive: false, render: () => <ViewPlaceholder view="grouped" /> },
timeline: { keepAlive: false, render: () => <ViewPlaceholder view="timeline" /> },
charts: { keepAlive: false, render: () => <ViewPlaceholder view="charts" /> },
charts: { keepAlive: false, render: renderChartsView },
correlation: { keepAlive: false, render: () => <ViewPlaceholder view="correlation" /> },
};

Expand Down
Loading