-
Notifications
You must be signed in to change notification settings - Fork 917
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to search on index fields Signed-off-by: Abbas Hussain <[email protected]>
- Loading branch information
Showing
3 changed files
with
73 additions
and
14 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/plugins/wizard/public/application/components/data_tab/field_search.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,47 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@osd/i18n'; | ||
import { EuiFieldSearch, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; | ||
import { setSearchField } from '../../utils/state_management/datasource_slice'; | ||
import { useTypedDispatch } from '../../utils/state_management'; | ||
|
||
export interface Props { | ||
/** | ||
* the input value of the user | ||
*/ | ||
value?: string; | ||
} | ||
|
||
/** | ||
* Component is Wizard's side bar to search of available fields | ||
* Additionally there's a button displayed that allows the user to show/hide more filter fields | ||
*/ | ||
export function FieldSearch({ value }: Props) { | ||
const searchPlaceholder = i18n.translate('wizard.fieldChooser.searchPlaceHolder', { | ||
defaultMessage: 'Search field names', | ||
}); | ||
|
||
const dispatch = useTypedDispatch(); | ||
|
||
return ( | ||
<React.Fragment> | ||
<EuiFlexGroup responsive={false} gutterSize={'s'}> | ||
<EuiFlexItem> | ||
<EuiFieldSearch | ||
aria-label={searchPlaceholder} | ||
data-test-subj="fieldFilterSearchInput" | ||
compressed | ||
fullWidth | ||
onChange={(event) => dispatch(setSearchField(event.currentTarget.value))} | ||
placeholder={searchPlaceholder} | ||
value={value} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</React.Fragment> | ||
); | ||
} |
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