Skip to content

[settings] Extract and fix Section Registry#163502

Merged
clintandrewhall merged 3 commits intoelastic:mainfrom
clintandrewhall:advanced_settings/registry
Aug 14, 2023
Merged

[settings] Extract and fix Section Registry#163502
clintandrewhall merged 3 commits intoelastic:mainfrom
clintandrewhall:advanced_settings/registry

Conversation

@clintandrewhall
Copy link
Copy Markdown
Contributor

@clintandrewhall clintandrewhall commented Aug 9, 2023

Summary

While working to extract various portions of the advancedSettings plugin into packages, I found the ComponentRegistry in the plugin to have a number of issues that contributed to a fairly bad UX:

  • the API allows for adding/overriding the title, subtitle and footer of the Advanced Settings page, but only the footer is rendered.
  • the API is available to all plugins, but only renders a single entry... so depending on the plugin load order, the render is not guaranteed.
  • filtering the footer in or out of the display is delegated to the component itself, so:
    • it only takes effect on render.
    • the count is only updated if you click on the page that contains it, but that logic is currently broken.
    • the error message is inaccurate.

Aug-09-2023 11-19-06

This PR fixes those issues and more:

  • extracts the registry into its own package.
  • changes the API to allow for multiple sections from multiple plugins.
  • changes the API to filter these sections from the plugin, rather than from each individual component.
  • fixes state management to show sections, keep counts accurate, etc.

Aug-09-2023 11-02-11

@clintandrewhall clintandrewhall added review loe:medium Medium Level of Effort Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// release_note:skip Skip the PR/issue when compiling release notes impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// v8.11.0 labels Aug 9, 2023
@clintandrewhall clintandrewhall requested a review from a team August 9, 2023 15:15
@clintandrewhall clintandrewhall requested review from a team as code owners August 9, 2023 15:15
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@clintandrewhall clintandrewhall force-pushed the advanced_settings/registry branch from 7a3278f to 8783dab Compare August 9, 2023 15:51
Comment thread packages/kbn-management/settings/section_registry/section_registry.ts Outdated
Comment thread packages/kbn-management/settings/section_registry/section_registry.ts Outdated
Comment thread packages/kbn-management/settings/section_registry/section_registry.ts Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I should probably delete this route, unless there are objections...?

Comment thread src/plugins/advanced_settings/public/management_app/settings.tsx Outdated
Copy link
Copy Markdown
Contributor

@vadimkibana vadimkibana 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, also ran it locally LGTM.

One thing I'm not sure was fixed, is deterministic rendering order:

[..] so depending on the plugin load order, the render is not guaranteed.

but maybe I'm missing something.

Comment thread packages/kbn-management/settings/section_registry/README.mdx Outdated
Comment thread packages/kbn-management/settings/section_registry/README.mdx Outdated
Comment thread packages/kbn-management/settings/section_registry/README.mdx Outdated
Copy link
Copy Markdown
Contributor

@thomheymann thomheymann left a comment

Choose a reason for hiding this comment

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

I'm a bit confused by the title of the callout. I would have expected that to display the correct space but it always seems to think it's in the "default" space:

Screenshot 2023-08-10 at 15 12 39

Copy link
Copy Markdown
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

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

Code changes LGTM and tested the advanced settings app locally.
Thanks for working on this @clintandrewhall!

@clintandrewhall
Copy link
Copy Markdown
Contributor Author

clintandrewhall commented Aug 10, 2023

One thing I'm not sure was fixed, is deterministic rendering order

@vadimkibana You're right, this fix doesn't address that. I'm not sure how I would do it without adding a lot of complexity. Perhaps I'll leave it for a future fix, since we only have a single item being added at the moment.

Copy link
Copy Markdown
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning this up, I tested locally and it worked as expected for the telemetry section. Great job @clintandrewhall

clintandrewhall and others added 2 commits August 14, 2023 12:34
[CI] Auto-commit changed files from 'node scripts/generate codeowners'

Remove last bits from Spaces plugin.

Update CODEOWNERS

