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

Fit data should respect geo filter #17727

Merged
merged 4 commits into from
Apr 16, 2018
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
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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, {
Expand Down
6 changes: 6 additions & 0 deletions src/ui/public/vis/vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
}
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/visualize/visualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down