Ver código fonte

HUE-6357 [notebook] Enable the selection of queries from files, saved queries as snippet

Main usage it to allow Notebook to be used a simple Presentations.
Romain Rigaux 8 anos atrás
pai
commit
3b4cb6a8d3

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

@@ -666,6 +666,9 @@
   ## Show the notebook menu or not
   # show_notebooks=true
 
+  ## Flag to enable the selection of queries from files, saved queries into the editor or as snippet.
+  # enable_external_statements=true
+
   ## Flag to enable the bulk submission of queries as a background task through Oozie.
   # enable_batch_execute=true
 

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

@@ -668,6 +668,9 @@
   ## Show the notebook menu or not
   # show_notebooks=true
 
+  ## Flag to enable the selection of queries from files, saved queries into the editor or as snippet.
+  # enable_external_statements=true
+
   ## Flag to enable the bulk submission of queries as a background task through Oozie.
   # enable_batch_execute=true
 

+ 7 - 0
desktop/libs/notebook/src/notebook/conf.py

@@ -131,6 +131,13 @@ ENABLE_QUERY_SCHEDULING = Config(
   dynamic_default=is_hue4
 )
 
+ENABLE_EXTERNAL_STATEMENT = Config(
+  key="enable_external_statements",
+  help=_t("Flag to enable the selection of queries from files, saved queries into the editor or as snippet."),
+  type=bool,
+  default=True
+)
+
 ENABLE_BATCH_EXECUTE = Config(
   key="enable_batch_execute",
   help=_t("Flag to enable the bulk submission of queries as a background task through Oozie."),

+ 2 - 2
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -22,7 +22,7 @@ from desktop.lib.i18n import smart_unicode
 from desktop.views import _ko, antixss
 
 from metadata.conf import has_optimizer
-from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_BATCH_EXECUTE
+from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_BATCH_EXECUTE, ENABLE_EXTERNAL_STATEMENT
 %>
 
 <%def name="includes(is_embeddable=False)">
@@ -909,7 +909,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
 
 
 <script type="text/html" id="snippet-header-statement-type">
-  % if ENABLE_BATCH_EXECUTE.get():
+  % if ENABLE_EXTERNAL_STATEMENT.get():
   <!-- ko if: isSqlDialect() -->
     <div class="margin-left-10" data-bind="component: { name: 'hue-drop-down', params: { value: statementType, entries: statementTypes, linkTitle: '${ _ko('Statement type') }' } }" style="display: inline-block"></div>
   <!-- /ko -->