From 645f3c486bb6f8321da9227b0eba217cff598ff0 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 13 Nov 2019 14:19:05 -0700 Subject: [PATCH] add checkbox to join UI --- .../components/global_filter_checkbox.js | 10 ++++---- .../layer_panel/join_editor/resources/join.js | 23 +++++++++++++++++++ .../layer_panel/join_editor/view.js | 3 ++- .../maps/public/layers/sources/source.js | 1 - 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/x-pack/legacy/plugins/maps/public/components/global_filter_checkbox.js b/x-pack/legacy/plugins/maps/public/components/global_filter_checkbox.js index 8694fd0451238..e841fa573c9a5 100644 --- a/x-pack/legacy/plugins/maps/public/components/global_filter_checkbox.js +++ b/x-pack/legacy/plugins/maps/public/components/global_filter_checkbox.js @@ -8,7 +8,11 @@ import React from 'react'; import { EuiFormRow, EuiSwitch } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -export function GlobalFilterCheckbox({ applyGlobalQuery, setApplyGlobalQuery }) { +const label = i18n.translate('xpack.maps.layerPanel.applyGlobalQueryCheckboxLabel', { + defaultMessage: `Apply global filter to source`, +}); + +export function GlobalFilterCheckbox({ applyGlobalQuery, customLabel, setApplyGlobalQuery }) { const onApplyGlobalQueryChange = event => { setApplyGlobalQuery(event.target.checked); }; @@ -18,9 +22,7 @@ export function GlobalFilterCheckbox({ applyGlobalQuery, setApplyGlobalQuery }) display="columnCompressedSwitch" > { + this.props.onChange({ + leftField: this.props.join.leftField, + right: { + ...this.props.join.right, + applyGlobalQuery, + }, + }); + } + render() { const { join, @@ -184,6 +195,7 @@ export class Join extends Component { const isJoinConfigComplete = join.leftField && right.indexPatternId && right.term; let metricsExpression; + let globalFilterCheckbox; if (isJoinConfigComplete) { metricsExpression = ( @@ -194,6 +206,15 @@ export class Join extends Component { /> ); + globalFilterCheckbox = ( + + ); } let whereExpression; @@ -234,6 +255,8 @@ export class Join extends Component { {whereExpression} + {globalFilterCheckbox} +