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] Disable layout changes when panel is expanded #152054
[Dashboard] Disable layout changes when panel is expanded #152054
Conversation
Pinging @elastic/kibana-presentation (Team:Presentation) |
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
code review
// onLayoutChange gets called by react grid layout a lot more than it should, so only dispatch the updated panels if the layout has actually changed | ||
if (!getPanelLayoutsAreEqual(panels, updatedPanels)) { | ||
dispatch(setPanels(updatedPanels)); | ||
if (!expandedPanelId) { |
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.
nit
Instead of nesting everything under if (!expandedPanelId)
, how about just returning early
if (expandedPanelId) {
return;
}
…rd/disable-layout-changes-in-maximize
…//github.com/cqliu1/kibana into dashboard/disable-layout-changes-in-maximize
@@ -68,14 +68,13 @@ function ResponsiveGrid({ | |||
}); | |||
|
|||
const MARGINS = useMargins ? 8 : 0; | |||
// We can't take advantage of isDraggable or isResizable due to performance concerns: | |||
// https://github.com/STRML/react-grid-layout/issues/240 |
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 performance concern mentioned here is that react-grid-layout
children were unmounted when isDraggable
and isResizable
were dynamically changed. This issue has since been resolved with this fix which went into RGL v0.81.0, and we're currently on v1.3.4.
…rd/disable-layout-changes-in-maximize
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.
Looked through the code and tested this locally. Everything works great!
As discussed offline, would love to see a performance comparison using the isResizable
/ isDraggable
strategy vs pure CSS just for peace of mind.
@@ -33,6 +33,10 @@ | |||
*/ | |||
.dshLayout-isMaximizedPanel { | |||
height: 100% !important; /* 1. */ | |||
|
|||
.react-resizable-handle { | |||
display: none; /* 1 */ |
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.
nit: Is this still needed now that we have the isResizable
set to false?
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.
It looks like this isn't necessary anymore after setting isResizable
to false. I'll remove this
@@ -21,4 +19,9 @@ | |||
.embPanel { | |||
border-color: transparent; | |||
} | |||
|
|||
.embPanel--dragHandle:hover { |
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.
What is this new style for?
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 one is to keep the title bar from setting that yellow background and prevent the cursor from changing to the move
cursor to override styles defined by the embeddable plugin.
Amazing, thank you for doing those profiles! Definitely adds to my confidence in this PR. |
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.
I think it'd be good to have an indicator for users to know that a panel is maximized (see screenshot below) but we can tackle that in a follow-up.
Nice job @cqliu1 !
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
## Summary Closes #152052. This ignores dashboard layout changes when a panel is expanded to prevent accidental layout changes. This also cleans up some of the CSS for maximized panel to look more similar to a single panel on a dashboard and hides the resize handle in the bottom right corner. One additional CSS change included in this PR is I switched the embeddable panel dashed border to a dashed outline to prevent panel resizing between view/edit mode. ### Maximized Panel Before | After :------: | :------: ![Screenshot 2023-02-23 at 4 40 26 PM](https://user-images.githubusercontent.com/1697105/221063721-34a63f96-a7fe-4fab-a21d-c1108f4ba63d.png) | ![Screenshot 2023-02-23 at 4 39 55 PM](https://user-images.githubusercontent.com/1697105/221063765-a7da2c8e-8e60-469a-b607-872a8c3957aa.png) ### Disabled dragging when maximized ![Mar-20-2023 14-00-21](https://user-images.githubusercontent.com/1697105/226464826-1882fbcd-cfcb-471c-8e6c-e795d0c3762b.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)
…2054) ## Summary Closes elastic#152052. This ignores dashboard layout changes when a panel is expanded to prevent accidental layout changes. This also cleans up some of the CSS for maximized panel to look more similar to a single panel on a dashboard and hides the resize handle in the bottom right corner. One additional CSS change included in this PR is I switched the embeddable panel dashed border to a dashed outline to prevent panel resizing between view/edit mode. ### Maximized Panel Before | After :------: | :------: ![Screenshot 2023-02-23 at 4 40 26 PM](https://user-images.githubusercontent.com/1697105/221063721-34a63f96-a7fe-4fab-a21d-c1108f4ba63d.png) | ![Screenshot 2023-02-23 at 4 39 55 PM](https://user-images.githubusercontent.com/1697105/221063765-a7da2c8e-8e60-469a-b607-872a8c3957aa.png) ### Disabled dragging when maximized ![Mar-20-2023 14-00-21](https://user-images.githubusercontent.com/1697105/226464826-1882fbcd-cfcb-471c-8e6c-e795d0c3762b.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)
Summary
Closes #152052.
This ignores dashboard layout changes when a panel is expanded to prevent accidental layout changes. This also cleans up some of the CSS for maximized panel to look more similar to a single panel on a dashboard and hides the resize handle in the bottom right corner.
One additional CSS change included in this PR is I switched the embeddable panel dashed border to a dashed outline to prevent panel resizing between view/edit mode.
Maximized Panel
Disabled dragging when maximized
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:
For maintainers