-
Notifications
You must be signed in to change notification settings - Fork 91
feat(webui): Add configurable max results limit to CLP search UI. #2289
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| .queryBox { | ||
| flex: 1; | ||
| min-width: 100px; | ||
| position: relative; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .progressBarMask { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| .datasetContainer { | ||
| display: flex; | ||
| max-width: 250px; | ||
| } | ||
|
|
||
| .selectContainer { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| .maxResultsContainer { | ||
| display: flex; | ||
| } | ||
|
|
||
| .maxResultsContainer :global(.ant-select) { | ||
| min-width: 80px; | ||
| max-width: 80px; | ||
| } | ||
|
|
||
| .maxResultsContainer :global(.ant-select-selector) { | ||
| border-top-left-radius: 0 !important; | ||
| border-bottom-left-radius: 0 !important; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import {Select} from "antd"; | ||
|
|
||
| import InputLabel from "../../../../components/InputLabel"; | ||
| import useSearchStore from "../../SearchState"; | ||
| import { | ||
| MAX_RESULTS_OPTIONS, | ||
| SEARCH_UI_STATE, | ||
| } from "../../SearchState/typings"; | ||
| import styles from "./index.module.css"; | ||
|
|
||
|
|
||
| /** | ||
| * Renders a dropdown to select the maximum number of search results. | ||
| * | ||
| * @return | ||
| */ | ||
| const MaxResultsSelect = () => { | ||
| const maxNumResults = useSearchStore((state) => state.maxNumResults); | ||
| const updateMaxNumResults = useSearchStore((state) => state.updateMaxNumResults); | ||
| const searchUiState = useSearchStore((state) => state.searchUiState); | ||
|
|
||
| const isDisabled = searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING || | ||
| searchUiState === SEARCH_UI_STATE.QUERYING; | ||
|
|
||
| const handleChange = (value: number) => { | ||
| updateMaxNumResults(value); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className={styles["maxResultsContainer"]}> | ||
| <InputLabel>Limit</InputLabel> | ||
| <Select | ||
| disabled={isDisabled} | ||
| popupMatchSelectWidth={false} | ||
| size={"middle"} | ||
| value={maxNumResults} | ||
| options={MAX_RESULTS_OPTIONS.map((option) => ({ | ||
| label: option.toLocaleString(), | ||
| value: option, | ||
| }))} | ||
| onChange={handleChange}/> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default MaxResultsSelect; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,5 +4,6 @@ | |
|
|
||
| .rangePicker { | ||
| min-width: 350px; | ||
| max-width: 350px; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,7 @@ import { | |||||||||||
| const QueryJobCreationSchema = Type.Object({ | ||||||||||||
| datasets: Type.Array(Type.String()), | ||||||||||||
| ignoreCase: Type.Boolean(), | ||||||||||||
| maxNumResults: Type.Optional(Type.Integer({minimum: 1})), | ||||||||||||
|
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. Add an upper bound for
Suggested patch- maxNumResults: Type.Optional(Type.Integer({minimum: 1})),
+ maxNumResults: Type.Optional(Type.Integer({
+ minimum: 1,
+ maximum: 10000,
+ })),📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| queryString: StringSchema, | ||||||||||||
| timeRangeBucketSizeMillis: Type.Integer(), | ||||||||||||
| timestampBegin: Type.Union([Type.Null(), | ||||||||||||
|
|
||||||||||||
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.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: y-scope/clp
Length of output: 83
🏁 Script executed:
Repository: y-scope/clp
Length of output: 1276
🏁 Script executed:
Repository: y-scope/clp
Length of output: 1376
🏁 Script executed:
Repository: y-scope/clp
Length of output: 37
🏁 Script executed:
Repository: y-scope/clp
Length of output: 153
🏁 Script executed:
Repository: y-scope/clp
Length of output: 19282
🏁 Script executed:
Repository: y-scope/clp
Length of output: 83
🏁 Script executed:
# Find the SearchState definition file with different extensions fd -e js -e jsx -e ts -e tsx SearchState/index components/webui/client/src/pages/SearchPageRepository: y-scope/clp
Length of output: 37
🏁 Script executed:
# Also search for the file in the parent SearchState directory ls -la components/webui/client/src/pages/SearchPage/SearchState/Repository: y-scope/clp
Length of output: 562
🏁 Script executed:
Repository: y-scope/clp
Length of output: 2874
Use selective Zustand store subscriptions instead of full-state destructuring.
This hook subscribes to all store property changes when only
searchJobIdandmaxNumResultsare needed. Using selector functions limits re-renders to changes in those specific properties, improving performance and following the established pattern throughout the codebase.Proposed refactor
📝 Committable suggestion
🤖 Prompt for AI Agents