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

[Dashboard] Scroll to new panel #152056

Merged
merged 29 commits into from
Apr 24, 2023
Merged

Conversation

cqliu1
Copy link
Contributor

@cqliu1 cqliu1 commented Feb 24, 2023

Summary

Closes #97064.
Closes #148922.

This scrolls to a newly added panel on a dashboard instead of remaining at the top. The user can see the new panel without having to manually scroll to the bottom.

This also scrolls to the maximized panel when you minimize instead of just throwing you back to the top of the dashboard.

This scrolling behavior also seems to work with portable dashboards embedded in another apps, but it may require additional work on the consumer to call scrollToPanel in the appropriate callbacks when adding panels.

Scrolls to newly added panel and shows a success border animation

Apr-18-2023 07-40-41

Scrolls to panel on return from editor

Apr-18-2023 07-56-35

Scrolls to panel clone

Apr-18-2023 07-54-43

Scrolling in portable dashboards example

Apr-18-2023 08-13-14

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@cqliu1 cqliu1 added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Project:Dashboard Usability Related to the Dashboard Usability initiative loe:medium Medium Level of Effort impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. v8.8.0 release_note:enhancement enhancement New value added to drive a business result backport:skip This commit does not require backporting ci:cloud-deploy Create or update a Cloud deployment labels Feb 24, 2023
@cqliu1 cqliu1 force-pushed the dashboard/scroll-to-new-panel branch 2 times, most recently from 915a10c to 82d22db Compare March 2, 2023 16:46
@cqliu1 cqliu1 force-pushed the dashboard/scroll-to-new-panel branch from 82d22db to 2546175 Compare March 20, 2023 16:41
@cqliu1 cqliu1 force-pushed the dashboard/scroll-to-new-panel branch from 2546175 to 32781fa Compare April 17, 2023 23:41
@cqliu1 cqliu1 force-pushed the dashboard/scroll-to-new-panel branch from 32781fa to efef24a Compare April 18, 2023 14:29
@cqliu1 cqliu1 marked this pull request as ready for review April 18, 2023 14:57
@cqliu1 cqliu1 requested review from a team as code owners April 18, 2023 14:57
@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Apr 18, 2023
Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

LGTM. Nice job!

@Heenawter Heenawter self-requested a review April 21, 2023 15:29
Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Code review + tested locally - everything worked great except for the controls, which currently cause the dashboard to crash (see #152056 (comment)) - will re-review once this is fixed :)

I also noticed that the "scroll to panel" behaviour is a little off for smaller browser sizes - specifically, on smaller vertical browser sizes, the top of the panel gets hidden behind the top nav bar. Not worth holding up this PR though, unless it was a quick fix:

Screen.Recording.2023-04-24.at.8.47.59.AM.mov

@cqliu1
Copy link
Contributor Author

cqliu1 commented Apr 24, 2023

I also noticed that the "scroll to panel" behaviour is a little off for smaller browser sizes - specifically, on smaller vertical browser sizes, the top of the panel gets hidden behind the top nav bar. Not worth holding up this PR though, unless it was a quick fix:

It looks like this is a side effect of using the block: center scrolling option where it will center the panel on the viewport which includes the space underneath the search/editor bars, so when you have a taller panel, the top could get cut off. I opted for scrolling to the center bc using block: start also resulted in the panel top getting cut off bc it was scrolling to the top of the div which lies under the fixed search/editor bars, so we could need to do an additional scroll to offset the height of the bars. But doing this additional scroll offset would lead the bottom getting cut off when scrolling to the bottom most panels. There just doesn't seem to be a good one size fits all scenario with the scrolling behavior.

If we could someday restore the isolated scrolling to just the dashboard container, we could improve some of the scrolling behavior here.

Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Did another quick test locally + reviewed changes - everything LGTM. Such an exciting and useful feature 🎉 💃 🎉

@kibana-ci
Copy link
Collaborator

kibana-ci commented Apr 24, 2023

💚 Build Succeeded

Metrics [docs]

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
embeddable 442 444 +2

Async chunks

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

id before after diff
controls 187.7KB 187.9KB +153.0B
dashboard 433.8KB 435.5KB +1.7KB
total +1.8KB

Page load bundle

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

id before after diff
dashboard 38.9KB 39.7KB +816.0B
embeddable 75.7KB 75.8KB +91.0B
total +907.0B
Unknown metric groups

API count

id before after diff
embeddable 544 546 +2

ESLint disabled line counts

id before after diff
enterpriseSearch 17 19 +2
securitySolution 395 398 +3
total +5

Total ESLint disabled count

id before after diff
enterpriseSearch 18 20 +2
securitySolution 475 478 +3
total +5

History

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

@cqliu1 cqliu1 merged commit 32de23b into elastic:main Apr 24, 2023
@cqliu1 cqliu1 deleted the dashboard/scroll-to-new-panel branch April 24, 2023 19:40
nikitaindik pushed a commit to nikitaindik/kibana that referenced this pull request Apr 25, 2023
## Summary

Closes elastic#97064.

This scrolls to a newly added panel on a dashboard instead of remaining
at the top. The user can see the new panel without having to manually
scroll to the bottom.

~This also scrolls to the maximized panel when you minimize instead of
just throwing you back to the top of the dashboard.~ Note: Scrolling on
minimize will be addressed in a future PR.

This scrolling behavior also seems to work with portable dashboards
embedded in another apps, but it may require additional work on the
consumer to call `scrollToPanel` in the appropriate callbacks when
adding panels.

#### Scrolls to newly added panel and shows a success border animation

![Apr-18-2023
07-40-41](https://user-images.githubusercontent.com/1697105/232812491-5bf3ee3a-c81d-4dd3-8b04-67978da3b9a8.gif)

#### Scrolls to panel on return from editor
![Apr-18-2023
07-56-35](https://user-images.githubusercontent.com/1697105/232817401-6cfd7085-91b6-4f05-be1c-e47f6cc3edab.gif)

#### Scrolls to panel clone
![Apr-18-2023
07-54-43](https://user-images.githubusercontent.com/1697105/232816928-2b473778-76e1-4781-8e51-f9e46ab74b9b.gif)

#### Scrolling in portable dashboards example

![Apr-18-2023
08-13-14](https://user-images.githubusercontent.com/1697105/232822632-ffcbd9ad-9cad-4185-931c-a68fbf7e0fbe.gif)



### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] 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))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] 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))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces—unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes—Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### 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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
@Heenawter Heenawter mentioned this pull request Apr 25, 2023
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:cloud-deploy Create or update a Cloud deployment enhancement New value added to drive a business result Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort Project:Dashboard Usability Related to the Dashboard Usability initiative release_note:enhancement Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard] Scroll to panel on minimize [Dashboard] Scroll to new panel
6 participants