Skip to content

[Maps] layer specific filtering#33209

Merged
nreese merged 23 commits intoelastic:masterfrom
nreese:map_layer_filters
Mar 27, 2019
Merged

[Maps] layer specific filtering#33209
nreese merged 23 commits intoelastic:masterfrom
nreese:map_layer_filters

Conversation

@nreese
Copy link
Copy Markdown
Contributor

@nreese nreese commented Mar 13, 2019

This PR adds ability to add filter to layer

Screen Shot 2019-03-13 at 4 33 33 PM

Screen Shot 2019-03-13 at 4 39 23 PM

@nreese nreese requested a review from a team as a code owner March 13, 2019 22:38
@nreese nreese added Team:Geo Former Team Label for Geo Team. Now use Team:Presentation enhancement New value added to drive a business result v8.0.0 v7.2.0 labels Mar 13, 2019
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-gis

@nreese
Copy link
Copy Markdown
Contributor Author

nreese commented Mar 13, 2019

@cchaos

I had to deviate from the design a little bit. The QueryBar requires a submit button so I could not put the button in the footer.

Also, talked to @thomasneirynck, and we decided to skip showing a table of results because it did not make sense for Grid sources since Grid sources do not show individual documents.

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@nreese nreese added release_note:enhancement and removed enhancement New value added to drive a business result labels Mar 14, 2019
@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@nreese nreese added the review label Mar 14, 2019
@nreese nreese requested review from cchaos and thomasneirynck March 14, 2019 19:35
@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@thomasneirynck
Copy link
Copy Markdown
Contributor

I prefer the pop-over as opposed to the modal. It looks clean, and users can continue see the data in the background, so it preserves some context.

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Copy link
Copy Markdown
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but some minor suggestions.

private renderUpdateButton() {
const button = (
const button = this.props.customSubmitButton ? (
React.cloneElement(this.props.customSubmitButton, { onClick: this.onClickSubmitButton })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the React.cloneElement?

Copy link
Copy Markdown
Contributor Author

@nreese nreese Mar 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That allows for the adding the onClick property while preserving all of the other props passed in with the button

refreshInterval?: number;
showAutoRefreshOnly?: boolean;
onRefreshChange?: (options: { isPaused: boolean; refreshInterval: number }) => void;
customSubmitButton?: any;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider PropTypes.element

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript does recognize PropTypes. I had React.ReactNode but then there were TS lint errors

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't know this, thanks


_renderOpenButton() {
const query = this.props.layer.getQuery();
const openButtonLabel = query && query.query
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to not have this "Edit filter" button, and just have the previwer, that's either empty or has the preview of the string. I kind of like how the join-editor is editable like that. just click the preview, no need for extra button.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @cchaos What do you think?

Screen Shot 2019-03-25 at 1 41 47 PM

Screen Shot 2019-03-25 at 1 41 58 PM

return [this._descriptor.indexPatternId];
}

supportsElasticsearchFilters() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make this a static function or static property on Source, and not a method on the prototype. The return true/false is independent of instance-state, but only depends on the type instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the method is a static method then it has to be called on the Class instead of the instance. The method is executed from within a layer instance where I have easy access to the source instance, but not the source Class. It would be cumbersome to get the Class of the source instance and then call the static method on the class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this._source.constructor.supportsElasticsearchFilters

but yeah, that looks somewhat funny. your call.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will just leave it on prototype since that is consistent with isFieldAware, isRefreshTimerAware, and others

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Copy link
Copy Markdown
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, really cool

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@nreese nreese merged commit 465d37b into elastic:master Mar 27, 2019
nreese added a commit to nreese/kibana that referenced this pull request Mar 27, 2019
* render filters section in layer details

* add popover with QueryBar

* show index pattern type ahead

* scss

* add custom button to QueryBar

* add setQuery action creator

* wire together layer query to search source

* remove old comment

* update heatmap layer to consider layerQuery during resync logic

* update getBounds to apply layer query

* fix QueryBar typescript problems

* add functional test for layer query

* more typescript nonsense

* fix jest test

* use EuiPopover instead of EuiModal

* close popover on button click

* fix functional test with popover change

* add empty state help text and use small padding on EuiCodeBlock

* query_bar renderUpdateButton return early if not this.props.showDatePicker
joelgriffith pushed a commit that referenced this pull request Mar 27, 2019
* render filters section in layer details

* add popover with QueryBar

* show index pattern type ahead

* scss

* add custom button to QueryBar

* add setQuery action creator

* wire together layer query to search source

* remove old comment

* update heatmap layer to consider layerQuery during resync logic

* update getBounds to apply layer query

* fix QueryBar typescript problems

* add functional test for layer query

* more typescript nonsense

* fix jest test

* use EuiPopover instead of EuiModal

* close popover on button click

* fix functional test with popover change

* add empty state help text and use small padding on EuiCodeBlock

* query_bar renderUpdateButton return early if not this.props.showDatePicker
nreese added a commit to nreese/kibana that referenced this pull request Mar 28, 2019
* render filters section in layer details

* add popover with QueryBar

* show index pattern type ahead

* scss

* add custom button to QueryBar

* add setQuery action creator

* wire together layer query to search source

* remove old comment

* update heatmap layer to consider layerQuery during resync logic

* update getBounds to apply layer query

* fix QueryBar typescript problems

* add functional test for layer query

* more typescript nonsense

* fix jest test

* use EuiPopover instead of EuiModal

* close popover on button click

* fix functional test with popover change

* add empty state help text and use small padding on EuiCodeBlock

* query_bar renderUpdateButton return early if not this.props.showDatePicker
nreese added a commit to nreese/kibana that referenced this pull request Mar 28, 2019
* render filters section in layer details

* add popover with QueryBar

* show index pattern type ahead

* scss

* add custom button to QueryBar

* add setQuery action creator

* wire together layer query to search source

* remove old comment

* update heatmap layer to consider layerQuery during resync logic

* update getBounds to apply layer query

* fix QueryBar typescript problems

* add functional test for layer query

* more typescript nonsense

* fix jest test

* use EuiPopover instead of EuiModal

* close popover on button click

* fix functional test with popover change

* add empty state help text and use small padding on EuiCodeBlock

* query_bar renderUpdateButton return early if not this.props.showDatePicker
nreese added a commit that referenced this pull request Mar 28, 2019
* [Maps] layer specific filtering (#33209)

* render filters section in layer details

* add popover with QueryBar

* show index pattern type ahead

* scss

* add custom button to QueryBar

* add setQuery action creator

* wire together layer query to search source

* remove old comment

* update heatmap layer to consider layerQuery during resync logic

* update getBounds to apply layer query

* fix QueryBar typescript problems

* add functional test for layer query

* more typescript nonsense

* fix jest test

* use EuiPopover instead of EuiModal

* close popover on button click

* fix functional test with popover change

* add empty state help text and use small padding on EuiCodeBlock

* query_bar renderUpdateButton return early if not this.props.showDatePicker

* skip fitToBounds tests until fix is merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:enhancement review Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v7.2.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants