From f236430833d7071f29117c7a5355ee527d59356a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Sep 2024 23:04:48 +0000 Subject: [PATCH] [Look&Feel] Updated Discover No Results panel (#7891) * Empty Prompt changes Signed-off-by: Dan Dong Update src/plugins/discover/public/application/components/no_results/no_results.tsx Co-authored-by: Miki Signed-off-by: Dan Dong <58446449+danieldong51@users.noreply.github.com> Updated Discover No Results panel Signed-off-by: Dan Dong * Changeset file for PR #7891 created/updated * Changes for Cypress tests Signed-off-by: Dan Dong * Added localization Signed-off-by: Dan Dong --------- Signed-off-by: Dan Dong Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 5d1c21bd923fc18ac08fb223e3abf6bea9141c05) Signed-off-by: github-actions[bot] --- changelogs/fragments/7891.yml | 2 + .../components/no_results/no_results.tsx | 304 ++++++++---------- 2 files changed, 143 insertions(+), 163 deletions(-) create mode 100644 changelogs/fragments/7891.yml diff --git a/changelogs/fragments/7891.yml b/changelogs/fragments/7891.yml new file mode 100644 index 000000000000..6300c0905a55 --- /dev/null +++ b/changelogs/fragments/7891.yml @@ -0,0 +1,2 @@ +refactor: +- [Look&Feel] Updated Discover No Results panel ([#7891](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7891)) \ No newline at end of file diff --git a/src/plugins/discover/public/application/components/no_results/no_results.tsx b/src/plugins/discover/public/application/components/no_results/no_results.tsx index 90804ba23260..2c64bd6a0412 100644 --- a/src/plugins/discover/public/application/components/no_results/no_results.tsx +++ b/src/plugins/discover/public/application/components/no_results/no_results.tsx @@ -28,19 +28,11 @@ * under the License. */ -import React, { Fragment } from 'react'; -import { FormattedMessage, I18nProvider } from '@osd/i18n/react'; +import React from 'react'; +import { I18nProvider } from '@osd/i18n/react'; -import { - EuiCallOut, - EuiCode, - EuiDescriptionList, - EuiLink, - EuiPanel, - EuiSpacer, - EuiText, -} from '@elastic/eui'; -import { getServices } from '../../../opensearch_dashboards_services'; +import { EuiEmptyPrompt, EuiPanel, EuiText } from '@elastic/eui'; +import { i18n } from '@osd/i18n'; interface Props { timeFieldName?: string; @@ -48,164 +40,150 @@ interface Props { } export const DiscoverNoResults = ({ timeFieldName, queryLanguage }: Props) => { - let timeFieldMessage; - - if (timeFieldName) { - timeFieldMessage = ( - - - - -

- -

- -

- -

-
-
- ); - } - - let luceneQueryMessage; - - if (queryLanguage === 'lucene') { - const searchExamples = [ - { - description: 200, - title: ( - - - - - - ), - }, - { - description: status:200, - title: ( - - - - - - ), - }, - { - description: status:[400 TO 499], - title: ( - - - - - - ), - }, - { - description: status:[400 TO 499] AND extension:PHP, - title: ( - - - - - - ), - }, - { - description: status:[400 TO 499] AND (extension:php OR extension:html), - title: ( - - - - - - ), - }, - ]; - - luceneQueryMessage = ( - - - - -

- -

- -

- - - - ), - }} - /> -

-
- - - - - - -
- ); - } + // Commented out due to no usage in code + // See: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/8149 + // + // let luceneQueryMessage; + // + // if (queryLanguage === 'lucene') { + // const searchExamples = [ + // { + // description: 200, + // title: ( + // + // + // + // + // + // ), + // }, + // { + // description: status:200, + // title: ( + // + // + // + // + // + // ), + // }, + // { + // description: status:[400 TO 499], + // title: ( + // + // + // + // + // + // ), + // }, + // { + // description: status:[400 TO 499] AND extension:PHP, + // title: ( + // + // + // + // + // + // ), + // }, + // { + // description: status:[400 TO 499] AND (extension:php OR extension:html), + // title: ( + // + // + // + // + // + // ), + // }, + // ]; + // + // luceneQueryMessage = ( + // + // + // + // + //

+ // + //

+ // + //

+ // + // + // + // ), + // }} + // /> + //

+ //
+ // + // + // + // + // + // + //
+ // ); + // } return ( - + +

+ {i18n.translate('discover.emptyPrompt.title', { + defaultMessage: 'No Results', + })} +

+
+ } + body={ + +

+ {i18n.translate('discover.emptyPrompt.body', { + defaultMessage: + 'Try selecting a different data source, expanding your time range or modifying the query & filters.', + })} +

+
} - color="warning" - iconType="help" - data-test-subj="discoverNoResults" /> - {timeFieldMessage} - {luceneQueryMessage}
);