Skip to content

Commit

Permalink
Toggling spy panel no longer throws an error (#8906)
Browse files Browse the repository at this point in the history
Backports PR #8877

**Commit 1:**
Toggling spy panel no longer throws an error

* Original sha: 0de553d
* Authored by Thomas Neirynck <thomas@elastic.co> on 2016-10-28T18:06:05Z

**Commit 2:**
Complete existence check before using handler

* Original sha: 6fad2be
* Authored by Thomas Neirynck <thomas@elastic.co> on 2016-10-31T14:11:40Z
  • Loading branch information
elastic-jasper authored and thomasneirynck committed Nov 1, 2016
1 parent 405b541 commit c834ee7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/ui/public/filter_bar/filter_bar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import _ from 'lodash';
import template from 'ui/filter_bar/filter_bar.html';
import moment from 'moment';
import angular from 'angular';
import 'ui/directives/json_input';
import filterAppliedAndUnwrap from 'ui/filter_bar/lib/filter_applied_and_unwrap';
import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters';
Expand Down
2 changes: 0 additions & 2 deletions src/ui/public/vislib/lib/handler/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default function HandlerBaseClass(Private) {
*/
class Handler {
constructor(vis, opts) {

this.data = opts.data || new Data(vis.data, vis._attr, vis.uiState);
this.vis = vis;
this.el = vis.el;
Expand Down Expand Up @@ -78,7 +77,6 @@ export default function HandlerBaseClass(Private) {
*/
this.disable = this.chartEventProxyToggle('off');
}

/**
* Validates whether data is actually present in the data object
* used to render the Vis. Throws a no results error if data is not
Expand Down
13 changes: 7 additions & 6 deletions src/ui/public/visualize/visualize_legend.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import _ from 'lodash';
import html from 'ui/visualize/visualize_legend.html';
import $ from 'jquery';
import d3 from 'd3';
import findByParam from 'ui/utils/find_by_param';
import VislibLibDataProvider from 'ui/vislib/lib/data';
import VislibComponentsColorColorProvider from 'ui/vislib/components/color/color';
import FilterBarFilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler';
Expand All @@ -18,7 +15,7 @@ uiModules.get('kibana')
return {
restrict: 'E',
template: html,
link: function ($scope, $elem) {
link: function ($scope) {
let $state = getAppState();
let clickHandler = filterBarClickHandler($state);
$scope.open = $scope.uiState.get('vis.legendOpen', true);
Expand All @@ -32,7 +29,11 @@ uiModules.get('kibana')
$scope.highlight = function (event) {
let el = event.currentTarget;
let handler = $scope.renderbot.vislibVis.handler;
if (!handler) return;

//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);
};

Expand Down Expand Up @@ -110,7 +111,7 @@ uiModules.get('kibana')
data = data.columns || data.rows || [data];
if (type === 'pie') return Data.prototype.pieNames(data);
return getSeriesLabels(data);
};
}

function getSeriesLabels(data) {
let values = data.map(function (chart) {
Expand Down

0 comments on commit c834ee7

Please sign in to comment.