kibana/examples
Eyo O. Eyo d458b5382f
Remove legacy kibana react code editor (#171047)
## Summary

This PR removes the legacy kibana react code-editor, alongside replacing
all import declarations of this legacy component to the one offered by
shared-ux, i.e import declaration source of `'@kbn/kibana-react/public'`
is switched to `@kbn/code-editor`.

Also in this PR an helper for writing jest tests has been included
through the package `@kbn/code-editor-mock`, this would facilitate
mocking the editor, especially given that the code editor leverages
couple of APIs that are aren't included by default in jsdom, among them,
`matchMedia`, `ResizeObserver`. The provided mock is sufficient for most
use cases and can be setup in any package within kibana as a
[`node_module`
mock](https://jestjs.io/docs/manual-mocks#mocking-node-modules) without
having to repeatedly manually mock the editor within individual test
files. An example for how this might be done can be found here
ec5ba25368


### 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)
-->
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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

<!--
- [ ] 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&mdash;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&mdash;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 <42973632+kibanamachine@users.noreply.github.com>
2024-01-05 14:35:09 +01:00
..
bfetch_explorer async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
content_management_examples [shared-ux] no-data analytics page package code cleanup (#172416) 2023-12-04 13:07:59 -07:00
controls_example [Tech Debt] Remove deprecated EuiLoadingContent (#156316) 2023-05-03 08:01:37 -06:00
data_view_field_editor_example Assign functional tests and example plugins code ownership to Data Discovery (#162740) 2023-08-04 17:21:13 -03:00
developer_examples Update EUI layout components in dev examples (#163494) 2023-08-10 11:19:06 +02:00
discover_customization_examples Upgrade EUI to v91.0.0 (with backports) (#170716) 2023-12-18 11:15:15 -06:00
embeddable_examples async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
embeddable_explorer Clean up saved object based embeddable examples (#162987) 2023-08-03 03:14:36 -07:00
error_boundary Functional tests for KibanaErrorBoundary (#170569) 2023-11-08 11:23:19 -07:00
eso_model_version_example Implements Encrypted Saved Objects Model Version API (#166302) 2023-12-07 16:01:29 -05:00
expressions_explorer Remove legacy kibana react code editor (#171047) 2024-01-05 14:35:09 +01:00
feature_control_examples async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
field_formats_example async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
files_example async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
guided_onboarding_example async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
hello_world [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
locator_examples Set correct ownership of older app-services code (#168209) 2023-10-09 18:57:26 +02:00
locator_explorer Set correct ownership of older app-services code (#168209) 2023-10-09 18:57:26 +02:00
partial_results_example [Discover] Replace deprecated page components (#162836) 2023-08-02 20:08:17 +02:00
portable_dashboards_example [shared-ux-router] Add Router and Routes components (#159834) 2023-06-23 10:02:06 -05:00
preboot_example async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
resizable_layout_examples [Discover] Add resize support to the Discover field list sidebar (#167066) 2023-09-27 21:52:25 -03:00
response_stream Update dependency @elastic/charts to v61 (main) (#170914) 2023-12-13 14:56:54 -05:00
routing_example async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
screenshot_mode_example async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
search_examples async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
share_examples Set correct ownership of older app-services code (#168209) 2023-10-09 18:57:26 +02:00
state_containers_examples [Kibana] New "Saved Query Management" privilege to allow saving queries across Kibana (#166937) 2023-09-29 11:52:39 +02:00
ui_action_examples [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
ui_actions_explorer Update usage of deprecated EUI components in SharedUx plugins (#163560) 2023-08-14 06:36:38 -07:00
unified_doc_viewer [UnifiedDocViewer] Move Discover doc viewer into plugin/package (#162847) 2023-08-31 11:46:59 -07:00
unified_field_list_examples [Discover] Redesign for the grid, panels and sidebar v1 (#165866) 2023-09-12 08:51:34 +02:00
user_profile_examples async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
v8_profiler_examples async-import plugins in the server side (#170856) 2023-11-15 00:55:56 -07:00
README.asciidoc Adds run without basepath configured to examples readme (#173086) 2023-12-12 11:22:02 -07:00

[[example-plugins]]
== Example plugins

This folder contains example plugins.  To run the plugins in this folder, use the `--run-examples` flag (without a basepath), via

[source,bash]
----
yarn start --run-examples
----