From d15ed6463e8b9527be7b478c4046a9384f059ce6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 5 Oct 2023 16:39:54 +0000 Subject: [PATCH] Adding minor updates and bug fixes (#140) * adding minor updates to acceleration ui Signed-off-by: Shenoy Pratik * edits to acceleration index flyout Signed-off-by: Shenoy Pratik * adding minor edits to table view Signed-off-by: Shenoy Pratik * update snapshots Signed-off-by: Shenoy Pratik * remove console log Signed-off-by: Shenoy Pratik * minor fixes to namings and tableview Signed-off-by: Shenoy Pratik * update tableview clear db Signed-off-by: Shenoy Pratik --------- Signed-off-by: Shenoy Pratik (cherry picked from commit 56a6bce458da6c765b69d2e0e074a627cb8fb71e) Signed-off-by: github-actions[bot] --- common/constants/index.ts | 16 +-- .../Main/__snapshots__/main.test.tsx.snap | 51 ++++++++- public/components/Main/main.tsx | 11 +- public/components/PPLPage/PPLPage.tsx | 15 ++- .../__snapshots__/PPLPage.test.tsx.snap | 8 +- public/components/SQLPage/CreateButton.tsx | 30 ++--- public/components/SQLPage/SQLPage.tsx | 4 +- public/components/SQLPage/TableView.tsx | 60 ++++++---- .../SQLPage/acceleration_index_flyout.tsx | 104 ++++++++++-------- public/components/SQLPage/utils.tsx | 17 ++- .../selectors/index_type_selector.tsx | 12 +- .../visual_editors/query_builder.tsx | 12 +- test/mocks/accelerationMock.ts | 12 +- 13 files changed, 217 insertions(+), 135 deletions(-) diff --git a/common/constants/index.ts b/common/constants/index.ts index 4fc24444..ed37754e 100644 --- a/common/constants/index.ts +++ b/common/constants/index.ts @@ -8,20 +8,20 @@ export const PLUGIN_NAME = 'Query Workbench'; export const OPENSEARCH_ACC_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest'; export const ACC_INDEX_TYPE_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest'; -export const SKIPPING_INDEX = `skipping_index` +export const SKIPPING_INDEX = `skipping_index`; export const ON_LOAD_QUERY = `SHOW tables LIKE '%';`; export const SKIPPING_INDEX_QUERY = `CREATE SKIPPING INDEX ON myS3.logs_db.http_logs (status VALUE_SET) WITH ( auto_refresh = true - )` -export const COVERING_INDEX_QUERY =`CREATE INDEX covering_idx ON myS3.logs_db.http_logs + )`; +export const COVERING_INDEX_QUERY = `CREATE INDEX covering_idx ON myS3.logs_db.http_logs (status) WITH ( auto_refresh = true - )` -export const CREATE_DATABASE_QUERY =`CREATE DATABASE myS3.logs_db` -export const CREATE_TABLE_QUERY =`CREATE EXTERNAL TABLE logs ( + )`; +export const CREATE_DATABASE_QUERY = `CREATE DATABASE myS3.logs_db`; +export const CREATE_TABLE_QUERY = `CREATE EXTERNAL TABLE myS3.logs_db.logs ( key BIGINT, status INTEGER, size FLOAT, @@ -32,7 +32,7 @@ USING JSON OPTIONS ( path 's3://test/path', compression 'gzip' -);` +);`; export const ACCELERATION_INDEX_TYPES = [ { label: 'Skipping Index', value: 'skipping' }, @@ -80,3 +80,5 @@ export const ACCELERATION_INDEX_NAME_INFO = `All OpenSearch acceleration indices ##### Note: - All user given index names must be in lowercase letters. Cannot begin with underscores or hyphens. Spaces, commas, and characters :, ", *, +, /, \, |, ?, #, >, or < are not allowed. `; + +export const SIDEBAR_POLL_INTERVAL_MS = 5000; diff --git a/public/components/Main/__snapshots__/main.test.tsx.snap b/public/components/Main/__snapshots__/main.test.tsx.snap index ff0dd051..d8ef37d5 100644 --- a/public/components/Main/__snapshots__/main.test.tsx.snap +++ b/public/components/Main/__snapshots__/main.test.tsx.snap @@ -193,6 +193,7 @@ exports[`
spec click clear button 1`] = ` >
spec click run button, and response causes an error 1`] = ` >
spec click run button, and response is not ok 1`] = ` >
spec click run button, and response is ok 1`] = ` >
spec click run button, and response is ok 1`] = ` class="euiTreeView__nodeLabel" >
- 2 + +
+ 2 +
+
@@ -2015,7 +2027,15 @@ exports[`
spec click run button, and response is ok 1`] = ` class="euiTreeView__nodeLabel" >
- 2 + +
+ 2 +
+
@@ -2501,6 +2521,7 @@ exports[`
spec click run button, response fills null and missing values >
spec click run button, response fills null and missing values class="euiTreeView__nodeLabel" >
+ +
+
@@ -2645,6 +2673,13 @@ exports[`
spec click run button, response fills null and missing values class="euiTreeView__nodeLabel" >
+ +
+
@@ -3133,6 +3168,7 @@ exports[`
spec click translation button, and response is ok 1`] = ` >
spec renders the component 1`] = ` >
spec renders the component 1`] = ` class="euiTreeView__nodeLabel" >
- .kibana_1 + +
+ .kibana_1 +
+
diff --git a/public/components/Main/main.tsx b/public/components/Main/main.tsx index 046554dc..a8b38326 100644 --- a/public/components/Main/main.tsx +++ b/public/components/Main/main.tsx @@ -14,7 +14,7 @@ import { EuiPageSideBar, EuiPanel, EuiSpacer, - EuiText + EuiText, } from '@elastic/eui'; import { IHttpResponse } from 'angular'; import _ from 'lodash'; @@ -790,6 +790,9 @@ export class Main extends React.Component { } handleDataSelect = (selectedItems: []) => { + if (selectedItems[0].label !== 'OpenSearch' && this.state.language === 'SQL') { + this.updateSQLQueries(''); + } this.setState({ selectedDatasource: selectedItems, }); @@ -912,13 +915,11 @@ export class Main extends React.Component { {this.state.language === 'SQL' && ( - + - + void; @@ -107,7 +106,7 @@ export class PPLPage extends React.Component { spec renders the component 1`] = `