Skip to content

Commit

Permalink
Fix "See some examples" requires non-empty query [BUG] (opensearch-pr…
Browse files Browse the repository at this point in the history
…oject#82)

* fix: Style conflict

Signed-off-by: Mingkun Ma <[email protected]>

* Add label to search button

Signed-off-by: Mingkun Ma <[email protected]>

* fix: Default tab spacing in query box

Signed-off-by: Mingkun Ma <[email protected]>

* fix: Query Box on blur issue

Signed-off-by: Mingkun Ma <[email protected]>

* feat: Add default query

Signed-off-by: Mingkun Ma <[email protected]>

Signed-off-by: Mingkun Ma <[email protected]>
Co-authored-by: Mingkun Ma <[email protected]>
  • Loading branch information
mingkunm and Mingkun Ma authored Nov 8, 2022
1 parent 65cb2b1 commit 047700f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 4 additions & 2 deletions public/components/query_compare/search_result/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import { SearchResults, QueryError, QueryStringError } from '../../../types/inde
import { ResultComponents } from './result_components/result_components';
import { useSearchRelevanceContext, initialQueryErrorState } from '../../../contexts';

const DEFAULT_QUERY = '{}';

interface SearchResultProps {
http: CoreStart['http'];
}

export const SearchResult = ({ http }: SearchResultProps) => {
const [queryString1, setQueryString1] = useState('');
const [queryString2, setQueryString2] = useState('');
const [queryString1, setQueryString1] = useState(DEFAULT_QUERY);
const [queryString2, setQueryString2] = useState(DEFAULT_QUERY);
const [queryResult1, setQueryResult1] = useState<SearchResults>({} as any);
const [queryResult2, setQueryResult2] = useState<SearchResults>({} as any);
const [searchBarValue, setSearchBarValue] = useState('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ export const SearchConfig: FunctionComponent<SearchConfigProps> = ({
label="Query"
error={!!queryError.queryString.length && <span>{queryError.queryString}</span>}
isInvalid={!!queryError.queryString.length}
labelAppend={
<EuiText size="xs">
<EuiButtonEmpty size="xs" color="primary" onClick={() => setShowFlyout(true)}>
Help
</EuiButtonEmpty>
</EuiText>
}
>
<EuiCodeEditor
mode="json"
Expand All @@ -130,16 +137,7 @@ export const SearchConfig: FunctionComponent<SearchConfigProps> = ({
<EuiText>
<p style={{ fontSize: '14px', fontWeight: '400', lineHeight: '18px' }}>
Enter a query in OpenSearch Query DSL. Use %SearchText% to refer to the text in the search
bar. Need more help?{' '}
<EuiButtonEmpty
size="xs"
color="primary"
onClick={() => setShowFlyout(true)}
style={{ margin: '0 -8px' }}
>
See some examples
</EuiButtonEmpty>
.
bar.
</p>
</EuiText>
</>
Expand Down

0 comments on commit 047700f

Please sign in to comment.