-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Maps] add draw filter action to layer #33686
[Maps] add draw filter action to layer #33686
Conversation
Pinging @elastic/kibana-gis |
💔 Build Failed |
Is the plan to add a global one as well? I'd imagine if users are filtering, they'd like to across all layers when on a dashboard for instance. |
We can. I'm just not sure how this would behave. If we add a global filter, we'll need to create the same shape filter for each and every index-pattern on the map. I'm concerned the filter bar will look really cluttered. Filter-management would get complicated. It's just not an issue we're running into with coordinate-maps (since it's only a single layer), but we are running into here. Not sure what a good flow would be. |
I think it would be nice to have a way of showing the geospatial filters that are applied to the map so users can see where their filters are |
💔 Build Failed |
I agree this is useful, but it adds a whole new layer of functionality to the app. I guess we would end up adding something like a "filter layer" (?). Would this be present in the table of contents as a top-level layer (?), with all the associated actions/features? Perhaps we could tackle that concept more as part of an "annotation" layer. It would be a new layer-type, not backed by a source. But people could draw any kind of shape on the map, in a dedicated layer. Then, we could associate actions with these shapes (e.g. create filter for this shape, query nearby features, ....). Or do you see lower hanging fruit? |
💔 Build Failed |
7762c1d
to
30c63f5
Compare
@thomasneirynck new PR or issue? I was hoping to test out today haha |
💚 Build Succeeded |
💔 Build Failed |
💔 Build Failed |
e832db6
to
f9f653e
Compare
💔 Build Failed |
Below is mostly obsolete (historical purposes) POC of how we may might possibly do shape filtering on the map. The biggest issue is that this needs to function across multiple index-patterns. This PR proposes that spatial filters are layer-based and part of the layer-actions. After drawing the shape, a filter is added to the filter bar, which will apply to all visualizations that are backed by that index pattern. For layers which are not backed by an es index-pattern that is spatially filterable the shape filtering is disabled. After the filter is created, the editable shape disappears from the map. This is all very close to how spatial filtering now works on coordinate maps. The biggest difference is that with multiple layers, multiple spatial filters could be created for multiple index patterns. UPDATE Trying a differnent approach: Have top level filter tool buttons. On opening, they present the user with a list of indexpattern-geofields they can use to create the filter. Added a tool for both shape and bounds drawing. wrt. the bounds drawing tool. This relies on a 3d party dependency thrice removed (https://github.com/mapbox/mapbox-gl-draw). It is a plugin, on to of a mapbox-drawing plugin, which in turn is a plugin for the mapbox-gl library. If rectangle bounds filtering is not strictly necessary, I would prefer not to see this included in a first pass at this funtionality. (I also don't think we should get into the business of writing our own drawing tools, at least at this stage, given the limited added-value it would add wrt. required work/maintenance). |
💚 Build Succeeded |
} | ||
|
||
componentDidUpdate() { | ||
this._getuniqueIndexPatternAndFieldCombos(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does _getuniqueIndexPatternAndFieldCombos
need to get called on every state/prop change. How about just calling _getuniqueIndexPatternAndFieldCombos
inside componentDidMount and inside _toggleToolbar when opening the popover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visibility of the tool-button depends on whether there are filterable-layers to begin with, it also needs to be called at every update of props.uniqueIndexPatternIds
(as layers are added).
afaic, I would just leave it as-is, instead of trying to optimize this away.
💔 Build Failed |
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-tested and works for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with green CI
code review, tested in chrome
💔 Build Failed |
💚 Build Succeeded |
This breaks IE11, so we might want to revert until we can resolve. There are a few issues on the repo regarding this issue: |
I have opened a fix here: #36505 |
Closes #33658
Companion to #33635, addresses spatial filtering item of #31178.
This now introduces a toolbar
Toolbar contains draw controls
Selecting draw type requires index and field selection
Draw shape and filter