Ver Fonte

HUE-4031 [editor] Add a global config flag to enable or disable the SQL syntax checker

Johan Ahlen há 8 anos atrás
pai
commit
7b8a7cc

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -172,6 +172,9 @@
   # Choose whether to show the new SQL editor.
   ## use_new_editor=true
 
+  # Choose whether to enable SQL syntax check or not
+  ## enable_sql_syntax_check=false
+
   # Choose whether to show the improved assist panel and the right context panel
   ## use_new_side_panels=false
 

+ 4 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -176,6 +176,10 @@
   # Choose whether to show the new SQL editor.
   ## use_new_editor=true
 
+  # Choose whether to enable the new SQL syntax checker or not
+  ## enable_sql_syntax_check=false
+
+
   # Choose whether to show the improved assist panel and the right context panel
   ## use_new_side_panels=false
 

+ 7 - 0
desktop/core/src/desktop/conf.py

@@ -1293,6 +1293,13 @@ DJANGO_EMAIL_BACKEND = Config(
   default="django.core.mail.backends.smtp.EmailBackend"
 )
 
+ENABLE_SQL_SYNTAX_CHECK = Config( # To remove when syntax check is ready
+  key='enable_sql_syntax_check',
+  default=False,
+  type=coerce_bool,
+  help=_('Choose whether to enable SQL syntax check or not.')
+)
+
 USE_NEW_AUTOCOMPLETER = Config( # This now refers to the new autocomplete dropdown
   key='use_new_autocompleter',
   default=True,

+ 2 - 2
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -3897,8 +3897,8 @@
         }
       };
 
-      if (window.Worker) {
-        var errorHighlightingEnabled = snippet.getApiHelper().getFromTotalStorage('hue.ace', 'errorHighlightingEnabled', false);
+      if (ENABLE_SQL_SYNTAX_CHECK && window.Worker) {
+        var errorHighlightingEnabled = snippet.getApiHelper().getFromTotalStorage('hue.ace', 'errorHighlightingEnabled', true);
 
         if (errorHighlightingEnabled) {
           aceLocationHandler.attachSqlSyntaxWorker();

+ 4 - 2
desktop/core/src/desktop/templates/common_header_footer_components.mako

@@ -73,9 +73,11 @@ from metadata.conf import has_optimizer, OPTIMIZER
       optimizer: ${ OPTIMIZER.CACHEABLE_TTL.get() }
     };
 
-    var AUTOCOMPLETE_TIMEOUT = ${ conf.EDITOR_AUTOCOMPLETE_TIMEOUT.get() }
+    var AUTOCOMPLETE_TIMEOUT = ${ conf.EDITOR_AUTOCOMPLETE_TIMEOUT.get() };
 
-    DocumentTypeGlobals = {
+    var ENABLE_SQL_SYNTAX_CHECK = '${ conf.ENABLE_SQL_SYNTAX_CHECK.get() }' === 'True';
+
+    var DocumentTypeGlobals = {
       'all': '${_('All')}',
       'directory': '${ _('Directory') }',
       'link-pigscript': '${_('Pig Script')}',