V2Wizard: Add "clear" to package search
This adds a "clear" button to the package search input. The button appears only when there is already a searchTerm in the input.
This commit is contained in:
parent
603362972b
commit
160381908a
1 changed files with 16 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ import {
|
|||
HelpIcon,
|
||||
OptimizeIcon,
|
||||
SearchIcon,
|
||||
TimesIcon,
|
||||
} from '@patternfly/react-icons';
|
||||
import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
|
||||
import { useDispatch } from 'react-redux';
|
||||
|
|
@ -613,6 +614,10 @@ const Packages = () => {
|
|||
setSearchTerm(selection);
|
||||
};
|
||||
|
||||
const handleClear = async () => {
|
||||
setSearchTerm('');
|
||||
};
|
||||
|
||||
const handleSelect = (
|
||||
pkg: IBPackageWithRepositoryInfo,
|
||||
_: number,
|
||||
|
|
@ -886,6 +891,17 @@ const Packages = () => {
|
|||
onChange={handleSearch}
|
||||
/>
|
||||
</InputGroupItem>
|
||||
{searchTerm && (
|
||||
<InputGroupItem>
|
||||
<Button
|
||||
variant="control"
|
||||
aria-label="clear-package-search"
|
||||
onClick={handleClear}
|
||||
icon={<TimesIcon />}
|
||||
ouiaId="clear-package-search-button"
|
||||
/>
|
||||
</InputGroupItem>
|
||||
)}
|
||||
</InputGroup>
|
||||
</ToolbarItem>
|
||||
<ToolbarItem>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue