Эх сурвалжийг харах

HUE-3461 [notebook] Flag to show notebooks in the top menu

Romain Rigaux 9 жил өмнө
parent
commit
c48722377d

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

@@ -564,6 +564,9 @@
 
 [notebook]
 
+  ## Show the notebook menu or not
+  # show_notebooks=true
+
   ## Base URL to Remote GitHub Server
   # github_remote_url=https://github.com
 

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

@@ -568,6 +568,9 @@
 
 [notebook]
 
+  ## Show the notebook menu or not
+  # show_notebooks=true
+
   ## Base URL to Remote GitHub Server
   # github_remote_url=https://github.com
 

+ 2 - 2
desktop/core/src/desktop/templates/common_header.mako

@@ -495,9 +495,9 @@ if USE_NEW_EDITOR.get():
        % endif
        % if 'beeswax' in apps:
         <%
-          from desktop.conf import USE_NEW_EDITOR
+          from notebook.conf import SHOW_NOTEBOOKS
         %>
-        % if USE_NEW_EDITOR.get():
+        % if SHOW_NOTEBOOKS.get():
          <% from desktop.models import Document2, Document %>
          <% notebooks = [d.content_object.to_dict() for d in Document.objects.get_docs(user, Document2, extra='notebook') if not d.content_object.is_history] %>
          % if not notebooks:

+ 10 - 1
desktop/libs/notebook/src/notebook/conf.py

@@ -23,7 +23,7 @@ except ImportError:
 from django.utils.translation import ugettext_lazy as _t
 
 from desktop.lib.conf import Config, UnspecifiedConfigSection, ConfigSection,\
-  coerce_json_dict, coerce_string
+  coerce_json_dict, coerce_string, coerce_bool
 
 
 def get_interpreters(user=None):  
@@ -40,6 +40,14 @@ def get_interpreters(user=None):
       for i in interpreters
   ]
 
+
+SHOW_NOTEBOOKS = Config(
+    key="show_notebooks",
+    help=_t("Show the notebook menu or not"),
+    type=coerce_bool,
+    default=True
+)
+
 INTERPRETERS = UnspecifiedConfigSection(
   "interpreters",
   help="One entry for each type of snippet. The first 5 will appear in the wheel.",
@@ -102,6 +110,7 @@ GITHUB_CLIENT_SECRET = Config(
     default=""
 )
 
+
 def _default_interpreters():
   INTERPRETERS.set_for_testing(OrderedDict((
       ('hive', {