Skip to content

Commit

Permalink
[Maps] only show top hits checkbox if index has date fields (#43056)
Browse files Browse the repository at this point in the history
* [Maps] only show top hits checkbox if index has date fields

* rename useTopHitsCheckbox to topHitsCheckbox
  • Loading branch information
nreese authored Aug 9, 2019
1 parent 2198222 commit 27d02bb
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,23 @@ export class UpdateSourceEditor extends Component {
}

render() {
let topHitsCheckbox;
if (this.state.dateFields && this.state.dateFields.length) {
topHitsCheckbox = (
<EuiFormRow>
<EuiSwitch
label={
i18n.translate('xpack.maps.source.esSearch.useTopHitsLabel', {
defaultMessage: `Show most recent documents by entity`
})
}
checked={this.props.useTopHits}
onChange={this.onUseTopHitsChange}
/>
</EuiFormRow>
);
}

return (
<Fragment>
<TooltipSelector
Expand All @@ -212,17 +229,7 @@ export class UpdateSourceEditor extends Component {
/>
</EuiFormRow>

<EuiFormRow>
<EuiSwitch
label={
i18n.translate('xpack.maps.source.esSearch.useTopHitsLabel', {
defaultMessage: `Show most recent documents by entity`
})
}
checked={this.props.useTopHits}
onChange={this.onUseTopHitsChange}
/>
</EuiFormRow>
{topHitsCheckbox}

{this.renderTopHitsForm()}
</Fragment>
Expand Down

0 comments on commit 27d02bb

Please sign in to comment.