Răsfoiți Sursa

HUE-7839 [dashboard] Support the new counter form in SQL

Romain Rigaux 8 ani în urmă
părinte
comite
b3651a486a

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

@@ -1531,7 +1531,7 @@ ${ dashboard.layout_skeleton(suffix='search') }
         <!-- ko if: widgetType() == 'hit-widget' -->
           <!-- ko with: $parent -->
             <!-- ko if: counts().length > 0 -->
-              <span class="big-counter" data-bind="template: { name: 'counter-form', data: {counts: counts()[0].count, properties: $root.collection.getFacetById($parent.id()).properties }}"></span>
+              <span class="big-counter" data-bind="template: { name: 'counter-form', data: {counts: counts(), properties: $root.collection.getFacetById($parent.id()).properties }}"></span>
             <!-- /ko -->
           <!-- /ko -->
         <!-- /ko -->

+ 1 - 1
desktop/libs/notebook/src/notebook/dashboard_api.py

@@ -734,7 +734,7 @@ class SQLDashboardApi(DashboardApi):
   def _convert_notebook_function_facet(self, result, facet, query):
     rows = list(result['data'])
 
-    response = {"query": facet['id'], "counts": rows[0][0], "type": "function", "id": facet['id'], "label": facet['id']}
+    response = {"query": facet['id'], 'counts': {'percentage': 0, 'value': rows[0][0]}, "type": "function", "id": facet['id'], "label": facet['id']}
 
     return {'normalized_facets': [response]}