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

Discover page collapsible panels #5635

Conversation

Ganesh0107
Copy link
Contributor

Description

This PR resolves Discover 2.0's missing left sidebar expand/collapse features by integrating OUI's resizable container

Issues Resolved

Closes #4780 [Data Explorer] Left side bar can not be expanded and collapsed

Screenshot

Screen.Recording.2023-12-22.at.12.54.52.AM.mov

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@vvvprabhakar
Copy link

Looks good

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

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

@Ganesh0107 Thanks for the PR! I have tested the change locally and I have a few comments on the PR:

  1. The DCO check has failed. The project needs never commit in the PR to be signed off using git's signoff feature -s. Can you check the details for the DCO workflow failure for step on how to remedy it?
  2. The EUI Resize component's children are rerndered every time a resize event happens. This causes performance issues. Can you memoize its children to prevent this. Here is how another application that uses the same component does it: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/vis_builder/public/application/components/workspace.tsx#L157-L159. This is not a blocker but will really improve the change :)

<EuiResizableContainer>
{(EuiResizablePanel, EuiResizableButton) => (
<>
<EuiResizablePanel initialSize={140} minSize="10%" mode="collapsible">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<EuiResizablePanel initialSize={140} minSize="10%" mode="collapsible">
<EuiResizablePanel initialSize={140} minSize="10%" mode="collapsible" paddingSize="none">

Copy link
Member

Choose a reason for hiding this comment

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

Nit: would be nice to give the left panel a bit right padding after setting paddingSize="none" , like style={{ paddingRight: 8 }}, otherwise the resize button is overlapping with the right border:
image

Copy link
Member

Choose a reason for hiding this comment

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

Thats fine for now. I'd leave minor modifications to spacing and padding to a full UX review since they have to match other experiences too.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, I'm fine with that :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated style={{ paddingRight: 8 }}

</EuiResizablePanel>
<EuiResizableButton />

<EuiResizablePanel initialSize={1140} minSize="65%" mode="main">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<EuiResizablePanel initialSize={1140} minSize="65%" mode="main">
<EuiResizablePanel initialSize={1140} minSize="65%" mode="main" paddingSize="none">

Copy link

codecov bot commented Dec 25, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (7c0bd9f) 67.01% compared to head (2c6b02b) 67.03%.

❗ Current head 2c6b02b differs from pull request most recent head 1d82737. Consider uploading reports for the commit 1d82737 to get more accurate results

Files Patch % Lines
.../data_explorer/public/components/app_container.tsx 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5635      +/-   ##
==========================================
+ Coverage   67.01%   67.03%   +0.02%     
==========================================
  Files        3296     3296              
  Lines       63370    63349      -21     
  Branches    10093    10089       -4     
==========================================
+ Hits        42465    42468       +3     
+ Misses      18456    18431      -25     
- Partials     2449     2450       +1     
Flag Coverage Δ
Linux_1 35.23% <ø> (ø)
Linux_2 55.18% <ø> (+0.06%) ⬆️
Linux_3 43.92% <50.00%> (-0.02%) ⬇️
Linux_4 35.33% <ø> (ø)
Windows_1 35.26% <ø> (ø)
Windows_2 55.15% <ø> (+0.06%) ⬆️
Windows_3 43.93% <50.00%> (+<0.01%) ⬆️
Windows_4 35.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

<EuiResizableContainer>
{(EuiResizablePanel, EuiResizableButton) => (
<>
<EuiResizablePanel initialSize={140} minSize="10%" mode="collapsible">
Copy link
Member

@ruanyl ruanyl Dec 26, 2023

Choose a reason for hiding this comment

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

initialSize is number in percent according to OUI documentation, could you check if initialSize={140} and initialSize={1140} are correctly used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ruanyl , Updated the initial size with percent according to OUI documentation.

<EuiResizableContainer>
{(EuiResizablePanel, EuiResizableButton) => (
<>
<EuiResizablePanel initialSize={140} minSize="10%" mode="collapsible">
Copy link
Member

Choose a reason for hiding this comment

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

Nit: would be nice to give the left panel a bit right padding after setting paddingSize="none" , like style={{ paddingRight: 8 }}, otherwise the resize button is overlapping with the right border:
image

min-width: 400px;
max-width: 620px;
min-width: 180px;
top: 0;
Copy link
Member

Choose a reason for hiding this comment

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

This top: 0 seems not necessary

@ruanyl
Copy link
Member

ruanyl commented Dec 26, 2023

Thanks for the improvement! Could you also add an entry about this change to CHANGELOG.md?

Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
@Ganesh0107 Ganesh0107 force-pushed the DiscoverPage-CollapsiblePanels branch from 169db75 to a071290 Compare December 26, 2023 12:52
@ashwin-pc
Copy link
Member

@Ganesh0107 will you able to make the changes suggested in the review? We are currently tracking this issue for the 2.12 release, so let me know if I can help in any way here :)

@Ganesh0107
Copy link
Contributor Author

@ashwin-pc I have made the changes and testing them locally, will commit the changes soon

Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
Comment on lines 4 to 5
max-width: 620px;
min-width: 180px;
Copy link
Collaborator

@AMoo-Miki AMoo-Miki Jan 11, 2024

Choose a reason for hiding this comment

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

I am not a fan of these. Wouldn't they limit how far I can narrow or expand the panels? Wouldn't having a min prevent me from totally collapsing the left-bar if i desired?

Also, shouldn't these be unnecessary, even unwanted, inside a resizable-container?

I am having trouble seeing the need for these boundaries.

Choose a reason for hiding this comment

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

We any way have buttons for collapse and expand, this will not prevent from completely closing it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

onClick of the button , the side bar will be collapsed.

screen-recording-2024-01-12-at-122141-am_kPc2t5La.mp4

Copy link
Member

Choose a reason for hiding this comment

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

Can we eliminate these two styles. They dont seem necessary anymore

@ashwin-pc
Copy link
Member

@Ganesh0107 Looks like your latest change has neither the paddingSize="none" prop or the padding right that @ruanyl suggested. Can you check and see if you have pushed all your changes?

Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
@Ganesh0107
Copy link
Contributor Author

@ashwin-pc Apologies for the oversight. I've pushed the latest changes, including the missing CSS adjustment. Please review the updated code, and let me know if there are any further adjustments needed.

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @Ganesh0107. I pulled down the changes and have a few more minor changes that are needed. The biggest one being that this layout has to render correctly in mobile too. Ive added all my suggestions inline so that its easy but once those are made the PR should be good to go :)

initialSize={25}
minSize="10%"
mode="collapsible"
style={{ paddingRight: 8 }}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
style={{ paddingRight: 8 }}
style={isMobile ? { paddingBottom: 8 } : { paddingRight: 8 }}
paddingSize="none"

</EuiResizablePanel>
<EuiResizableButton />

<EuiResizablePanel initialSize={75} minSize="65%" mode="main">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<EuiResizablePanel initialSize={75} minSize="65%" mode="main">
<EuiResizablePanel initialSize={75} minSize="65%" mode="main" paddingSize="none">

Comment on lines 4 to 5
max-width: 620px;
min-width: 180px;
Copy link
Member

Choose a reason for hiding this comment

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

Can we eliminate these two styles. They dont seem necessary anymore

<EuiPageBody className="deLayout__canvas">
<Canvas {...params} />
</EuiPageBody>
<EuiResizableContainer>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<EuiResizableContainer>
<EuiResizableContainer direction={isMobile ? 'vertical' : 'horizontal'}>

And you can get the value of isMobile as follows:

import { ..., useIsWithinBreakpoints } from '@elastic/eui';
// ...
const isMobile = useIsWithinBreakpoints(['xs', 's', 'm']);

<>
<EuiResizablePanel
initialSize={25}
minSize="10%"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
minSize="10%"
minSize="260px"

Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
@Ganesh0107
Copy link
Contributor Author

@ashwin-pc Updated the suggested changes, currently adding test cases. PR will be ready for review shortly. Let me know if further adjustments are required. Thanks!

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

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

Looks like you missed on of my suggestions. The rest looks good :)

Ganesh0107 and others added 3 commits January 25, 2024 12:56
Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
Co-authored-by: Ashwin P Chandran <ashwinpc1993@gmail.com>
Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
@Ganesh0107
Copy link
Contributor Author

@ashwin-pc Thanks for letting me know. I've made the necessary changes

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

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

@Ganesh0107 thanks for making the changes, the PR looks good. Sorry but i noticed one other change thats needed. The Changelog entry you have made is for the 1.x releases. Since this change has not been released yet, it should go to the unreleased section of the file, which is in and around line 30

Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
This reverts commit 34a1b12.
Signed-off-by: Ganesh0107 <ganesh.gopal@freshworks.com>
@ashwin-pc
Copy link
Member

@Ganesh0107 thanks for the PR. I have incorporated your changes in #5789 and will credit you for your contribution on that PR instead of this one since I had to make changes on top of yours for another feature. Closing this PR for now since the changes have already been incorporated elsewhere.

@ashwin-pc ashwin-pc closed this Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Data Explorer] Left side bar can not be expanded and collapsed
6 participants