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

[KibanaReact] Use settings service in useUiSetting hook #154710

Merged
merged 54 commits into from
May 12, 2023

Conversation

majagrubic
Copy link
Contributor

@majagrubic majagrubic commented Apr 11, 2023

Summary

Fixes: #149347

This PR replaces deprecated uiSettings client with settings.client in useUiSetting hook. As a result, all consumers of the hook need to provide settings service to Kibana context. The majority of this PR is providing the settings as a dependency to affected plugins. It would be great if sometime in the future we could get rid of uiSettings entirely.

CodeEditor is one of the components relying on this hook, which caused a lot of the changes in this PR.

If you have been tagged for review it means your code is using useUiSetting hook directly, or is consuming CodeEditor component. I have been focused on updating plugins that had failing functional tests, but would appreciate a manual pass on this as well.

xoxo

Checklist

Delete any items that are not applicable to this PR.

~ [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support~
- [ ] Documentation was added for features that require explanation or tutorials

  • Unit or functional tests 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)
    - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)
    - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
    - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this in your browser)
    - [ ] This was checked for cross-browser compatibility

For maintainers

@kibanamachine
Copy link
Contributor

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@stratoula
Copy link
Contributor

buildkite test this

@majagrubic
Copy link
Contributor Author

@elasticmachine merge upstream

@stratoula
Copy link
Contributor

buildkite test this

@majagrubic
Copy link
Contributor Author

@elasticmachine merge upstream

@stratoula
Copy link
Contributor

buildkite test this

1 similar comment
@stratoula
Copy link
Contributor

buildkite test this

@rudolf
Copy link
Contributor

rudolf commented Apr 17, 2023

buildkite test this

@stratoula
Copy link
Contributor

buildkite test this

@majagrubic
Copy link
Contributor Author

I have the synthetics tests in the exploratory_view constantly failing, but I can't figure out. They don't seem related to my changes and for me, they are failing locally in main.
There are no ui-settings related errors in the console, and both exploratory_view and synthetics plugins are already taking entire coreStart as a dependency, so switching to settings shouldn't bother them. Can someone from the team take a look? (I can't tag teams anymore 😅 )

@majagrubic majagrubic requested a review from a team as a code owner May 11, 2023 10:07
@patrykkopycinski
Copy link
Contributor

buildkite test this

@stratoula
Copy link
Contributor

buildkite test this

@patrykkopycinski
Copy link
Contributor

buildkite test this

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
dataViewManagement 118.6KB 118.6KB +22.0B
fileUpload 852.8KB 852.8KB +23.0B
indexManagement 525.9KB 525.9KB +22.0B
ingestPipelines 453.4KB 453.4KB +20.0B
lens 1.2MB 1.2MB +54.0B
painlessLab 16.1KB 16.2KB +22.0B
savedObjectsManagement 87.6KB 87.6KB +42.0B
snapshotRestore 266.7KB 266.8KB +22.0B
transform 386.6KB 386.6KB +22.0B
watcher 162.7KB 162.7KB +20.0B
total +269.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dataViewFieldEditor 23.3KB 23.3KB +22.0B
discover 27.9KB 27.9KB +20.0B
fileUpload 7.2KB 7.2KB +56.0B
inspector 21.7KB 21.7KB +20.0B
kibanaReact 52.0KB 51.9KB -132.0B
painlessLab 10.3KB 10.3KB +22.0B
runtimeFields 11.0KB 11.0KB +22.0B
urlDrilldown 15.4KB 15.4KB -8.0B
watcher 13.4KB 13.5KB +22.0B
total +44.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 400 404 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 480 484 +4
total +6

History

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

@patrykkopycinski
Copy link
Contributor

@elasticmachine run elasticsearch-ci/docs

@patrykkopycinski
Copy link
Contributor

@majagrubic 🎉

@majagrubic
Copy link
Contributor Author

Thanx @patrykkopycinski 🙌
If you could just ping someone from observabillity-ui for review and then we can merge this beastie 💪

Copy link
Member

@dgieselaar dgieselaar left a comment

Choose a reason for hiding this comment

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

Hope you're well @majagrubic !

@majagrubic
Copy link
Contributor Author

Thank you @dgieselaar 🙇‍♀️
@stratoula do you want to do the honours of merging this? :)

@stratoula
Copy link
Contributor

Thanx @majagrubic, kibana team loves you ❤️

@stratoula stratoula merged commit 069550d into elastic:main May 12, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 12, 2023
jasonrhodes pushed a commit that referenced this pull request May 17, 2023
## Summary

Fixes: #149347

This PR replaces deprecated `uiSettings` client with `settings.client`
in `useUiSetting` hook. As a result, all consumers of the hook need to
provide `settings` service to Kibana context. The majority of this PR is
providing the `settings` as a dependency to affected plugins. It would
be great if sometime in the future we could get rid of `uiSettings`
entirely.

`CodeEditor` is one of the components relying on this hook, which caused
a lot of the changes in this PR.

If you have been tagged for review it means your code is using
`useUiSetting` hook directly, or is consuming `CodeEditor` component. I
have been focused on updating plugins that had failing functional tests,
but would appreciate a manual pass on this as well.

xoxo


### 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~
- [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)~


