Skip to content

Commit

Permalink
remove modal for discover redirection (opensearch-project#1543)
Browse files Browse the repository at this point in the history
Signed-off-by: Eric <[email protected]>
  • Loading branch information
mengweieric authored Mar 16, 2024
1 parent ecb8fb3 commit f095910
Showing 1 changed file with 1 addition and 40 deletions.
41 changes: 1 addition & 40 deletions public/components/common/search/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiIcon,
EuiModal,
EuiModalBody,
EuiModalFooter,
EuiModalHeader,
EuiModalHeaderTitle,
EuiPopover,
EuiPopoverFooter,
EuiText,
Expand Down Expand Up @@ -139,9 +134,6 @@ export const Search = (props: any) => {
const sqlService = new SQLService(coreRefs.http);
const { application } = coreRefs;
const [nlqInput, setNlqInput] = useState('');
const [isModalVisible, setIsModalVisible] = useState(false);
const closeModal = () => setIsModalVisible(false);
const showModal = () => setIsModalVisible(true);

const showQueryArea = !appLogEvents && coreRefs.queryAssistEnabled;

Expand Down Expand Up @@ -205,7 +197,7 @@ export const Search = (props: any) => {

const handleQueryLanguageChange = (lang: string) => {
if (lang === QUERY_LANGUAGE.DQL) {
showModal();
redirectToDiscover();
return;
}
dispatch(
Expand Down Expand Up @@ -316,36 +308,6 @@ export const Search = (props: any) => {
application!.navigateToUrl('../app/data-explorer/discover');
};

let redirectionModal = null;
if (isModalVisible) {
redirectionModal = (
<EuiModal onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Open in Discover</h1>
</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
<EuiText>
The OpenSearch Dashboards Query Language (DQL) offers a simplified query syntax and
support for scripted fields. Selecting this option will open the Discover application.
</EuiText>
</EuiModalBody>
<EuiModalFooter>
<EuiButtonEmpty onClick={closeModal}>Cancel</EuiButtonEmpty>
<EuiButton
onClick={() => {
redirectToDiscover();
}}
fill
>
Open in Discover
</EuiButton>
</EuiModalFooter>
</EuiModal>
);
}

return (
<div className="globalQueryBar">
<EuiFlexGroup direction="column" gutterSize="s">
Expand Down Expand Up @@ -594,7 +556,6 @@ export const Search = (props: any) => {
</>
)}
</EuiFlexGroup>
{redirectionModal}
{flyout}
</div>
);
Expand Down

0 comments on commit f095910

Please sign in to comment.