Browse Source

HUE-5417 [search] Provide the field analysis link

Romain Rigaux 9 years ago
parent
commit
42edf920c9

+ 1 - 1
apps/search/src/search/models.py

@@ -895,7 +895,7 @@ def augment_solr_response(response, collection, query):
           'dimension': dimension,
           'dimension': dimension,
           'response': {'response': {'start': 0, 'numFound': len(rows)}},
           'response': {'response': {'start': 0, 'numFound': len(rows)}},
           'docs': [dict(zip(cols, row)) for row in rows],
           'docs': [dict(zip(cols, row)) for row in rows],
-          'fieldsAttributes': [Collection2._make_gridlayout_header_field({'name': col, 'type': 'string'}) for col in cols]
+          'fieldsAttributes': [Collection2._make_gridlayout_header_field({'name': col, 'type': 'aggr' if '(' in col else 'string'}) for col in cols]
         }
         }
 
 
         normalized_facets.append(facet)
         normalized_facets.append(facet)

+ 1 - 1
apps/search/src/search/static/search/js/search.ko.js

@@ -1442,7 +1442,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
     self.toggledGridlayoutResultChevron(false);
     self.toggledGridlayoutResultChevron(false);
   };
   };
   self.fieldAnalyses = ko.observableArray([]);
   self.fieldAnalyses = ko.observableArray([]);
-  self.fieldAnalysesName = ko.observableArray("");
+  self.fieldAnalysesName = ko.observable("");
   self.fieldsAnalysisAttributesNames = ko.computed(function () {
   self.fieldsAnalysisAttributesNames = ko.computed(function () {
     var _fields = [];
     var _fields = [];
     $.each(self.collection.template.fieldsAttributes(), function (index, field) {
     $.each(self.collection.template.fieldsAttributes(), function (index, field) {

+ 1 - 1
apps/search/src/search/templates/common_search.mako

@@ -1711,7 +1711,7 @@ ${ dashboard.layout_skeleton() }
           <div style="margin-bottom: 3px; white-space: nowrap; position:relative">
           <div style="margin-bottom: 3px; white-space: nowrap; position:relative">
             <input type="checkbox" data-bind="checkedValue: name, checked: $parent.template.fieldsSelected" style="margin: 0" />
             <input type="checkbox" data-bind="checkedValue: name, checked: $parent.template.fieldsSelected" style="margin: 0" />
             <div data-bind="text: name, css:{'field-selector': true, 'hoverable': $parent.template.fieldsSelected.indexOf(name()) > -1}, click: highlightColumn" style="margin-right:10px"></div>
             <div data-bind="text: name, css:{'field-selector': true, 'hoverable': $parent.template.fieldsSelected.indexOf(name()) > -1}, click: highlightColumn" style="margin-right:10px"></div>
-            <i class="fa fa-question-circle muted pointer analysis" data-bind="click: function(data, e) { $parent.fieldAnalysesName(name()); $parent.showFieldAnalysis(data, e); }, attr: {'title': '${ _ko('Analyze ') } ' + name() + ' (' + type() + ')'}" style="position:absolute; left: 168px; background-color: #FFF"></i>
+            <i class="fa fa-question-circle muted pointer analysis" data-bind="click: function(data, e) { $root.fieldAnalysesName(name()); $root.showFieldAnalysis(data, e); }, attr: {'title': '${ _ko('Analyze ') } ' + name() + ' (' + type() + ')'}, visible: type() != 'aggr'" style="position:absolute; left: 168px; background-color: #FFF"></i>
           </div>
           </div>
         </div>
         </div>
         <div data-bind="visible: template.filteredAttributeFields().length == 0" style="padding-left:4px; padding-top:5px; font-size:40px; color:#CCC">
         <div data-bind="visible: template.filteredAttributeFields().length == 0" style="padding-left:4px; padding-top:5px; font-size:40px; color:#CCC">