Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix filtering from visualizations #7793

Merged
merged 1 commit into from
Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/core_plugins/kbn_vislib_vis_types/public/tile_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ export default function TileMapVisType(Private, getAppState, courier, config) {

pushFilter(filter, false, indexPatternName);
},
mapMoveEnd: function (event, uiState) {
uiState.set('mapCenter', event.center);
mapMoveEnd: function (event) {
const vis = _.get(event, 'chart.geohashGridAgg.vis');
if (vis && vis.hasUiState()) {
vis.getUiState().set('mapCenter', event.center);
}
},
mapZoomEnd: function (event, uiState) {
uiState.set('mapZoom', event.zoom);
mapZoomEnd: function (event) {
const vis = _.get(event, 'chart.geohashGridAgg.vis');
if (vis && vis.hasUiState()) {
vis.getUiState().set('mapZoom', event.zoom);
}

const autoPrecision = _.get(event, 'chart.geohashGridAgg.params.autoPrecision');
if (autoPrecision) {
Expand Down
22 changes: 22 additions & 0 deletions src/ui/public/vislib/__tests__/lib/handler/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,27 @@ dateHistogramArray.forEach(function (data, i) {
expect(vis.handler.charts.length).to.be(0);
});
});

describe('event proxying', function () {

it('should only pass the original event object to downstream handlers', function (done) {
const event = {};
const chart = vis.handler.charts[0];

const mockEmitter = function () {
const args = Array.from(arguments);
expect(args.length).to.be(2);
expect(args[0]).to.be('click');
expect(args[1]).to.be(event);
done();
};

vis.emit = mockEmitter;
vis.handler.enable('click', chart);
chart.events.emit('click', event);
});

});

});
});
2 changes: 1 addition & 1 deletion src/ui/public/vislib/lib/handler/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function HandlerBaseClass(Private) {
this.getProxyHandler = _.memoize(function (event) {
let self = this;
return function (e) {
self.vis.emit(event, e, vis.uiState);
self.vis.emit(event, e);
};
});
}
Expand Down