Skip to content
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] filter dashboard by map extent #99860

Merged
merged 12 commits into from
May 26, 2021
Merged

Conversation

nreese
Copy link
Contributor

@nreese nreese commented May 11, 2021

Fixes #59751

This PR adds a new context menu option for map embeddables.

Screen Shot 2021-05-11 at 4 26 56 PM

When selected, a filter will be added to the dashboard that filters all panels by the map view area. When the map moves, this filter will be updated for the new map extent

Screen Shot 2021-05-11 at 4 28 31 PM

cc @mbarretta

@nreese nreese added [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 v7.14.0 reason:enhancement labels May 11, 2021
@nreese nreese requested a review from a team as a code owner May 11, 2021 22:30
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@@ -286,6 +286,11 @@ export function FilterItem(props: FilterItemProps) {
message: '',
status: FILTER_ITEM_OK,
};

if (filter.meta?.isMultiIndex) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Dosant @lizozom isMultiIndex flag was added to remove "Warning" label from the filter pill

The screen shot below was taken before these changes. Notice the "Warning" label. In this case, its not warranted since the filter is written to target any index pattern in the dashboard
Screen Shot 2021-05-12 at 8 04 38 AM

This is a screen shot after the changes. Notice that the warning label is gone
Screen Shot 2021-05-12 at 8 05 00 AM

@jsanz
Copy link
Member

jsanz commented May 12, 2021

@nreese I'm testing this (Chromium and Firefox browsers on Linux) and I don't get the filter updated when I move the map. I don't see any errors on the console either. Anything I can check or test to be sure I'm doing it right?

Peek 2021-05-12 19-14

@nreese
Copy link
Contributor Author

nreese commented May 12, 2021

I'm testing this (Chromium and Firefox browsers on Linux) and I don't get the filter updated when I move the map. I don't see any errors on the console either. Anything I can check or test to be sure I'm doing it right?

It looks like you are doing everything correctly but there is something weird. Each time you got to the panel menu, the text says "filter by map extent". When filterByMapExtent is enabled, it should read "disable filter by map extent". So it looks like some state is not getting preserved in your instance.

@nreese
Copy link
Contributor Author

nreese commented May 12, 2021

@jsanz You have to put the dashboard in edit mode to enable filter by map bounds. Not being in edit mode unsets the value after it was set. I will merge a fix to remove the option when not in edit mode

@nreese
Copy link
Contributor Author

nreese commented May 12, 2021

@jsanz I have pushed a fix so you can not toggle filtering by extent while outside of dashboard edit mode. Mind pulling the latest and re-testing?

@nreese nreese requested a review from a team as a code owner May 12, 2021 19:14
@jsanz
Copy link
Member

jsanz commented May 13, 2021

Thanks, @nreese now it works as expected. It's a pity that this only works in dashboard edit mode, but nevertheless a very powerful feature.

Peek 2021-05-13 13-38

@nreese
Copy link
Contributor Author

nreese commented May 13, 2021

@elasticmachine merge upstream

@nreese
Copy link
Contributor Author

nreese commented May 24, 2021

@elasticmachine merge upstream

Copy link
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 a lot, this is a great PR.

return {
bool: {
must: [
{
Copy link
Contributor

Choose a reason for hiding this comment

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

so good!

@nreese nreese requested a review from ppisljar May 24, 2021 17:37
@nreese
Copy link
Contributor Author

nreese commented May 25, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
maps 782 783 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
data 3263 3264 +1
maps 191 195 +4
total +5

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
data 165.3KB 165.4KB +121.0B
maps 2.7MB 2.7MB +3.3KB
total +3.5KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 817.4KB 817.5KB +162.0B
maps 62.2KB 63.2KB +984.0B
total +1.1KB
Unknown metric groups

API count

id before after diff
data 3763 3764 +1
maps 192 196 +4
total +5

References to deprecated APIs

id before after diff
canvas 29 25 -4
crossClusterReplication 8 6 -2
fleet 22 20 -2
globalSearch 4 2 -2
indexManagement 12 7 -5
infra 261 149 -112
lens 67 45 -22
licensing 18 15 -3
lists 239 236 -3
maps 286 208 -78
ml 121 115 -6
monitoring 109 56 -53
securitySolution 386 342 -44
stackAlerts 101 95 -6
total -342

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

app services changes LGTM

@ppisljar
Copy link
Member

reposting comment from above for visibility:

nit: would it make sense to rename this to id to make it more general ? it seems it kind of needs to be unique anyway and controlledBy might not be the best name as possibly multiple filters are controlled by a single consumer (and they would all need different controlledBy id even if they are controlled by the same thing)

@nreese nreese mentioned this pull request May 26, 2021
8 tasks
@nreese nreese added the auto-backport Deprecated - use backport:version if exact versions are needed label May 26, 2021
@nreese nreese merged commit e49db71 into elastic:master May 26, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request May 26, 2021
* [Maps] filter dashboard by map extent

* clean up

* remove warning from filter pill

* tslint

* API doc updates, i18n fixes, tslint

* only show context menu option in edit mode

* add functional test

* review feedback

* do not use search session when filtering by map bounds

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

gmmorris added a commit to gmmorris/kibana that referenced this pull request May 26, 2021
* master: (60 commits)
  [Docs] Index patterns REST API docs (elastic#100549)
  [Ingest pipelines] add support for fingerprint processor (elastic#100541)
  ping Core team when renovate bot bumps es client version (elastic#100662)
  [Maps] Add draw wizard (elastic#100278)
  Use documentation link service for index pattern field editor (elastic#100609)
  [Maps] filter dashboard by map extent (elastic#99860)
  [ftr] migrate screenshots and snapshots services to FtrService class (elastic#100514)
  fix anomaly functional test (elastic#100504)
  update breaking changes template to incorporate ES deprecations (elastic#100621)
  improve default time ranges (elastic#100536)
  [Gauge] Fixes wrong translations on ranges less than symbol (elastic#100535)
  [ftr] migrate "globalNav" service to FtrService class (elastic#100604)
  [ftr] migrate "testSubjects" to FtrService class (elastic#100512)
  Fix spaces test flakyness (elastic#100605)
  [Ingest pipelines] add support for ip type in convert processor (elastic#100531)
  [ftr] migrate "browser" to FtrService class (elastic#100507)
  [ftr] migrate "find" service to FtrService class (elastic#100509)
  [telemetry] report config deprecations (elastic#99887)
  [ftr] migrate "docTable" service to FtrService class (elastic#100595)
  [ftr] migrate "listingTable" service to FtrService class (elastic#100606)
  ...
kibanamachine added a commit that referenced this pull request May 26, 2021
* [Maps] filter dashboard by map extent

* clean up

* remove warning from filter pill

* tslint

* API doc updates, i18n fixes, tslint

* only show context menu option in edit mode

* add functional test

* review feedback

* do not use search session when filtering by map bounds

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Nathan Reese <reese.nathan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:enhancement v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps] Option to filter Dashboard visualizations by geo bounds of an embedded Map
6 participants