From 256eeda3e34148eda5dcbc13fcafc475887df0b7 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 16:02:03 -0700 Subject: [PATCH] Fixed bugs in explorer redirection (#1609) (#1624) * allow for redirection in associated objects skipping indices * redirection in datasources table implemented * moderate s3 callout changes * lint complaint * update snap * fix discover to explorer url redirection * include glue cache s3 callout * update snapshot * expand text area max length * s3 no results page updated implementation * open up acceleration flyout when direct query visualization * update snapshots * update one last snap * fix lint complaint for a file i didnt even touch --------- (cherry picked from commit faf9c239b2edb04b4806c50e9e8dbf34c8a887f7) Signed-off-by: Paul Sebastian Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- common/constants/autocomplete.ts | 2 + common/types/data_connections.ts | 5 +- .../__snapshots__/create.test.tsx.snap | 32 +-- .../__snapshots__/log_config.test.tsx.snap | 8 +- .../__snapshots__/search.test.tsx.snap | 4 +- .../components/common/search/autocomplete.tsx | 3 +- .../custom_panel_view.test.tsx.snap | 12 +- .../custom_panel_view_so.test.tsx.snap | 6 +- .../associated_objects_tab.test.tsx.snap | 40 +++ .../associated_objects_tab.tsx | 5 +- .../modules/associated_objects_table.tsx | 4 +- .../utils/associated_objects_tab_utils.tsx | 11 + .../components/manage/data_connection.tsx | 11 +- .../manage/manage_data_connections_table.tsx | 10 +- .../__snapshots__/no_results.test.tsx.snap | 210 +++++++------- .../datasources/datasources_selection.tsx | 11 +- .../event_analytics/explorer/explorer.tsx | 48 ++-- .../event_analytics/explorer/no_results.tsx | 262 +++++++++++++----- .../sidebar/observability_sidebar.tsx | 8 +- .../visualizations/direct_query_vis.tsx | 12 +- 20 files changed, 435 insertions(+), 269 deletions(-) diff --git a/common/constants/autocomplete.ts b/common/constants/autocomplete.ts index b8c1c41b95..46b82d3f5e 100644 --- a/common/constants/autocomplete.ts +++ b/common/constants/autocomplete.ts @@ -6,6 +6,8 @@ import { BaseItem } from '@algolia/autocomplete-core'; +export const textAreaMaxLength = 16384; + export const firstCommand = [{ label: 'source' }]; export const pipeCommands = [ diff --git a/common/types/data_connections.ts b/common/types/data_connections.ts index b5f2a4ec88..249531f911 100644 --- a/common/types/data_connections.ts +++ b/common/types/data_connections.ts @@ -35,11 +35,12 @@ export interface Acceleration { } export interface AssociatedObject { + tableName: string; datasource: string; id: string; name: string; database: string; - type: AccelerationIndexType | 'table'; + type: AssociatedObjectIndexType; accelerations: CachedAcceleration[]; columns?: CachedColumn[]; } @@ -86,6 +87,8 @@ export interface AsyncApiResponse { export type PollingCallback = (statusObj: AsyncApiResponse) => void; +export type AssociatedObjectIndexType = AccelerationIndexType | 'table'; + export type AccelerationIndexType = 'skipping' | 'covering' | 'materialized'; export type LoadCacheType = 'databases' | 'tables' | 'accelerations' | 'tableColumns'; diff --git a/public/components/application_analytics/__tests__/__snapshots__/create.test.tsx.snap b/public/components/application_analytics/__tests__/__snapshots__/create.test.tsx.snap index e7c2dbdedf..4329246ca1 100644 --- a/public/components/application_analytics/__tests__/__snapshots__/create.test.tsx.snap +++ b/public/components/application_analytics/__tests__/__snapshots__/create.test.tsx.snap @@ -307,7 +307,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -1561,7 +1561,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -2756,7 +2756,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -3924,7 +3924,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -5151,7 +5151,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -6319,7 +6319,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -7543,7 +7543,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -8672,7 +8672,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -9859,7 +9859,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -10993,7 +10993,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -12186,7 +12186,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -13354,7 +13354,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -14581,7 +14581,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -15749,7 +15749,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -16978,7 +16978,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" @@ -18232,7 +18232,7 @@ Object { data-test-subj="searchAutocompleteTextArea" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Enter query" rows="6" spellcheck="false" diff --git a/public/components/application_analytics/__tests__/__snapshots__/log_config.test.tsx.snap b/public/components/application_analytics/__tests__/__snapshots__/log_config.test.tsx.snap index 9646f354c0..284a2e51ae 100644 --- a/public/components/application_analytics/__tests__/__snapshots__/log_config.test.tsx.snap +++ b/public/components/application_analytics/__tests__/__snapshots__/log_config.test.tsx.snap @@ -512,7 +512,7 @@ exports[`Log Config component renders empty log config 1`] = ` disabled={false} enterKeyHint="search" id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} @@ -543,7 +543,7 @@ exports[`Log Config component renders empty log config 1`] = ` disabled={false} enterKeyHint="search" id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} @@ -1136,7 +1136,7 @@ exports[`Log Config component renders with query 1`] = ` disabled={false} enterKeyHint="search" id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} @@ -1167,7 +1167,7 @@ exports[`Log Config component renders with query 1`] = ` disabled={false} enterKeyHint="search" id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} diff --git a/public/components/common/search/__tests__/__snapshots__/search.test.tsx.snap b/public/components/common/search/__tests__/__snapshots__/search.test.tsx.snap index 46cdaf8704..7380a86ca7 100644 --- a/public/components/common/search/__tests__/__snapshots__/search.test.tsx.snap +++ b/public/components/common/search/__tests__/__snapshots__/search.test.tsx.snap @@ -250,7 +250,7 @@ exports[`Explorer Search component renders basic component 1`] = ` data-test-subj="searchAutocompleteTextArea" enterKeyHint="search" id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} @@ -280,7 +280,7 @@ exports[`Explorer Search component renders basic component 1`] = ` data-test-subj="searchAutocompleteTextArea" enterKeyHint="search" id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} diff --git a/public/components/common/search/autocomplete.tsx b/public/components/common/search/autocomplete.tsx index 79642bbe7c..83050697a1 100644 --- a/public/components/common/search/autocomplete.tsx +++ b/public/components/common/search/autocomplete.tsx @@ -9,7 +9,7 @@ import { EuiFieldText, EuiTextArea } from '@elastic/eui'; import $ from 'jquery'; import DSLService from 'public/services/requests/dsl'; import React, { useEffect, useMemo, useState } from 'react'; -import { AutocompleteItem } from '../../../../common/constants/autocomplete'; +import { AutocompleteItem, textAreaMaxLength } from '../../../../common/constants/autocomplete'; import { uiSettingsService } from '../../../../common/utils'; import { IQueryBarProps } from './search'; import './search.scss'; @@ -142,6 +142,7 @@ export const Autocomplete = (props: AutocompleteProps) => { 'data-test-subj': 'searchAutocompleteTextArea', placeholder, inputElement: null, + maxLength: textAreaMaxLength, })} {...(panelsFilter && { append, fullWidth: true })} disabled={isDisabled} diff --git a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap index ecd0abef40..f5f95e97e6 100644 --- a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap +++ b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap @@ -191,7 +191,7 @@ exports[`Panels View Component render panel view container and refresh panel 1`] disabled="" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Use PPL 'where' clauses to add filters on all visualizations [where Carrier = 'OpenSearch-Air']" spellcheck="false" style="margin-top: 0px; height: 18px; padding: 8px;" @@ -622,7 +622,7 @@ exports[`Panels View Component render panel view so container and reload dashboa disabled="" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Use PPL 'where' clauses to add filters on all visualizations [where Carrier = 'OpenSearch-Air']" spellcheck="false" style="margin-top: 0px; height: 18px; padding: 8px;" @@ -1810,7 +1810,7 @@ exports[`Panels View Component renders panel view container with visualizations enterKeyHint="search" fullWidth={true} id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} @@ -1864,7 +1864,7 @@ exports[`Panels View Component renders panel view container with visualizations disabled={true} enterKeyHint="search" id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} @@ -4043,7 +4043,7 @@ exports[`Panels View Component renders panel view container without visualizatio enterKeyHint="search" fullWidth={true} id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} @@ -4097,7 +4097,7 @@ exports[`Panels View Component renders panel view container without visualizatio disabled={true} enterKeyHint="search" id="autocomplete-textarea" - maxLength={512} + maxLength={16384} onBlur={[Function]} onChange={[Function]} onClick={[Function]} diff --git a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view_so.test.tsx.snap b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view_so.test.tsx.snap index b3292cc595..050c4678a1 100644 --- a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view_so.test.tsx.snap +++ b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view_so.test.tsx.snap @@ -191,7 +191,7 @@ exports[`Panels View SO Component render panel view container and refresh panel disabled="" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Use PPL 'where' clauses to add filters on all visualizations [where Carrier = 'OpenSearch-Air']" spellcheck="false" style="margin-top: 0px; height: 18px; padding: 8px;" @@ -622,7 +622,7 @@ exports[`Panels View SO Component render panel view so container and reload dash disabled="" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Use PPL 'where' clauses to add filters on all visualizations [where Carrier = 'OpenSearch-Air']" spellcheck="false" style="margin-top: 0px; height: 18px; padding: 8px;" @@ -1055,7 +1055,7 @@ exports[`Panels View SO Component renders panels view SO container with visualiz disabled="" enterkeyhint="search" id="autocomplete-textarea" - maxlength="512" + maxlength="16384" placeholder="Use PPL 'where' clauses to add filters on all visualizations [where Carrier = 'OpenSearch-Air']" spellcheck="false" style="margin-top: 0px; height: 18px; padding: 8px;" diff --git a/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap b/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap index 2bc07095f6..231505e1c4 100644 --- a/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap +++ b/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap @@ -621,6 +621,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_1", "name": "mock_table_1", + "tableName": "mock_table_1", "type": "table", }, Object { @@ -630,6 +631,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_2", "name": "mock_table_2", + "tableName": "mock_table_2", "type": "table", }, Object { @@ -639,6 +641,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_3", "name": "mock_table_3", + "tableName": "mock_table_3", "type": "table", }, Object { @@ -648,6 +651,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_4", "name": "mock_table_4", + "tableName": "mock_table_4", "type": "table", }, Object { @@ -657,6 +661,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_5", "name": "mock_table_5", + "tableName": "mock_table_5", "type": "table", }, Object { @@ -666,6 +671,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", + "tableName": "", "type": "skipping", }, Object { @@ -675,6 +681,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", + "tableName": "", "type": "materialized", }, ] @@ -758,6 +765,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_1", "name": "mock_table_1", + "tableName": "mock_table_1", "type": "table", }, Object { @@ -767,6 +775,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_2", "name": "mock_table_2", + "tableName": "mock_table_2", "type": "table", }, Object { @@ -776,6 +785,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_3", "name": "mock_table_3", + "tableName": "mock_table_3", "type": "table", }, Object { @@ -785,6 +795,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_4", "name": "mock_table_4", + "tableName": "mock_table_4", "type": "table", }, Object { @@ -794,6 +805,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_5", "name": "mock_table_5", + "tableName": "mock_table_5", "type": "table", }, Object { @@ -803,6 +815,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", + "tableName": "", "type": "skipping", }, Object { @@ -812,6 +825,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", + "tableName": "", "type": "materialized", }, ] @@ -1316,6 +1330,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", + "tableName": "", "type": "skipping", }, Object { @@ -1325,6 +1340,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", + "tableName": "", "type": "materialized", }, Object { @@ -1334,6 +1350,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_1", "name": "mock_table_1", + "tableName": "mock_table_1", "type": "table", }, Object { @@ -1343,6 +1360,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_2", "name": "mock_table_2", + "tableName": "mock_table_2", "type": "table", }, Object { @@ -1352,6 +1370,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_3", "name": "mock_table_3", + "tableName": "mock_table_3", "type": "table", }, Object { @@ -1361,6 +1380,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_4", "name": "mock_table_4", + "tableName": "mock_table_4", "type": "table", }, Object { @@ -1370,6 +1390,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_5", "name": "mock_table_5", + "tableName": "mock_table_5", "type": "table", }, ] @@ -2008,6 +2029,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", + "tableName": "", "type": "skipping", } } @@ -2034,6 +2056,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", + "tableName": "", "type": "skipping", } } @@ -2273,6 +2296,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", + "tableName": "", "type": "materialized", } } @@ -2299,6 +2323,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", + "tableName": "", "type": "materialized", } } @@ -2546,6 +2571,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_1", "name": "mock_table_1", + "tableName": "mock_table_1", "type": "table", } } @@ -2572,6 +2598,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_1", "name": "mock_table_1", + "tableName": "mock_table_1", "type": "table", } } @@ -2668,6 +2695,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_1", "name": "mock_table_1", + "tableName": "mock_table_1", "type": "table", } } @@ -2915,6 +2943,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_2", "name": "mock_table_2", + "tableName": "mock_table_2", "type": "table", } } @@ -2941,6 +2970,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_2", "name": "mock_table_2", + "tableName": "mock_table_2", "type": "table", } } @@ -3037,6 +3067,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_2", "name": "mock_table_2", + "tableName": "mock_table_2", "type": "table", } } @@ -3284,6 +3315,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_3", "name": "mock_table_3", + "tableName": "mock_table_3", "type": "table", } } @@ -3310,6 +3342,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_3", "name": "mock_table_3", + "tableName": "mock_table_3", "type": "table", } } @@ -3406,6 +3439,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_3", "name": "mock_table_3", + "tableName": "mock_table_3", "type": "table", } } @@ -3653,6 +3687,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_4", "name": "mock_table_4", + "tableName": "mock_table_4", "type": "table", } } @@ -3679,6 +3714,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_4", "name": "mock_table_4", + "tableName": "mock_table_4", "type": "table", } } @@ -3775,6 +3811,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_4", "name": "mock_table_4", + "tableName": "mock_table_4", "type": "table", } } @@ -4022,6 +4059,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_5", "name": "mock_table_5", + "tableName": "mock_table_5", "type": "table", } } @@ -4048,6 +4086,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_5", "name": "mock_table_5", + "tableName": "mock_table_5", "type": "table", } } @@ -4144,6 +4183,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_table_5", "name": "mock_table_5", + "tableName": "mock_table_5", "type": "table", } } diff --git a/public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx b/public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx index 02e690f0e0..33ea10223d 100644 --- a/public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx +++ b/public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx @@ -18,6 +18,7 @@ import { i18n } from '@osd/i18n'; import { ACCELERATION_INDEX_TYPES } from '../../../../../../common/constants/data_sources'; import { AssociatedObject, + AssociatedObjectIndexType, CachedAcceleration, CachedAccelerationByDataSource, CachedDataSourceStatus, @@ -296,6 +297,7 @@ export const AssociatedObjectsTab: React.FC = (props) useEffect(() => { const tableObjects: AssociatedObject[] = cachedTables.map((table: CachedTable) => { return { + tableName: table.name, datasource: datasource.name, id: table.name, name: table.name, @@ -310,12 +312,13 @@ export const AssociatedObjectsTab: React.FC = (props) const accelerationObjects: AssociatedObject[] = cachedAccelerations .filter((acceleration: CachedAcceleration) => acceleration.database === selectedDatabase) .map((acceleration: CachedAcceleration) => ({ + tableName: acceleration.table, datasource: datasource.name, id: acceleration.indexName, name: getAccelerationName(acceleration), database: acceleration.database, type: ACCELERATION_INDEX_TYPES.find((accelType) => accelType.value === acceleration.type)! - .value, + .value as AssociatedObjectIndexType, accelerations: [], columns: undefined, })); diff --git a/public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx b/public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx index 797aae2435..a46b0c0900 100644 --- a/public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx +++ b/public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx @@ -151,12 +151,12 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => { (acc) => getAccelerationName(acc) === asscObj.name ); redirectToExplorerOSIdx(acceleration!.flintIndexName); - } else if (asscObj.type === 'table') { + } else if (asscObj.type === 'table' || asscObj.type === 'skipping') { redirectToExplorerWithDataSrc( asscObj.datasource, DATA_SOURCE_TYPES.S3Glue, asscObj.database, - asscObj.name + asscObj.tableName ); } }, diff --git a/public/components/datasources/components/manage/associated_objects/utils/associated_objects_tab_utils.tsx b/public/components/datasources/components/manage/associated_objects/utils/associated_objects_tab_utils.tsx index 6b8332880c..63ad3261ee 100644 --- a/public/components/datasources/components/manage/associated_objects/utils/associated_objects_tab_utils.tsx +++ b/public/components/datasources/components/manage/associated_objects/utils/associated_objects_tab_utils.tsx @@ -6,6 +6,7 @@ import { coreRefs } from '../../../../../../framework/core_refs'; import { DirectQueryLoadingStatus } from '../../../../../../../common/types/explorer'; import { + DATA_SOURCE_TYPES, DEFAULT_DATA_SOURCE_NAME, DEFAULT_DATA_SOURCE_TYPE, } from '../../../../../../../common/constants/data_sources'; @@ -72,6 +73,16 @@ export const redirectToExplorerOSIdx = (indexName: string) => { redirectToExplorerWithQuery(DEFAULT_DATA_SOURCE_NAME, DEFAULT_DATA_SOURCE_TYPE, indexName); }; +export const redirectToExplorerS3 = (datasourceName: string) => { + coreRefs?.application!.navigateToApp(observabilityLogsID, { + path: `#/explorer`, + state: { + datasourceName, + datasourceType: DATA_SOURCE_TYPES.S3Glue, + }, + }); +}; + const redirectToExplorerWithQuery = ( datasourceName: string, datasourceType: string, diff --git a/public/components/datasources/components/manage/data_connection.tsx b/public/components/datasources/components/manage/data_connection.tsx index 9b1d53e95a..980f0e5bfa 100644 --- a/public/components/datasources/components/manage/data_connection.tsx +++ b/public/components/datasources/components/manage/data_connection.tsx @@ -24,7 +24,6 @@ import React, { useEffect, useState } from 'react'; import { DATACONNECTIONS_BASE, INTEGRATIONS_BASE, - observabilityLogsID, observabilityMetricsID, } from '../../../../../common/constants/shared'; import { @@ -36,7 +35,7 @@ import { useLoadDatabasesToCache, useLoadTablesToCache, } from '../../../../../public/framework/catalog_cache/cache_loader'; -import { DATA_SOURCE_TYPES } from '../../../../../common/constants/data_sources'; +import { redirectToExplorerS3 } from './associated_objects/utils/associated_objects_tab_utils'; import { coreRefs } from '../../../../framework/core_refs'; import { getRenderCreateAccelerationFlyout } from '../../../../plugin'; import { NoAccess } from '../no_access'; @@ -125,13 +124,7 @@ export const DataConnection = (props: { dataSource: string }) => { }; const onclickDiscoverCard = () => { - application!.navigateToApp(observabilityLogsID, { - path: `#/explorer`, - state: { - datasourceName: dataSource, - datasourceType: DATA_SOURCE_TYPES.S3Glue, - }, - }); + redirectToExplorerS3(dataSource); }; const DefaultDatasourceCards = () => { diff --git a/public/components/datasources/components/manage/manage_data_connections_table.tsx b/public/components/datasources/components/manage/manage_data_connections_table.tsx index 8beec4bd7b..2a95458dde 100644 --- a/public/components/datasources/components/manage/manage_data_connections_table.tsx +++ b/public/components/datasources/components/manage/manage_data_connections_table.tsx @@ -20,7 +20,6 @@ import _ from 'lodash'; import React, { useEffect, useState } from 'react'; import { DATACONNECTIONS_BASE, - observabilityLogsID, observabilityMetricsID, } from '../../../../../common/constants/shared'; import { @@ -38,6 +37,7 @@ import { DataConnectionsHeader } from '../data_connections_header'; import { DataConnectionsDescription } from './manage_data_connections_description'; import { getRenderCreateAccelerationFlyout } from '../../../../../public/plugin'; import { InstallIntegrationFlyout } from './integrations/installed_integrations_table'; +import { redirectToExplorerS3 } from './associated_objects/utils/associated_objects_tab_utils'; interface DataConnection { connectionType: DatasourceType; @@ -132,9 +132,11 @@ export const ManageDataConnectionsTable = (props: HomeProps) => { icon: 'discoverApp', type: 'icon', onClick: (datasource: DataConnection) => { - application!.navigateToApp( - datasource.connectionType === 'PROMETHEUS' ? observabilityMetricsID : observabilityLogsID - ); + if (datasource.connectionType === 'PROMETHEUS') { + application!.navigateToApp(observabilityMetricsID); + } else if (datasource.connectionType === 'S3GLUE') { + redirectToExplorerS3(datasource.name); + } }, 'data-test-subj': 'action-query', }, diff --git a/public/components/event_analytics/__tests__/__snapshots__/no_results.test.tsx.snap b/public/components/event_analytics/__tests__/__snapshots__/no_results.test.tsx.snap index 0fe3612fb8..bd485c2276 100644 --- a/public/components/event_analytics/__tests__/__snapshots__/no_results.test.tsx.snap +++ b/public/components/event_analytics/__tests__/__snapshots__/no_results.test.tsx.snap @@ -21,134 +21,136 @@ exports[`No result component Renders No result component 1`] = `
- -
+ - -
- - } +
-
+ } >
- - + + + + + + + + No results match your search criteria + + + +
+
+ +
+ + +
+ +
+ + +
+

