Date: Wed, 13 Apr 2022 10:17:13 -0700
Subject: [PATCH 10/28] add t
---
.../src/SqlLab/components/SqlEditorLeftBar/index.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
index 9c5148eb0f66a..7dab5b1995ea0 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
@@ -166,8 +166,8 @@ export default function SqlEditorLeftBar({
image="empty.svg"
title={
isDbSearch
- ? 'No databases match your search'
- : 'There are no databases available'
+ ? t('No databases match your search')
+ : t('There are no databases available')
}
description={
From 61ee6c6f8aa1877d71719379b7aa336c29664614 Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson
Date: Wed, 13 Apr 2022 11:07:37 -0700
Subject: [PATCH 11/28] lint
---
superset-frontend/src/SqlLab/actions/sqlLab.js | 1 -
.../SqlLab/components/SqlEditor/SqlEditor.test.jsx | 6 +++---
.../src/SqlLab/components/SqlEditor/index.jsx | 14 +++++++-------
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.js b/superset-frontend/src/SqlLab/actions/sqlLab.js
index f1a1bb43b3b3e..3d1298e6c3b73 100644
--- a/superset-frontend/src/SqlLab/actions/sqlLab.js
+++ b/superset-frontend/src/SqlLab/actions/sqlLab.js
@@ -127,7 +127,6 @@ export function resetState() {
return { type: RESET_STATE };
}
-
export function startQueryValidation(query) {
Object.assign(query, {
id: query.id ? query.id : shortid.generate(),
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.jsx
index 906db2c721e56..d946c675cc8c4 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.jsx
@@ -65,8 +65,8 @@ describe('SqlEditor', () => {
allow_file_upload: false,
allow_multi_schema_metadata_fetch: false,
allow_run_async: false,
- backend: "postgresql",
- database_name: "examples",
+ backend: 'postgresql',
+ database_name: 'examples',
expose_in_sqllab: true,
force_ctas_schema: null,
id: 1,
@@ -95,7 +95,7 @@ describe('SqlEditor', () => {
it('does not render SqlEditor if no db selected', () => {
const database = {};
- const updatedProps = {...mockedProps, database};
+ const updatedProps = { ...mockedProps, database };
const wrapper = buildWrapper(updatedProps);
expect(wrapper.find(EmptyStateBig)).toExist();
});
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index edd60c2f036c1..90fe7511e2fcf 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -67,6 +67,7 @@ import {
} from 'src/utils/localStorageHelpers';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { EmptyStateBig } from 'src/components/EmptyState';
+import { isEmpty } from 'lodash';
import TemplateParamsEditor from '../TemplateParamsEditor';
import ConnectedSouthPane from '../SouthPane/state';
import SaveQuery from '../SaveQuery';
@@ -76,7 +77,6 @@ import ShareSqlLabQuery from '../ShareSqlLabQuery';
import SqlEditorLeftBar from '../SqlEditorLeftBar';
import AceEditorWrapper from '../AceEditorWrapper';
import RunQueryActionButton from '../RunQueryActionButton';
-import { isEmpty } from 'lodash';
const LIMIT_DROPDOWN = [10, 100, 1000, 10000, 100000];
const SQL_EDITOR_PADDING = 10;
@@ -231,11 +231,11 @@ class SqlEditor extends React.PureComponent {
// We need to measure the height of the sql editor post render to figure the height of
// the south pane so it gets rendered properly
// eslint-disable-next-line react/no-did-mount-set-state
- const db = this.props.database;
+ const db = this.props.database;
this.setState({ height: this.getSqlEditorHeight() });
- if (!db || isEmpty(db) ) {
- this.setState({ showEmptyState: true})
- }
+ if (!db || isEmpty(db)) {
+ this.setState({ showEmptyState: true });
+ }
window.addEventListener('resize', this.handleWindowResize);
window.addEventListener('beforeunload', this.onBeforeUnload);
@@ -371,7 +371,7 @@ class SqlEditor extends React.PureComponent {
}
setEmptyState(bool) {
- this.setState({ setEmptyState: bool })
+ this.setState({ setEmptyState: bool });
}
setQueryEditorSql(sql) {
@@ -766,7 +766,7 @@ class SqlEditor extends React.PureComponent {
tables={this.props.tables}
actions={this.props.actions}
setEmptyState={this.setEmptyState}
- showDisabled={this.state.showEmptyState}
+ showDisabled={this.state.showEmptyState}
/>
From 7255d359b44bc040bc4c78287bce6c2428aa6d27 Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson
Date: Wed, 13 Apr 2022 11:27:56 -0700
Subject: [PATCH 12/28] fix text and remove code
---
superset-frontend/src/SqlLab/components/SqlEditor/index.jsx | 2 +-
.../src/SqlLab/components/SqlEditorLeftBar/index.tsx | 2 +-
superset-frontend/src/components/DatabaseSelector/index.tsx | 1 -
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index 90fe7511e2fcf..16e8ba685d58b 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -774,7 +774,7 @@ class SqlEditor extends React.PureComponent {
) : (
this.queryPane()
diff --git a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
index 45a75a644bdd3..f1c5ed27f31ce 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
@@ -194,7 +194,7 @@ export default function SqlEditorLeftBar({
}
description={
- Manage your database here
+ Manage your databases here
}
/>
diff --git a/superset-frontend/src/components/DatabaseSelector/index.tsx b/superset-frontend/src/components/DatabaseSelector/index.tsx
index d79997071efda..461923d180199 100644
--- a/superset-frontend/src/components/DatabaseSelector/index.tsx
+++ b/superset-frontend/src/components/DatabaseSelector/index.tsx
@@ -256,7 +256,6 @@ export default function DatabaseSelector({
) {
setCurrentDb(database);
setCurrentSchema(undefined);
- // dispatch(setNoDatabaseConnected(true));
if (onDbChange) {
onDbChange(database);
}
From 19283db2f371082c80e1ec56ff8839e1c4d494a7 Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson
Date: Wed, 13 Apr 2022 15:01:58 -0700
Subject: [PATCH 13/28] ts and fix t in p
---
superset-frontend/src/SqlLab/components/SqlEditor/index.jsx | 1 +
.../src/SqlLab/components/SqlEditorLeftBar/index.tsx | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index 16e8ba685d58b..dd4a5a22b6719 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -370,6 +370,7 @@ class SqlEditor extends React.PureComponent {
return base;
}
+ // @ts-ignore
setEmptyState(bool) {
this.setState({ setEmptyState: bool });
}
diff --git a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
index f1c5ed27f31ce..6ceed0b8777b3 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
@@ -194,7 +194,8 @@ export default function SqlEditorLeftBar({
}
description={
- Manage your databases here
+ {t('Manage your databases')}{' '}
+ {t('here')}
}
/>
From dbed5fe7e53f8121e620009a0c71f0bcdfc7bf07 Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson
Date: Wed, 13 Apr 2022 15:33:36 -0700
Subject: [PATCH 14/28] fix spelling
---
superset-frontend/src/SqlLab/components/SqlEditor/index.jsx | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index dd4a5a22b6719..a7229a2113a1b 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -370,9 +370,8 @@ class SqlEditor extends React.PureComponent {
return base;
}
- // @ts-ignore
setEmptyState(bool) {
- this.setState({ setEmptyState: bool });
+ this.setState({ showEmptyState: bool });
}
setQueryEditorSql(sql) {
@@ -767,7 +766,6 @@ class SqlEditor extends React.PureComponent {
tables={this.props.tables}
actions={this.props.actions}
setEmptyState={this.setEmptyState}
- showDisabled={this.state.showEmptyState}
/>
From f1eba1926d10e74ebd3e4ec28d623e1d9609dfd7 Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson
Date: Wed, 13 Apr 2022 15:45:58 -0700
Subject: [PATCH 15/28] remove unused prop
---
superset-frontend/src/components/TableSelector/index.tsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/superset-frontend/src/components/TableSelector/index.tsx b/superset-frontend/src/components/TableSelector/index.tsx
index 0ac35b687eeac..872fc34725c3e 100644
--- a/superset-frontend/src/components/TableSelector/index.tsx
+++ b/superset-frontend/src/components/TableSelector/index.tsx
@@ -299,7 +299,6 @@ const TableSelector: FunctionComponent = ({
dbSelectClosedState={dbSelectClosedState}
setDbSearch={setDbSearch}
emptyState={emptyState}
- setEmptyState={setEmptyState}
formMode={formMode}
getDbList={getDbList}
handleError={handleError}
From 7bca734579b82ba37b3acf61155d61a018bbcd37 Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson
Date: Thu, 14 Apr 2022 09:29:14 -0700
Subject: [PATCH 16/28] add fn to prop change state
---
.../src/SqlLab/components/SqlEditorLeftBar/index.tsx | 7 ++++++-
.../src/components/DatabaseSelector/index.tsx | 8 +++-----
.../src/components/TableSelector/index.tsx | 10 +++-------
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
index 6ceed0b8777b3..556e8ea78be3f 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
@@ -115,6 +115,11 @@ export default function SqlEditorLeftBar({
if (isSelectIsClosed) setDbSearch(false);
}, [isSelectIsClosed]);
+ const onDbSearch = (searchText?: string) => {
+ if (searchText) setDbSearch(true);
+ else setDbSearch(false);
+ };
+
const onDbChange = ({ id: dbId }: { id: number }) => {
setEmptyState(false);
actions.queryEditorSetDb(queryEditor, dbId);
@@ -222,7 +227,7 @@ export default function SqlEditorLeftBar({
return (
>;
emptyState?: ReactNode;
formMode?: boolean;
getDbList?: (arg0: any) => {};
handleError: (msg: string) => void;
isDatabaseSelectEnabled?: boolean;
onDbChange?: (db: DatabaseObject) => void;
+ onEmptyResults?: (searchText?: string) => null;
onSchemaChange?: (schema?: string) => void;
onSchemasLoad?: (schemas: Array