浏览代码

HUE-2236 [search] Highlight the selected pivot

Enrico Berti 11 年之前
父节点
当前提交
56c276ec78

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

@@ -887,7 +887,6 @@ ${ dashboard.layout_skeleton() }
           onStateChange: function(state){ },
           onClick: function(d) {
             $root.query.togglePivotFacet({facet: d.obj, widget_id: id()});
-            $(document).find('svg').css('opacity', '1');
           },
           onComplete: function(){ viewModel.getWidgetById(id()).isLoading(false) } }"
         />

+ 6 - 7
apps/search/static/css/search.css

@@ -276,10 +276,10 @@ em {
 
 .filter-box .title {
   font-weight: bold;
-  color: #FFF;
-  padding-left: 5px;
+  color: #333;
+  padding: 5px;
   border: 1px solid #d8d8d8;
-  background-color: #999;
+  background-color: #F6F6F6;
   border-bottom: none;
   -webkit-border-radius: 3px 3px 0 0;
   -moz-border-radius: 3px 3px 0 0;
@@ -287,8 +287,7 @@ em {
 }
 
 .filter-box .title a {
-  color: #FFF;
-  margin-right: 5px;
+  color: #333;
 }
 
 .filter-box .title.excluded {
@@ -296,8 +295,8 @@ em {
 }
 
 .filter-box .content {
-  padding: 5px;
-  background-color: #F6F6F6;
+  padding: 8px;
+  background-color: #FFFFFF;
   border: 1px solid #d8d8d8;
   border-top: none;
   -webkit-border-radius: 0 0 3px 3px;

+ 1 - 1
desktop/core/src/desktop/templates/common_dashboard.mako

@@ -225,7 +225,7 @@
   <script src="/static/ext/js/leaflet/leaflet.js" type="text/javascript" charset="utf-8"></script>
 
   <script src="/static/ext/js/d3.v3.js" type="text/javascript" charset="utf-8"></script>
-  <script src="/static/ext/js/nv.d3.js" type="text/javascript" charset="utf-8"></script>
+  <script src="/static/js/nv.d3.js" type="text/javascript" charset="utf-8"></script>
   <script src="/static/ext/js/topojson.v1.min.js" type="text/javascript" charset="utf-8"></script>
   <script src="/static/ext/js/topo/world.topo.js" type="text/javascript" charset="utf-8"></script>
   <script src="/static/ext/js/topo/usa.topo.js" type="text/javascript" charset="utf-8"></script>

文件差异内容过多而无法显示
+ 0 - 0
desktop/core/static/ext/js/nv.d3.min.js


+ 6 - 0
desktop/core/static/js/ko.charts.js

@@ -542,6 +542,12 @@ function barChartBuilder(element, options, isTimeline) {
         if (item.field() == options.field) {
           _chart.selectBars($.map(item.filter(), function(it) {return it.value();}));
         }
+        if (item.field().indexOf(":") > -1){
+          _chart.selectBars({
+            field: item.field(),
+            selected: $.map(item.filter(), function(it) {return it.value();})
+          });
+        }
       });
 
       nv.utils.windowResize(_chart.update);

+ 17 - 4
desktop/core/static/js/nv.d3.growingMultiBar.js

@@ -206,16 +206,29 @@ nv.models.growingMultiBar = function() {
       bars.exit().remove();
 
       selectBars = function(selected) {
+        var _pivotField = null;
+        if (!Array.isArray(selected)){
+          _pivotField = selected.field;
+          selected = selected.selected;
+        }
+
         $(selected).each(function(cnt, item){
           bars.each(function(d, i) {
-            if (d.x instanceof Date){
-              if (moment(d.x).utc().format("YYYY-MM-DD[T]HH:mm:ss[Z]") == item) {
+            if (_pivotField != null){
+              if (d.obj.fq_fields == _pivotField && d.obj.fq_values == item){
                 d3.select(this).classed('selected', true);
               }
             }
             else {
-              if (d.x == item) {
-                d3.select(this).classed('selected', true);
+              if (d.x instanceof Date){
+                if (moment(d.x).utc().format("YYYY-MM-DD[T]HH:mm:ss[Z]") == item) {
+                  d3.select(this).classed('selected', true);
+                }
+              }
+              else {
+                if (d.x == item) {
+                  d3.select(this).classed('selected', true);
+                }
               }
             }
           });

+ 2 - 2
desktop/core/static/ext/js/nv.d3.js → desktop/core/static/js/nv.d3.js

@@ -1102,7 +1102,7 @@ nv.utils.optionsFunc = function(args) {
           axisLabel
               .attr('text-anchor', 'middle')
               .attr('y', 0)
-              .attr('x', w/2);
+              .attr('x', nv.utils.NaNtoZero(w)/2);
           if (showMaxMin) {
             var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
                            .data(scale.domain());
@@ -1149,7 +1149,7 @@ nv.utils.optionsFunc = function(args) {
           axisLabel
               .attr('text-anchor', 'middle')
               .attr('y', xLabelMargin)
-              .attr('x', w/2);
+              .attr('x', nv.utils.NaNtoZero(w)/2);
           if (showMaxMin) {
           //if (showMaxMin && !isOrdinal) {
             var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')

部分文件因为文件数量过多而无法显示