Repository navigation
feat(new-webui): Adds search job ID and number of search results to search page. #962
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 15 commits
2144448
d88bb6b
740644b
658bf0f
0cf2801
17e0c26
1ac83b1
8d0e7f6
e125f6f
2d5beb6
6cfdb86
eae67a6
cf476f5
83ce6db
ef93fb2
4792bf0
71644fb
5edc36a
1f2c938
6452d31
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,4 +1,4 @@ | ||
| { | ||
| "MongoDbSearchResultsMetadataCollectionName": "results-metadata", | ||
| "ClpStorageEngine": "clp" | ||
| "ClpStorageEngine": "clp-s" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import {useMemo} from "react"; | ||
|
|
||
| import { | ||
| GetProps, | ||
| Typography, | ||
| } from "antd"; | ||
|
|
||
| import useSearchStore from "../SearchState/index"; | ||
| import {SEARCH_UI_STATE} from "../SearchState/typings"; | ||
|
|
||
|
|
||
| const {Text} = Typography; | ||
| type TextTypes = GetProps<typeof Text>["type"]; | ||
|
|
||
|
|
||
| /** | ||
| * Displays the number of search results. | ||
| * | ||
| * @return | ||
| */ | ||
| const Results = () => { | ||
| const numSearchResultsTimeline = useSearchStore((state) => state.numSearchResultsTimeline); | ||
| const numSearchResultsTable = useSearchStore((state) => state.numSearchResultsTable); | ||
| const searchUiState = useSearchStore((state) => state.searchUiState); | ||
|
|
||
| // Number of results is the maximum of the number of results in the timeline and table. The | ||
| // timeline may have more results since the table results are capped. Having two sources may | ||
| // provide more timely updates to the user. | ||
| const numResults = useMemo( | ||
| () => Math.max(numSearchResultsTimeline, numSearchResultsTable), | ||
| [ | ||
| numSearchResultsTimeline, | ||
| numSearchResultsTable, | ||
| ] | ||
| ); | ||
|
|
||
| let textType: TextTypes; | ||
| switch (searchUiState) { | ||
| case SEARCH_UI_STATE.QUERYING: | ||
| textType = "warning"; | ||
| break; | ||
| case SEARCH_UI_STATE.DEFAULT: | ||
| case SEARCH_UI_STATE.QUERY_ID_PENDING: | ||
| textType = "secondary"; | ||
| break; | ||
| case SEARCH_UI_STATE.DONE: | ||
| textType = "success"; | ||
| break; | ||
| default: | ||
| textType = "secondary"; | ||
| } | ||
|
|
||
| return ( | ||
| <Text | ||
| strong={true} | ||
| type={textType} | ||
| > | ||
| {numResults} | ||
| </Text> | ||
| ); | ||
| }; | ||
|
|
||
| export default Results; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .status { | ||
| margin-left: 2px; | ||
| margin-top: 4px; | ||
| } | ||
|
|
||
| .badge { | ||
| padding-bottom: 4px; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import {Typography} from "antd"; | ||
|
|
||
| import useSearchStore from "../SearchState/index"; | ||
| import {SEARCH_UI_STATE} from "../SearchState/typings"; | ||
| import styles from "./index.module.css"; | ||
| import Results from "./Results"; | ||
|
|
||
|
|
||
| const {Text} = Typography; | ||
|
|
||
| /** | ||
| * Displays the search job ID and the number of results found. | ||
| * | ||
| * @return | ||
| */ | ||
| const SearchQueryStatus = () => { | ||
| const { | ||
| searchJobId, | ||
| searchUiState, | ||
| } = useSearchStore(); | ||
|
|
||
| return ( | ||
| <div className={styles["status"]}> | ||
| {(searchUiState === SEARCH_UI_STATE.QUERYING || | ||
| searchUiState === SEARCH_UI_STATE.DONE) && ( | ||
| <Text type={"secondary"}> | ||
| Search job # | ||
| {searchJobId} | ||
| {" "} | ||
| found | ||
| {" "} | ||
| </Text> | ||
| )} | ||
| <Results/> | ||
| <Text type={"secondary"}> results</Text> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
|
|
||
| export default SearchQueryStatus; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ import {SEARCH_UI_STATE} from "./typings"; | |
| */ | ||
| const SEARCH_STATE_DEFAULT = Object.freeze({ | ||
| aggregationJobId: null, | ||
| numSearchResultsTable: 0, | ||
| numSearchResultsTimeline: 0, | ||
| queryIsCaseSensitive: false, | ||
| queryString: "", | ||
| searchJobId: null, | ||
|
|
@@ -32,6 +34,16 @@ interface SearchState { | |
| */ | ||
| aggregationJobId: string | null; | ||
|
|
||
| /** | ||
| * The number of search table results. | ||
| */ | ||
| numSearchResultsTable: number; | ||
|
|
||
| /** | ||
| * The number of timeline results. | ||
| */ | ||
| numSearchResultsTimeline: number; | ||
|
|
||
| /** | ||
| * Whether the query is case sensitive. | ||
| */ | ||
|
|
@@ -70,6 +82,8 @@ interface SearchState { | |
| timelineConfig: TimelineConfig; | ||
|
|
||
| updateAggregationJobId: (id: string | null) => void; | ||
|
Member
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. following our latest (undocumented yet - sorry!) Zustand practices, Zustand actions that do not perform more actions than state settings should be prefixed with |
||
| updateNumSearchResultsTable: (num: number) => void; | ||
| updateNumSearchResultsTimeline: (num: number) => void; | ||
| updateQueryIsCaseSensitive: (newValue: boolean) => void; | ||
| updateQueryString: (query: string) => void; | ||
| updateSearchJobId: (id: string | null) => void; | ||
|
|
@@ -84,6 +98,12 @@ const useSearchStore = create<SearchState>((set) => ({ | |
| updateAggregationJobId: (id) => { | ||
| set({aggregationJobId: id}); | ||
| }, | ||
| updateNumSearchResultsTable: (num) => { | ||
| set({numSearchResultsTable: num}); | ||
| }, | ||
| updateNumSearchResultsTimeline: (num) => { | ||
| set({numSearchResultsTimeline: num}); | ||
| }, | ||
| updateQueryIsCaseSensitive: (newValue: boolean) => { | ||
| set({queryIsCaseSensitive: newValue}); | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,4 +48,5 @@ const useResultsMetadata = () => { | |
| return resultsMetadata; | ||
| }; | ||
|
|
||
|
|
||
|
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) Remove unnecessary blank line before export The blank line added at line 51 serves no functional purpose and may introduce trailing whitespace. Please remove it to keep formatting consistent. 🤖 Prompt for AI Agents |
||
| export {useResultsMetadata}; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,6 @@ | |
| NODE_ENV=production | ||
|
|
||
| HOST=localhost | ||
| PORT=3000 | ||
| PORT=3001 | ||
| CLP_DB_USER=clp-user | ||
| CLP_DB_PASS= | ||
| CLP_DB_PASS=qO55i66GEUs | ||
|
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. Avoid committing sensitive credentials. 🧰 Tools🪛 dotenv-linter (3.3.0)[warning] 9-9: [UnorderedKey] The CLP_DB_PASS key should go before the CLP_DB_USER key 🤖 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
Verify storage engine configuration update.
Changing
"ClpStorageEngine"from"clp"to"clp-s"must be supported by the backend and all references in code and documentation updated accordingly.Run this script to ensure no stale references remain:
🏁 Script executed:
Length of output: 315
Fix default ClpStorageEngine in webui settings and verify backend support
The search still shows a hardcoded
"ClpStorageEngine": "clp"in your WebUI defaults. Please update that value and confirm the backend handles the new engine ID everywhere.• components/webui/settings.json (line 14): change
"ClpStorageEngine": "clp"→"ClpStorageEngine": "clp-s"• components/log-viewer-webui/client/settings.json is already set to
"clp-s"• components/clp-package-utils/clp_package_utils/scripts/start_clp.py (line 878): verify
storage_enginecan be"clp-s"• Review any documentation or README files for lingering “clp” references and update accordingly
🤖 Prompt for AI Agents