Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions frontend/e2e/admin-events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ test.describe('Admin Events', () => {
await adminPage.goto(PATH);
await expectTableColumn(adminPage, 'Time', EMPTY_PATTERN);
});

test('opens the details of an event with its timestamp', async ({ adminPage }) => {
await adminPage.goto(PATH);
await adminPage.getByRole('button', { name: /View details for event/ }).first().click();
const dialog = adminPage.getByRole('dialog', { name: 'Event Details' });
await expect(dialog).toBeVisible();
await expect(dialog.getByRole('row', { name: /Timestamp/ })).toContainText(/\d{4}/);
});
});

test.describe('Refresh', () => {
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/lib/admin/stores/__tests__/eventsStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ describe('EventsStore', () => {
);
});

it('turns the event timestamp the generated transformer skips into a Date', async () => {
const event = { ...createMockEvent(), timestamp: '2026-10-11T08:00:00Z' };
mockApi(getEventDetailApiV1AdminEventsEventIdGet).ok({ event, related_events: [], timeline: [] });

createStore();
await store.openEventDetail('evt-1');

expect(store.selectedEvent?.event.timestamp).toEqual(new Date('2026-10-11T08:00:00Z'));
});

it('leaves selectedEvent empty when the load fails', async () => {
mockApi(getEventDetailApiV1AdminEventsEventIdGet).err({ detail: 'Event not found' });

Expand Down
9 changes: 8 additions & 1 deletion frontend/src/lib/admin/stores/eventsStore.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ class EventsStore {
async openEventDetail(eventId: string): Promise<void> {
// A failed load already showed the interceptor's toast, so the modal just stays closed
this.selectedEvent = await this.#queryClient
.query(getEventDetailApiV1AdminEventsEventIdGetOptions({ path: { event_id: eventId } }))
.query({
...getEventDetailApiV1AdminEventsEventIdGetOptions({ path: { event_id: eventId } }),
// hey-api's transformer skips a union-typed field, so `event.timestamp` arrives as a string
select: (detail) => ({
...detail,
event: { ...detail.event, timestamp: new Date(detail.event.timestamp) },
}),
})
.catch(() => null);
}

Expand Down
Loading