mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Complete existence check before using handler
This commit is contained in:
parent
0de553d37b
commit
6fad2be793
3 changed files with 9 additions and 15 deletions
|
@ -101,7 +101,9 @@ export default function DispatchClass(Private, config) {
|
|||
const isClickable = this.listenerCount('click') > 0;
|
||||
const addEvent = this.addEvent;
|
||||
const $el = this.handler.el;
|
||||
this.handler.highlight = self.highlight;
|
||||
if (!this.handler.highlight) {
|
||||
this.handler.highlight = self.highlight;
|
||||
}
|
||||
|
||||
function hover(d, i) {
|
||||
// Add pointer if item is clickable
|
||||
|
@ -125,7 +127,9 @@ export default function DispatchClass(Private, config) {
|
|||
const self = this;
|
||||
const addEvent = this.addEvent;
|
||||
const $el = this.handler.el;
|
||||
this.handler.unHighlight = self.unHighlight;
|
||||
if (!this.handler.unHighlight) {
|
||||
this.handler.unHighlight = self.unHighlight;
|
||||
}
|
||||
|
||||
function mouseout() {
|
||||
self.handler.unHighlight.call(this, $el);
|
||||
|
|
|
@ -76,19 +76,7 @@ export default function HandlerBaseClass(Private) {
|
|||
* @returns {*}
|
||||
*/
|
||||
this.disable = this.chartEventProxyToggle('off');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clients expect the Handler-type to have a highlight/unhighlight functions. The default implementation is a noop.
|
||||
* Specific implementations are free to override this.
|
||||
*/
|
||||
highlight() {
|
||||
}
|
||||
unHighlight() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates whether data is actually present in the data object
|
||||
* used to render the Vis. Throws a no results error if data is not
|
||||
|
|
|
@ -29,7 +29,9 @@ uiModules.get('kibana')
|
|||
$scope.highlight = function (event) {
|
||||
let el = event.currentTarget;
|
||||
let handler = $scope.renderbot.vislibVis.handler;
|
||||
if (!handler) {
|
||||
|
||||
//there is no guarantee that a Chart will set the highlight-function on its handler
|
||||
if (!handler || typeof handler.highlight !== 'function') {
|
||||
return;
|
||||
}
|
||||
handler.highlight.call(el, handler.el);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue