-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Allows users to not render suggestions #115946
Conversation
@MichaelMarcialis I want your feedback here! |
My first instinct would be to try using an |
@elasticmachine merge upstream |
@@ -264,8 +264,10 @@ describe('suggestion_panel', () => { | |||
preloadedState, | |||
}); | |||
|
|||
expect(instance.find(EuiIcon)).toHaveLength(1); | |||
expect(instance.find(EuiIcon).prop('type')).toEqual(LensIconChartDatatable); | |||
expect(instance.find('[data-test-subj="lnsSuggestionsPanel"]').find(EuiIcon)).toHaveLength(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.
I have to be more specific here as EuiAccordion
introduces another EuiIcon
component.
@MichaelMarcialis great idea! It worked like a charm :) |
Pinging @elastic/kibana-vis-editors (Team:VisEditors) |
@@ -293,6 +296,15 @@ export function SuggestionPanel({ | |||
}, [ExpressionRendererComponent]); | |||
|
|||
const [lastSelectedSuggestion, setLastSelectedSuggestion] = useState<number>(-1); | |||
// get user's selection from localStorage, this key defines if the suggestions panel will be hidden or not | |||
const [hideSuggestions, setHideSuggestions] = useLocalStorage( |
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.
Haven't tested yet, maybe there's no difference, but can you prevent the suggestion computation above based on this flag?
I would be interesting to check if it has a performance impact
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 had looked into it but it wasn't so simple. I could also get another look if you want.
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 did some basic profiling with and without recomputing the suggestions even if hidden, and it does change much the performance. The expression evaluation is still the main bottleneck there, so strong opinion on this.
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.
@dej611 the biggest problem I see is this:
if (suggestions.length === 0) {
return null;
}
When there are no suggestions then we don't display the suggestions panel. For example
if we don't compute them if the suggestions are hidden, how this will work? Can we use another variable? If yes, which?
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 looking good, @stratoula! Left a few comments/questions for your review.
.lnsSuggestionPanel--hideSuggestions { | ||
padding-bottom: $euiSizeS; | ||
} |
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.
Rather than conditionally applying padding to the bottom of the suggestions panel, would it be better to just apply ever-present bottom padding to .lnsFrameLayout__pageBody
? You'd likely also have to adjust or remove the padding from .lnsSuggestionPanel__suggestions
as well, but I think that makes the organization and maintenance of the padding much simpler. What do you think?
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.
@MichaelMarcialis the reason I didn't do it this way, is because I saw this comment and didn't want to break anything :D
.lnsFrameLayout__pageBody {
@include euiScrollBar;
min-width: $lnsPanelMinWidth + $euiSizeXL;
overflow: hidden auto;
display: flex;
flex-direction: column;
flex: 1 1 100%;
// Leave out bottom padding so the suggestions scrollbar stays flush to window edge
// Leave out left padding so the left sidebar's focus states are visible outside of content bounds
// This also means needing to add same amount of margin to page content and suggestion items**
padding: $euiSize $euiSize 0;
position: relative;
z-index: $lnsZLevel1;
&:first-child {
padding-left: $euiSize;
}
&.lnsFrameLayout__pageBody-isFullscreen {
background: $euiColorEmptyShade;
flex: 1;
padding: 0;
}
}
But I removed the condition with this way:
- removed the
lnsSuggestionPanel--hideSuggestions
- removed the padding from
lnsSuggestionPanel__suggestions
- added the padding on the container
lnsSuggestionPanel
Wdyt about this?
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.
That works. Thanks for looking into it!
x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.scss
Outdated
Show resolved
Hide resolved
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 did test locally with Chrome and Safari and all good 👍
Maybe the only minor feedback I can report is the use of the right arrow icon for the accordion feels weird, maybe it would look better as an arrow up? On click the content is rising up rather than pushing it down, which looks a bit different from classical accordion case.
Anyway approving to not block for that detail.
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Test Failures
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
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.
Thanks for addressing my comments. This LGTM!
* [Lens] Allows users to not render suggestions * Improve the transitions * change implementation and use EuiAccordion instead * Fixes the scrolling problem on the suggestions panel * Apply PR comments Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit 29e807f) # Conflicts: # x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx
* [Lens] Allows users to not render suggestions * Improve the transitions * change implementation and use EuiAccordion instead * Fixes the scrolling problem on the suggestions panel * Apply PR comments Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit 29e807f)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
* [Lens] Allows users to not render suggestions * Improve the transitions * change implementation and use EuiAccordion instead * Fixes the scrolling problem on the suggestions panel * Apply PR comments Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit 29e807f) # Conflicts: # x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx Co-authored-by: Stratoula Kalafateli <[email protected]>
* [Lens] Allows users to not render suggestions * Improve the transitions * change implementation and use EuiAccordion instead * Fixes the scrolling problem on the suggestions panel * Apply PR comments Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit 29e807f) Co-authored-by: Stratoula Kalafateli <[email protected]>
Summary
Closes #85518
This PR gives the users the ability to not render the suggestions.
The accordion status value is stored in localeStorage with the key
LENS_SUGGESTIONS_PANEL_HIDDEN
.Note: When it is hidden, I don't send the search request so it could also be a performance improvement.
Checklist