> Pre-req for https://github.com/elastic/kibana/issues/56406
## Summary
We've had a long-standing problem in Kibana around our use of React
context, particularly with EUI and i18n. There hasn't existed an
idempotent context structure, and that has lead to a lot of unexpected
results, (e.g. missing translations, inconsistent dark mode, excess
context providers, etc).
The biggest change coming from this PR is knowing exactly which provider
to use in a particular use case. This means, for example,
`ReactDOM.render` calls won't be missing `i18n` or `theme` due to a
missing context. It also allows consumers to use `darkMode` without
having to read the `uiSetting` themselves, instead allowing the context
to do it for them.
We also haven't been honoring the intended [`EuiProvider`
API](https://eui.elastic.co/#/utilities/provider#theming-and-global-styles)...
in some cases we've been creating and re-creating the Emotion caches,
often by copy/paste of the cache code. We've also been nesting
`EuiThemeProvider` contexts unnecessarily-- thinking we need to render a
theme provider in an isolated component-- which renders an additional
`span` element into the DOM.
This PR attempts to address this inconsistency by creating a set of
context providers divided by use case:

### `KibanaRootContextProvider`
A root context provider for Kibana. This is the top level context
provider that wraps the entire application. It is responsible for
initializing all of the other contexts and providing them to the
application. It's provided as a package for specific use cases, (e.g.
the `RenderingService`, cases where we replace the entire page content,
Storybook, testing, etc), but not intended for plugins.
### `KibanaRenderContextProvider`
A render context provider for Kibana. This context is designed to be
used with ad-hoc renders of React components, (usually with
`ReactDOM.render`).
### `KibanaThemeContextProvider`
A theme context provider for Kibana. A corollary to EUI's
`EuiThemeProvider`, it uses Kibana services to ensure the EUI Theme is
customized correctly.
### (deprecated) `KibanaStyledComponentsThemeProvider`
A styled components theme provider for Kibana. This package is supplied
for compatibility with legacy code, but should not be used in new code.
## Deprecation strategy
This PR does *not* change any use of context by consumers. It maps the
existing contexts in `kibanaReact` to the new contexts, (along with the
loose API). This means that we won't have completely fixed all of our
dark mode issues yet. But this is necessary to keep this PR focused on
the change, rather than drawing in a lot of teams to review individual
uses.
We should, however, see an immediate performance improvement in the UI
from the reduction in `EuiProvider` calls.
## Open questions
- [ ] Does it make sense to expose a `useTheme` hook from
`@kbn/react-kibana-context-theme` to replace `useEuiTheme`?
## Next steps
- [ ] Update deprecated uses to new contexts.
- [ ] Audit and update calls to `ReactDOM.render`.
- [ ] Add ESLint rule to warn for use of EUI contexts.
- [ ] Delete code from `kibanaReact`.
This PR makes the following changes:
- Update look & feel of contextual insights (previously called prompts)
according to the new design that is being developed. Some things might
still change, but hopefully not too much.
- Move all the Observability AI Assistant (previously called CoPilot)
code into a separate plugin for better isolation, more specific code
ownership and to solve some circular dependency issues
- Use connectors instead of a kibana.yml setting
Note: for OpenAI, the model is currently hardcoded to `gpt-4` until
https://github.com/elastic/kibana/issues/162204 has been addressed.
557676b6-065a-4b6f-86b2-1f0c2fd5e07e
---------
Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
`toKqlExpression` support was added in
https://github.com/elastic/kibana/pull/161601. This PR Fixes a bug with
`toKqlExpression` that did not properly re-escape quotes inside of
quoted values.
Without this fix, calling `toKqlExpression` on the AST generated from a
KQL expression like `my_field: "quoted \"value\""` would result in a
string like `my_field: "quoted "value""` instead of the original
expression.
### Checklist
- [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
## Summary
This PR adds a rule preview panel to the expandable flyout:
- Preview panel skeleton is added, now we can open a preview on top of
right section of flyout
- Go to rule details button is replaced by a button that will open a
rule preview panel
- The rule preview contains placeholder sections (About, Definition,
Schedule) and footer with a link to rule details page

**How to test**
- add `xpack.securitySolution.enableExperimental:
['securityFlyoutEnabled']` to the `kibana.dev.json` file
- go to the Alerts page, and click on the expand detail button on any
row of the table
- click on `Overview`, `About`, then `Rule summary`
### Checklist
- [x] 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] [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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR addresses the occasional toast-floods/toast-storms with a simple
catch mechanism: deduplicate/group toasts by their broad alikeness,
their text and title.
This implementation plugs in to the `global_toast_list.tsx` in Kibana's
GlobalToastList component, capturing updates on the toast update stream,
and collapses toasts before passing them further to the downstream EUI
Toast list react components.
The core idea is to not display notifications directly, but to keep the
toast notifications apart from their visual representation. This way, we
can represent more notifications with one toast on our end, if we group
rightly. The only issue then, is to clean up everything nicely when it's
time. For this we're also exporting a mapping that shows which toast ID
represents which grouped toasts.
I also changed the type `ToastInputFields` to accept rendered react
components as title/text - this will prevent attempts to unmount react
components from elements that are not displayed, thus causing React
warnings.
The close-all button is an EUI feature, which we've started discussing
[here](https://github.com/elastic/eui/issues/6945), probably not part of
this PR.
## What toasts get merged?
The exact merging strategy was not settled, and it's kind of a valve,
where we trade off potential detail lost in toasts for the prevented
noise in the toast floods. The current strategy is as folows:
```
* These toasts will be merged:
* - where title and text are strings, and the same (1)
* - where titles are the same, and texts are missing (2)
* - where titles are the same, and the text's mount function is the same string (3)
* - where titles are missing, but the texts are the same string (4)
```
The base merge case is `(1) & (2)`, after some discussion with @Dosant
we decided to include (3) as a compromise, where we're still merging
somewhat similar toasts, and extend the merging to `ToastsApi::addError`
where all error toasts have a MountPoint as their text. We understand
this might hide some details (e.g.: same titles, but very slightly
different MountPoints as their text) but realistically this shouldn't
really happen.
The ultimate future improvement will be (as suggested in the comments by
@jloleysens) a sort of identifier to the toast, based on which we can
group without fear of losing information. But this will require more
work on all the call-sites.
Relates to: #161482

### Checklist
Delete any items that are not applicable to this PR.
- [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
### For maintainers
- [x] 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Bumps node.js to 18.17.0 (replacement for PR #144012 which was later
reverted)
As a result, these categorical additions were needed:
- `node` evocations will need the `--openssl-legacy-provider` flag,
wherever it would use certain crypto functionalities
- tests required updating of the expected HTTPS Agent call arguments,
`noDelay` seems to be a default
- `window.[NAME]` fields cannot be written directly
- some stricter typechecks
This is using our in-house built node.js 18 versions through the URLs
the proxy-cache. (built with
https://github.com/elastic/kibana-custom-nodejs-builds/pull/4)
These urls are served from a bucket, where the RHEL7/Centos7 compatible
node distributables are. (see:
https://github.com/elastic/kibana-ci-proxy-cache/pull/7)
Further todos:
- [x] check docs wording and consistency
- [ ] update the dependency report
- [x] explain custom builds in documentation
- [x] node_sass prebuilts
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: Thomas Watson <w@tson.dk>
## Summary
Moves constants from the Discover plugin into the `@kbn/discover-utils`
package.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes#159260
## Summary
Adds support for running ES through Docker and Serverless in `@kbn/es`
### Checklist
Delete any items that are not applicable to this PR.
- [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
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
**Related to: https://github.com/elastic/security-team/issues/7098**
### Summary
- Move Rules Management HTTP API schemas to `/common/api`
- Explicitly define response types for API endpoints
- Remove the `_generate_assets` endpoint as unused
- Minor type fixes
## Summary
Adds content management api mSearch functionality to `lens`,
`visualization`, and `event_annotation_group` types via abstracted
function and types.
Part of https://github.com/elastic/kibana/issues/161545
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
## Summary
This PR versions the `cases` and `comment` domain objects and their
corresponding APIs. It was not possible to do them separately as I got
errors due to circular dependencies.
## Notable Changes
- The `Comment` type was renamed to `Attachment`
- The `Comments` type was renamed to `Attachments`
- The `*CommentRequestRt` type was renamed to `*AttachmentPayload`
- The `CommentType` type was renamed to `AttachmentType`
- The `AttributesType*` type was renamed to `*AttachmentAttributes`
- The `*ResponseTypeUserRt` type was renamed to `*AttachmentRt`
- The word `comment` got replaced with the word `attachment` in all
types
- The `RelatedCaseInfo` type was renamed to `RelatedCase`
- The `CasesByAlertId` type was renamed to
`GetRelatedCasesByAlertResponse`
Depends on: https://github.com/elastic/kibana/pull/161783,
https://github.com/elastic/kibana/pull/162059
### Checklist
Delete any items that do not apply to this PR.
- [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
### For maintainers
- [x] 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
When turning on `server.restrictInternalApis` a number of issues
surfaced due to defaulting to internal resulting in `400`s for:
* HTTP resources
* Static assets via `registerStaticDir`
* Use of `res.render(Html|Js|Css)` outside of HTTP resources
This PR:
* defaults our HTTP resources service to register routes by default
`public`, same for static dirs.
* Did an audit of all renderX usages, if outside of HTTP resources I
added an explicit `access: public`
* ...what else?
### Set `access: 'public'` for known set of "system" routes
Method | Path | Comment
-- | -- | --
GET | /api/status
GET | /api/stats
GET | /translations/{locale}.json
GET | /api/fleet/agent_policies
GET | /api/task_manager/_background_task_utilization
GET | /internal/task_manager/_background_task_utilization
GET | /internal/detection_engine/health/_cluster
POST | /internal/detection_engine/health/_cluster
GET | /internal/detection_engine/health/_space
POST | /internal/detection_engine/health/_space
POST | /internal/detection_engine/health/_rule
POST | /internal/detection_engine/health/_setup
GET | /bootstrap.js
GET | /bootstrap-anonymous.js
GET | \*\*/bundles/\* | Core's routes for serving JS & CSS bundles
## How to test
Run this PR with `kibana.dev.yml` containing
`server.restrictInternalApis: true` and navigate around Kibana UI
checking that there are no `400`s in the network resources tab due to
access restrictions.
## Notes
* Either left a comment about why `access` was set public or a simple
unit test to check that we are setting access for a given route
## To do
- [x] Manually test Kibana
- [x] Manually test with `interactiveSetup` plugin
- [ ] Add integration and e2e test (will do in a follow up PR)
Related: https://github.com/elastic/kibana/pull/162149
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Closes https://github.com/elastic/kibana/issues/160993
## Summary
This PR introduces `dataView.toMinimalSpec()` which is used now in 3
cases:
- when constructing an alert link
- when constructing a share URL for ad-hoc data views
- when constructing search session info for ad-hoc data views
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Follow up to https://github.com/elastic/kibana/pull/161592
Some remaining EUI components that are still in Sass unfortunately need
to respect EUI's global CSS utilities (e.g. `.eui-yScroll`,
`.eui-textTruncate` - [full list
here](https://elastic.github.io/eui/#/utilities/css-utility-classes)).
Creating a separate utilities cache and insertion point should solve the
CSS order/specificity issues.
### Checklist
- [x] Confirm Emotion output order is expected in head (EUI globals, All
Emotion styles, Sass styles, then utilities last)
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Ensure that a plugin containing a nested `node_modules` folder correctly
identifies imports from that folder as regular node modules instead of relative imports.
Kibana should currently only have a single root `node_modules` folder, so this should
not be a real issue. However, if for some reason a stray `node_modules` folder is
created, this commit will make sure it's not introducing hard to debug ESLint errors.
## Summary
Fixes https://github.com/elastic/kibana/issues/160735
When implementing drag and drop for the first time, to move smoothly
between the main drop target and extra drop targets (duplicate or swap),
I created an extra overlay path that keeps the elements visible when
moving around (so when user drags out of the main drop target in the
direction of extra targets, we don't loose their visibility)
Turns out it started causing the 🔝 bug in the recent versions.
This solution is not needed anymore though. Right now we keep elements
visible for a few seconds when user drags out no matter where the mouse
cursor is, so that's enough to go from main target to extra targets.
Here's the overlay path I removed (I added yellow transparent background
so it's more visible)
<img width="485" alt="Screenshot 2023-07-20 at 13 34 41"
src="69acb1ff-1ada-4987-b47e-da282f8b992d">
## Summary
The idea here is to simplify shared values management in the expandable
flyout. This PR is a start for a series of changes aimed at this goal.
Here, we are moving the flyout init to a dedicated Flyout and Provider
components, composing Expandable Flyout and respective providers into
something specific to Security Solution. Also, changes to how the flyout
is composed will no longer trigger codeowner review for 3 teams, just
one.
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
`toKqlExpression` support was added in
https://github.com/elastic/kibana/pull/161601. This PR Fixes a bug with
`toKqlExpression` that did not properly escape special characters and
keywords.
Without this fix, you could get into a problematic situation like the
following:
```ts
const node = fromKueryExpression('field: bar\\*');
const result = toKqlExpression(node); // 'field: bar*'
```
This was incorrect, since if we were then to call `fromKueryExpression`
on this value again, we would get a wildcard (`bar*`), not a string.
### Checklist
- [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
This PR adds the `Blob` polyfill into the jest jsdom env which is
currently not supported as mentioned in
https://github.com/jsdom/jsdom/issues/2555
---------
Co-authored-by: Thomas Watson <w@tson.dk>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/kibana/issues/159675
## Summary
We have in lot of places, Tutorial link hardcoded to
`'/app/home#/tutorial/apm'`
This must change based on deployment type to be Serverless or Non
Serverless.
For Serverless the URL is - `'/app/apm/onboarding'`
For Non Serverless, the URL - `'/app/home#/tutorial/apm'`
Hence to avoid adding logic to read Serverless/Non Serverless mode in
all plugins and packages, i have implemented a redirect URL
`/app/apm/tutorial` inside the APM plugin which will read the Serverless
config and accordingly do the redirect.
## Summary
Add a `buildFavor` property to `Env` (accessible from the plugin's
initializer context), Mimicking the idea of ES's `version.buildFlavor`
field.
Note: this is not supposed to be a replacement for feature flags, but
can be useful when wanting to toggle features based on actual
capabilities of our serverless product. Also, we already expose this
value through the configuration via the `serverless` context value, so
it now adds another way to access the information.
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR improves the message for the case where a visualization where a
counter field was used, but it wasn't yet in time series mode, then it
gets upgraded to timeseries and ES will restrict its agg support.
Added also few new documentation links to TSDS documentation pages.
Within a dashboard the error would be a reshape of the ES one:
<img width="774" alt="Screenshot 2023-07-17 at 17 58 17"
src="766c60e3-166c-4038-bf04-bbb1d5c08cb2">
Unfortunately it is only possible to show simple text (no link) within a
dashboard panel in view mode as it relies on native `Embeddable` types
which only allow native JS errors.
If user has edit permissions then it would be possible to click the
`Edit in Lens` to open the editor and see more information about the
error, i.e. the doc link:
<img width="513" alt="Screenshot 2023-07-17 at 17 50 39"
src="54c19c9f-7385-405e-8c4c-9061185ac52b">
To test just use the latest ES snapshot with this PR:
https://github.com/elastic/elasticsearch/pull/93545
~~Waiting for a link to some documentation from the ES team to be
included here as well.~~
Added link to https://github.com/elastic/elasticsearch/pull/97618
improved documentation.
### 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—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)
## Summary
Part of https://github.com/elastic/kibana/issues/161882
- Updates the remaining "dynamic" es archives (aka those using the
`$KIBANA_PACKAGE_VERSION` variable), deleting mappings.json.
- It also removes the piece of logic in `esArchiver` that replaces that
variable.
## Summary
Creates a shared package for Discover utils/services/hooks,
`@kbn/discover-utils`. Moves a couple of utils there
(`buildDataTableRecord`/`getDocId`). This will be the future home for
many services/utils that are shared between the Discover app and its
packaged components (like unified field list, unified histogram, etc.)
### Checklist
- [ ]
[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
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
close https://github.com/elastic/kibana/issues/160011
This PR adds helpers for testing serverless specific navigation. There
are helpers for sidenav, breadcrumbs, global search, recent items, logo,
checking that no page reload happened during nav.
This PR also adds some serverless specific navigation tests. The should
serve as a navigation smoke check and testing helpers example. Solution
teams can improve them as they see fit.
## Summary
Resolves https://github.com/elastic/kibana/issues/77971.
Adds a `toKqlExpression` method to the `@kbn/es-query` that allows
generating a KQL expression from an AST node.
Example:
```ts
const node = fromKueryExpression('extension: "jpg"');
const kql = toKqlExpression(node); // 'extension: "jpg"'
```
Note that the generated KQL expression may not exactly match the
original text (whitespace is not preserved, parentheses may be added,
etc.).
### Checklist
Delete any items that are not applicable to this PR.
- [ ]
[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
Resolves https://github.com/elastic/actionable-observability/issues/70
For the APM Error Count rule -
- Added `error.grouping_name` in the index mapping of AAD index
- Added `error.grouping_name` in the alert document in AAD index
- Added `errorGroupingName` in the list of action variables
I discussed with @simianhacker regarding the alert instance ID having
space/quotes with introduction of `errorGroupingName`. It appears that
using `errorGroupingName` as is should not be an issue and so we don't
need to modify or hash it.
## Group by dropdown
<img width="604" alt="Screenshot 2023-07-13 at 17 27 44"
src="d9ab1a8d-3272-4c36-8c71-a7163a024249">
## Reason message
<img width="755" alt="Screenshot 2023-07-13 at 17 38 31"
src="dbe4a86b-812b-4068-abea-4b96fa5fb38b">
## Index mapping
<img width="1514" alt="Screenshot 2023-07-13 at 17 40 32"
src="f1e48045-a7a8-4044-bc33-f4d34dc1c8cc">
## Alert document
<img width="681" alt="Screenshot 2023-07-13 at 17 39 46"
src="985cf003-ac32-4c7e-9f2a-5bda033c194b">
## Action variable
<img width="612" alt="Screenshot 2023-07-13 at 17 43 13"
src="2edfb388-f99d-4cae-98ef-3e9b275bb848">
## Alert notification
<img width="650" alt="Screenshot 2023-07-13 at 17 41 37"
src="c057a3a1-dc6e-4fee-97ad-5790ab3c531b">
Partially addresses https://github.com/elastic/kibana/issues/159590
## Summary
This PR adds an an internal uiSettings API that is a duplicate of the
public API and is intended for use by the browser-side uiSettings
client.
The PR also adds a config settings that is configured in serverless
context only and exposes the public uiSettings routes based on the value
of this setting (it defaults to false since we don't want to expose the
public routes in serverless).
**How to test:**
I. Verify that in serverless the internal routes are exposed but the
public ones aren't:
1. Start Es with `yarn es snapshot` and Kibana with `yarn
serverless-{mode}` where `{mode}` can be `es`, `oblt`, or `security`
(the public routes should be disabled for all projects).
2. Verify that the public endpoints are not accessible. For example,
`curl --user elastic:changeme
'http://localhost:5601/zhb/api/kibana/settings' -X 'GET'` should return
`{"statusCode":404,"error":"Not Found","message":"Not Found"}`.
3. Verify that the internal endpoints are accessible. For example, `curl
--user elastic:changeme
'http://localhost:5601/zhb/internal/kibana/settings' -X 'GET'` should
return
`{"settings":{"buildNum":{"userValue":9007199254740991},"isDefaultIndexMigrated":{"userValue":true},"defaultRoute":{"isOverridden":true,"userValue":"/app/elasticsearch"}}}`
II. Verify that the both public and internal routes are exposed in
self-managed:
1. Start Es with `yarn es snapshot` and Kibana with `yarn start`
2. Verify that the public endpoints are accessible. For example, `curl
--user elastic:changeme 'http://localhost:5601/zhb/api/kibana/settings'
-X 'GET'` should return
`{"settings":{"buildNum":{"userValue":9007199254740991},"isDefaultIndexMigrated":{"userValue":true}}}`
3. Verify that the internal endpoints are accessible. For example, `curl
--user elastic:changeme
'http://localhost:5601/zhb/internal/kibana/settings' -X 'GET'` should
return
`{"settings":{"buildNum":{"userValue":9007199254740991},"isDefaultIndexMigrated":{"userValue":true}}}`
III. Verify that the plugins/services that consume the internal
uiSettings endpoints work as expected in both self-managed and
serverless environment.
### 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>
## Summary
Fixing calculated theme tags. An issue found was in the bootstrap
renderer when User Profile's Theme was set to 'Light' and Adv. Setting's
Theme was set to 'Dark'.
In my original PR, I had originally had the UserSettings > darkMode be a
string ('', 'light', 'dark'), but changed it to a boolean | undefined
and the conditional no longer worked.
This should fix a number of sporadic darkmode issues
## Summary
Fix an unwanted behavior of the config merging logic, that was merging
arrays the same way objects are merged.
E.g the output of `getConfigFromFiles(file1, file2)` with
```yaml
### file 1
array: [1, 2, 3]
obj_array:
- id: 1
- id: 2
### file 2
array: [4]
obj_array:
- id: 3
```
was
```yaml
array: [4, 2, 3]
obj_array:
- id: 3
- id: 2
```
instead of
```yaml
array: [4]
obj_array:
- id: 3
```
Which is causing problems when merging the default, serverless,
serverless project and dev file in some scenarios.