[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix'

Fix i18n keys

Address NTS

Fix test, translations

Fix i18n variable to pass compatibility check.
Co-authored-by: Vadim Kibana <82822460+vadimkibana@users.noreply.github.com>
@clintandrewhall clintandrewhall force-pushed the advanced_settings/registry branch from 520aa91 to e34e445 Compare August 14, 2023 16:34
@clintandrewhall clintandrewhall enabled auto-merge (squash) August 14, 2023 16:46
@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
advancedSettings 56 62 +6
spaces 263 256 -7
telemetryManagementSection 10 12 +2
total +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/management-settings-section-registry - 11 +11
advancedSettings 32 15 -17
total -6

Async chunks

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

id before after diff
advancedSettings 51.4KB 53.1KB +1.6KB
telemetryManagementSection 10.5KB 9.8KB -744.0B
total +932.0B

Page load bundle

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

id before after diff
advancedSettings 10.3KB 9.5KB -812.0B
spaces 26.0KB 24.3KB -1.7KB
telemetryManagementSection 3.9KB 4.3KB +389.0B
total -2.1KB
Unknown metric groups

API count

id before after diff
@kbn/management-settings-section-registry - 20 +20
advancedSettings 36 17 -19
telemetryManagementSection 5 6 +1
total +2

References to deprecated APIs

id before after diff
advancedSettings 11 8 -3

History

  • 💚 Build #148985 succeeded e96e381b7a3fec4ca828c044bbd0010129598e0a
  • 💔 Build #148896 failed 2b00ce6cc50e05387b38346caea7d1a3a12f27ef
  • 💔 Build #148878 failed 4494753ffab5bf73c0826619a10be5c8aa69b14e
  • 💔 Build #148851 failed 38048eb660be7d533bbfa3ccea2729a8f1e0345c
  • 💔 Build #148844 failed 15c6baeb0c5c0cc458439ccf5bcf00e144037bf9
  • 💔 Build #148843 failed 54c24548e8c20d6dab2a84153620d15d2224d547

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

@clintandrewhall clintandrewhall merged commit 1546490 into elastic:main Aug 14, 2023
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.11 The branch "8.11" does not exist

Manual backport

To create the backport manually run:

node scripts/backport --pr 163502

Questions ?

Please refer to the Backport tool documentation

bryce-b pushed a commit that referenced this pull request Aug 22, 2023
## Summary

While working to extract various portions of the `advancedSettings`
plugin into packages, I found the `ComponentRegistry` in the plugin to
have a number of issues that contributed to a fairly bad UX:

- the API allows for adding/overriding the title, subtitle and footer of
the Advanced Settings page, but only the footer is rendered.
- the API is available to all plugins, but only renders a single
entry... so depending on the plugin load order, the render is not
guaranteed.
- filtering the footer in or out of the display is delegated to the
component itself, so:
  - it only takes effect on render.
- the count is only updated if you click on the page that contains it,
but that logic is currently broken.
  - the error message is inaccurate.

![Aug-09-2023
11-19-06](https://github.com/elastic/kibana/assets/297604/494aba14-f2c0-4ce7-b3f0-1910824aeb0e)

This PR fixes those issues and more:

- extracts the registry into its own package.
- changes the API to allow for multiple sections from multiple plugins.
- changes the API to filter these sections from the plugin, rather than
from each individual component.
- fixes state management to show sections, keep counts accurate, etc.

![Aug-09-2023
11-02-11](https://github.com/elastic/kibana/assets/297604/d8e8033c-f9ed-4615-b954-b5c23fda4d7a)

---------

Co-authored-by: Vadim Kibana <82822460+vadimkibana@users.noreply.github.com>
ElenaStoeva added a commit that referenced this pull request Sep 11, 2023
Addresses #160411

## Summary

This PR adds functionality for filtering out advanced settings that are
not relevant for serverless.

For context, we need to build an Advanced settings page in serverless
which only contains a set of the existing settings. We will reuse the
section registry (#163502) from
the original Advanced settings plugin as well as its UI components which
will also be extracted into a separate package. The app will be
registered from inside the `serverless` plugin.

In order to only display the settings that are relevant for serverless,
we need to make some changes to the uiSettings service. The
implementation in this PR leverages the existing `readonly` uiSettings
param and adds the `setAllowlist()` method which is called by the
serverless plugin to set an allowlist of setting keys.

**Testing in serverless:**
1. Set `advanced_settings.enabled: true` to enable the Advanced settings
app in serverless:
https://github.com/elastic/kibana/blob/5b216c6ea94e739fea1f161f0bbce5a57ae44c02/config/serverless.yml#L53
2. Start Es with `yarn es serverless --ssl` and Kibana with `yarn
serverless-{mode} --ssl` in any serverless mode.
3. Navigate to `app/management/kibana/settings`
4. Verify that the app only displays the settings from
`packages/serverless/settings/common/index.ts` (these are the settings,
relevant for all projects in serverless) as well as the settings from
the corresponding project package
`packages/serverless/settings/{mode}_project/index.ts`.
5. Verify that the app is functioning correctly.

**Testing in self-managed:**
1. Start Es with `yarn es snapshot` and Kibana with `yarn start`.
2. Go to Stack Management > Advanced settings
3. Verify that all settings are displayed as usual.
4. Verify that the app is functioning correctly.

If your team is a code owner of any of the serverless project plugins,
please review the corresponding package
`packages/serverless/settings/{search/observanility/security}_project/index.ts`
where you've been added as an owner and test in the serverless solution
accordingly.


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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 22, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 163502 locally

4 similar comments
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 163502 locally

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 163502 locally

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 163502 locally

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 163502 locally

@jbudz jbudz added the backport:skip This PR does not require backporting label Sep 30, 2024
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:skip Skip the PR/issue when compiling release notes review Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// v8.10.0 v8.11.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants