Fitting data should respect filters (#17727)

This commit is contained in:
Thomas Neirynck 2018-04-16 17:55:11 -04:00 committed by GitHub
parent 19b9265425
commit 56690d1992
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -1,14 +1,12 @@
import _ from 'lodash';
import { GeohashLayer } from './geohash_layer';
import { BaseMapsVisualizationProvider } from './base_maps_visualization';
import { SearchSourceProvider } from 'ui/courier/data_source/search_source';
import { VisAggConfigProvider } from 'ui/vis/agg_config';
import './styles/_tilemap.less';
export function CoordinateMapsVisualizationProvider(Notifier, Private) {
const AggConfig = Private(VisAggConfigProvider);
const SearchSource = Private(SearchSourceProvider);
const BaseMapsVisualization = Private(BaseMapsVisualizationProvider);
class CoordinateMapsVisualization extends BaseMapsVisualization {
@ -142,8 +140,7 @@ export function CoordinateMapsVisualizationProvider(Notifier, Private) {
async getGeohashBounds() {
const agg = this._getGeoHashAgg();
if (agg) {
const searchSource = new SearchSource();
searchSource.index(this.vis.indexPattern);
const searchSource = this.vis.API.createInheritedSearchSource(this.vis.searchSource);
searchSource.size(0);
searchSource.aggs(function () {
const geoBoundsAgg = new AggConfig(agg.vis, {

View file

@ -64,6 +64,12 @@ export function VisProvider(Private, Promise, indexPatterns, timefilter, getAppS
const appState = getAppState();
brushEvent(appState)(event);
}
},
createInheritedSearchSource: (parentSearchSource) => {
if (!parentSearchSource) {
throw new Error('Unable to inherit search source, visualize saved object does not have search source.');
}
return new SearchSource().inherits(parentSearchSource);
}
};
}

View file

@ -52,6 +52,7 @@ uiModules
});
$scope.vis = $scope.savedObj.vis;
$scope.vis.searchSource = $scope.savedObj.searchSource;
// Set the passed in uiState to the vis object. uiState reference should never be changed
if (!$scope.uiState) $scope.uiState = $scope.vis.getUiState();