Răsfoiți Sursa

HUE-7757 [dashboard] Give a text label to the dimension

jdesjean 8 ani în urmă
părinte
comite
46c49e2

+ 1 - 0
desktop/libs/dashboard/src/dashboard/api.py

@@ -420,6 +420,7 @@ def _create_facet(collection, user, facet_id, facet_label, facet_field, widget_t
       facet = NESTED_FACET_FORM.copy()
       facet['field'] = facet_field
       facet['limit'] = 10
+      facet['fieldLabel'] = facet_field
 
       if range_properties:
         # TODO: timeline still uses properties from top properties

+ 2 - 0
desktop/libs/dashboard/src/dashboard/models.py

@@ -139,6 +139,8 @@ class Collection2(object):
         properties['domain'] = {'blockParent': [], 'blockChildren': []}
       if 'missing' not in properties:
         properties['missing'] = False
+      if 'fieldLabel' not in properties:
+        properties['fieldLabel'] = None
 
       if facet['widgetType'] == 'histogram-widget':
         if 'timelineChartType' not in properties:

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

@@ -1031,6 +1031,7 @@ var Collection = function (vm, collection) {
 
     pivot = ko.mapping.fromJS({
       'field': ko.mapping.toJS(facet.properties.facets_form.field),
+      'fieldLabel': ko.mapping.toJS(facet.properties.facets_form.field),
       'limit': ko.mapping.toJS(facet.properties.facets_form.limit),
       'mincount': ko.mapping.toJS(facet.properties.facets_form.mincount),
       'aggregate': ko.mapping.toJS(facet.properties.facets_form.aggregate),

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

@@ -594,7 +594,7 @@ ${ dashboard.layout_skeleton(suffix='search') }
         <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }, visible: $parent.properties.facets().length > 1" class="pull-right" href="javascript:void(0)">
           <i class="fa fa-times"></i>
         </a>
-        <div class="hit-title" data-bind="text: field, attr: {'title': field}"></div>
+        <div class="hit-title" data-bind="editable: fieldLabel, editableOptions: { enabled: $root.isEditing(), placement: 'right' }, attr: { 'title': fieldLabel }"></div>
         <div class="clearfix"></div>
       </div>