Эх сурвалжийг харах

HUE-6874 [search] Properly reinitialize the nested facet form

Fix percentile function syntax.
Fix Add dimension icon padding.
Romain Rigaux 8 жил өмнө
parent
commit
6e6366f

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

@@ -683,10 +683,6 @@ var Collection = function (vm, collection) {
         return _fields;
       });
 
-      if (typeof facets_form != 'undefined' && typeof facets_form.aggregate != 'undefined') {
-        facet.properties.facets_form.aggregate.percentiles = ko.mapping.fromJS([{'value': 50}]);
-      }
-
       facet.template.fieldsSelected.subscribe(function(newValue) { // Could be more efficient as we don't need to research, just redraw
         vm.getFacetFromQuery(facet.id()).resultHash('');
         vm.search();
@@ -916,7 +912,8 @@ var Collection = function (vm, collection) {
 
     facet.properties.facets_form.aggregate.function('count');
     facet.properties.facets_form.aggregate.ops.removeAll();
-    facet.properties.facets_form.aggregate.percentiles(ko.mapping.fromJS([{'value': 50}]));
+    facet.properties.facets_form.aggregate.percentiles.removeAll();
+    facet.properties.facets_form.aggregate.percentiles.push({'value': 50});
 
     if (pivot != null) {
       pivot.aggregate.function.subscribe(function() {

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

@@ -692,7 +692,7 @@ ${ dashboard.layout_skeleton(suffix='search') }
   <div class="filter-box" data-bind="visible: $root.isEditing() && properties.facets().length < 15" style="opacity: 0.7">
     <div class="title" style="border: 1px dashed #d8d8d8; border-bottom: none">
       <a data-bind="visible: ko.toJSON(properties.facets_form.field), click: $root.collection.addPivotFacetValue2" class="pull-right" href="javascript:void(0)">
-        <i class="fa fa-plus"></i> ${ _('Add') }
+        <i class="fa fa-fw fa-plus"></i> ${ _('Add') }
       </a>
       <select data-bind="options: $root.collection.template.fieldsNames, value: properties.facets_form.field, optionsCaption: '${ _ko('Field...') }', selectize: $root.collection.template.fieldsNames" class="hit-options" style="margin-bottom: 0"></select>
       <div class="clearfix"></div>

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

@@ -785,8 +785,9 @@ class SolrApi(object):
       if f['function'] == 'median':
         f['function'] = 'percentile'
         fields.append('50')
-      elif f['function'] == 'percentiles':
+      elif f['function'] == 'percentile':
         fields.extend(map(lambda a: str(a), [_p['value'] for _p in f['percentiles']]))
+        f['function'] = 'percentile'
       return '%s(%s)' % (f['function'], ','.join(fields))
 
   def _get_range_borders(self, collection, query):