forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[discover] Query editor UI clean up (opensearch-project#7896)
* follow up Signed-off-by: abbyhu2000 <[email protected]> * address comments Signed-off-by: abbyhu2000 <[email protected]> * Changeset file for PR opensearch-project#7896 created/updated --------- Signed-off-by: abbyhu2000 <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
3c5a506
commit ea96379
Showing
36 changed files
with
192 additions
and
190 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fix: | ||
- Query editor UI clean up ([#7896](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7896)) |
77 changes: 77 additions & 0 deletions
77
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,77 @@ | ||
/* | ||
* 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
Oops, something went wrong.