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] Support suggesting index templates v2 #124655

Merged
merged 5 commits into from
Feb 15, 2022

Conversation

mibragimov
Copy link
Contributor

@mibragimov mibragimov commented Feb 4, 2022

Closes #75967

Release note

Console in Dev Tools now supports autocompletion for index templates and component templates introduced in Elasticsearch 7.8.

Screen Shot 2022-02-09 at 9 31 29 AM

Capture

Copy link
Contributor

@Kuznietsov Kuznietsov left a comment

Choose a reason for hiding this comment

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

Solution LGTM. Thanks, @mibragimov.
Left some comments to be addressed.

}

getDefaultTermMeta() {
return 'name';
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious about the reason for not using a pattern of TypeAutocompleteComponent or FieldAutocompleteComponent classes here.

According to that pattern, getDefaultTermMeta should return index_template, and getContextKey - index_templates.

On the other hand, TemplateAutocompleteComponent is using only getContextKey.

And then, at src/plugins/console/public/lib/kb/kb.js, it is provided a template for every key.

So, my suggestion is to follow the style of TypeAutocompleteComponent or FieldAutocompleteComponent classes and add support of both meaningful keywords at the src/plugins/console/public/lib/kb/kb.js factories, or go by the path of TemplateAutocompleteComponent, add support only for the context key and add its support to the parametrizedComponentFactories.

I prefer to follow the way of TemplateAutocompleteComponent, as they are close by the idea with IndexTemplateAutocompleteComponent. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is bit of a problem with long index template names. See screenshots below:

Capture1
Capture

Perhaps we should leave name as default here. WDYT?

Copy link
Contributor

@Kuznietsov Kuznietsov Feb 8, 2022

Choose a reason for hiding this comment

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

The main idea of the context key is to identify the element, which has been shown at the prompt. Let us imagine, one day we'll receive the task to add templates to _index_template's autocompletion results.

And you'll have:

.ml-state-temp                       template
.ml-state                            name

But should see:

.ml-state-temp                       template
.ml-state                            index_template

What about the long name of the index, possibly, we should pick some shorter meaningful name for the index_template context key. The other option is resizing the .ace-editor.ace-autocomplete. Or, as this problem has been before, leave it as it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cjcenizal could you please review the changes and advise regarding the comments above?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the ping! Someone from @elastic/platform-deployment-management will provide input.

Copy link
Contributor

@alisonelizabeth alisonelizabeth Feb 9, 2022

Choose a reason for hiding this comment

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

I agree with @mibragimov and would prefer to use index_template.

I see the issue with the spacing, though. Perhaps we should address this as a separate issue, as the same could happen in other scenarios, e.g., if you have a really long index name. Thoughts?

Screen Shot 2022-02-09 at 9 26 33 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a separate issue for this #125186. I'll work on that

src/plugins/console/public/lib/kb/kb.js Outdated Show resolved Hide resolved
src/plugins/console/public/lib/mappings/mappings.js Outdated Show resolved Hide resolved
@Kuznietsov
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@Kuznietsov Kuznietsov left a comment

Choose a reason for hiding this comment

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

Code LGTM 👍

What about the width of the autocomplete prompt window, let us listen to the opinion of the @elastic/platform-deployment-management.

@mibragimov mibragimov added backport:skip This commit does not require backporting Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more release_note:feature Makes this part of the condensed release notes v8.1.0 and removed WIP Work in progress labels Feb 8, 2022
@mibragimov mibragimov marked this pull request as ready for review February 8, 2022 13:03
@mibragimov mibragimov requested a review from a team as a code owner February 8, 2022 13:03
@elasticmachine
Copy link
Contributor

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

@alisonelizabeth alisonelizabeth added v8.2.0 and removed backport:skip This commit does not require backporting labels Feb 9, 2022
@alisonelizabeth
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Great work @mibragimov!

Tested locally and works as expected. I went ahead and updated the PR description to include a release note. I also updated the labels to include 8.2. I believe main is currently representative of 8.2, and then this will need to be backported to the 8.1 branch.

Also, a couple questions -

1 - Is it possible to add any tests around this new functionality?
2 - What are your thoughts about renaming areas of the code for the legacy template autocomplete to be prefixed with legacy? For example, TemplateAutocompleteComponent would become LegacyTemplateAutocompleteComponent. Otherwise, I could see it potentially confusing if someone else comes into the code and needs to differentiate between the template autocomplete logic vs. the index_template autocomplete logic. WDYT?

@mibragimov
Copy link
Contributor Author

Great work @mibragimov!

Tested locally and works as expected. I went ahead and updated the PR description to include a release note. I also updated the labels to include 8.2. I believe main is currently representative of 8.2, and then this will need to be backported to the 8.1 branch.

Also, a couple questions -

1 - Is it possible to add any tests around this new functionality? 2 - What are your thoughts about renaming areas of the code for the legacy template autocomplete to be prefixed with legacy? For example, TemplateAutocompleteComponent would become LegacyTemplateAutocompleteComponent. Otherwise, I could see it potentially confusing if someone else comes into the code and needs to differentiate between the template autocomplete logic vs. the index_template autocomplete logic. WDYT?

Thank you for the review @alisonelizabeth! I completely agree with the suggested changes. Working on these

@mibragimov mibragimov force-pushed the index-template branch 2 times, most recently from 234bff3 to f9d6bd4 Compare February 10, 2022 08:01
@mibragimov
Copy link
Contributor Author

@alisonelizabeth @Kunzetsov I haven't noticed this point from #75967

Note that we also want to suggest the names of existing component templates for the _component_template API.

So I added support for _component_template as well. Working on the tests.

Capture

@alisonelizabeth
Copy link
Contributor

Thanks for making those changes @mibragimov! Let me know when you add tests and I will review again.

@mibragimov
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
console 165 168 +3

Async chunks

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

id before after diff
console 378.3KB 379.6KB +1.2KB

History

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

cc @mibragimov

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Latest changes LGTM. Thanks @mibragimov!

@mibragimov mibragimov added the auto-backport Deprecated - use backport:version if exact versions are needed label Feb 15, 2022
@mibragimov mibragimov merged commit 75ac8e5 into elastic:main Feb 15, 2022
@mibragimov mibragimov deleted the index-template branch February 15, 2022 08:58
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 15, 2022
* Add autocomplete suggestions for index template api

* Add support for component templates

* Add unit tests

Co-authored-by: Muhammad Ibragimov <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 75ac8e5)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Feb 15, 2022
* Add autocomplete suggestions for index template api

