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

[Console Monaco migration] Implement request body autocomplete #182562

Merged
merged 12 commits into from
May 14, 2024

Conversation

yuliacech
Copy link
Contributor

@yuliacech yuliacech commented May 3, 2024

Summary

Closes #180208

This PR adds support for autocomplete suggestions in the request body. The focus of this work is to correctly suggest the names of properties and insert corresponding template snippets.

Screen recording

Screen.Recording.2024-05-08.at.11.15.00.mov

Follow up issues that need to be addressed later

  • Correct use of the conditional template (create snapshot repo)
  • Display async loading suggestions (fields)
  • Correctly suggest the values of properties (GET _search, property explain)
  • After inserting a template snippet, move the cursor to a correct position (inside an empty object)

@yuliacech yuliacech added Feature:Console Dev Tools Console Feature Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels May 3, 2024
@yuliacech
Copy link
Contributor Author

/ci

2 similar comments
@yuliacech
Copy link
Contributor Author

/ci

@yuliacech
Copy link
Contributor Author

/ci

* For example '{ "test": [' -> ['{', 'test', '[']. This array is used for autocomplete.
* Returns array of strings representing body tokens for autocomplete.
*/
export const parseBody = (value: string): string[] => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function uses the logic similar to the code in parser, we could consider re-using some of the code in both.

@yuliacech yuliacech marked this pull request as ready for review May 8, 2024 10:26
@yuliacech yuliacech requested a review from a team as a code owner May 8, 2024 10:26
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@yuliacech yuliacech added the release_note:skip Skip the PR/issue when compiling release notes label May 8, 2024
@ElenaStoeva ElenaStoeva self-requested a review May 9, 2024 16:28
Copy link
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

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

Great job @yuliacech! Tested locally and the request body params are correctly suggested.

I noticed one small issue though. When I click somewhere outside the autocomplete suggestions pop-up window and then continue typing, I no longer get autocomplete suggestions. This doesn't happen in the Ace Console.

Monaco
Screen.Recording.2024-05-09.at.18.27.08.mov
Ace
Screen.Recording.2024-05-09.at.18.28.19.mov

Would there be an easy fix for this or should we leave it for a follow-up PR?

@yuliacech yuliacech force-pushed the console/implement_autocomplete_body branch from a911984 to 1ff1acb Compare May 13, 2024 12:45
@yuliacech
Copy link
Contributor Author

Thanks a lot for the review, @ElenaStoeva!
Indeed, the monaco editor has a different behaviour with when autocomplete suggestions are displayed. I'll open an issue to track that. Currently I know that the monaco editor triggers suggestions on specific characters. We will need to find a way to trigger suggestions more often to keep the behaviour similar to ace.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
console 251 256 +5

Async chunks

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

id before after diff
console 443.3KB 447.8KB +4.5KB

History

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

Copy link
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

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

Indeed, the monaco editor has a different behaviour with when autocomplete suggestions are displayed. I'll open an issue to track that. Currently I know that the monaco editor triggers suggestions on specific characters. We will need to find a way to trigger suggestions more often to keep the behaviour similar to ace.

I see, thanks for letting me know! In this case, I'm approving to unblock the PR.

@yuliacech
Copy link
Contributor Author

Opened #183421 and #183422 for follow up work

@yuliacech yuliacech merged commit 5346e0d into elastic:main May 14, 2024
17 checks passed
@kibanamachine kibanamachine added v8.15.0 backport:skip This commit does not require backporting labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Console Dev Tools Console Feature release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Console Monaco migration] Add autocomplete suggestions
5 participants