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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2144448
latest
d88bb6b
latest
740644b
latest
658bf0f
latest
0cf2801
saving
17e0c26
latest
1ac83b1
latest
8d0e7f6
latest
e125f6f
latest
2d5beb6
latest
6cfdb86
fix lint
eae67a6
Merge branch 'main' into num
davemarco cf476f5
latest
83ce6db
Merge branch 'main' into num
davemarco ef93fb2
hello
4792bf0
merge
71644fb
remove en
5edc36a
revert
1f2c938
Merge branch 'main' into num
davemarco 6452d31
accident
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
8 changes: 8 additions & 0 deletions
8
components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/index.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
41 changes: 41 additions & 0 deletions
41
components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
following our latest (undocumented yet - sorry!) Zustand practices, Zustand actions that do not perform more actions than state settings should be prefixed with
setinstead ofupdate. This is fine to leave in the current PR, but we should address such in a future Zustand refactoring PR.