- No results match your search criteria + Select a data source, expand your time range, or modify the query - +

+

+ + + After selection, check the time range, query filters, fields, and query + + +

-
- -
-
- -
- -
- - -
-

- - - Select a data source, expand your time range, or modify the query - - -

-

- - - After selection, check the time range, query filters, fields, and query - - -

-
-
-
- -
- + +
+
+
+
+
diff --git a/public/components/event_analytics/explorer/datasources/datasources_selection.tsx b/public/components/event_analytics/explorer/datasources/datasources_selection.tsx index b2117fede7..fb8bf7bb83 100644 --- a/public/components/event_analytics/explorer/datasources/datasources_selection.tsx +++ b/public/components/event_analytics/explorer/datasources/datasources_selection.tsx @@ -202,7 +202,16 @@ export const DataSourceSelection = ({ tabId }: { tabId: string }) => { dispatch( updateSearchMetaData({ tabId, - data: { datasources: [{ label: datasourceName, type: datasourceType }] }, + data: { + datasources: [ + { + label: datasourceName, + type: datasourceType, + value: datasourceName, + name: datasourceName, + }, + ], + }, }) ); }); diff --git a/public/components/event_analytics/explorer/explorer.tsx b/public/components/event_analytics/explorer/explorer.tsx index 7406253b8e..319f42e419 100644 --- a/public/components/event_analytics/explorer/explorer.tsx +++ b/public/components/event_analytics/explorer/explorer.tsx @@ -276,28 +276,32 @@ export const Explorer = ({ queryToRun, }: any = historyFromRedirection.location.state; batch(() => { - dispatch( - updateSearchMetaData({ - tabId, - data: { - datasources: [ - { - label: datasourceName, - type: datasourceType, - value: datasourceName, - name: datasourceName, - }, - ], - }, - }) - ); - dispatch( - changeQuery({ - tabId, - query: { [RAW_QUERY]: queryToRun }, - }) - ); - setTempQuery(queryToRun); + if (datasourceName && datasourceType) { + dispatch( + updateSearchMetaData({ + tabId, + data: { + datasources: [ + { + label: datasourceName, + type: datasourceType, + value: datasourceName, + name: datasourceName, + }, + ], + }, + }) + ); + } + if (queryToRun) { + dispatch( + changeQuery({ + tabId, + query: { [RAW_QUERY]: queryToRun }, + }) + ); + setTempQuery(queryToRun); + } }); }, []); diff --git a/public/components/event_analytics/explorer/no_results.tsx b/public/components/event_analytics/explorer/no_results.tsx index 403fe6d74f..76b6b87778 100644 --- a/public/components/event_analytics/explorer/no_results.tsx +++ b/public/components/event_analytics/explorer/no_results.tsx @@ -5,12 +5,15 @@ import { EuiCallOut, + EuiCode, EuiCodeBlock, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, + EuiLink, EuiLoadingSpinner, EuiPage, + EuiPanel, EuiSpacer, EuiText, } from '@elastic/eui'; @@ -22,6 +25,8 @@ import { selectQueryAssistantSummarization } from '../redux/slices/query_assista 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'; +import { CatalogCacheManager } from '../../../framework/catalog_cache/cache_manager'; +import { CachedDataSourceStatus } from '../../../../common/types/data_connections'; export const NoResults = ({ tabId }: any) => { // get the queries isLoaded, if it exists AND is true = show no res @@ -30,9 +35,181 @@ export const NoResults = ({ tabId }: any) => { const queryAssistLoading = summaryData?.loading; const explorerSearchMeta = useSelector(selectSearchMetaData)[tabId]; - const datasourceName = explorerSearchMeta?.datasources[0]?.name; + const datasourceName = explorerSearchMeta?.datasources[0]?.label; const languageInUse = explorerSearchMeta?.lang; + const queryInputted = queryInfo?.rawQuery !== ''; + + const CreatedCodeBlock = ({ code }: any) => { + return ( + + {code} + + ); + }; + + let arbitraryDatabaseName: string | undefined; + let arbitraryTableName: string | undefined; + let arbitraryRealQuery: string | undefined; + const datasourceCache = CatalogCacheManager.getOrCreateDataSource(datasourceName); + if (datasourceCache?.status === CachedDataSourceStatus.Updated) { + const database = datasourceCache?.databases?.[0]; + if (database?.status === CachedDataSourceStatus.Updated) { + const table = database.tables[0]; + arbitraryDatabaseName = database.name; + arbitraryTableName = table.name; + if (languageInUse === QUERY_LANGUAGE.SQL) { + arbitraryRealQuery = `SELECT * FROM ${datasourceName}.${database.name}.${table.name} LIMIT 10`; + } else { + arbitraryRealQuery = `source = ${datasourceName}.${database.name}.${table.name} | head 10`; + } + } + } + + const S3Callouts = () => { + return ( + + {queryInputted && ( + + + } + color="warning" + iconType="help" + data-test-subj="observabilityNoResultsCallout" + /> + + )} + + +

+ +

+

+ To start exploring this datasource, enter a query or{' '} + { + coreRefs?.application!.navigateToApp('datasources', { + path: `#/manage/${datasourceName}`, + }); + }} + > + view databases and tables. + +

