-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ui: Add search block UI #4444
Merged
Merged
ui: Add search block UI #4444
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
739e792
ui: Add block search feature
adzshaf 243acd8
fix: fis props on source view test
adzshaf dcfc9d9
ui: add build from search ui
adzshaf 667184e
fix(search block): fix code reviews on pr
adzshaf e05ed00
build(search block): build assets
adzshaf 3ede8bd
docs(search block): add changelog
adzshaf 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 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
Large diffs are not rendered by default.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
pkg/ui/react-app/src/thanos/pages/blocks/BlockSearchInput.tsx
This file contains 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,31 @@ | ||
import React, { FC, ChangeEvent } from 'react'; | ||
import { Button, InputGroup, InputGroupAddon, InputGroupText, Input, Form } from 'reactstrap'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faSearch } from '@fortawesome/free-solid-svg-icons'; | ||
import styles from './blocks.module.css'; | ||
|
||
interface BlockSearchInputProps { | ||
onChange: ({ target }: ChangeEvent<HTMLInputElement>) => void; | ||
onClick: () => void; | ||
defaultValue: string; | ||
} | ||
|
||
export const BlockSearchInput: FC<BlockSearchInputProps> = ({ onChange, onClick, defaultValue }) => { | ||
return ( | ||
<Form onSubmit={(e) => e.preventDefault()}> | ||
<InputGroup className={styles.blockInput}> | ||
<InputGroupAddon addonType="prepend"> | ||
<InputGroupText> | ||
<FontAwesomeIcon icon={faSearch} /> | ||
</InputGroupText> | ||
</InputGroupAddon> | ||
<Input placeholder="Search block by ulid" onChange={onChange} defaultValue={defaultValue} /> | ||
<InputGroupAddon addonType="append"> | ||
<Button className="execute-btn" color="primary" onClick={onClick} type="submit"> | ||
Search | ||
</Button> | ||
</InputGroupAddon> | ||
</InputGroup> | ||
</Form> | ||
); | ||
}; |
This file contains 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 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 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 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 |
---|---|---|
|
@@ -190,3 +190,7 @@ | |
.level-6 { | ||
background: var(--level-6); | ||
} | ||
|
||
.blockInput { | ||
margin-bottom: 12px; | ||
} |
This file contains 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.
I spoke with @adzshaf and mentioned that I think this could produce confusing experience for the user. If I provide full-length ULID that matches a block name exactly, but fuzzy search returns more than one result, then I would be very confused and asume that all of the blocks have the same name, which should not really be happening. I think it's fair to return multiple blocks if the ULID does not match any block exactly, i.e. it is not full-length or has a typo.
We can do this in a follow up of course, since this UI already provides a ton of value.