Skip to content

Commit 0de553d

Browse files
Toggling spy panel no longer throws an error
1 parent c5ca160 commit 0de553d

4 files changed

Lines changed: 18 additions & 15 deletions

File tree

src/ui/public/filter_bar/filter_bar.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import _ from 'lodash';
22
import template from 'ui/filter_bar/filter_bar.html';
3-
import moment from 'moment';
4-
import angular from 'angular';
53
import 'ui/directives/json_input';
64
import filterAppliedAndUnwrap from 'ui/filter_bar/lib/filter_applied_and_unwrap';
75
import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters';

src/ui/public/vislib/lib/dispatch.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ export default function DispatchClass(Private, config) {
101101
const isClickable = this.listenerCount('click') > 0;
102102
const addEvent = this.addEvent;
103103
const $el = this.handler.el;
104-
if (!this.handler.highlight) {
105-
this.handler.highlight = self.highlight;
106-
}
104+
this.handler.highlight = self.highlight;
107105

108106
function hover(d, i) {
109107
// Add pointer if item is clickable
@@ -127,9 +125,7 @@ export default function DispatchClass(Private, config) {
127125
const self = this;
128126
const addEvent = this.addEvent;
129127
const $el = this.handler.el;
130-
if (!this.handler.unHighlight) {
131-
this.handler.unHighlight = self.unHighlight;
132-
}
128+
this.handler.unHighlight = self.unHighlight;
133129

134130
function mouseout() {
135131
self.handler.unHighlight.call(this, $el);

src/ui/public/vislib/lib/handler/handler.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export default function HandlerBaseClass(Private) {
2020
*/
2121
class Handler {
2222
constructor(vis, opts) {
23-
2423
this.data = opts.data || new Data(vis.data, vis._attr, vis.uiState);
2524
this.vis = vis;
2625
this.el = vis.el;
@@ -77,6 +76,17 @@ export default function HandlerBaseClass(Private) {
7776
* @returns {*}
7877
*/
7978
this.disable = this.chartEventProxyToggle('off');
79+
80+
}
81+
82+
83+
/**
84+
* Clients expect the Handler-type to have a highlight/unhighlight functions. The default implementation is a noop.
85+
* Specific implementations are free to override this.
86+
*/
87+
highlight() {
88+
}
89+
unHighlight() {
8090
}
8191

8292
/**

src/ui/public/visualize/visualize_legend.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import _ from 'lodash';
22
import html from 'ui/visualize/visualize_legend.html';
3-
import $ from 'jquery';
4-
import d3 from 'd3';
5-
import findByParam from 'ui/utils/find_by_param';
63
import VislibLibDataProvider from 'ui/vislib/lib/data';
74
import VislibComponentsColorColorProvider from 'ui/vislib/components/color/color';
85
import FilterBarFilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler';
@@ -18,7 +15,7 @@ uiModules.get('kibana')
1815
return {
1916
restrict: 'E',
2017
template: html,
21-
link: function ($scope, $elem) {
18+
link: function ($scope) {
2219
let $state = getAppState();
2320
let clickHandler = filterBarClickHandler($state);
2421
$scope.open = $scope.uiState.get('vis.legendOpen', true);
@@ -32,7 +29,9 @@ uiModules.get('kibana')
3229
$scope.highlight = function (event) {
3330
let el = event.currentTarget;
3431
let handler = $scope.renderbot.vislibVis.handler;
35-
if (!handler) return;
32+
if (!handler) {
33+
return;
34+
}
3635
handler.highlight.call(el, handler.el);
3736
};
3837

@@ -110,7 +109,7 @@ uiModules.get('kibana')
110109
data = data.columns || data.rows || [data];
111110
if (type === 'pie') return Data.prototype.pieNames(data);
112111
return getSeriesLabels(data);
113-
};
112+
}
114113

115114
function getSeriesLabels(data) {
116115
let values = data.map(function (chart) {

0 commit comments

Comments
 (0)