+
+
+ + + + + Sample Queries + + {languageInUse === QUERY_LANGUAGE.SQL ? ( + <> + +

+ Show a list of databases in{' '} + {datasourceName} +

+ + +
+ +

Show a list of tables within a database

+ + LIKE '*'`} + /> +
+ +

Explore data within a table

+ + . LIMIT 10`} + /> + + + ) : ( + +

Explore data within a table

+ + .
| head 10`} + /> + + )} + {arbitraryRealQuery && ( + +

+ Explore data within the table + {arbitraryTableName!} in the + database + {arbitraryDatabaseName!} +

+ + +
+ )} + + + Reference manual + + + + + + + ); + }; + + const OpenSearchIndexNoResults = () => { + return ( + + + + } + color="warning" + iconType="help" + data-test-subj="observabilityNoResultsCallout" + /> + + + + +

+ +

+

+ +

+
+
+
+ ); + }; + return ( {coreRefs.queryAssistEnabled ? ( @@ -86,82 +263,13 @@ export const NoResults = ({ tabId }: any) => { )} ) : ( - - - {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" - /> - )} - - - - -

- -

-

- -

-
-
- + <> + {explorerSearchMeta?.datasources[0]?.type === DATA_SOURCE_TYPES.S3Glue ? ( + + ) : ( + + )} + )} ); diff --git a/public/components/event_analytics/explorer/sidebar/observability_sidebar.tsx b/public/components/event_analytics/explorer/sidebar/observability_sidebar.tsx index 89cb4e5e61..80dd3cd991 100644 --- a/public/components/event_analytics/explorer/sidebar/observability_sidebar.tsx +++ b/public/components/event_analytics/explorer/sidebar/observability_sidebar.tsx @@ -28,11 +28,7 @@ export const ObservabilitySideBar = ({ tabId, pplService, notifications }) => { const explorerFields = useSelector(selectFields)[tabId]; const countDistribution = useSelector(selectCountDistribution)[tabId]; const requestParams = { tabId }; - const { - isEventsLoading: isPatternLoading, - getPatterns, - setDefaultPatternsField, - } = useFetchPatterns({ + const { getPatterns, setDefaultPatternsField } = useFetchPatterns({ pplService, requestParams, }); @@ -87,7 +83,7 @@ export const ObservabilitySideBar = ({ tabId, pplService, notifications }) => { isOverridingTimestamp={isOverridingTimestamp} isOverridingPattern={isOverridingPattern} isFieldToggleButtonDisabled={ - isEmpty(explorerData.jsonData) || !isEmpty(query[RAW_QUERY].match(PPL_STATS_REGEX)) + isEmpty(explorerData.jsonData) || !isEmpty(query[RAW_QUERY]?.match(PPL_STATS_REGEX)) } tabId={tabId} /> diff --git a/public/components/event_analytics/explorer/visualizations/direct_query_vis.tsx b/public/components/event_analytics/explorer/visualizations/direct_query_vis.tsx index a1268c62dc..a1314d6f26 100644 --- a/public/components/event_analytics/explorer/visualizations/direct_query_vis.tsx +++ b/public/components/event_analytics/explorer/visualizations/direct_query_vis.tsx @@ -3,15 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - EuiCallOut, - EuiFlexGroup, - EuiFlexItem, - EuiLink, - EuiPage, - EuiText, - EuiSpacer, -} from '@elastic/eui'; +import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiLink, EuiPage, EuiText } from '@elastic/eui'; import React from 'react'; import { FormattedMessage, I18nProvider } from '@osd/i18n/react'; import { queryWorkbenchPluginID } from '../../../../../common/constants/shared'; @@ -41,7 +33,7 @@ export const DirectQueryVisualization = ({ currentDataSource }: DirectQueryVisua coreRefs?.application!.navigateToApp(queryWorkbenchPluginID, { - path: `#/${currentDataSource}`, + path: `#/accelerate/${currentDataSource}`, }) } >