Repository navigation
feat(new-webui): Limit search results to most recent 1000 entries. #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,10 +30,17 @@ interface SearchResult { | |
| const searchResultsTableColumns: NonNullable<TableProps<SearchResult>["columns"]> = [ | ||
| { | ||
| dataIndex: "timestamp", | ||
| defaultSortOrder: "ascend", | ||
| defaultSortOrder: "descend", | ||
| key: "timestamp", | ||
| render: (timestamp: number) => dayjs(timestamp).format(DATETIME_FORMAT_TEMPLATE), | ||
| sorter: (a, b) => a.timestamp - b.timestamp, | ||
| sorter: (a, b) => { | ||
| const timestampDiff = a.timestamp - b.timestamp; | ||
| if (0 !== timestampDiff) { | ||
| return timestampDiff; | ||
| } | ||
|
|
||
| return a._id.localeCompare(b._id); | ||
| }, | ||
|
|
||
| // Specifying a third sort direction removes ability for user to cancel sorting. | ||
| sortDirections: [ | ||
|
|
@@ -68,8 +75,15 @@ const searchResultsTableColumns: NonNullable<TableProps<SearchResult>["columns"] | |
| */ | ||
| const TABLE_BOTTOM_PADDING = 75; | ||
|
|
||
| /** | ||
| * The maximum number of results to retrieve for a search. | ||
| */ | ||
| const SEARCH_MAX_NUM_RESULTS = 1000; | ||
|
|
||
|
Comment on lines
+78
to
+82
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Duplicate definition of A constant with the same value already lives in 🤖 Prompt for AI Agents |
||
|
|
||
| export type {SearchResult}; | ||
| export { | ||
| searchResultsTableColumns, TABLE_BOTTOM_PADDING, | ||
| SEARCH_MAX_NUM_RESULTS, | ||
| searchResultsTableColumns, | ||
| TABLE_BOTTOM_PADDING, | ||
| }; | ||
|
Comment on lines
+86
to
89
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Re-export order nit Minor: exporting the new constant before the column configs would better match the declaration order above. 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Comparator returns ascending order; verify this aligns with intended “descend” default
defaultSortOrderis set to"descend", yet the comparator returnsa.timestamp - b.timestamp, which produces an ascending result set that Ant Design will then invert to achieve descending order.If someone later removes/changes
defaultSortOrder, the implicit coupling may break. Consider returning the inverted difference to make the comparator self-contained and future-proof:Same reasoning applies to the
_idfallback:This keeps the comparator’s semantics clear and avoids relying on external props for direction.
🏁 Script executed:
Length of output: 2691
Make the sorter self-contained by flipping to descending
The current comparator (
a.timestamp - b.timestamp) produces an ascending sort that Ant Design then reverses due todefaultSortOrder: "descend". To avoid this implicit coupling—so changing or removingdefaultSortOrderwon’t silently break the order—flip both parts of the comparator to sort descending by default:• File:
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/typings.tsx
• Around lines 36–43
This change makes the comparator’s intent explicit and decoupled from the
defaultSortOrderprop.📝 Committable suggestion
🤖 Prompt for AI Agents