mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 06:29:07 +00:00
feat(log): add filters to the event log and cap the log store
Finding a single error in a stream of RX/TX traffic was not practical with only the origin filters. - add a text filter and an issues only filter - show how many entries are being displayed - add an empty state which distinguishes no activity from no matches - collapse the six origin flags into a single set - cap the log store at 500 entries, it was growing unbounded for the duration of a session - the event log button was labelled Extract, which did not convey that it opens the log in a new window Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NrhcEgY8mqaxZi8veMPrrx
This commit is contained in:
@@ -15,11 +15,14 @@ const logger = createStore<LogStore>(() => ({
|
||||
logs: [],
|
||||
}));
|
||||
|
||||
/** the log is kept in memory, we cap it to avoid it growing through a long show */
|
||||
const maxLogEntries = 500;
|
||||
|
||||
export const useLogData = () => useStore(logger);
|
||||
|
||||
export const addLog = (log: Log) =>
|
||||
logger.setState((state) => ({
|
||||
logs: [log, ...state.logs],
|
||||
logs: [log, ...state.logs].slice(0, maxLogEntries),
|
||||
}));
|
||||
|
||||
export const clearLogs = () => logger.setState({ logs: [] });
|
||||
|
||||
Reference in New Issue
Block a user