From a5aaf18424a50a55ea0ca8fdd0b074bdb5e4612e Mon Sep 17 00:00:00 2001 From: Aaron Caldwell Date: Thu, 16 Jan 2020 09:33:22 -0700 Subject: [PATCH 1/3] Set filterByMapBounds to default constant if no arg passed --- .../layers/sources/es_search_source/create_source_editor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js index 28045eeb5e9b5..0e48e3b4cad8c 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js @@ -40,6 +40,10 @@ export class CreateSourceEditor extends Component { onSourceConfigChange: PropTypes.func.isRequired, }; + static defaultProps = { + filterByMapBounds: DEFAULT_FILTER_BY_MAP_BOUNDS, + }; + state = { isLoadingIndexPattern: false, noGeoIndexPatternsExist: false, From 4d9e83c44550d31e6a4e6702d3c86b24f611bae4 Mon Sep 17 00:00:00 2001 From: Aaron Caldwell Date: Mon, 3 Feb 2020 17:40:17 -0700 Subject: [PATCH 2/3] toggle accidentally refers to props instead of state for filterByBounds. update to state --- .../sources/es_search_source/create_source_editor.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js index fad73314c6721..dae9411317ee8 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js @@ -46,13 +46,10 @@ export class CreateSourceEditor extends Component { onSourceConfigChange: PropTypes.func.isRequired, }; - static defaultProps = { - filterByMapBounds: DEFAULT_FILTER_BY_MAP_BOUNDS, - }; - state = { isLoadingIndexPattern: false, noGeoIndexPatternsExist: false, + filterByMapBounds: DEFAULT_FILTER_BY_MAP_BOUNDS, ...RESET_INDEX_PATTERN_STATE, }; @@ -231,7 +228,7 @@ export class CreateSourceEditor extends Component { label={i18n.translate('xpack.maps.source.esSearch.extentFilterLabel', { defaultMessage: `Dynamically filter for data in the visible map area`, })} - checked={this.props.filterByMapBounds} + checked={this.state.filterByMapBounds} onChange={this.onFilterByMapBoundsChange} /> From d744b1e426a840db01dd90d988d9aa67b7422214 Mon Sep 17 00:00:00 2001 From: Aaron Caldwell Date: Mon, 3 Feb 2020 19:11:09 -0700 Subject: [PATCH 3/3] Review feedback. Remove extra filterByMapBounds --- .../layers/sources/es_search_source/create_source_editor.js | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js index dae9411317ee8..da6248099c9c1 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js @@ -49,7 +49,6 @@ export class CreateSourceEditor extends Component { state = { isLoadingIndexPattern: false, noGeoIndexPatternsExist: false, - filterByMapBounds: DEFAULT_FILTER_BY_MAP_BOUNDS, ...RESET_INDEX_PATTERN_STATE, };