From a2a756cf7c87ede8f6e1d185b089295d99ff75a2 Mon Sep 17 00:00:00 2001 From: Paul Sebastian Date: Tue, 24 Oct 2023 18:49:16 -0700 Subject: [PATCH] pr requested changes Signed-off-by: Paul Sebastian --- common/constants/index.ts | 3 + public/components/Main/main.tsx | 36 +++++----- public/components/PPLPage/PPLPage.tsx | 8 +-- public/components/SQLPage/SQLPage.tsx | 7 +- public/components/SQLPage/table_view.tsx | 86 ++++++++++++------------ 5 files changed, 66 insertions(+), 74 deletions(-) diff --git a/common/constants/index.ts b/common/constants/index.ts index 6e88cb94..724aae24 100644 --- a/common/constants/index.ts +++ b/common/constants/index.ts @@ -95,3 +95,6 @@ export const POLL_INTERVAL_MS = 2000; export const ASYNC_QUERY_ENDPOINT = '/api/spark_sql_console'; export const ASYNC_QUERY_JOB_ENDPOINT = ASYNC_QUERY_ENDPOINT + '/job/'; export const ASYNC_QUERY_SESSION_ID = 'async-query-session-id'; + +export const SAMPLE_PPL_QUERY = 'source = .. | head 10'; +export const SAMPLE_SQL_QUERY = 'select * from ..
limit 10'; diff --git a/public/components/Main/main.tsx b/public/components/Main/main.tsx index 62ee1758..fe1ebacc 100644 --- a/public/components/Main/main.tsx +++ b/public/components/Main/main.tsx @@ -966,25 +966,23 @@ export class Main extends React.Component { height: 'calc(100vh - 254px)', }} > - - - - - - - - - - + + + + + + + + void; @@ -161,12 +162,7 @@ export class PPLPage extends React.Component { ) : ( - - this.props.updatePPLQueries('source = ..
| head 10') - } - > + this.props.updatePPLQueries(SAMPLE_PPL_QUERY)}> Sample Query diff --git a/public/components/SQLPage/SQLPage.tsx b/public/components/SQLPage/SQLPage.tsx index 4bb6ff2d..4e31b6d4 100644 --- a/public/components/SQLPage/SQLPage.tsx +++ b/public/components/SQLPage/SQLPage.tsx @@ -25,6 +25,7 @@ import React from 'react'; import { CoreStart } from '../../../../../src/core/public'; import { ResponseDetail, TranslateResult } from '../Main/main'; import { CreateAcceleration } from '../acceleration/create/create_acceleration'; +import { SAMPLE_SQL_QUERY } from '../../../common/constants'; interface SQLPageProps { http: CoreStart['http']; @@ -202,11 +203,7 @@ export class SQLPage extends React.Component { ) : ( - this.props.updateSQLQueries( - 'select * from ..
limit 10' - ) - } + onClick={() => this.props.updateSQLQueries(SAMPLE_SQL_QUERY)} > Sample Query diff --git a/public/components/SQLPage/table_view.tsx b/public/components/SQLPage/table_view.tsx index 884ba942..bc3206ad 100644 --- a/public/components/SQLPage/table_view.tsx +++ b/public/components/SQLPage/table_view.tsx @@ -501,52 +501,50 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree } return ( <> - <> - {isLoadingBanner.flag ? ( - - - - - - Loading data - -
- - - Loading may take over 30 seconds - - - - - Status: {isLoadingBanner.status} - - -
-
-
- ) : OpenSearchIndicesTree.length > 0 || treeDataDatabases.length > 0 ? ( + {isLoadingBanner.flag ? ( + + + + + + Loading data + +
+ + + Loading may take over 30 seconds + + + + + Status: {isLoadingBanner.status} + + +
+
+
+ ) : OpenSearchIndicesTree.length > 0 || treeDataDatabases.length > 0 ? ( + + {selectedItems[0].label === 'OpenSearch' ? ( + + ) : ( + + )} + + ) : ( + - {selectedItems[0].label === 'OpenSearch' ? ( - - ) : ( - - )} + } + iconColor="subdued" + titleSize="xs" + title={

No Data available

} + body={

{isLoadingBanner.status}

} + />
- ) : ( - - - } - iconColor="subdued" - titleSize="xs" - title={

No Data available

} - body={

{isLoadingBanner.status}

} - /> -
-
- )} - {indexFlyout} - +
+ )} + {indexFlyout} ); };