Fixing very minor issues in the Kibana dev docs that I found as I was
getting bootstrapped:
- fixing bad markdown syntax
- adding first startup info (url + credentials)
## Summary
- Updated the "Transforms" side navigation link to go to ingest
pipelines stack management page. This link will eventually be updated to
a new page in June, but this page is closer to whats needed for now.
- Add the Indexing API to the side nav as a placeholder, but it links to
the getting started page for now, this will also be a new page in June.
Closes#155245
Adds a version to the `endpoint` name for public APIs. It's required for
public APIs and enforced via type checks. Example:
`GET /api/apm/settings/agent-configuration/environments 2023-05-22`. The
reason why it's part of the endpoint is because it's the simplest change
to make, requires very little runtime changes and doesn't dramatically
change the way we handle type-safety for our server routes.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
The exposed kbnUrlStateStorage property of `DiscoverStateContainer` is removed. It was just used for testing and is replaced with `await new Promise(process.nextTick);`
## Summary
This PR cleans up some outstanding tech debt.
### 1. Remove deprecation warning for `disabled` prop
This property was marked as deprecated the moment it was introduced (See
https://github.com/elastic/kibana/pull/118001/files#r753124740). However
it has been adopted by Fleet and Guided Onboarding plugins so I don't
think there's value in keeping this deprecation warning in place.
As an alternative we could also bump the `@removeBy` version if people
think we should still remove this property.
### ~~2. Remove deprecated property `requiredRoles`~~
~~This property has been deprecated and marked for removal for 8.8. The
property isn't being used anywhere in our codebase and we have reached
feature freeze for 8.8 so looks safe to be removed now.~~
Turns out this property is still used and can't be removed without
breaking existing functionality so reverting that commit.
## Summary
Part of https://github.com/elastic/kibana/issues/150312
(next steps depend on https://github.com/elastic/kibana/pull/153117)
**This PR does two things:**
- introduce the concept of version persistence schema
- adapt the document migrator to support downward migrations for
documents of an higher version.
In the follow-up, we will then update the calls from the SOR to the
document migrator to allow downward conversions when we're using the ZDT
migration algorithm (which requires
https://github.com/elastic/kibana/pull/153117 to be merged)
### Model version persistence schema.
*(This is what has also been named 'eviction schema' or 'known fields
schema'.)*
A new `SavedObjectsModelVersion.schemas.backwardConversion` property was
added to the model version definition.
This 'schema' can either be an arbitrary function, or a `schema.object`
from `@kbn/config-schema`
```ts
type SavedObjectModelVersionBackwardConversionSchema<
InAttrs = unknown,
OutAttrs = unknown
> = ObjectType | SavedObjectModelVersionBackwardConversionFn<InAttrs, OutAttrs>;
```
When specified for a version, the document's attributes will go thought
this schema during down conversions by the document migrator.
### Adapt the document migrator to support downward migrations for
documents of an higher version.
Add an `allowDowngrade` option to `DocumentMigrator.migrate` and
`KibanaMigrator.migrateDocument`. When this option is set to `true`, the
document migration will accept to 'downgrade' the document if necessary,
instead of throwing an error as done when the option is `false` or
unspecified (which was the only behavior prior to this PR's changes)
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Pitch: https://github.com/elastic/apm-dev/issues/1001 (_internal_)
## Summary
Use portable dashboards for runtime metrics as a fallback.
Example dashboard:
<img width="1588" alt="image"
src="ee46582d-60db-4538-925f-e9729e77e70b">
---------
Signed-off-by: Alexander Wert <AlexanderWert@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Closes https://github.com/elastic/kibana/issues/158154
Closes https://github.com/elastic/kibana/issues/158048
Closes https://github.com/elastic/kibana/issues/158052
This PR fixes the UI bugs that were created when we added the user
profile dark mode settings.
There are many cases in our visualizations where we are checking if the
uiSetting is in dark mode and apply custom colors. This is not the case
anymore. Now we need to check this flag from the theme$.
There is a bug on the user profile service. When the user profile is set
to Light and the advanced setting is set to dark mode, the dark mode is
applied. I have reported this to the security team.
### 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
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Fix the way of using setActionMenu. According their doc and source
code we need to call it twice, for moun and unmount.
- Fix redirection issue and using reactDom in rendering of action items
<img width="926" alt="image"
src="1e531299-e055-4af1-8ec7-92511e1a6e81">
## Summary
After changing the UserSettingService to calculate darkmode and return
`boolean | undefined` , the Rendering service `darkMode` logic needed to
be updated to work when a User chooses 'Light' which provides a 'false'
value to the Rendering service.
## Testing
For Space Setting:
1. Set Space Adv. Setting to darkMode: true
2. Set User Profile Setting to 'Light'
3. Observe that Light mode takes precedence
For Config setting:
1. Set User Profile Setting to 'Dark'
2. In `kibana.yml` set `uiSettings.overrides.theme:darkMode: false`
3. Observe that Light mode takes precedence
## Summary
Part of https://github.com/elastic/kibana/issues/158034
This PR moves the TopNavMenu placement to below the breadcrumbs bar for
the serverless project chrome layout.
The app toolbar must appear below the breadcrumbs bar in the layout,
when the app has TopNavMenu items registered with the navigation
service.
To prevent the layout from rendering an empty container, I had to create
a new hook, `useHeaderActionMenuMounter`, that extracts the state from
HeaderActionMenu. The state (`mounter: MountPoint | undefined`) is
hoisted above so that the header can check if it is empty before
rendering the container.
_Future work is still needed to achieve the end goal of the design._
Apps must be able to define custom layouts, which commonly require grid
and spacer components. The TopNavMenu needs augmentation to support the
new API. See the project document from the issue.
## Screenshots
**App showing the toolbar, with the container shown below breadcrumbs**

**App without the toolbar and no empty container**

## Summary
PR introduces a new Files service client to the Fleet server-side code
that will enable integration to work with Files received/sent to Hosts
without having to access `.fleet-*` indexes directly.
### Fleet changes
- Adds `FleetFilesClient` to Fleet's server-side code. Supports both
files that are received from the host as well as files that can be sent
to the host.
- exposes new `createFilesClient()` method from `FleetStartContract`
that enables fleet dependents to get a files client.
### Security Solution changes
- Refactors API routes to use new `FleetFilesClient`
- Deletes all file related services from server code
## Summary
Adds e2e tests for `get-file` and `execute` response actions.
~- [ ] Test response actions fail without signing~
- [x] Ensure other endpoint tests are not using the same endpoint for
tests
### 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
We now ensure that policy names are unique and sequentially numbered,
using the `getMaxPackageName` utility function. This function retrieves
the highest number appended to existing package policy names for a given
package, and increments it by one to generate a new unique name.
I added back the `usePolicyTemplateInitialName` hook @opauloh created.
The `usePolicyTemplateInitialName` custom hook has been enhanced to
automatically set the initial policy name based on the unique name
generated by getMaxPackageName.
498b6069-4221-4300-b6f4-6125adc524e2
## Summary
This PR converts all connector forms to use the form lib.
Fixes: https://github.com/elastic/kibana/issues/133467,
https://github.com/elastic/kibana/issues/143408,
https://github.com/elastic/kibana/issues/146394
## Notable changes
- All connector's hooks were converted to use React Query
- All connector's forms were converted to use the Kibana Form Lib
- The form of fields of the connector and the preview of the fields of
the connector got separated
- All connector logic in the case view page moved on its own component
- Improve loading visualization on the first render
- Jira: Issue type is not selected automatically
- Jira: Added validation for the issue type field
- ServiceNow: Subcategory is visible
## Testing scenarios
- Create a case with no connectors. Press "Add connector". The Save
button should be disabled
- Create a case (or edit an existing one) with a connector. Press the
edit pencil. The Save button should be disabled
- Create a case (or edit an existing one) with a connector. Press the
edit pencil. Change a field or a connector. The Save button should not
be disabled
- Change various connectors and their fields on a case. The fields
should be preserved between changes
- Change various connectors and their fields on a case
- Test the forms of all supported connectors in the create case and the
view case page
- Push all supported connectors in the create case and the view case
page and verify it is working as expected
- Optional fields can be pushed correctly
- Check that the fields are being reset when changing connectors of the
same type (Jira for example)
- Test that connectors work in the create case form when attaching
outside of Cases (ML for example)
- Jira: Try to submit without an issue type selected. You should see an
error
- ServiceNow: Test that the subcategory is being reset when you change
the category.
## Flaky tests
The PR fixes the flaky tests in
`x-pack/plugins/cases/public/components/create/form_context.test.tsx`. I
run the test multiple times on CI to ensure that the test is not flaky
anymore: Specifically:
- Test run 50 times in
f220cc30cf
- Test run 55 times in
6221314b2e
- Test run 50 times in
91551631ff
### Checklist
Delete any items that are not applicable to this PR.
- [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
### 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
Use migrations.batchSize config for the scroll_size in update_by_query /
updateAndPickupMappings. The default scroll_size=1000 can sometimes
cause Elasticsearch to fail with `RecyclerBytesStreamOutput cannot hold
more than 2GB of data`
On CI our Elasticsearch cluster does not have enough memory to reproduce
`RecyclerBytesStreamOutput` error it OOMs before it's able to load 2GB.
However it's possible to test manually:
1. Start Elasticsearch with 8GB heap `ES_JAVA_OPTS=' -Xms8g -Xmx8g' yarn
es snapshot`
2. Ingest > 2GB of saved objects distributed over batchSize documents (<
1000)
```
curl -XPOST "elastic:changeme@localhost:9200/_security/user/superuser"
-H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d'
{
"password" : "changeme",
"roles" : [ "superuser", "grant_kibana_system_indices" ]
}'
curl -XPUT
"superuser:changeme@localhost:9200/.kibana_8.4.0_001/_mappings" -H
"kbn-xsrf: reporting" -H "Content-Type: application/json" -d'
{
"dynamic": false,
"properties": {
}
}'
set -B # enable brace expansion
for i in {1..500}; do
curl -k --data-binary "@/Users/rudolf/dev/kibana/body.json" -X PUT
"http://superuser:changeme@localhost:9200/.kibana_8.4.0_001/_doc/cases-comments:"{$i}"?&pretty=true"
-H "Content-Type: application/json"
done
curl -XPOST "superuser:changeme@localhost:9200/_aliases" -H "kbn-xsrf:
reporting" -H "Content-Type: application/json" -d'
{
"actions": [
{
"add": {
"index": ".kibana_8.4.0_001",
"alias": ".kibana_8.4.0"
}
},
{
"add": {
"index": ".kibana_8.4.0_001",
"alias": ".kibana"
}
}
]
}'
```
body.json
```
{
"cases-comments": {
"comment": "...put lots of data here...",
"type": "user",
"owner": "cases",
"created_at": "2023-05-09T08:07:50.121Z",
"created_by": {
"email": null,
"full_name": null,
"username": "elastic"
},
"pushed_at": null,
"pushed_by": null,
"updated_at": null,
"updated_by": null
},
"type": "cases-comments",
"references": [
{
"type": "cases",
"name": "associated-cases",
"id": "9563b290-ee40-11ed-8fcc-e975e7d47f63"
}
],
"namespaces": [
"default"
],
"migrationVersion": {
"cases-comments": "8.6.0"
},
"coreMigrationVersion": "8.7.2",
"updated_at": "2023-05-09T08:07:50.168Z",
"created_at": "2023-05-09T08:07:50.168Z"
}
```
3. Run Kibana with default and smaller migrations.batchSize
### Checklist
Delete any items that are not applicable to this PR.
- [ ] [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)
## What does this PR do?
* This PR adds a `Badge` beside the "Alerts" tab name to display the
amount of alerts the selected case has.
Fixes: https://github.com/elastic/kibana/issues/156169
## Video/Screenshot Demo
###### STEPS TO REPRODUCE:
6cd253ad-c6ac-4997-b74b-da317e895cb5
###### FIX:
a607e4b0-0f10-447a-babb-cc9beab23fc8
---
This code was written and reviewed by GitStart Community. Growing great
engineers, one PR at a time.
---------
Co-authored-by: KlingerMatheus <klinger.matheus@gitstart.dev>
Co-authored-by: gitstart_bot <gitstart_bot@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
The spread operator is costly and put pressure on GC. It should be
avoided when possible, especially in loops.
This PR adapts a lot of `reduce` calls in the codebase to remove the
usages of the diabolic spread operator, when possible.
Note: the PR is not fully exhaustive. I focused on the server-side, as
we're more directly impacted than on browser-side code regarding
performances.
## Removing `...` usages in `kittens.reduce()`
For `reduce` loops, the spread operator can usually easily be replaced:
#### - setting a value on the accum object and returning it
#### BAD
```ts
return this.toArray().reduce(
(acc, renderer) => ({
...acc,
[renderer.name]: renderer,
}),
{} as Record<string, ExpressionRenderer>
);
```
#### GOOD
```ts
return this.toArray().reduce((acc, renderer) => {
acc[renderer.name] = renderer;
return acc;
}, {} as Record<string, ExpressionRenderer>);
```
#### - assigning values to the accum object and returning it
#### BAD
```ts
const allAggs: Record<string, any> = fieldAggRequests.reduce(
(aggs: Record<string, any>, fieldAggRequest: unknown | null) => {
return fieldAggRequest ? { ...aggs, ...(fieldAggRequest as Record<string, any>) } : aggs;
},
{}
);
```
#### GOOD
```ts
const allAggs = fieldAggRequests.reduce<Record<string, any>>(
(aggs: Record<string, any>, fieldAggRequest: unknown | null) => {
if (fieldAggRequest) {
Object.assign(aggs, fieldAggRequest);
}
return aggs;
},
{}
);
```
#### - pushing items to the accum list and returning it
#### BAD
```ts
const charsFound = charToArray.reduce(
(acc, char) => (value.includes(char) ? [...acc, char] : acc),
[] as string[]
);
```
#### GOOD
```ts
const charsFound = charToArray.reduce((acc, char) => {
if (value.includes(char)) {
acc.push(char);
}
return acc;
}, [] as string[]);
```
## Questions
#### Are you sure all the changes in this are strictly better for
runtime performances?
Yes, yes I am.
#### How much better?
Likely not much.
#### Are you planning on analyzing the perf gain?
Nope.
#### So why did you do it?
I got tired of seeing badly used spread operators in my team's owned
code, and I had some extra time during on-week, so I spent a few hours
adapting the usages in all our runtime/production codebase.
#### Was it fun?
Take your best guess.
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Add flags to give permissions to reroute events from an input package to
other datastreams with the same type but different dataset and
namespace.
```
elasticsearch.dynamic_dataset: true
elasticsearch.dynamic_namespace: true,
```
## Summary
Closes https://github.com/elastic/kibana/issues/154330
This PR:
- Moves the editor from unified-search to a standalone package
- The editor has now a core ui settings dependency but is going to have
an expressions dependency too when merged with the ESQL branch
- Adds a new plugin (text-based-languages) which is used to pass the
dependencies on the package. The user can either use this plugin without
giving any dependencies or use the package with passing the dependecies
on the KibanaContextProvider.
- Adds storybook for the editor (I used the mdx stories as we did on the
random sampling package)
<img width="1668" alt="image"
src="763a3112-1ae5-49bb-81f3-acd02892e402">
### Checklist
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
- Adds new test cases for event filters and trusted apps.
- Adds new test case when multiple entries are created with different
policies.
- Test refactor.
- Adds testId generator to effected policies element in event filters
and host isolation exceptions forms.
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR adds boilerplate code and a few initial end-to-end tests to
serverless plugins.
Note that the tests defined in this PR are not part of any CI run yet,
this will be done in a follow-up after this PR is merged.
### Details
The serverless test structure corresponds to what we have in
`x-pack/test` with API tests in `api_integration` and UI tests in
`functional`, each with their set of helper methods and sub-directories
for
- `common` functionality shared across serverless projects (core, shared
UX, ...)
- `observability` project specific functionality
- `search` project specific functionality
- `security` project specific functionality
The `shared` directory contains fixtures, services, ... that are shared
across `api_integration` abd `functional` tests.
```
x-pack/test_serverless/
├─ api_integration
│ ├─ services
│ ├─ test_suites
│ │ ├─ common
│ │ ├─ observability
│ │ ├─ search
│ │ ├─ security
├─ functional
│ ├─ page_objects
│ ├─ services
│ ├─ test_suites
│ │ ├─ common
│ │ ├─ observability
│ │ ├─ search
│ │ ├─ security
├─ shared
│ ├─ services
│ ├─ types
```
See also `x-pack/test_serverless/README.md`
### Run tests
Similar to how functional tests are run in `x-pack/test`, you can point
the functional tests server and test runner to config files in this
`x-pack/test_serverless` directory, e.g. from the `x-pack` directory
run:
```
node scripts/functional_tests_server.js --config test_serverless/api_integration/test_suites/common/config.ts
```
and
```
node scripts/functional_test_runner.js --config test_serverless/api_integration/test_suites/common/config.ts
```
### Additional changes
- The stateful `common_page` page object used the existence of the
global nav to determine `isChromeVisible` and `isChromeHidden`, which is
not working when the global nav is disabled. To solve this, a
`data-test-subj` that indicates the chrome visible state is added to the
Kibana app wrapper and is used for the checks.
- Add a few `data-test-subj` entries to the Observability overview page.
- Add optional `dataTestSubj` to the `Navigation` component and use that
for the serverless search nav.
- Add optional `titleDataTestSubj` to the `SolutionNav` component and
use it for the serverless security nav.
- Add a data-test-subj entry to the Search overview page.
* Add deferred migrations parameter.
* Update outdated documents query to take into account deferred migrations.
* Update outdated documents query to take into account the core migration version.
* Update read operations in the saved objects repository to perform deferred migrations.