Browse Source

HUE-6869 [editor] Add a config flag to enable the language reference

The generated file is about 1.4 MB at this point, until split and fetched async the flag is disabled by default. Enable by:

[desktop]
  enable_sql_language_ref=true
Johan Ahlen 7 years ago
parent
commit
0fa80e56bd

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

@@ -38,6 +38,9 @@
   # container element.
   ## is_embedded=false
 
+  # Choose whether to enable the SQL Language Reference or not.
+  ## enable_sql_language_ref=false
+
   # A comma-separated list of available Hue load balancers
   ## hue_load_balancer=
 

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

@@ -42,6 +42,9 @@
   # container element.
   ## is_embedded=false
 
+  # Choose whether to enable the SQL Language Reference or not.
+  ## enable_sql_language_ref=false
+
   # A comma-separated list of available Hue load balancers
   ## hue_load_balancer=
 

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

@@ -1591,6 +1591,13 @@ IS_MULTICLUSTER_ONLY = Config(
   help=_('Choose whether to pick configs only from [desktop] [[cluster]]')
 )
 
+ENABLE_SQL_LANGUAGE_REF = Config(
+  key='enable_sql_language_ref',
+  default=False,
+  type=coerce_bool,
+  help=_('Choose whether to enable the SQL Language Reference or not.')
+)
+
 
 def get_clusters(user):
   clusters = []

+ 1 - 1
desktop/core/src/desktop/templates/assist.mako

@@ -3560,7 +3560,7 @@ from desktop.views import _ko
 
         var updateContentsForType = function (type) {
           self.functionsTabAvailable(type === 'hive' || type === 'impala' || type === 'pig');
-          self.langRefTabAvailable(type === 'impala');
+          self.langRefTabAvailable(type === 'impala' && window.ENABLE_SQL_LANGUAGE_REF);
           self.editorAssistantTabAvailable((!window.IS_EMBEDDED || window.EMBEDDED_ASSISTANT_ENABLED) && (type === 'hive' || type === 'impala'));
           self.dashboardAssistantTabAvailable(type === 'dashboard');
           self.schedulesTabAvailable(false);

+ 2 - 0
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -54,6 +54,8 @@
 
   window.IS_EMBEDDED = '${ IS_EMBEDDED.get() }' === 'True';
 
+  window.ENABLE_SQL_LANGUAGE_REF = '${ conf.ENABLE_SQL_LANGUAGE_REF.get() }' === 'True';
+
   window.HUE_I18n = {
     autocomplete: {
       category: {

+ 2 - 0
desktop/core/src/desktop/templates/hue.mako

@@ -512,7 +512,9 @@ ${ commonshare() | n,unicode }
 <script src="${ static('desktop/js/jquery.scrollup.js') }"></script>
 <script src="${ static('desktop/js/jquery.huedatatable.js') }"></script>
 <script src="${ static('desktop/js/sqlFunctions.js') }"></script>
+%if conf.ENABLE_SQL_LANGUAGE_REF.get():
 <script src="${ static('desktop/js/sqlImpalaLangRef.js') }"></script>
+%endif
 <script src="${ static('desktop/ext/js/selectize.min.js') }"></script>
 <script src="${ static('desktop/js/ko.selectize.js') }"></script>
 <script src="${ static('desktop/js/ace/ace.js') }"></script>