You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2022/04/15 18:55:10 UTC

[superset] branch master updated: fix(sql lab): add quotes when autocompleting table names with spaces in the editor (#19311)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d4a52c9d0 fix(sql lab): add quotes when autocompleting table names with spaces in the editor (#19311)
8d4a52c9d0 is described below

commit 8d4a52c9d014047baecbdab76f48eb729e3842dc
Author: Diego Medina <di...@gmail.com>
AuthorDate: Fri Apr 15 14:55:04 2022 -0400

    fix(sql lab): add quotes when autocompleting table names with spaces in the editor (#19311)
---
 .../src/SqlLab/components/AceEditorWrapper/index.tsx           | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx
index e2e141608c..53ec3f808a 100644
--- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx
+++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx
@@ -227,11 +227,15 @@ class AceEditorWrapper extends React.PureComponent<Props, State> {
             this.props.queryEditor.schema,
           );
         }
+
+        let { caption } = data;
+        if (data.meta === 'table' && caption.includes(' ')) {
+          caption = `"${caption}"`;
+        }
+
         // executing https://github.com/thlorenz/brace/blob/3a00c5d59777f9d826841178e1eb36694177f5e6/ext/language_tools.js#L1448
         editor.completer.insertMatch(
-          `${data.caption}${
-            ['function', 'schema'].includes(data.meta) ? '' : ' '
-          }`,
+          `${caption}${['function', 'schema'].includes(data.meta) ? '' : ' '}`,
         );
       },
     };