From 52c36b95bfb78305e335e8cf2814718e99cc2a46 Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Tue, 24 Sep 2024 18:52:48 +0000 Subject: [PATCH] Revert "[Look&Feel] Updated Discover No Results panel (#7891) (#8224)" This reverts commit 10bb541a7f9321d49aac875a62c5ff5d257c9bd1. --- changelogs/fragments/7891.yml | 2 - .../components/no_results/no_results.tsx | 304 ++++++++++-------- 2 files changed, 163 insertions(+), 143 deletions(-) delete mode 100644 changelogs/fragments/7891.yml diff --git a/changelogs/fragments/7891.yml b/changelogs/fragments/7891.yml deleted file mode 100644 index 6300c0905a55..000000000000 --- a/changelogs/fragments/7891.yml +++ /dev/null @@ -1,2 +0,0 @@ -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 2c64bd6a0412..90804ba23260 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,11 +28,19 @@ * under the License. */ -import React from 'react'; -import { I18nProvider } from '@osd/i18n/react'; +import React, { Fragment } from 'react'; +import { FormattedMessage, I18nProvider } from '@osd/i18n/react'; -import { EuiEmptyPrompt, EuiPanel, EuiText } from '@elastic/eui'; -import { i18n } from '@osd/i18n'; +import { + EuiCallOut, + EuiCode, + EuiDescriptionList, + EuiLink, + EuiPanel, + EuiSpacer, + EuiText, +} from '@elastic/eui'; +import { getServices } from '../../../opensearch_dashboards_services'; interface Props { timeFieldName?: string; @@ -40,150 +48,164 @@ interface Props { } export const DiscoverNoResults = ({ timeFieldName, queryLanguage }: Props) => { - // 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 = ( - // - // - // - // - //

- // - //

- // - //

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

- //
- // - // - // - // - // - // - //
- // ); - // } + 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 = ( + + + + +

+ +

+ +

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

+
+ + + + + + +
+ ); + } 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}
);