mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
## Summary This PR uses the new script to generate autocomplete definitions for Dev Tools Console from the ES specification repo. #### Definitions changes - New property `availability` is added to filter out endpoints that are not available in Serverless - Some endpoints' query parameters have more details now, for example common query params are now defined in definitions ```json "url_params": { "error_trace": "__flag__", "filter_path": [], "human": "__flag__", "pretty": "__flag__" }, ``` - Url components in few endpoints are removed, but those were added to overrides files in https://github.com/elastic/kibana/pull/163096 - Documentation links contain `{branch}` instead of `master` (fix for that added in https://github.com/elastic/kibana/pull/159241) #### Script changes - The logic for generating `availability` for endpoint has been updated based on the feedback from the Clients team. Details added to the script file. - Added a few "safe guards" to the spots in the script where an unexpected type of data might be coming from the ES specification schema #### Console changes - Fixed the autocomplete request on Serverless (we might need a proper fix for that, details in https://github.com/elastic/kibana/issues/163318) Also updates to readme files both in Console and the new script. I will remove the old script in a separate PR. ## Screenshots "ILM" autocomplete suggestions displayed on stateful <img width="583" alt="Screenshot 2023-08-07 at 17 47 48" src="641a48b0
-fb1a-4d3b-a8c9-99eab8795510"> "ILM" autocomplete suggestions not displayed on serverless <img width="572" alt="Screenshot 2023-08-07 at 17 35 16" src="a1ee5468
-eb9f-4f52-81d5-c661b06f8ceb"> ## How to test - Start Kibana on stateful (`yarn start`) and check that autocomplete suggestions are working as before (no changes) - Start Kibana on serverless (`yarn start --serverless`) and check that autocomplete suggestions are not displayed for endpoints blocked/internal on serverless. ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2.1 KiB
2.1 KiB
Generate console definitions
This package is a script to generate definitions used in Console to display autocomplete suggestions.
The definitions files are generated from the Elasticsearch specification repo.
This script is
a new implementation of an old kbn-spec-to-console
package: The old script used JSON specs in the Elasticsearch repo as the source.
Instructions
- Checkout the Elasticsearch specification repo.
- Run the command
node scripts/generate_console_definitions.js --source <ES_SPECIFICATION_REPO> --emptyDest
This command will use the folder<ES_SPECIFICATION_REPO>
as the source and the constantAUTOCOMPLETE_DEFINITIONS_FOLDER
as the destination. Based on the value of the constant, the autocomplete definitions will be generated in the folder<KIBANA_REPO>/src/plugins/server/lib/spec_definitions/json/generated
. The flag--emptyDest
indicates that all existing files in the destination folder will be removed. - It's possible to generate the definitions into a different folder. For that pass an option to the command
--dest <DEFINITIONS_FOLDER>
and also update the constantAUTOCOMPLETE_DEFINITIONS_FOLDER
so that the Console server will load the definitions from this folder.
Functionality
This script generates definitions for all endpoints defined in the ES specification at once.
The script generates fully functional autocomplete definition files with properties as described in the Console README.md file except data_autocomplete_rules
. Currently, this property needs to be written manually to add autocomplete suggestions for request body parameters.