Skip to content

Fixes unnecessary autocompletes on HTTP methods#163233

Merged
sakurai-youhei merged 29 commits intoelastic:mainfrom
sakurai-youhei:fix-156254-refix-120606-unfix-19961
Aug 23, 2023
Merged

Fixes unnecessary autocompletes on HTTP methods#163233
sakurai-youhei merged 29 commits intoelastic:mainfrom
sakurai-youhei:fix-156254-refix-120606-unfix-19961

Conversation

@sakurai-youhei
Copy link
Copy Markdown
Member

@sakurai-youhei sakurai-youhei commented Aug 6, 2023

Summary

This PR,,,

  1. fixes [Console] Unnecessary autocomplete suggestions for HTTP methods #156254
  2. fixes [Console] No autocomplete suggestions when using lowercase methods #120606 differently from Fix autocomplete suggestions for lowercase methods and other related bug #121033
  3. fixes Console doesn't display suggestions when you first type _ #19961 differently from Fix autocomplete suggestions for lowercase methods and other related bug #121033

[1] left=PR / right=8.9.0

fix-156254

[2] left=PR / right=8.9.0

fix-120606

[3] left=PR / right=8.9.0

fix-19961

Original description
  1. fixes [Console] Unnecessary autocomplete suggestions for HTTP methods #156254
  2. refixes [Console] No autocomplete suggestions when using lowercase methods #120606 - which should stay closed
  3. unfixes Console doesn't display suggestions when you first type _ #19961 - which must be reopened or duplicated after merging this PR

[1] left=PR / right=8.9.0

fix-156254

[2] left=PR / right=8.9.0

refix-120606

Autocomplete starts if the method is all uppercase or all lowercase; it doesn't with mixed cases such as Get, gET, etc. anymore.

[3] left=PR / right=8.9.0

unfix-19961

Autocomplete no longer starts on first typing _ after url.slash. No simple solution makes me leave this issue unfixed.

Checklist

  • Unit or functional tests 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)
  • Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)

For maintainers

Other notes

Release note

Fixes unnecessary autocompletes on HTTP methods

fixes elastic#156254
refixes elastic#120606 - should stay closed
unfixes elastic#19961 - should be reopened
@sakurai-youhei sakurai-youhei added bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature release_note:fix backport:skip This PR does not require backporting labels Aug 6, 2023
@sakurai-youhei sakurai-youhei requested a review from a team as a code owner August 6, 2023 15:31
@sakurai-youhei sakurai-youhei marked this pull request as draft August 6, 2023 17:21
@sakurai-youhei
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@sakurai-youhei
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@sakurai-youhei sakurai-youhei marked this pull request as ready for review August 7, 2023 21:52
Copy link
Copy Markdown
Contributor

@yuliacech yuliacech left a comment

Choose a reason for hiding this comment

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

Thank you for working on this issue, @sakurai-youhei!
Here are my thoughts on the changes:

  1. Good to have this fixed, it's indeed annoying that the methods autocomplete is constantly displayed on arrow navigation
  2. I'm not sure we need to fix this: the request works when the method uses mixed lower/upper case letters like Get /_search so that is not needed in my opinion
  3. That is regression that I have to block the PR on. I think it's important to have urls displayed for example after an index name and an underscore: GET /.kibana/_. The tradeoff for me is not worth to fix 1. but introducing this regression

@sakurai-youhei
Copy link
Copy Markdown
Member Author

sakurai-youhei commented Aug 8, 2023

@yuliacech thank you for your comments.

  1. I keep this.
  2. I leave this unless I will try to find a reasonable way to get autocomplete back to work on Get _, gET _, etc. because these are also trade-off regression introduced by 1.
  3. OK, I’m going to work on this to eliminate the regression. Once done, I will mark this PR ready again.

@sakurai-youhei sakurai-youhei marked this pull request as draft August 8, 2023 13:35
@sakurai-youhei
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@sakurai-youhei sakurai-youhei marked this pull request as ready for review August 10, 2023 00:17
@sakurai-youhei
Copy link
Copy Markdown
Member Author

@yuliacech How do you find this approach and outcome? Thanks.

@yuliacech yuliacech added the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// label Aug 14, 2023
@yuliacech yuliacech self-requested a review August 14, 2023 12:21
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/platform-deployment-management (Team:Deployment Management)

Copy link
Copy Markdown
Contributor

@yuliacech yuliacech left a comment

Choose a reason for hiding this comment

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

I was testing locally and noticed that when I type just 1 letter, there is no autocomplete for methods, for example I would expect to see POST, PUT when typing P. This currently works on main. Is this intended?

