Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Console] Migrate output editor to Monaco (#178696)
Closes #178941 ## Summary This PR migrates the output editor from Ace editor to Monaco editor. <img width="1491" alt="Screenshot 2024-04-03 at 11 22 27" src="https://github.com/elastic/kibana/assets/59341489/fbff226d-8f6b-470a-b6c8-34f4aaf64200"> **How to test:** 1. Create a `config/kibana.dev.yml` file (if one doesn't exist already) and add the line: `console.dev.enableMonaco: true` 2. Change the condition in https://github.com/elastic/kibana/blob/b8c13babf1c24a2a50668bc5ed647ce87deec5f0/src/plugins/console/public/application/containers/editor/editor.tsx#L76 to `!isMonacoEnabled` to display the old Ace editor in the request panel for now so that we can test sending a request. 3. Send a request and verify the output panel displays the response correctly in json format and that the highlighting is the same as in the original output panel. Also test sending multiple requests at once. <details> <summary>JSON output screenshots:</summary> Ace editor: <img width="561" alt="Screenshot 2024-03-22 at 16 12 48" src="https://github.com/elastic/kibana/assets/59341489/898a3e48-5a3b-48b6-ac4e-92fa6e05403a"> Now: <img width="722" alt="Screenshot 2024-04-03 at 11 12 59" src="https://github.com/elastic/kibana/assets/59341489/503614db-946b-490e-9447-fd3cdcb83bcf"> When multiple requests are sent: <img width="1491" alt="Screenshot 2024-04-03 at 11 10 53" src="https://github.com/elastic/kibana/assets/59341489/63b05227-a723-49ec-a9ac-3ae3269effd1"> </details> 4. Send a request with `?format=yaml` parameter (e.g. `GET _all?format=yaml`) and verify that the output panel displays the response correctly in yaml format. <details> <summary>YAML output screenshot:</summary> <img width="1459" alt="Screenshot 2024-03-27 at 11 29 45" src="https://github.com/elastic/kibana/assets/59341489/c1967f0f-021e-4b68-bb8f-3098ef35ff1f"> </details> 5. The output also supports text output data. To test this format, delete line 29 and add the following code in line 34 in `src/plugins/console/public/application/containers/editor/monaco/monaco_editor_output.tsx`: ``` const data = [ { response: { value: 'Hello World!' }, }, ]; ``` Then reload the Console page and verify the data is correctly displayed and highlighted. <details> <summary>TEXT output screenshot:</summary> <img width="285" alt="Screenshot 2024-03-22 at 18 06 31" src="https://github.com/elastic/kibana/assets/59341489/f30cdfd6-be67-4d34-b54d-2a19d6dcb09d"> </details> <!--- ### 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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] 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) ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] 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: kibanamachine <[email protected]>
- Loading branch information