-
Notifications
You must be signed in to change notification settings - Fork 934
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: abbyhu2000 <[email protected]>
- Loading branch information
1 parent
f9965cd
commit 088d35d
Showing
39 changed files
with
192 additions
and
192 deletions.
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
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 |
---|---|---|
|
@@ -35,4 +35,5 @@ export { | |
LanguageService, | ||
LanguageConfig, | ||
EditorEnhancements, | ||
QueryControl, | ||
} from './language_service'; |
78 changes: 78 additions & 0 deletions
78
src/plugins/data/public/query/query_string/language_service/default_language_reference.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,78 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { i18n } from '@osd/i18n'; | ||
|
||
import { EuiButtonIcon, EuiLink, EuiPopover, EuiPopoverTitle, EuiText } from '@elastic/eui'; | ||
|
||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { IDataPluginServices } from '../../../types'; | ||
import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public'; | ||
|
||
export const DefaultLanguageReference = () => { | ||
const opensearchDashboards = useOpenSearchDashboards<IDataPluginServices>(); | ||
const [isLanguageReferenceOpen, setIsLanguageReferenceOpen] = React.useState(false); | ||
const osdDQLDocs = opensearchDashboards.services.docLinks?.links.opensearchDashboards.dql.base; | ||
const dqlFullName = ( | ||
<FormattedMessage | ||
id="data.query.queryBar.dqlFullLanguageName" | ||
defaultMessage="OpenSearch Dashboards Query Language" | ||
/> | ||
); | ||
|
||
const button = ( | ||
<div> | ||
<EuiButtonIcon | ||
iconType={'iInCircle'} | ||
aria-label={i18n.translate('discover.queryControls.languageReference', { | ||
defaultMessage: `Language Reference`, | ||
})} | ||
onClick={() => setIsLanguageReferenceOpen(!isLanguageReferenceOpen)} | ||
/> | ||
</div> | ||
); | ||
|
||
return ( | ||
<EuiPopover | ||
id="languageReferencePopover" | ||
button={button} | ||
isOpen={isLanguageReferenceOpen} | ||
closePopover={() => setIsLanguageReferenceOpen(false)} | ||
panelPaddingSize="s" | ||
anchorPosition="downLeft" | ||
anchorClassName="euiFormControlLayout__append" | ||
> | ||
<EuiPopoverTitle> | ||
<FormattedMessage | ||
id="data.query.queryBar.syntaxOptionsTitle" | ||
defaultMessage="Syntax options" | ||
/> | ||
</EuiPopoverTitle> | ||
<div style={{ width: '350px' }}> | ||
<EuiText size="s"> | ||
<p> | ||
<FormattedMessage | ||
id="data.query.queryBar.syntaxOptionsDescription" | ||
defaultMessage="The {docsLink} (DQL) offers a simplified query | ||
syntax and support for scripted fields." | ||
values={{ | ||
docsLink: ( | ||
<EuiLink href={osdDQLDocs} target="_blank"> | ||
{dqlFullName} | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</p> | ||
</EuiText> | ||
</div> | ||
</EuiPopover> | ||
); | ||
}; | ||
|
||
export const createDefaultLanguageReference = () => { | ||
return <DefaultLanguageReference />; | ||
}; |
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
Oops, something went wrong.