// Prompt autocomplete window and provide a initial letter of properties to narrow down the results. E.g. 'b' = 'bool'
public async promptAutocomplete(letter = 'b') {
// give browser enough moments to complete events from past UI operations
await this.common.sleep(200);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd rather avoid using sleep if at all possible. There are other ways to wait for UI loading to compelte, for example waitFor.

Copy link
Copy Markdown
Member Author

@sakurai-youhei sakurai-youhei Aug 16, 2023

Choose a reason for hiding this comment

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

After reading the codes further, I found evaluateCurrentTokenAfterAChange function is protected by debounce with 100ms delay HERE, which is the reason why autocomplete does not appear without a short interval between operations.

So, I'm afraid there's no realistic (<-added) way to avoid using sleep. In addition to that, because I need to depend on sleep more to write tests, I split it out to iconic sleepforDebouncePeriod(duration: number = 100) function HERE.

Copy link
Copy Markdown
Member Author

@sakurai-youhei sakurai-youhei Aug 17, 2023

Choose a reason for hiding this comment

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

Furthermore, I increased the default sleep period to 200ms because lodash's debounce uses inaccurate setTimeout.

https://github.com/lodash/lodash/blob/4.17.21/lodash.js#L10488

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tests for auto-complete have no longer been flaky since this build. 100ms delay after sync exec JS code seems to work well with lodash's 100ms debounce.

💔 Build #151657 failed 5ec4ced

@yuliacech
Copy link
Copy Markdown
Contributor

Maybe we should add more tests for those regressions that keep popping up

@sakurai-youhei
Copy link
Copy Markdown
Member Author

Have added functional tests, which also cover the cases for autocomplete on typing the first character like P.

left=PR / right=8.9.1
type-one-char

Please give me your feedback, @yuliacech . Thank you.

@sakurai-youhei sakurai-youhei marked this pull request as ready for review August 21, 2023 03:28
@yuliacech
Copy link
Copy Markdown
Contributor

For me locally, the autocomplete still doesn't work when only 1 letter is typed in. It does work when it's not the first request though. Very weird behaviour, here is the screen recording

Screen.Recording.2023-08-22.at.14.44.31.mov

@sakurai-youhei
Copy link
Copy Markdown
Member Author

@yuliacech I agree it's wired. But the behavior is not a regression. I find the same observation even on 8.9.1. Shall we open a new issue for the behavior? I'll probably address it apart from this PR.

@yuliacech
Copy link
Copy Markdown
Contributor

You're right @sakurai-youhei , that is a pre-existing behaviour. I'll open an issue for that.

@sakurai-youhei sakurai-youhei enabled auto-merge (squash) August 23, 2023 10:16
@sakurai-youhei sakurai-youhei merged commit fade57d into elastic:main Aug 23, 2023
@kibana-ci
Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

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

id before after diff
console 416.7KB 418.3KB +1.6KB
Unknown metric groups

ESLint disabled line counts

id before after diff
console 37 38 +1

Total ESLint disabled count

id before after diff
console 40 41 +1

History

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

jloleysens added a commit to jloleysens/kibana that referenced this pull request Aug 23, 2023
* main: (150 commits)
  Fixes unnecessary autocompletes on HTTP methods (elastic#163233)
  [Defend Workflows] Convert filterQuery to kql  (elastic#161806)
  [Fleet] copy `inactivity_timeout` when duplicating agent policy (elastic#164544)
  Fix 7.17 forward compatibility with 8.2+ (elastic#164274)
  [ML] Fixes dark mode in flyouts and modals (elastic#164399)
  [Defend Workflows]Changes to policy settings are not persistent until a refresh (elastic#164403)
  [Security Solution][Endpoint] Fixes kibana crash when going back to policy details page (elastic#164329)
  Prepare the Security domain HTTP APIs for Serverless (elastic#162087)
  skip failing test suite (elastic#160986)
  [Security Solution] Fix flaky Event Filters test (elastic#164473)
  [EDR workflows] Osquery serverless tests (elastic#163795)
  [Fleet] Only show agent dashboard links if there is more than one non-server agent and if the dashboards exist (elastic#164469)
  [Chrome UI] Fix background color in serverless (elastic#164419)
  [DOCS] Saved objects - resolve import errors API (elastic#162825)
  Remove 'Create Rule' button from Rule Group page (elastic#164167)
  [Security Solution] expandable flyout - fix infinite loop in correlations (elastic#163450)
  [Remote Clusters] Update copy about port help text (elastic#164442)
  [api-docs] 2023-08-23 Daily api_docs build (elastic#164524)
  [data views] Disable scripted fields in serverless environment (elastic#163228)
  [Reporting] Fix - show diagnostic only when image reporting is enabled (elastic#164336)
  ...
yuliacech added a commit to yuliacech/kibana that referenced this pull request Oct 12, 2023
sakurai-youhei added a commit that referenced this pull request Oct 23, 2023
## Summary

This PR fixes autocomplete triggering on URL tokens ~~for url parameters
to work with a single character~~.

Fixes #168017 (which is a regression introduced by #163233)


![fix-autocomplete-168017](https://github.com/elastic/kibana/assets/721858/94e6f773-53c9-4bc1-991c-fb572ddf7ffd)

### Checklist

- [x] [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

### Notes

- No functional tests are added because they would also go flaky.
- ~~No unit tests are added because of the lack of existing unit
tests.~~
- ~~The change is kept minimal by accepting the growing if-else block.~~

### For maintainers

- [x] 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Oct 23, 2023
## Summary

This PR fixes autocomplete triggering on URL tokens ~~for url parameters
to work with a single character~~.

Fixes elastic#168017 (which is a regression introduced by elastic#163233)

![fix-autocomplete-168017](https://github.com/elastic/kibana/assets/721858/94e6f773-53c9-4bc1-991c-fb572ddf7ffd)

### Checklist

- [x] [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

### Notes

- No functional tests are added because they would also go flaky.
- ~~No unit tests are added because of the lack of existing unit
tests.~~
- ~~The change is kept minimal by accepting the growing if-else block.~~

### For maintainers

- [x] 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 8fe2e1a)
kibanamachine added a commit that referenced this pull request Oct 24, 2023
# Backport

This will backport the following commits from `main` to `8.11`:
- [Fix autocomplete triggering on URL tokens
(#168956)](#168956)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Youhei
Sakurai","email":"youhei.sakurai@elastic.co"},"sourceCommit":{"committedDate":"2023-10-23T22:42:30Z","message":"Fix
autocomplete triggering on URL tokens (#168956)\n\n##
Summary\r\n\r\nThis PR fixes autocomplete triggering on URL tokens ~~for
url parameters\r\nto work with a single character~~.\r\n\r\nFixes
#168017 (which is a regression introduced by
#163233)\r\n\r\n\r\n![fix-autocomplete-168017](https://github.com/elastic/kibana/assets/721858/94e6f773-53c9-4bc1-991c-fb572ddf7ffd)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n###
Notes\r\n\r\n- No functional tests are added because they would also go
flaky.\r\n- ~~No unit tests are added because of the lack of existing
unit\r\ntests.~~\r\n- ~~The change is kept minimal by accepting the
growing if-else block.~~\r\n\r\n### For maintainers\r\n\r\n- [x] This
was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"8fe2e1ac687678e0fe5558ca61853614b287adc0","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Feature:Console","Team:Deployment
Management","release_note:skip","v8.11.0","v8.12.0"],"number":168956,"url":"https://github.com/elastic/kibana/pull/168956","mergeCommit":{"message":"Fix
autocomplete triggering on URL tokens (#168956)\n\n##
Summary\r\n\r\nThis PR fixes autocomplete triggering on URL tokens ~~for
url parameters\r\nto work with a single character~~.\r\n\r\nFixes
#168017 (which is a regression introduced by
#163233)\r\n\r\n\r\n![fix-autocomplete-168017](https://github.com/elastic/kibana/assets/721858/94e6f773-53c9-4bc1-991c-fb572ddf7ffd)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n###
Notes\r\n\r\n- No functional tests are added because they would also go
flaky.\r\n- ~~No unit tests are added because of the lack of existing
unit\r\ntests.~~\r\n- ~~The change is kept minimal by accepting the
growing if-else block.~~\r\n\r\n### For maintainers\r\n\r\n- [x] This
was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"8fe2e1ac687678e0fe5558ca61853614b287adc0"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168956","number":168956,"mergeCommit":{"message":"Fix
autocomplete triggering on URL tokens (#168956)\n\n##
Summary\r\n\r\nThis PR fixes autocomplete triggering on URL tokens ~~for
url parameters\r\nto work with a single character~~.\r\n\r\nFixes
#168017 (which is a regression introduced by
#163233)\r\n\r\n\r\n![fix-autocomplete-168017](https://github.com/elastic/kibana/assets/721858/94e6f773-53c9-4bc1-991c-fb572ddf7ffd)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n###
Notes\r\n\r\n- No functional tests are added because they would also go
flaky.\r\n- ~~No unit tests are added because of the lack of existing
unit\r\ntests.~~\r\n- ~~The change is kept minimal by accepting the
growing if-else block.~~\r\n\r\n### For maintainers\r\n\r\n- [x] This
was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"8fe2e1ac687678e0fe5558ca61853614b287adc0"}}]}]
BACKPORT-->

Co-authored-by: Youhei Sakurai <youhei.sakurai@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature release_note:fix Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v8.11.0

Projects

None yet

5 participants