-
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
Multi-line kql bar #70140
Multi-line kql bar #70140
Conversation
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 pretty slick and overall I think a good solution for long queries.
A couple things that I found:
- The whole input steals the up/down arrow keys for traversing the auto-complete dropdown. Kind of annoying when you have more than one line. Is it possible to check if the auto-complete is open before steeling the up/down arrow keys?
- Should the enter key also collapse the input? Maybe moves the focus to the "Update" button?
- Tabbing out of the input doesn't reduce the width back. Meaning, the time picker doesn't come back when you tab to it.
- Super minor, but there's an interesting spacing difference between the date/picker and the Update button versus when the Kquery bar is fully open.
Don't mind the styles, I am in the K8 theme and didn't want to switch back yet - There's just a slight weirdness with the right border. Maybe the
KQL
button also needs a border to keep it separate from the cut off text.
All good feedback. I think I can solve most of them. The up/down one is interesting. |
Yeah I think it would just be moving the kibana/src/plugins/data/public/ui/query_string_input/query_string_input.tsx Lines 266 to 273 in 4c227b2
|
@cchaos I think I got all your issues. Here's a vid so you don't need to pull it down. https://snid.es/2020JUN/eJ00p18NjH5jOQ48.mp4 |
// Note to engineers. `isSuggestionVisible` does not mean the suggestions are visible. | ||
// This should likely be fixed, it's more that suggestions can be shown. |
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 HIGHLY suggest taking a look at the state changes in this code when you run through here. At best this state is improperly named. isSuggestionsVisible
is more accurately "mightHaveSuggestions". There are times when it is true
when the dropdown suggestions are not actually visible. My guess is that no suggestions are present, so nothing renders. So again, "mightHaveSuggestions" seems more accurate.
My logic works, but I wouldn't be suprised if the next person who reads this code will likely run into an hour of headscratching like I did trying to figure out what is wrong.
I did not change anything here related to the state change, because this is a big codebase and I didn't want to muck it up, but one of you should check it out. I could only diagnose the problem by adding a bunch of console logs and seeing how the state changed in various keyEvent
s
This is done on the design code / functionality side. I'm passing this over to @XavierM to fix the tests (it has to do with value/child changes now that it's a textarea). Please let me know before Friday if you notice errors in the actual functionality as I'll be gone the two weeks before FF. |
Thanks a lot, @snide, I hope that this commit 7ce67a9 will make everything green for us. If not I will come back to it ;) |
@elasticmachine merge upstream |
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.
@snide |
I think if there were a scroll bar people would still copy & paste between an editor in order to be able to see the search when there is branching or complex logic or a long series of tests. |
src/plugins/data/public/ui/query_string_input/query_string_input.tsx
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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.
Tested and working well now.
Also resolved merge conflicts 🙇
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededBuild metrics
History
To update your PR or re-run it, just comment with: |
* Multiline kql bar * fix id * use visibility rather than display to hide stuff, cross fingers for tests * another vis trick for tests * quasi fix tests, still some failures * caroline feedback * fun! * fix for mouse * fix test * check api * fix unit test on query_string_input * Fix cypress test * handle the resize of the height of the textarea when the window have been resize Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Liza K <liza.katz@elastic.co>
* Multiline kql bar * fix id * use visibility rather than display to hide stuff, cross fingers for tests * another vis trick for tests * quasi fix tests, still some failures * caroline feedback * fun! * fix for mouse * fix test * check api * fix unit test on query_string_input * Fix cypress test * handle the resize of the height of the textarea when the window have been resize Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Liza K <liza.katz@elastic.co> Co-authored-by: Dave Snider <dave.snider@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Liza K <liza.katz@elastic.co>
Summary
Fixes #36140
Makes the kql bar use a textarea isntead of a text input. Does some juggling to manage the focus state and change the height dynamically as people edit long form queries. Also hides Discover's date picker when the query bar is focused. The later change requires the need to no longer auto focus the query bar, which seems like an acceptable trade off.''
Focus hides the date picker
Content can now wrap multiple lines. The height adjusts appropriately
Tests
Dunno what would need to be added test wize. This should be a pretty simple change from an interface level. If there are tests to be added, I'll likely need help from engineering.
Checklist
Delete any items that are not applicable to this PR.
[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n supportDocumentation was added for features that require explanation or tutorialsUnit or functional tests were updated or added to match the most common scenariosThis renders correctly on smaller devices using a responsive layout. (You can test this in your browserFor maintainers