From 9f068b30c13b2622c494e9c2272bc4e778c1a18f Mon Sep 17 00:00:00 2001 From: Paul Sebastian Date: Tue, 19 Mar 2024 15:14:48 -0700 Subject: [PATCH 1/2] add callout for s3 datasources Signed-off-by: Paul Sebastian --- .../explorer/log_explorer.scss | 4 + .../event_analytics/explorer/no_results.tsx | 75 ++++++++++++++++--- 2 files changed, 68 insertions(+), 11 deletions(-) diff --git a/public/components/event_analytics/explorer/log_explorer.scss b/public/components/event_analytics/explorer/log_explorer.scss index f8c25dac7..823c18f6d 100644 --- a/public/components/event_analytics/explorer/log_explorer.scss +++ b/public/components/event_analytics/explorer/log_explorer.scss @@ -32,4 +32,8 @@ .search-area { position: relative; +} + +pre.euiCodeBlock__pre.euiCodeBlock__pre--whiteSpacePreWrap { + margin-bottom: 0; } \ No newline at end of file diff --git a/public/components/event_analytics/explorer/no_results.tsx b/public/components/event_analytics/explorer/no_results.tsx index 272417f7f..94fd1e7fd 100644 --- a/public/components/event_analytics/explorer/no_results.tsx +++ b/public/components/event_analytics/explorer/no_results.tsx @@ -4,7 +4,10 @@ */ import { + EuiButtonIcon, EuiCallOut, + EuiCodeBlock, + EuiCopy, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, @@ -19,12 +22,18 @@ import { useSelector } from 'react-redux'; import { coreRefs } from '../../../framework/core_refs'; import { selectQueryAssistantSummarization } from '../redux/slices/query_assistant_summarization_slice'; import { selectQueries } from '../redux/slices/query_slice'; +import { selectSearchMetaData } from '../redux/slices/search_meta_data_slice'; +import { DATA_SOURCE_TYPES, QUERY_LANGUAGE } from '../../../../common/constants/data_sources'; export const NoResults = ({ tabId }: any) => { // get the queries isLoaded, if it exists AND is true = show no res const queryInfo = useSelector(selectQueries)[tabId]; const summaryData = useSelector(selectQueryAssistantSummarization)[tabId]; const queryAssistLoading = summaryData.loading; + const explorerSearchMeta = useSelector(selectSearchMetaData)[tabId]; + + const datasourceName = explorerSearchMeta?.datasources[0]?.name; + const languageInUse = explorerSearchMeta?.lang; return ( @@ -81,17 +90,61 @@ export const NoResults = ({ tabId }: any) => { ) : ( - - } - color="warning" - iconType="help" - data-test-subj="observabilityNoResultsCallout" - /> + {explorerSearchMeta?.datasources[0]?.type === DATA_SOURCE_TYPES.S3Glue ? ( + + } + color="warning" + iconType="help" + data-test-subj="observabilityNoResultsCallout" + > + {languageInUse === QUERY_LANGUAGE.SQL ? ( + + +

Explore Databases

+ + {`SHOW SCHEMAS IN ${datasourceName}`} + +
+ +

Explore Tables

+ + {`SHOW TABLES EXTENDED IN ${datasourceName}. LIKE '*'`} + +
+ +

Sample Query

+ + {`SELECT * FROM ${datasourceName}.. LIMIT 10`} + + + + ) : ( + <> +

Sample Query

+ + {`source = ${datasourceName}..
| head 10`} + + + )} + + ) : ( + + } + color="warning" + iconType="help" + data-test-subj="observabilityNoResultsCallout" + /> + )} From b1e800377451fb2dc46e9f92435a79a355878085 Mon Sep 17 00:00:00 2001 From: Paul Sebastian Date: Tue, 19 Mar 2024 15:28:54 -0700 Subject: [PATCH 2/2] fix linting Signed-off-by: Paul Sebastian --- public/components/event_analytics/explorer/no_results.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/components/event_analytics/explorer/no_results.tsx b/public/components/event_analytics/explorer/no_results.tsx index 5ee05d191..403fe6d74 100644 --- a/public/components/event_analytics/explorer/no_results.tsx +++ b/public/components/event_analytics/explorer/no_results.tsx @@ -4,10 +4,8 @@ */ import { - EuiButtonIcon, EuiCallOut, EuiCodeBlock, - EuiCopy, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem,