Преглед изворни кода

HUE-7503 [dashboard] Rename generated formula to plain formula

Romain Rigaux пре 8 година
родитељ
комит
8baf76388d

+ 3 - 3
desktop/libs/dashboard/src/dashboard/api.py

@@ -369,7 +369,7 @@ def _create_facet(collection, user, facet_id, facet_label, facet_field, widget_t
     'limit': 10,
     'mincount': 1,
     'isDate': False,
-    'aggregate': {'function': 'unique', 'formula': '', 'generated_formula': '', 'percentiles': [{'value': 50}]}
+    'aggregate': {'function': 'unique', 'formula': '', 'plain_formula': '', 'percentiles': [{'value': 50}]}
   }
 
   if widget_type in ('tree-widget', 'heatmap-widget', 'map-widget'):
@@ -378,7 +378,7 @@ def _create_facet(collection, user, facet_id, facet_label, facet_field, widget_t
     facet_type = 'nested'
     properties['facets'] = []
     properties['domain'] = {'blockParent': [], 'blockChildren': []}
-    properties['facets_form'] = {'field': '', 'mincount': 1, 'limit': 5, 'sort': 'desc', 'aggregate': {'function': 'unique', 'formula': '', 'generated_formula': '', 'percentiles': [{'value': 50}]}}
+    properties['facets_form'] = {'field': '', 'mincount': 1, 'limit': 5, 'sort': 'desc', 'aggregate': {'function': 'unique', 'formula': '', 'plain_formula': '', 'percentiles': [{'value': 50}]}}
     properties['scope'] = 'world'
     properties['limit'] = 100
   else:
@@ -403,7 +403,7 @@ def _create_facet(collection, user, facet_id, facet_label, facet_field, widget_t
       else:
         facet_type = 'nested'
 
-      properties['facets_form'] = {'field': '', 'mincount': 1, 'limit': 5, 'sort': 'desc', 'aggregate': {'function': 'unique', 'formula': '', 'generated_formula': '', 'percentiles': [{'value': 50}]}}
+      properties['facets_form'] = {'field': '', 'mincount': 1, 'limit': 5, 'sort': 'desc', 'aggregate': {'function': 'unique', 'formula': '', 'plain_formula': '', 'percentiles': [{'value': 50}]}}
       properties['facets'] = []
       properties['domain'] = {'blockParent': [], 'blockChildren': []}
 

+ 7 - 7
desktop/libs/dashboard/src/dashboard/static/dashboard/js/search.ko.js

@@ -1389,17 +1389,17 @@ var Collection = function (vm, collection) {
     var facetFound = widget == facet_field;
 
     $.each(widget.properties.facets(), function(index, facet) {
-      if (facet.aggregate.function() == 'count') {    	
-    	if (facetFound) {
-    	  return false;
-    	} else {
-    	  facets = [facet];
-    	}
+      if (facet.aggregate.function() == 'count') {
+        if (facetFound) {
+          return false;
+        } else {
+          facets = [facet];
+        }
       }
       if (facet == facet_field) {
         facetFound = true;
       } else {
-    	facets.push(facet);
+        facets.push(facet);
       }
     });
 

+ 9 - 6
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -578,7 +578,7 @@ ${ dashboard.layout_skeleton(suffix='search') }
         <i class="fa" data-bind="css: { 'fa-caret-down': properties.sort() == 'desc', 'fa-caret-up': properties.sort() == 'asc', 'fa-sort': properties.sort() == 'default' }"></i>
         <span data-bind="visible: properties.sort() == 'desc'">${_('descending')}</span>
         <span data-bind="visible: properties.sort() == 'asc'">${_('ascending')}</span>
-        <span data-bind="visible: $parent.sort() == 'default'">${_('default')}</span>
+        <span data-bind="visible: properties.sort() == 'default'">${_('default')}</span>
       </a>
     </div>
     <!-- /ko -->
@@ -1739,8 +1739,8 @@ ${ dashboard.layout_skeleton(suffix='search') }
 
       <div class="pull-right" style="margin-top: 40px">
 
-        <div class="inline-block" style="padding-bottom: 10px; padding-right: 20px">
-          <span class="facet-field-label">${ _('Sorting') }</span>
+        <div class="inline-block hide" style="padding-bottom: 10px; padding-right: 20px">
+          <span class="facet-field-label hide">${ _('Sorting') }</span>
           <a href="javascript: void(0)" title="${ _('Toggle sort order') }" data-bind="click: $root.collection.toggleSortFacet">
             <i class="fa" data-bind="css: { 'fa-caret-down': properties.sort() == 'desc', 'fa-caret-up': properties.sort() == 'asc' }"></i>
             <span data-bind="visible: properties.sort() == 'desc'">${_('descending')}</span>
@@ -2095,7 +2095,7 @@ ${ dashboard.layout_skeleton(suffix='search') }
       <br/>
 
       <input data-bind="value: formula, visible: $parent.field() == 'formula', valueUpdate: 'afterkeydown'"></input>
-      <input data-bind="value: generated_formula" type="hidden"></input>
+      <input data-bind="value: plain_formula" type="hidden"></input>
 
       <!-- ko if: $data.function() != 'field' && $data.metrics -->
       <div class="facet-field-cnt">
@@ -2132,6 +2132,9 @@ ${ dashboard.layout_skeleton(suffix='search') }
     <!-- ko if: !$root.isEditing() -->
     <div class="content" style="border: 1px solid #d8d8d8;">
       <div data-bind="text: getPrettyMetric($data)" class="muted"></div>
+      <!-- ko if: $data.function() != 'field' && $data.metrics -->
+      <i class="fa" data-bind="css: { 'fa-long-arrow-down': $parent.sort() == 'desc', 'fa-long-arrow-up': $parent.sort() == 'asc' }"></i>
+      <!-- /ko -->
     </div>
     <!-- /ko -->
 
@@ -2842,8 +2845,8 @@ var DATETIME_HIT_OPTIONS = [
     { value: "unique", label: "${ _('Unique') }" },
 ];
 var ALPHA_HIT_COUNTER_OPTIONS = [
-    { value: "count", label: "${ _('Group by') }" },
-    ## { value: "counts", label: "Count" },
+    ##{ value: "count", label: "${ _('Group by') }" },
+    ##{ value: "counts", label: "Count" },
     { value: "unique", label: "${ _('Unique') }" },
     { value: "min", label: "${ _('Min') }" },
     { value: "max", label: "${ _('Max') }" }

+ 1 - 2
desktop/libs/libsolr/src/libsolr/api.py

@@ -143,13 +143,12 @@ class SolrApi(object):
               ('facet.field', '{!key=%(key)s ex=%(id)s f.%(field)s.facet.limit=%(limit)s f.%(field)s.facet.mincount=%(mincount)s}%(field)s' % keys),
           )
         elif facet['type'] == 'nested':
-#           sort = {'count': facet['sort']}
           sort = {'count': facet['properties']['sort']}
           for i, agg in enumerate(self._get_dimension_aggregates(facet['properties']['facets'])):
             if agg['sort'] != 'default':
               agg_function = self._get_aggregate_function(agg)
               sort = {'agg_%02d_%02d:%s' % (1, i, agg_function): agg['sort']}
-          print sort
+
           if sort.get('count') == 'default':
             sort['count'] = 'desc'
           _f = {