瀏覽代碼

HUE-7396 [dashboard] Adding config properties to enable query builder and report

Romain Rigaux 8 年之前
父節點
當前提交
59d32bc699

+ 15 - 9
desktop/conf.dist/hue.ini

@@ -829,22 +829,28 @@
 
 
 [dashboard]
 [dashboard]
 
 
-  ## Activate the Dashboard link in the menu.
-  # is_enabled=true
+  # Activate the Dashboard link in the menu.
+  ## is_enabled=true
 
 
-  ## Activate the SQL Dashboard (beta).
-  # has_sql_enabled=false
+  # Activate the SQL Dashboard (beta).
+  ## has_sql_enabled=false
+
+  # Activate the Query Builder (beta).
+  ## has_query_builder_enabled=false
+
+  # Activate the static report layout (beta).
+  ## has_report_enabled=false
 
 
   [[engines]]
   [[engines]]
 
 
     #  [[[solr]]]
     #  [[[solr]]]
-    ##  Requires Solr 6+
-    #  analytics=false
-    #  nesting=false
+    #  Requires Solr 6+
+    ##  analytics=false
+    ##  nesting=false
 
 
     #  [[[sql]]]
     #  [[[sql]]]
-    #  analytics=true
-    #  nesting=false
+    ##  analytics=true
+    ##  nesting=false
 
 
 
 
 ###########################################################################
 ###########################################################################

+ 15 - 9
desktop/conf/pseudo-distributed.ini.tmpl

@@ -831,22 +831,28 @@
 
 
 [dashboard]
 [dashboard]
 
 
-  ## Activate the Dashboard link in the menu.
-  # is_enabled=true
+  # Activate the Dashboard link in the menu.
+  ## is_enabled=true
 
 
-  ## Activate the SQL Dashboard (beta).
-  # has_sql_enabled=false
+  # Activate the SQL Dashboard (beta).
+  ## has_sql_enabled=false
+
+  # Activate the Query Builder (beta).
+  ## has_query_builder_enabled=false
+
+  # Activate the static report layout (beta).
+  ## has_report_enabled=false
 
 
   [[engines]]
   [[engines]]
 
 
     #  [[[solr]]]
     #  [[[solr]]]
-    ##  Requires Solr 6+
-    #  analytics=false
-    #  nesting=false
+    #  Requires Solr 6+
+    ##  analytics=false
+    ##  nesting=false
 
 
     #  [[[sql]]]
     #  [[[sql]]]
-    #  analytics=true
-    #  nesting=false
+    ##  analytics=true
+    ##  nesting=false
 
 
 
 
 ###########################################################################
 ###########################################################################

+ 6 - 0
desktop/core/src/desktop/templates/common_dashboard.mako

@@ -23,6 +23,8 @@
 
 
 <%!
 <%!
   from django.utils.translation import ugettext as _
   from django.utils.translation import ugettext as _
+
+  from dashboard.conf import HAS_QUERY_BUILDER_ENABLED, HAS_REPORT_ENABLED
 %>
 %>
 
 
 <%def name="import_layout(with_deferred=False)">
 <%def name="import_layout(with_deferred=False)">
@@ -51,11 +53,14 @@
         <div class="layout-box" style="width: 72px; margin-left: 4px"><i class="fa fa-line-chart"></i></div>
         <div class="layout-box" style="width: 72px; margin-left: 4px"><i class="fa fa-line-chart"></i></div>
       </div>
       </div>
     </a>
     </a>
+    % if HAS_QUERY_BUILDER_ENABLED.get():
     <a href="javascript: fullLayout(searchViewModel)" title="${ _('Query Builder: Single widget for easily analysing data in multiple dimensions') }" onmouseover="searchViewModel.previewColumns('qbuilder')" onmouseout="searchViewModel.previewColumns('')">
     <a href="javascript: fullLayout(searchViewModel)" title="${ _('Query Builder: Single widget for easily analysing data in multiple dimensions') }" onmouseover="searchViewModel.previewColumns('qbuilder')" onmouseout="searchViewModel.previewColumns('')">
       <div class="layout-container">
       <div class="layout-container">
         <div class="layout-box" style="width: 100px;"><i class="fa fa-table"></i></div>
         <div class="layout-box" style="width: 100px;"><i class="fa fa-table"></i></div>
       </div>
       </div>
     </a>
     </a>
+    % endif
+    % if HAS_REPORT_ENABLED.get():
     <a href="javascript: fullLayout(searchViewModel)" title="${ _('Report: static dashboard with multiple widgets executing independent queries') }" onmouseover="searchViewModel.previewColumns('dashboard')" onmouseout="searchViewModel.previewColumns('')">
     <a href="javascript: fullLayout(searchViewModel)" title="${ _('Report: static dashboard with multiple widgets executing independent queries') }" onmouseover="searchViewModel.previewColumns('dashboard')" onmouseout="searchViewModel.previewColumns('')">
       <div class="layout-container">
       <div class="layout-container">
         <div class="layout-box" style="width: 100px;">
         <div class="layout-box" style="width: 100px;">
@@ -63,6 +68,7 @@
         </div>
         </div>
       </div>
       </div>
     </a>
     </a>
+    % endif
     <a href="javascript: fullLayout(searchViewModel)" title="${ _('Empty dashboard that can be used as a starting point') }" onmouseover="searchViewModel.previewColumns('full')" onmouseout="searchViewModel.previewColumns('')">
     <a href="javascript: fullLayout(searchViewModel)" title="${ _('Empty dashboard that can be used as a starting point') }" onmouseover="searchViewModel.previewColumns('full')" onmouseout="searchViewModel.previewColumns('')">
       <div class="layout-container">
       <div class="layout-container">
         <div class="layout-box" style="width: 100px;"></div>
         <div class="layout-box" style="width: 100px;"></div>

+ 14 - 0
desktop/libs/dashboard/src/dashboard/conf.py

@@ -44,6 +44,20 @@ HAS_SQL_ENABLED = Config(
   type=coerce_bool
   type=coerce_bool
 )
 )
 
 
+HAS_QUERY_BUILDER_ENABLED = Config(
+  key="has_query_builder_enabled",
+  help=_t("Activate the Query Builder (beta)."),
+  default=False,
+  type=coerce_bool
+)
+
+HAS_REPORT_ENABLED = Config(
+  key="has_report_enabled",
+  help=_t("Activate the static report layout (beta)."),
+  default=False,
+  type=coerce_bool
+)
+
 
 
 def get_properties():
 def get_properties():
   if ENGINES.get():
   if ENGINES.get():