### 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>
Co-authored-by: Maja Grubic <maja.grubic@elastic.co>
Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
dej611 added a commit that referenced this pull request May 23, 2023
## Summary

Fix #158193

#154710 changed a bit the context type to work with the Monaco
CodeEditor and this example was not updated to use it. This PR should
fix it.


### 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)


### 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)
delanni pushed a commit to delanni/kibana that referenced this pull request May 25, 2023
)

## Summary

Fix elastic#158193

elastic#154710 changed a bit the context type to work with the Monaco
CodeEditor and this example was not updated to use it. This PR should
fix it.


### 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)


### 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)
ElenaStoeva added a commit that referenced this pull request May 31, 2023
Fixes #158459

## Summary

This PR updates the `KibanaReactContextServices` type so that it
corresponds to the context type that works with the Monaco CodeEditor
and which was recently changed in
#154710.

**How to test**
Verify that all CodeEditor components in Index Management work as
expected:

-
`application/components/shared/components/wizard_steps/step_aliases.tsx`
-
`application/components/shared/components/wizard_steps/step_settings.tsx`
-
`application/components/component_templates/component_template_wizard/component_template_form/steps/step_logistics.tsx`
-
`application/components/mappings_editor/components/templates_form/templates_form.tsx`
-
`application/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx`
-
`application/components/mappings_editor/components/document_fields/field_parameters/meta_parameter.tsx`
-
`application/components/mappings_editor/components/configuration_form/meta_field_section/meta_field_section.tsx`

- [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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
ElenaStoeva added a commit that referenced this pull request May 31, 2023
Fixes #158585

## Summary

This PR updates the context service type so that it corresponds to the
context type that works with the Monaco CodeEditor and which was
recently changed in #154710.

**How to test**
Verify that all CodeEditor components in Snapshot and Restore work as
expected:

- `application/components/restore_snapshot_form/steps/step_settings.tsx`
-
`application/components/repository_form/type_settings/hdfs_settings.tsx`

<br>

- [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 (Added e2e
tests that would catch this behaviour in case of any future changes to
CodeEditor)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
mykolaharmash added a commit that referenced this pull request Oct 19, 2023
Closes #167062

## Summary

* Adds "Features" section to Infra settings screen
* Hooks changes to `uiSettings` into existing form in order to use the
current "Discard" and "Apply" buttons logic
* Replaces usage of `uiSettings` with `settings.client` as `uiSettings`
seems to be [deprecated](#154710.
Observables exposed by `uiSettings` do not seem to work anymore.
* Deletes the Hosts landing screen
* Revives the logic for showing/hiding Hosts nav item depending on the
settings toggle


https://github.com/elastic/kibana/assets/793851/767e69cc-98b1-4fe9-93d9-f39c08ac5c83


## How to test

* Checkout locally and run in stateful mode
* Go to Infra Setttings screen and make sure Features section is present
* Make sure that the "Infrastructure Hosts view" toggle shows/hides the
Hosts nav item
* Make sure that "Infrastructure Hosts view" in "Anvanced Settings" is
synced with the the one in Infra settings

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
benakansara pushed a commit to benakansara/kibana that referenced this pull request Oct 22, 2023
Closes elastic#167062

## Summary

* Adds "Features" section to Infra settings screen
* Hooks changes to `uiSettings` into existing form in order to use the
current "Discard" and "Apply" buttons logic
* Replaces usage of `uiSettings` with `settings.client` as `uiSettings`
seems to be [deprecated](elastic#154710.
Observables exposed by `uiSettings` do not seem to work anymore.
* Deletes the Hosts landing screen
* Revives the logic for showing/hiding Hosts nav item depending on the
settings toggle


https://github.com/elastic/kibana/assets/793851/767e69cc-98b1-4fe9-93d9-f39c08ac5c83


## How to test

* Checkout locally and run in stateful mode
* Go to Infra Setttings screen and make sure Features section is present
* Make sure that the "Infrastructure Hosts view" toggle shows/hides the
Hosts nav item
* Make sure that "Infrastructure Hosts view" in "Anvanced Settings" is
synced with the the one in Infra settings

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
benakansara pushed a commit to benakansara/kibana that referenced this pull request Oct 22, 2023
Closes elastic#167062

## Summary

* Adds "Features" section to Infra settings screen
* Hooks changes to `uiSettings` into existing form in order to use the
current "Discard" and "Apply" buttons logic
* Replaces usage of `uiSettings` with `settings.client` as `uiSettings`
seems to be [deprecated](elastic#154710.
Observables exposed by `uiSettings` do not seem to work anymore.
* Deletes the Hosts landing screen
* Revives the logic for showing/hiding Hosts nav item depending on the
settings toggle


https://github.com/elastic/kibana/assets/793851/767e69cc-98b1-4fe9-93d9-f39c08ac5c83


## How to test

* Checkout locally and run in stateful mode
* Go to Infra Setttings screen and make sure Features section is present
* Make sure that the "Infrastructure Hosts view" toggle shows/hides the
Hosts nav item
* Make sure that "Infrastructure Hosts view" in "Anvanced Settings" is
synced with the the one in Infra settings

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
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 💝community Feature:Drilldowns Embeddable panel Drilldowns release_note:skip Skip the PR/issue when compiling release notes Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Kibana React] Replace uiSettings with settings service in the useUiSetting hook