Skip to content

Commit 645f3c4

Browse files
committed
add checkbox to join UI
1 parent a7efb25 commit 645f3c4

4 files changed

Lines changed: 31 additions & 6 deletions

File tree

x-pack/legacy/plugins/maps/public/components/global_filter_checkbox.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import React from 'react';
88
import { EuiFormRow, EuiSwitch } from '@elastic/eui';
99
import { i18n } from '@kbn/i18n';
1010

11-
export function GlobalFilterCheckbox({ applyGlobalQuery, setApplyGlobalQuery }) {
11+
const label = i18n.translate('xpack.maps.layerPanel.applyGlobalQueryCheckboxLabel', {
12+
defaultMessage: `Apply global filter to source`,
13+
});
14+
15+
export function GlobalFilterCheckbox({ applyGlobalQuery, customLabel, setApplyGlobalQuery }) {
1216
const onApplyGlobalQueryChange = event => {
1317
setApplyGlobalQuery(event.target.checked);
1418
};
@@ -18,9 +22,7 @@ export function GlobalFilterCheckbox({ applyGlobalQuery, setApplyGlobalQuery })
1822
display="columnCompressedSwitch"
1923
>
2024
<EuiSwitch
21-
label={i18n.translate('xpack.maps.layerPanel.applyGlobalQueryCheckboxLabel', {
22-
defaultMessage: `Apply global filter to source`,
23-
})}
25+
label={customLabel ? customLabel : label}
2426
checked={applyGlobalQuery}
2527
onChange={onApplyGlobalQueryChange}
2628
data-test-subj="mapLayerPanelApplyGlobalQueryCheckbox"

x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { i18n } from '@kbn/i18n';
1515
import { JoinExpression } from './join_expression';
1616
import { MetricsExpression } from './metrics_expression';
1717
import { WhereExpression } from './where_expression';
18+
import { GlobalFilterCheckbox } from '../../../../components/global_filter_checkbox';
1819

1920
import {
2021
indexPatternService,
@@ -168,6 +169,16 @@ export class Join extends Component {
168169
});
169170
}
170171

172+
_onApplyGlobalQueryChange = applyGlobalQuery => {
173+
this.props.onChange({
174+
leftField: this.props.join.leftField,
175+
right: {
176+
...this.props.join.right,
177+
applyGlobalQuery,
178+
},
179+
});
180+
}
181+
171182
render() {
172183
const {
173184
join,
@@ -184,6 +195,7 @@ export class Join extends Component {
184195
const isJoinConfigComplete = join.leftField && right.indexPatternId && right.term;
185196

186197
let metricsExpression;
198+
let globalFilterCheckbox;
187199
if (isJoinConfigComplete) {
188200
metricsExpression = (
189201
<EuiFlexItem grow={false}>
@@ -194,6 +206,15 @@ export class Join extends Component {
194206
/>
195207
</EuiFlexItem>
196208
);
209+
globalFilterCheckbox = (
210+
<GlobalFilterCheckbox
211+
applyGlobalQuery={right.applyGlobalQuery}
212+
setApplyGlobalQuery={this._onApplyGlobalQueryChange}
213+
customLabel={i18n.translate('xpack.maps.layerPanel.join.applyGlobalQueryCheckboxLabel', {
214+
defaultMessage: `Apply global filter to join`,
215+
})}
216+
/>
217+
);
197218
}
198219

199220
let whereExpression;
@@ -234,6 +255,8 @@ export class Join extends Component {
234255

235256
{whereExpression}
236257

258+
{globalFilterCheckbox}
259+
237260
<EuiButtonIcon
238261
className="mapJoinItem__delete"
239262
iconType="trash"

x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/view.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ export function JoinEditor({ joins, layer, onChange }) {
5858
...joins,
5959
{
6060
right: {
61-
id: uuid()
61+
id: uuid(),
62+
applyGlobalQuery: true,
6263
}
6364
}
6465
]);

x-pack/legacy/plugins/maps/public/layers/sources/source.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export class AbstractSource {
9696
}
9797

9898
getApplyGlobalQuery() {
99-
console.log(this._descriptor.applyGlobalQuery);
10099
return !!this._descriptor.applyGlobalQuery;
101100
}
102101

0 commit comments

Comments
 (0)