-
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
[Dashboard] View panel-level filters and queries #136655
[Dashboard] View panel-level filters and queries #136655
Conversation
5697f28
to
e1b193e
Compare
97fd063
to
1af3382
Compare
@andreadelrio As mentioned last week, this PR could definitely use a design review :) Basically, with the current design, I am adding a "Custom filters" badge in both view and edit mode whenever panel level filters are detected on a visualization, like so: When a user clicks on this badge, they will be shown a modal that lists all the panel-level filters as read only filter pills: The reasoning for going with a modal over a popover is as follows:
More screenshots |
615ad83
to
feab818
Compare
const { Provider: KibanaReactContextProvider } = createKibanaReactContext({ | ||
uiSettings: this.uiSettings, | ||
}); |
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.
This is necessary for line 36 of filter_items.tsx
:
kibana/src/plugins/unified_search/public/filter_bar/filter_item/filter_items.tsx
Lines 33 to 36 in 76d317b
const { appName, usageCollection, uiSettings } = kibana.services; | |
const { readOnly = false } = props; | |
if (!uiSettings) return null; |
Otherwise, kibana.services
is undefined for anything that happens inside of this modal.
@@ -20,7 +20,8 @@ | |||
"uiActions", | |||
"urlForwarding", | |||
"presentationUtil", | |||
"visualizations" | |||
"visualizations", | |||
"unifiedSearch" |
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.
Need the unifiedSearch
plugin so that I can access the FilterItems
component for rendering the filter pills inside the modal rather than coming up with my own logic for this.
@andreadelrio Do you mind giving another quick design review, since we added the new @ThomThomson The context loss should be fixed now, thanks for catching that 👍 @tsullivan I believe I've fixed all of the "Public APIs missing comments" and "Public APIs missing exports" metric increases - another review would be greatly appreciated 🙇 |
…wter/kibana into add-panel-level-filters_2022-07-18
…-ref HEAD~1..HEAD --fix'
…-ref HEAD~1..HEAD --fix'
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.
Reviewing again now that the context loss problem is fixed! This works great locally, looks good, and the code looks nice. Left a couple tiny nits, but nothing necessary to fix!
src/plugins/dashboard/public/application/actions/filters_notification_badge.tsx
Show resolved
Hide resolved
src/plugins/dashboard/public/application/actions/filters_notification_badge.tsx
Outdated
Show resolved
Hide resolved
src/plugins/dashboard/public/application/actions/filters_notification_modal.tsx
Outdated
Show resolved
Hide resolved
@Heenawter this is looking great! One nit, I'm wondering if we really need to include |
@andreadelrio Thanks so much! :) That was added so that the I can definitely get rid of it and show only the text in the filter pill (without the |
Ah I see. We can leave this as is then. |
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.
UX changes LGTM. Nice work!
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
History
To update your PR or re-run it, just comment with: cc @Heenawter |
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!
reviewed the embeddable api changes in the code
@Heenawter Map embeddable updated to support viewing panel-level filters and queries in #138188 |
Closes #141536 Closes #143386 ## Summary #136655 introduced a panel level filters badge that would notify users when a visualization was being filtered/queried on an individual panel level. While this exposed important information about how the panels were being generated and made it so that users no longer had to navigate to Lens/Visualize/etc. to see this information, it introduced a lot of undesired clutter to dashboards. This was especially annoying for dashboards in **view** mode, since panel level filter/query information is primarily useful for dashboard authors and thus this badge had minimal benefit despite its large visual impact. To fix this, this PR does three things: 1. Converts the panel filters badge to a single notification icon ![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png) 2. Displays the filters in a popover rather than a modal ![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png) 3. Makes this notification icon only visible in **edit** mode - it no longer shows up in view or print mode. ### How to Test 1. Create a visualization with panel level filters and/or queries. - Note that the sample `[Flights] Global Flight Dashboard` dashboard already has some visualizations with panel level filters, so you could also use that instead. 3. Ensure that the panel level filters action icon **only** shows up in edit mode - Swap to view mode and make sure there is no icon - Print a PDF or PNG report and make sure there is no icon 4. Ensure that the `"Edit filters"` button in the popover keeps context when clicked, including allowing you to `"Save and return"` after being taken to Lens/Visualize/etc. 5. Ensure that the contents of the popover react to changes to panel level filters/queries ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Closes elastic#141536 Closes elastic#143386 ## Summary elastic#136655 introduced a panel level filters badge that would notify users when a visualization was being filtered/queried on an individual panel level. While this exposed important information about how the panels were being generated and made it so that users no longer had to navigate to Lens/Visualize/etc. to see this information, it introduced a lot of undesired clutter to dashboards. This was especially annoying for dashboards in **view** mode, since panel level filter/query information is primarily useful for dashboard authors and thus this badge had minimal benefit despite its large visual impact. To fix this, this PR does three things: 1. Converts the panel filters badge to a single notification icon ![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png) 2. Displays the filters in a popover rather than a modal ![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png) 3. Makes this notification icon only visible in **edit** mode - it no longer shows up in view or print mode. ### How to Test 1. Create a visualization with panel level filters and/or queries. - Note that the sample `[Flights] Global Flight Dashboard` dashboard already has some visualizations with panel level filters, so you could also use that instead. 3. Ensure that the panel level filters action icon **only** shows up in edit mode - Swap to view mode and make sure there is no icon - Print a PDF or PNG report and make sure there is no icon 4. Ensure that the `"Edit filters"` button in the popover keeps context when clicked, including allowing you to `"Save and return"` after being taken to Lens/Visualize/etc. 5. Ensure that the contents of the popover react to changes to panel level filters/queries ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) (cherry picked from commit a5d7818)
Closes elastic#141536 Closes elastic#143386 elastic#136655 introduced a panel level filters badge that would notify users when a visualization was being filtered/queried on an individual panel level. While this exposed important information about how the panels were being generated and made it so that users no longer had to navigate to Lens/Visualize/etc. to see this information, it introduced a lot of undesired clutter to dashboards. This was especially annoying for dashboards in **view** mode, since panel level filter/query information is primarily useful for dashboard authors and thus this badge had minimal benefit despite its large visual impact. To fix this, this PR does three things: 1. Converts the panel filters badge to a single notification icon ![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png) 2. Displays the filters in a popover rather than a modal ![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png) 3. Makes this notification icon only visible in **edit** mode - it no longer shows up in view or print mode. 1. Create a visualization with panel level filters and/or queries. - Note that the sample `[Flights] Global Flight Dashboard` dashboard already has some visualizations with panel level filters, so you could also use that instead. 3. Ensure that the panel level filters action icon **only** shows up in edit mode - Swap to view mode and make sure there is no icon - Print a PDF or PNG report and make sure there is no icon 4. Ensure that the `"Edit filters"` button in the popover keeps context when clicked, including allowing you to `"Save and return"` after being taken to Lens/Visualize/etc. 5. Ensure that the contents of the popover react to changes to panel level filters/queries - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) (cherry picked from commit a5d7818)
…147134) # Backport This will backport the following commits from `main` to `8.6`: - [[Dashboard] Change panel filters action visibility (#146335)](#146335) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Hannah Mudge","email":"Heenawter@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-12-06T18:10:32Z","message":"[Dashboard] Change panel filters action visibility (#146335)\n\nCloses https://github.com/elastic/kibana/issues/141536\r\nCloses https://github.com/elastic/kibana/issues/143386\r\n\r\n## Summary\r\n\r\nhttps://github.com//pull/136655 introduced a panel level\r\nfilters badge that would notify users when a visualization was being\r\nfiltered/queried on an individual panel level. While this exposed\r\nimportant information about how the panels were being generated and made\r\nit so that users no longer had to navigate to Lens/Visualize/etc. to see\r\nthis information, it introduced a lot of undesired clutter to\r\ndashboards. This was especially annoying for dashboards in **view**\r\nmode, since panel level filter/query information is primarily useful for\r\ndashboard authors and thus this badge had minimal benefit despite its\r\nlarge visual impact.\r\n\r\nTo fix this, this PR does three things:\r\n1. Converts the panel filters badge to a single notification icon\r\n \r\n\r\n![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png)\r\n\r\n2. Displays the filters in a popover rather than a modal\r\n\r\n\r\n\r\n![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png)\r\n\r\n\r\n3. Makes this notification icon only visible in **edit** mode - it no\r\nlonger shows up in view or print mode.\r\n\r\n### How to Test\r\n1. Create a visualization with panel level filters and/or queries.\r\n- Note that the sample `[Flights] Global Flight Dashboard` dashboard\r\nalready has some visualizations with panel level filters, so you could\r\nalso use that instead.\r\n3. Ensure that the panel level filters action icon **only** shows up in\r\nedit mode\r\n - Swap to view mode and make sure there is no icon\r\n - Print a PDF or PNG report and make sure there is no icon\r\n4. Ensure that the `\"Edit filters\"` button in the popover keeps context\r\nwhen clicked, including allowing you to `\"Save and return\"` after being\r\ntaken to Lens/Visualize/etc.\r\n5. Ensure that the contents of the popover react to changes to panel\r\nlevel filters/queries\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"a5d781882730902650ee2f870064f0720aaad901","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Dashboard","release_note:fix","Team:Presentation","loe:days","impact:high","backport:all-open","v8.7.0","v8.6.1"],"number":146335,"url":"https://github.com/elastic/kibana/pull/146335","mergeCommit":{"message":"[Dashboard] Change panel filters action visibility (#146335)\n\nCloses https://github.com/elastic/kibana/issues/141536\r\nCloses https://github.com/elastic/kibana/issues/143386\r\n\r\n## Summary\r\n\r\nhttps://github.com//pull/136655 introduced a panel level\r\nfilters badge that would notify users when a visualization was being\r\nfiltered/queried on an individual panel level. While this exposed\r\nimportant information about how the panels were being generated and made\r\nit so that users no longer had to navigate to Lens/Visualize/etc. to see\r\nthis information, it introduced a lot of undesired clutter to\r\ndashboards. This was especially annoying for dashboards in **view**\r\nmode, since panel level filter/query information is primarily useful for\r\ndashboard authors and thus this badge had minimal benefit despite its\r\nlarge visual impact.\r\n\r\nTo fix this, this PR does three things:\r\n1. Converts the panel filters badge to a single notification icon\r\n \r\n\r\n![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png)\r\n\r\n2. Displays the filters in a popover rather than a modal\r\n\r\n\r\n\r\n![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png)\r\n\r\n\r\n3. Makes this notification icon only visible in **edit** mode - it no\r\nlonger shows up in view or print mode.\r\n\r\n### How to Test\r\n1. Create a visualization with panel level filters and/or queries.\r\n- Note that the sample `[Flights] Global Flight Dashboard` dashboard\r\nalready has some visualizations with panel level filters, so you could\r\nalso use that instead.\r\n3. Ensure that the panel level filters action icon **only** shows up in\r\nedit mode\r\n - Swap to view mode and make sure there is no icon\r\n - Print a PDF or PNG report and make sure there is no icon\r\n4. Ensure that the `\"Edit filters\"` button in the popover keeps context\r\nwhen clicked, including allowing you to `\"Save and return\"` after being\r\ntaken to Lens/Visualize/etc.\r\n5. Ensure that the contents of the popover react to changes to panel\r\nlevel filters/queries\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"a5d781882730902650ee2f870064f0720aaad901"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146335","number":146335,"mergeCommit":{"message":"[Dashboard] Change panel filters action visibility (#146335)\n\nCloses https://github.com/elastic/kibana/issues/141536\r\nCloses https://github.com/elastic/kibana/issues/143386\r\n\r\n## Summary\r\n\r\nhttps://github.com//pull/136655 introduced a panel level\r\nfilters badge that would notify users when a visualization was being\r\nfiltered/queried on an individual panel level. While this exposed\r\nimportant information about how the panels were being generated and made\r\nit so that users no longer had to navigate to Lens/Visualize/etc. to see\r\nthis information, it introduced a lot of undesired clutter to\r\ndashboards. This was especially annoying for dashboards in **view**\r\nmode, since panel level filter/query information is primarily useful for\r\ndashboard authors and thus this badge had minimal benefit despite its\r\nlarge visual impact.\r\n\r\nTo fix this, this PR does three things:\r\n1. Converts the panel filters badge to a single notification icon\r\n \r\n\r\n![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png)\r\n\r\n2. Displays the filters in a popover rather than a modal\r\n\r\n\r\n\r\n![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png)\r\n\r\n\r\n3. Makes this notification icon only visible in **edit** mode - it no\r\nlonger shows up in view or print mode.\r\n\r\n### How to Test\r\n1. Create a visualization with panel level filters and/or queries.\r\n- Note that the sample `[Flights] Global Flight Dashboard` dashboard\r\nalready has some visualizations with panel level filters, so you could\r\nalso use that instead.\r\n3. Ensure that the panel level filters action icon **only** shows up in\r\nedit mode\r\n - Swap to view mode and make sure there is no icon\r\n - Print a PDF or PNG report and make sure there is no icon\r\n4. Ensure that the `\"Edit filters\"` button in the popover keeps context\r\nwhen clicked, including allowing you to `\"Save and return\"` after being\r\ntaken to Lens/Visualize/etc.\r\n5. Ensure that the contents of the popover react to changes to panel\r\nlevel filters/queries\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"a5d781882730902650ee2f870064f0720aaad901"}},{"branch":"8.6","label":"v8.6.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
…147135) # Backport This will backport the following commits from `main` to `8.5`: - [[Dashboard] Change panel filters action visibility (#146335)](#146335) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Hannah Mudge","email":"Heenawter@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-12-06T18:10:32Z","message":"[Dashboard] Change panel filters action visibility (#146335)\n\nCloses https://github.com/elastic/kibana/issues/141536\r\nCloses https://github.com/elastic/kibana/issues/143386\r\n\r\n## Summary\r\n\r\nhttps://github.com//pull/136655 introduced a panel level\r\nfilters badge that would notify users when a visualization was being\r\nfiltered/queried on an individual panel level. While this exposed\r\nimportant information about how the panels were being generated and made\r\nit so that users no longer had to navigate to Lens/Visualize/etc. to see\r\nthis information, it introduced a lot of undesired clutter to\r\ndashboards. This was especially annoying for dashboards in **view**\r\nmode, since panel level filter/query information is primarily useful for\r\ndashboard authors and thus this badge had minimal benefit despite its\r\nlarge visual impact.\r\n\r\nTo fix this, this PR does three things:\r\n1. Converts the panel filters badge to a single notification icon\r\n \r\n\r\n![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png)\r\n\r\n2. Displays the filters in a popover rather than a modal\r\n\r\n\r\n\r\n![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png)\r\n\r\n\r\n3. Makes this notification icon only visible in **edit** mode - it no\r\nlonger shows up in view or print mode.\r\n\r\n### How to Test\r\n1. Create a visualization with panel level filters and/or queries.\r\n- Note that the sample `[Flights] Global Flight Dashboard` dashboard\r\nalready has some visualizations with panel level filters, so you could\r\nalso use that instead.\r\n3. Ensure that the panel level filters action icon **only** shows up in\r\nedit mode\r\n - Swap to view mode and make sure there is no icon\r\n - Print a PDF or PNG report and make sure there is no icon\r\n4. Ensure that the `\"Edit filters\"` button in the popover keeps context\r\nwhen clicked, including allowing you to `\"Save and return\"` after being\r\ntaken to Lens/Visualize/etc.\r\n5. Ensure that the contents of the popover react to changes to panel\r\nlevel filters/queries\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"a5d781882730902650ee2f870064f0720aaad901","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Dashboard","release_note:fix","Team:Presentation","loe:days","impact:high","backport:all-open","v8.7.0","v8.6.1"],"number":146335,"url":"https://github.com/elastic/kibana/pull/146335","mergeCommit":{"message":"[Dashboard] Change panel filters action visibility (#146335)\n\nCloses https://github.com/elastic/kibana/issues/141536\r\nCloses https://github.com/elastic/kibana/issues/143386\r\n\r\n## Summary\r\n\r\nhttps://github.com//pull/136655 introduced a panel level\r\nfilters badge that would notify users when a visualization was being\r\nfiltered/queried on an individual panel level. While this exposed\r\nimportant information about how the panels were being generated and made\r\nit so that users no longer had to navigate to Lens/Visualize/etc. to see\r\nthis information, it introduced a lot of undesired clutter to\r\ndashboards. This was especially annoying for dashboards in **view**\r\nmode, since panel level filter/query information is primarily useful for\r\ndashboard authors and thus this badge had minimal benefit despite its\r\nlarge visual impact.\r\n\r\nTo fix this, this PR does three things:\r\n1. Converts the panel filters badge to a single notification icon\r\n \r\n\r\n![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png)\r\n\r\n2. Displays the filters in a popover rather than a modal\r\n\r\n\r\n\r\n![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png)\r\n\r\n\r\n3. Makes this notification icon only visible in **edit** mode - it no\r\nlonger shows up in view or print mode.\r\n\r\n### How to Test\r\n1. Create a visualization with panel level filters and/or queries.\r\n- Note that the sample `[Flights] Global Flight Dashboard` dashboard\r\nalready has some visualizations with panel level filters, so you could\r\nalso use that instead.\r\n3. Ensure that the panel level filters action icon **only** shows up in\r\nedit mode\r\n - Swap to view mode and make sure there is no icon\r\n - Print a PDF or PNG report and make sure there is no icon\r\n4. Ensure that the `\"Edit filters\"` button in the popover keeps context\r\nwhen clicked, including allowing you to `\"Save and return\"` after being\r\ntaken to Lens/Visualize/etc.\r\n5. Ensure that the contents of the popover react to changes to panel\r\nlevel filters/queries\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"a5d781882730902650ee2f870064f0720aaad901"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146335","number":146335,"mergeCommit":{"message":"[Dashboard] Change panel filters action visibility (#146335)\n\nCloses https://github.com/elastic/kibana/issues/141536\r\nCloses https://github.com/elastic/kibana/issues/143386\r\n\r\n## Summary\r\n\r\nhttps://github.com//pull/136655 introduced a panel level\r\nfilters badge that would notify users when a visualization was being\r\nfiltered/queried on an individual panel level. While this exposed\r\nimportant information about how the panels were being generated and made\r\nit so that users no longer had to navigate to Lens/Visualize/etc. to see\r\nthis information, it introduced a lot of undesired clutter to\r\ndashboards. This was especially annoying for dashboards in **view**\r\nmode, since panel level filter/query information is primarily useful for\r\ndashboard authors and thus this badge had minimal benefit despite its\r\nlarge visual impact.\r\n\r\nTo fix this, this PR does three things:\r\n1. Converts the panel filters badge to a single notification icon\r\n \r\n\r\n![BeforeAndAfterFilterBadge](https://user-images.githubusercontent.com/8698078/205696453-c8a7bc85-46bf-4a0c-b206-bbb690577d9a.png)\r\n\r\n2. Displays the filters in a popover rather than a modal\r\n\r\n\r\n\r\n![BeforeAndAfterModal](https://user-images.githubusercontent.com/8698078/205758567-314e841d-646e-4cb6-973d-0fde79c2b9df.png)\r\n\r\n\r\n3. Makes this notification icon only visible in **edit** mode - it no\r\nlonger shows up in view or print mode.\r\n\r\n### How to Test\r\n1. Create a visualization with panel level filters and/or queries.\r\n- Note that the sample `[Flights] Global Flight Dashboard` dashboard\r\nalready has some visualizations with panel level filters, so you could\r\nalso use that instead.\r\n3. Ensure that the panel level filters action icon **only** shows up in\r\nedit mode\r\n - Swap to view mode and make sure there is no icon\r\n - Print a PDF or PNG report and make sure there is no icon\r\n4. Ensure that the `\"Edit filters\"` button in the popover keeps context\r\nwhen clicked, including allowing you to `\"Save and return\"` after being\r\ntaken to Lens/Visualize/etc.\r\n5. Ensure that the contents of the popover react to changes to panel\r\nlevel filters/queries\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"a5d781882730902650ee2f870064f0720aaad901"}},{"branch":"8.6","label":"v8.6.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/147134","number":147134,"state":"OPEN"}]}] BACKPORT--> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes #128010
Summary
This PR introduces a new panel badge that will show up when a specific panel has panel-level filters and/or panel-level queries - i.e. any filters/queries that are added directly to a visualization using the unified search bar at the top of the app. When this badge is clicked, it will bring up a modal that displays (1) all the panel-level filters as read-only filter pills, if there are panel-level filters, and (2) the panel-level query as a code block, if the visualization was saved with one.
Screen.Recording.2022-08-03.at.10.41.38.AM.mov
A few notes about this:
The new panel badge notification/modal currently only shows the app/panel-level filters/queries - i.e. the filters/queries that are added when creating a visualization in the Visualize/Maps/Lens/Discover app through the top navigation bar. For any other ways of adding filters (for example, layer-specific filters in Lens/Maps), it falls to each specific team to decide if/how they want to expose these through the new
getFilters()
embeddable API.This PR only exposes the panel-level filters/queries to the user in a read-only format - they must still navigate to different apps in order to edit these panel-level filters. As described in this issue, the next step will be to allow users to edit panel-level filters/queries through this modal.
However, since it may be awhile before we can implement this in-line editing, I added an "Edit filters" button at the bottom of the modal thanks to @andreadelrio's feedback - this at least makes this transition to the respective visualization plugin more smooth until we add this in-line edit functionality.
Embeddable Changes
This PR introduces new
getFilters()
andgetQuery
APIs for all embeddables that implement the newFilterableEmbeddable
class. The following four plugins support these panel-level filters/queries in their visualizations, so I modified their embeddables to implement this class:Unified Search Changes
This PR introduces the concept of
readOnly
to the filter pills rendering logic - basically, if the newreadOnly
optional parameter is given to either of theFilterItems
orFilterItem
components, then that filter pill will not include the delete icon and it will no longer be a button that opens theFilterEditor
popover.It also makes these new read only filter pills use
EuiTooltip
rather than the native tooltip, since this provides a better user experience when the filter pill label is truncated:While I originally tried to use the
EuiTooltip
for allFilterItem
components (including those in the top navigation bar), the tooltip does not behave nicely withEuiPopover
, so I opted to keep these changes as simple as possible in this PR and limit theEuiTooltip
to read-only filter pills only:Testing Notes
Be sure to check both by reference and by value embeddables - it should work for both.
For saved search embeddables, try out the SQL functionality that was introduced in [Discover] Supports SQL query language #134429 - as can be seen in the above video, a SQL query should use the proper colouring in the modal.
Checklist
For maintainers