From 19cb56169497113c17959386cf61d717a23f0d74 Mon Sep 17 00:00:00 2001 From: David Aaron Suddjian Date: Mon, 3 Aug 2020 23:35:35 -0700 Subject: [PATCH 1/7] widen the autocomplete menu for table names --- .../src/SqlLab/components/AceEditorWrapper/AceStyles.less | 3 +++ .../{AceEditorWrapper.tsx => AceEditorWrapper/index.tsx} | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less rename superset-frontend/src/SqlLab/components/{AceEditorWrapper.tsx => AceEditorWrapper/index.tsx} (97%) diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less b/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less new file mode 100644 index 0000000000000..6b8cc6ff20120 --- /dev/null +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less @@ -0,0 +1,3 @@ +.ace_editor.ace_autocomplete { + width: 520px; +} diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx similarity index 97% rename from superset-frontend/src/SqlLab/components/AceEditorWrapper.tsx rename to superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx index 370cdbcb910c9..ea63414806938 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx @@ -22,14 +22,15 @@ import 'brace/mode/sql'; import 'brace/theme/github'; import 'brace/ext/language_tools'; import ace from 'brace'; -import { areArraysShallowEqual } from '../../reduxUtils'; -import sqlKeywords from '../utils/sqlKeywords'; +import { areArraysShallowEqual } from 'src/reduxUtils'; +import sqlKeywords from '../../utils/sqlKeywords'; import { SCHEMA_AUTOCOMPLETE_SCORE, TABLE_AUTOCOMPLETE_SCORE, COLUMN_AUTOCOMPLETE_SCORE, SQL_FUNCTIONS_AUTOCOMPLETE_SCORE, -} from '../constants'; +} from '../../constants'; +import './AceStyles.less'; const langTools = ace.acequire('ace/ext/language_tools'); From a9e91ef668db58d8e5027c0c90acb8b60a41b3a6 Mon Sep 17 00:00:00 2001 From: David Aaron Suddjian Date: Tue, 4 Aug 2020 12:33:09 -0700 Subject: [PATCH 2/7] display the full table name in a tooltip --- .../src/components/TableSelector.jsx | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/superset-frontend/src/components/TableSelector.jsx b/superset-frontend/src/components/TableSelector.jsx index 922fdd652fca6..677663db375ea 100644 --- a/superset-frontend/src/components/TableSelector.jsx +++ b/superset-frontend/src/components/TableSelector.jsx @@ -30,6 +30,7 @@ import FormLabel from 'src/components/FormLabel'; import SupersetAsyncSelect from './AsyncSelect'; import RefreshLabel from './RefreshLabel'; import './TableSelector.less'; +import TooltipWrapper from './TooltipWrapper'; const FieldTitle = styled.p` color: ${({ theme }) => theme.colors.secondary.light2}; @@ -257,16 +258,22 @@ export default class TableSelector extends React.PureComponent { renderTableOption(option) { return ( - - - - - + + + + + + + + {option.label} - {option.label} - + ); } From dbbd54f98e2cc4fba7f41483b39c33c643cbd5ba Mon Sep 17 00:00:00 2001 From: David Aaron Suddjian Date: Tue, 4 Aug 2020 14:12:42 -0700 Subject: [PATCH 3/7] license --- .../AceEditorWrapper/AceStyles.less | 19 +++++++++++++++++++ .../src/components/TableSelector.jsx | 18 ++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less b/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less index 6b8cc6ff20120..076f68b3b0f91 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less @@ -1,3 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + .ace_editor.ace_autocomplete { width: 520px; } diff --git a/superset-frontend/src/components/TableSelector.jsx b/superset-frontend/src/components/TableSelector.jsx index 677663db375ea..c546d0a632f12 100644 --- a/superset-frontend/src/components/TableSelector.jsx +++ b/superset-frontend/src/components/TableSelector.jsx @@ -247,12 +247,18 @@ export default class TableSelector extends React.PureComponent { renderDatabaseOption(db) { return ( - - - {db.database_name} - + + + + {db.database_name} + + ); } From b15b8bb76dca47ca09c5fe95f88930b736995eb8 Mon Sep 17 00:00:00 2001 From: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> Date: Wed, 5 Aug 2020 09:47:50 -0700 Subject: [PATCH 4/7] Update superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx Co-authored-by: Evan Rusackas --- .../src/SqlLab/components/AceEditorWrapper/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx index ea63414806938..3f6bcc24d4186 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx @@ -23,7 +23,7 @@ import 'brace/theme/github'; import 'brace/ext/language_tools'; import ace from 'brace'; import { areArraysShallowEqual } from 'src/reduxUtils'; -import sqlKeywords from '../../utils/sqlKeywords'; +import sqlKeywords from 'src/SqlLab/utils/sqlKeywords'; import { SCHEMA_AUTOCOMPLETE_SCORE, TABLE_AUTOCOMPLETE_SCORE, From 8c1c08a4dde8a3f7abb34509e581fabab966db4e Mon Sep 17 00:00:00 2001 From: David Aaron Suddjian Date: Wed, 5 Aug 2020 10:14:12 -0700 Subject: [PATCH 5/7] src importing --- .../src/SqlLab/components/AceEditorWrapper/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx index 3f6bcc24d4186..ad6feaf077b5b 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx @@ -29,7 +29,7 @@ import { TABLE_AUTOCOMPLETE_SCORE, COLUMN_AUTOCOMPLETE_SCORE, SQL_FUNCTIONS_AUTOCOMPLETE_SCORE, -} from '../../constants'; +} from 'src/SqlLab/constants'; import './AceStyles.less'; const langTools = ace.acequire('ace/ext/language_tools'); From a8db6caef597a677be07c8a49369b408e663d59f Mon Sep 17 00:00:00 2001 From: David Aaron Suddjian Date: Wed, 5 Aug 2020 11:16:30 -0700 Subject: [PATCH 6/7] move autocomplete width css to main.less --- .../index.tsx => AceEditorWrapper.tsx} | 1 - .../AceEditorWrapper/AceStyles.less | 22 ------------------- superset-frontend/src/SqlLab/main.less | 4 ++++ 3 files changed, 4 insertions(+), 23 deletions(-) rename superset-frontend/src/SqlLab/components/{AceEditorWrapper/index.tsx => AceEditorWrapper.tsx} (99%) delete mode 100644 superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper.tsx similarity index 99% rename from superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx rename to superset-frontend/src/SqlLab/components/AceEditorWrapper.tsx index ad6feaf077b5b..29929d23d8ed9 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper.tsx @@ -30,7 +30,6 @@ import { COLUMN_AUTOCOMPLETE_SCORE, SQL_FUNCTIONS_AUTOCOMPLETE_SCORE, } from 'src/SqlLab/constants'; -import './AceStyles.less'; const langTools = ace.acequire('ace/ext/language_tools'); diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less b/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less deleted file mode 100644 index 076f68b3b0f91..0000000000000 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceStyles.less +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -.ace_editor.ace_autocomplete { - width: 520px; -} diff --git a/superset-frontend/src/SqlLab/main.less b/superset-frontend/src/SqlLab/main.less index b09884d8fcf45..df1c493942dd7 100644 --- a/superset-frontend/src/SqlLab/main.less +++ b/superset-frontend/src/SqlLab/main.less @@ -421,6 +421,10 @@ div.tablePopover { border: 1px solid @gray-light; font-feature-settings: @font-feature-settings; font-family: @font-family-monospace; + + &.ace_autocomplete { + width: 520px; + } } .Select__menu-outer { From 29f1a2d32ccdb9aa9189fed08098089ca2d54083 Mon Sep 17 00:00:00 2001 From: David Aaron Suddjian Date: Sun, 9 Aug 2020 21:56:00 -0700 Subject: [PATCH 7/7] use html title attribute instead of tooltip --- .../src/components/TableSelector.jsx | 43 +++++++------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/superset-frontend/src/components/TableSelector.jsx b/superset-frontend/src/components/TableSelector.jsx index c546d0a632f12..03818b306e48d 100644 --- a/superset-frontend/src/components/TableSelector.jsx +++ b/superset-frontend/src/components/TableSelector.jsx @@ -30,7 +30,6 @@ import FormLabel from 'src/components/FormLabel'; import SupersetAsyncSelect from './AsyncSelect'; import RefreshLabel from './RefreshLabel'; import './TableSelector.less'; -import TooltipWrapper from './TooltipWrapper'; const FieldTitle = styled.p` color: ${({ theme }) => theme.colors.secondary.light2}; @@ -247,39 +246,27 @@ export default class TableSelector extends React.PureComponent { renderDatabaseOption(db) { return ( - - - - {db.database_name} - - + + + {db.database_name} + ); } renderTableOption(option) { return ( - - - - - - - - {option.label} + + + + + - + {option.label} + ); }