Browse Source

HUE-3281 [core] Unify some test config flags

Romain Rigaux 8 years ago
parent
commit
49879cf

+ 2 - 1
apps/search/src/search/conf.py

@@ -17,6 +17,7 @@
 
 
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
+from desktop.conf import is_hue4
 from desktop.lib.conf import Config, coerce_bool
 from desktop.lib.conf import Config, coerce_bool
 
 
 
 
@@ -45,6 +46,6 @@ LATEST = Config(
 ENABLE_SQL = Config(
 ENABLE_SQL = Config(
   key="enable_sql",
   key="enable_sql",
   help=_("Offer to use SQL engines to compute the dashboards."),
   help=_("Offer to use SQL engines to compute the dashboards."),
-  default=False,
+  dynamic_default=is_hue4,
   private=True,
   private=True,
   type=coerce_bool)
   type=coerce_bool)

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

@@ -1226,9 +1226,14 @@ USE_NEW_EDITOR = Config( # To remove in Hue 4
   help=_('Choose whether to show the new SQL editor.')
   help=_('Choose whether to show the new SQL editor.')
 )
 )
 
 
+def is_hue4():
+  """Hue is configured to show version 4."""
+  return IS_HUE_4.get()
+
+
 USE_NEW_SIDE_PANELS = Config( # To remove in Hue 4
 USE_NEW_SIDE_PANELS = Config( # To remove in Hue 4
   key='use_new_side_panels',
   key='use_new_side_panels',
-  default=False,
+  dynamic_default=is_hue4,
   type=coerce_bool,
   type=coerce_bool,
   help=_('Choose whether to show extended left and right panels.')
   help=_('Choose whether to show extended left and right panels.')
 )
 )
@@ -1240,6 +1245,7 @@ USE_DEFAULT_CONFIGURATION = Config(
   help=_('Enable saved default configurations for Hive, Impala, Spark, and Oozie.')
   help=_('Enable saved default configurations for Hive, Impala, Spark, and Oozie.')
 )
 )
 
 
+
 IS_HUE_4 = Config( # To remove in Hue 5
 IS_HUE_4 = Config( # To remove in Hue 5
   key='is_hue_4',
   key='is_hue_4',
   default=False,
   default=False,

+ 4 - 2
desktop/core/src/desktop/views.py

@@ -45,7 +45,7 @@ import desktop.conf
 import desktop.log.log_buffer
 import desktop.log.log_buffer
 
 
 from desktop.api import massaged_tags_for_json, massaged_documents_for_json, _get_docs
 from desktop.api import massaged_tags_for_json, massaged_documents_for_json, _get_docs
-from desktop.conf import USE_NEW_EDITOR
+from desktop.conf import USE_NEW_EDITOR, IS_HUE_4
 from desktop.converters import DocumentConverter
 from desktop.converters import DocumentConverter
 from desktop.lib import django_mako
 from desktop.lib import django_mako
 from desktop.lib.conf import GLOBAL_CONFIG, BoundConfig
 from desktop.lib.conf import GLOBAL_CONFIG, BoundConfig
@@ -347,7 +347,9 @@ def index(request):
   if request.user.is_superuser and request.COOKIES.get('hueLandingPage') != 'home':
   if request.user.is_superuser and request.COOKIES.get('hueLandingPage') != 'home':
     return redirect(reverse('about:index'))
     return redirect(reverse('about:index'))
   else:
   else:
-    if USE_NEW_EDITOR.get():
+    if IS_HUE_4.get():
+      return responsive(request)
+    elif USE_NEW_EDITOR.get():
       return home2(request)
       return home2(request)
     else:
     else:
       return home(request)
       return home(request)

+ 3 - 2
desktop/libs/notebook/src/notebook/conf.py

@@ -23,13 +23,14 @@ except ImportError:
 from django.utils.translation import ugettext_lazy as _t
 from django.utils.translation import ugettext_lazy as _t
 
 
 from desktop import appmanager
 from desktop import appmanager
+from desktop.conf import is_hue4
 from desktop.lib.conf import Config, UnspecifiedConfigSection, ConfigSection,\
 from desktop.lib.conf import Config, UnspecifiedConfigSection, ConfigSection,\
   coerce_json_dict, coerce_string, coerce_bool, coerce_csv
   coerce_json_dict, coerce_string, coerce_bool, coerce_csv
 
 
 
 
 def is_oozie_enabled():
 def is_oozie_enabled():
   """Oozie needs to be available as it is the backend."""
   """Oozie needs to be available as it is the backend."""
-  return len([app for app in appmanager.DESKTOP_MODULES if app.name == 'oozie']) > 0
+  return len([app for app in appmanager.DESKTOP_MODULES if app.name == 'oozie']) > 0 and is_hue4()
 
 
 
 
 SHOW_NOTEBOOKS = Config(
 SHOW_NOTEBOOKS = Config(
@@ -127,7 +128,7 @@ ENABLE_QUERY_SCHEDULING = Config(
   key="enable_query_scheduling",
   key="enable_query_scheduling",
   help=_t("Flag to enable the creation of a coordinator for the current SQL query."),
   help=_t("Flag to enable the creation of a coordinator for the current SQL query."),
   type=bool,
   type=bool,
-  default=False
+  dynamic_default=is_hue4
 )
 )
 
 
 ENABLE_BATCH_EXECUTE = Config(
 ENABLE_BATCH_EXECUTE = Config(