* Add support for component templates

* Add unit tests

Co-authored-by: Muhammad Ibragimov <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 75ac8e5)

Co-authored-by: Muhammad Ibragimov <[email protected]>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 15, 2022
…pdf-generation-in-worker-thread

* 'main' of github.com:elastic/kibana: (40 commits)
  Service overview e2e test (elastic#125359)
  [Graph] Make graph edges easier to click (elastic#124053)
  [Reporting] Add additional PNG and PDF metrics  (elastic#125450)
  [APM] Lint rule for explicit return types (elastic#124771)
  [SecuritySolution] Enrich threshold data from correct fields (elastic#125376)
  [Uptime monitor management] Make index template installation retry (elastic#125537)
  [Console] Support suggesting index templates v2 (elastic#124655)
  [Logs UI] Support switching between log source modes (elastic#124929)
  SavedObjects management: change index patterns labels to data views (elastic#125356)
  [ci-stats] add Client class for accessing test group stats (elastic#125164)
  [ML] Use Discover locator in Data Visualizer instead of URL Generator (elastic#124283)
  [Fleet] Add retries when starting docker registry in integration tests (elastic#125530)
  Update osquery.asciidoc to address doc issue (elastic#125425)
  synthetics e2e - use custom location when defined (elastic#125560)
  [ci] Retry failed steps in on-merge pipeline (elastic#125550)
  [babel] Bump babel packages (elastic#125446)
  [DOCS] Updates Upgrade Assistant API status (elastic#125410)
  [DOCS] Minor tweaks to upgrade docs (elastic#125538)
  [Uptime] handle null duration on ping list (elastic#125438)
  [TSVB][Lens] Navigate to Lens with your current configuration (elastic#114794)
  ...

# Conflicts:
#	x-pack/plugins/reporting/server/export_types/common/pdf/pdfmaker.ts
#	x-pack/plugins/reporting/server/export_types/printable_pdf/lib/generate_pdf.ts
#	x-pack/plugins/reporting/server/export_types/printable_pdf_v2/lib/generate_pdf.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Console Dev Tools Console Feature Feature:Dev Tools release_note:feature Makes this part of the condensed release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v8.1.0 v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Console] Support suggesting index templates v2
7 participants