From 4bc9fc91aaa79065eca86a724d3e11e1035c8cb6 Mon Sep 17 00:00:00 2001 From: Dan Dong Date: Wed, 28 Aug 2024 11:58:07 -0700 Subject: [PATCH] Updated Discover No Results panel Signed-off-by: Dan Dong --- .../components/no_results/no_results.tsx | 189 ++---------------- .../view_components/canvas/index.tsx | 4 +- 2 files changed, 20 insertions(+), 173 deletions(-) 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..fa4bed405400 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,184 +28,33 @@ * 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'; - -interface Props { - timeFieldName?: string; - queryLanguage?: string; -} - -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 = ( - - - - -

- -

- -

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

-
- - - - - - -
- ); - } +import { EuiEmptyPrompt, EuiPanel, EuiText } from '@elastic/eui'; +export const DiscoverNoResults = () => { return ( - + +

No results

+
+ } + body={ + +

+ Try selecting a different data source, expanding your time range or modifying the + query & filters. You may also use the Query Assistant to fine-tune your query using + simple conversational prompts. +

+
} - color="warning" - iconType="help" - data-test-subj="discoverNoResults" /> - {timeFieldMessage} - {luceneQueryMessage}
); diff --git a/src/plugins/discover/public/application/view_components/canvas/index.tsx b/src/plugins/discover/public/application/view_components/canvas/index.tsx index a44ac89c5d62..a70d20e4fdd8 100644 --- a/src/plugins/discover/public/application/view_components/canvas/index.tsx +++ b/src/plugins/discover/public/application/view_components/canvas/index.tsx @@ -141,9 +141,7 @@ export default function DiscoverCanvas({ setHeaderActionMenu, history, optionalR showSaveQuery={showSaveQuery} /> - {fetchState.status === ResultStatus.NO_RESULTS && ( - - )} + {fetchState.status === ResultStatus.NO_RESULTS && } {fetchState.status === ResultStatus.UNINITIALIZED && ( refetch$.next()} /> )}