浏览代码

HUE-7931 [dashboard] Feature flag for widget filter and compare

To turn on and compare values against some period of times or filter via direct query:
[dashboard]
has_widget_filter=true

Not styled currently.
Romain Rigaux 7 年之前
父节点
当前提交
4ad5940

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

@@ -880,6 +880,9 @@
   # Activate the new grid layout system (beta).
   ## use_gridster=false
 
+  # Activate the widget filter and comparison (beta).
+  ## has_widget_filter=false
+
   [[engines]]
 
     #  [[[solr]]]

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

@@ -882,6 +882,9 @@
   # Activate the new grid layout system (beta).
   ## use_gridster=false
 
+  # Activate the widget filter and comparison (beta).
+  ## has_widget_filter=false
+
   [[engines]]
 
     #  [[[solr]]]

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

@@ -65,6 +65,12 @@ USE_GRIDSTER = Config(
   type=coerce_bool
 )
 
+HAS_WIDGET_FILTER = Config(
+  key="has_widget_filter",
+  help=_t("Activate the widget filter and comparison (beta)."),
+  default=False,
+  type=coerce_bool
+)
 
 def get_properties():
   if ENGINES.get():

+ 3 - 1
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -20,7 +20,7 @@ from django.utils.translation import ugettext as _
 from desktop import conf
 from desktop.views import commonheader, commonfooter, _ko, commonshare
 
-from dashboard.conf import USE_GRIDSTER, HAS_REPORT_ENABLED
+from dashboard.conf import USE_GRIDSTER, HAS_REPORT_ENABLED, HAS_WIDGET_FILTER
 %>
 
 <%namespace name="dashboard" file="common_dashboard.mako" />
@@ -2018,10 +2018,12 @@ ${ dashboard.layout_skeleton(suffix='search') }
     <div data-bind="with: $root.collection.getFacetById($parent.id())">
       <span data-bind="template: { name: 'facet-toggle2' }"></span>
 
+      % if HAS_WIDGET_FILTER.get():      
       <div class="pull-right">
         <span data-bind="visible: $root.collection.supportAnalytics(), template: { name: 'facet-filter', data: properties.filter }"></span>
         <span data-bind="visible: $root.collection.supportAnalytics() && $root.availableDateFields().length > 0, template: { name: 'facet-compare', data: properties.compare }"></span>
       </div>
+      % endif
     </div>
 
     <span class="big-counter" data-bind="template: { name: 'counter-form', data: {counts: counts(), properties: $root.collection.getFacetById($parent.id()).properties }}"></span>