Commit graph

59381 commits

Author SHA1 Message Date
Spencer
afb09ccf8a
Transpile packages on demand, validate all TS projects (#146212)
## Dearest Reviewers 👋 

I've been working on this branch with @mistic and @tylersmalley and
we're really confident in these changes. Additionally, this changes code
in nearly every package in the repo so we don't plan to wait for reviews
to get in before merging this. If you'd like to have a concern
addressed, please feel free to leave a review, but assuming that nobody
raises a blocker in the next 24 hours we plan to merge this EOD pacific
tomorrow, 12/22.

We'll be paying close attention to any issues this causes after merging
and work on getting those fixed ASAP. 🚀

---

The operations team is not confident that we'll have the time to achieve
what we originally set out to accomplish by moving to Bazel with the
time and resources we have available. We have also bought ourselves some
headroom with improvements to babel-register, optimizer caching, and
typescript project structure.

In order to make sure we deliver packages as quickly as possible (many
teams really want them), with a usable and familiar developer
experience, this PR removes Bazel for building packages in favor of
using the same JIT transpilation we use for plugins.

Additionally, packages now use `kbn_references` (again, just copying the
dx from plugins to packages).

Because of the complex relationships between packages/plugins and in
order to prepare ourselves for automatic dependency detection tools we
plan to use in the future, this PR also introduces a "TS Project Linter"
which will validate that every tsconfig.json file meets a few
requirements:

1. the chain of base config files extended by each config includes
`tsconfig.base.json` and not `tsconfig.json`
1. the `include` config is used, and not `files`
2. the `exclude` config includes `target/**/*`
3. the `outDir` compiler option is specified as `target/types`
1. none of these compiler options are specified: `declaration`,
`declarationMap`, `emitDeclarationOnly`, `skipLibCheck`, `target`,
`paths`

4. all references to other packages/plugins use their pkg id, ie:
	
	```js
    // valid
    {
      "kbn_references": ["@kbn/core"]
    }
    // not valid
    {
      "kbn_references": [{ "path": "../../../src/core/tsconfig.json" }]
    }
    ```

5. only packages/plugins which are imported somewhere in the ts code are
listed in `kbn_references`

This linter is not only validating all of the tsconfig.json files, but
it also will fix these config files to deal with just about any
violation that can be produced. Just run `node scripts/ts_project_linter
--fix` locally to apply these fixes, or let CI take care of
automatically fixing things and pushing the changes to your PR.

> **Example:** [`64e93e5`
(#146212)](64e93e5806)
When I merged main into my PR it included a change which removed the
`@kbn/core-injected-metadata-browser` package. After resolving the
conflicts I missed a few tsconfig files which included references to the
now removed package. The TS Project Linter identified that these
references were removed from the code and pushed a change to the PR to
remove them from the tsconfig.json files.

## No bazel? Does that mean no packages??
Nope! We're still doing packages but we're pretty sure now that we won't
be using Bazel to accomplish the 'distributed caching' and 'change-based
tasks' portions of the packages project.

This PR actually makes packages much easier to work with and will be
followed up with the bundling benefits described by the original
packages RFC. Then we'll work on documentation and advocacy for using
packages for any and all new code.

We're pretty confident that implementing distributed caching and
change-based tasks will be necessary in the future, but because of
recent improvements in the repo we think we can live without them for
**at least** a year.

## Wait, there are still BUILD.bazel files in the repo
Yes, there are still three webpack bundles which are built by Bazel: the
`@kbn/ui-shared-deps-npm` DLL, `@kbn/ui-shared-deps-src` externals, and
the `@kbn/monaco` workers. These three webpack bundles are still created
during bootstrap and remotely cached using bazel. The next phase of this
project is to figure out how to get the package bundling features
described in the RFC with the current optimizer, and we expect these
bundles to go away then. Until then any package that is used in those
three bundles still needs to have a BUILD.bazel file so that they can be
referenced by the remaining webpack builds.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 19:00:29 -06:00
Rodney Norris
e9c5c16bfd
[Enterprise Search] updated simulate endpoints to return error from simulate (#147898)
## Summary

Updated the two simulate endpoints to return an error with the
underlying simulate error instead of throwing the error up to the
default handler.

<img width="1839" alt="image"
src="https://user-images.githubusercontent.com/1972968/208780111-c9315897-adc8-40af-bbcf-7a67a997381e.png">
2022-12-22 16:31:56 -06:00
Thomas Watson
0d2e8156bf
[@kbn/handlebars] Refactor internal context handling (#148029) 2022-12-22 16:23:43 -05:00
Cee Chen
251bdcec6c
Upgrade EUI to v72.0.0 (#147888)
## Summary

`eui@71.0.0`  `eui@72.0.0`

---

## [`72.0.0`](https://github.com/elastic/eui/tree/v72.0.0)

- Added the `customQuickSelectRender` render prop to
`EuiSuperDatePicker`, which allows customizing the Quick Select popover
([#6382](https://github.com/elastic/eui/pull/6382))
- `EuiFilePicker` styles have been updated to look more like an
interactive element. ([#6479](https://github.com/elastic/eui/pull/6479))
- Added a third argument to `EuiSelectable`'s `onChange` callback. The
single `option` object that triggered the `onChange` event is now also
passed to consumers with its most recent `checked` state
([#6487](https://github.com/elastic/eui/pull/6487))

**Bug fixes**

- `EuiTabs` now passes `size` and `expand` to all children using a React
context provider. ([#6478](https://github.com/elastic/eui/pull/6478))
- Fixed security warnings caused by `trim@0.0.1` sub-dependency
([#6482](https://github.com/elastic/eui/pull/6482))

**Breaking changes**

- Removed `size` and `expand` props from `EuiTab`
([#6478](https://github.com/elastic/eui/pull/6478))

## [`71.1.0`](https://github.com/elastic/eui/tree/v71.1.0)

**Deprecations**

- Renamed `EuiPageSideBarProps` to `EuiPageSideBarProps_Deprecated`, to
reduce usage/confusion with `EuiPageSidebar`
([#6468](https://github.com/elastic/eui/pull/6468))

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 14:41:18 -06:00
Quynh Nguyen (Quinn)
602b6d645a
[ML] Add responsive layout to Index data visualizer, fix doc count chart margin (#147137)
## Summary

This PR addresses https://github.com/elastic/kibana/issues/137257 and
better handles the layout when the screen width decreases. Changes
include:
- The css is now updating based on the body content width (which
window's width - side bar navigation's width).
- The link cards are shown in the bottom instead of on the right side
when the content width is smaller
- Refresh button will only show the refresh icon when the size is small
- Fix the doc count chart margin too big causing the chart 
- Fix wide time range display with sparse data

For reviewers:
- **kibana-design**: 2 `.scss` files were deleted

Before

After
<img width="1223" alt="Screen Shot 2022-12-06 at 14 31 27"
src="https://user-images.githubusercontent.com/43350163/206016842-f884ee1f-eb60-4c83-9ad3-2fd0f7c90005.png">


### 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 12:57:09 -07:00
Aleh Zasypkin
3a5f5626b2
Ensure that API keys are rendered before performing bulk delete in functional tests. (#148013) 2022-12-22 19:44:11 +01:00
Nicolas Chaulet
5b53a8e9d9
[Fleet] Validate pagination in fleet agents API (#148002) 2022-12-22 11:19:25 -07:00
Vadim Kibana
8e79d783ee
use ReactMenuItem directly (#147988)
## Summary

Partially addresses https://github.com/elastic/kibana/issues/147756

- starts using `ReactMenuItem` directly, when available.
- removes dependence on `uiToReactComponent` in
`build_eui_context_menu_panels.tsx`.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 18:55:00 +01:00
Pierre Gayvallet
a4674f65b6
Allow creating CoreKibanaRequest using fake raw requests (#147919)
## Summary

Fix https://github.com/elastic/kibana/issues/147853

(See issue for more context) 

Given we don't want to spend much effort in user impersonation right
now, the compromise would be to make sure that our system is resilient
to creating 'stubbed' requests. The best way to do that is to offer an
official, proper way to instantiate `CoreKibanaRequest` without having a
proper `HAPI.Request` instance.

This PR is introducing the `FakeRawRequest` type, and changing the
signature of `CoreKibanaRequest.create` to accept this new type.


d2eb3e1801/packages/core/http/core-http-server/src/router/raw_request.ts (L14-L36)

The PR also adapts the existing, non-test usages of
`CoreKibanaRequest.from(someUglyStub as unknown as Request)` to use the
new `FakeRawRequest` type instead.
2022-12-22 10:50:29 -07:00
Yngrid Coello
3de5b43fba
[APM] Show alert indicator on service inventory page (#147511)
Closes https://github.com/elastic/kibana/issues/146701.

### Changes
- `getApmAlertsClient` was moved from `service-groups` to `helper`
folder.
- `getServicesAlerts` method was created in order to get the active
alerts from services matching filters (timeframe, env, service-group,
etc).
- `getServicesItems` is now also getting the service alerts and merging
them in the results so a knew property was added to service results:
`alertsCount`.
- Alerts badge was added to service inventory page.

**After the changes**

- From service inventory


https://user-images.githubusercontent.com/1313018/207597602-21412be9-be7b-4b8a-8eb8-37416b6c10bc.mov

- From a service group


https://user-images.githubusercontent.com/1313018/207597893-d4d19a21-b936-4bbd-beaa-9f3ac6c051b8.mov

- After Weekly UI presentation and sync with @boriskirov and
@chrisdistasio, we decided to add a loading indicator to
serviceGroupCards to give users a hint that something is loading in the
background. This is how it looks like:


https://user-images.githubusercontent.com/1313018/208681846-4a47f593-1010-4471-86f2-18b196c40684.mov
2022-12-22 18:42:39 +01:00
Janki Salvi
8337c7d72f
[Cases] My recently assigned cases (#147763)
## Summary

Fixes: #140172 

This PR 
- updates filter of Recent Cases in Security Dashboard from
ButtonSelection to Dropdown.
- it also adds option to select recent cases by `assigned to me` option
i.e. it allows to filter Recent cases which are assigned to user.

**Before:**
<img width="1639" alt="image"
src="https://user-images.githubusercontent.com/117571355/208679744-34b6af71-038a-4cb3-b893-0dc0a43fac31.png">


**After:**


https://user-images.githubusercontent.com/117571355/208679791-9483c97d-6ef9-4688-ab26-78c5a3764c6b.mov


### 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
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

**Flakey Test Runner:**


![image](https://user-images.githubusercontent.com/117571355/208723595-50eadd01-32ef-44f8-a3a1-a1e2871a0f49.png)


![image](https://user-images.githubusercontent.com/117571355/209123674-b41853f6-a0b6-4423-819c-ffc8814ba9f9.png)


## Release Note:
See "My recently assigned cases" to the recent cases widget of Security
Solution dashboard -
Add the ability to filter recent cases by "assigned to me" which will
show top 3 recent cases assigned to user.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 18:42:20 +01:00
Thomas Watson
41fd68b719
[@kbn/handlebars] Improve types (#147800) 2022-12-22 18:27:56 +01:00
Matthew Kime
b697704639
defaultIndex setting description fix - its really a data view! (#147730)
## Summary

The defaultIndex setting title and description were poor. I've updated
them to correctly reference data views and be more specific about where
they're used.

Closes https://github.com/elastic/kibana/issues/143609
2022-12-22 10:14:56 -07:00
David Sánchez
6bdbf70fe3
[Security Solution][Endpoint] Removes id field on nested entries for event filters (#148000)
## Summary

- Removes id field on nested entries for event filters using the write
transform method.

### 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)
2022-12-22 12:12:39 -05:00
Devin W. Hurley
9eddb4c9cd
[Security Solution] [Exceptions] UX updates (#147955)
## Summary

<details><summary>Display link on rule details page -> add exception
flyout</summary>

<img width="1108" alt="image"
src="https://user-images.githubusercontent.com/616158/209036807-973a83b9-2903-4d45-a15d-7fd6751f30a1.png">

</details>
<details><summary>Adds manage rules functionality to list view overflow
menu</summary>

<img width="802" alt="Screen Shot 2022-12-21 at 4 59 11 PM"
src="https://user-images.githubusercontent.com/915763/209010900-4b609f9c-6fb1-46ca-a1f9-6aa3e67f5366.png">

</details>

<details><summary>Renames page to Shared exception lists and updates
page description with hyperlink to manage rules page</summary>
<img width="635" alt="Screen Shot 2022-12-21 at 4 58 58 PM"
src="https://user-images.githubusercontent.com/915763/209010964-2c7ba8bd-7b1c-4bf9-a0a6-12a456386aed.png">

</details>

<details><summary>Updates sidebar title + navigation title</summary>
<img width="590" alt="Screen Shot 2022-12-21 at 4 58 36 PM"
src="https://user-images.githubusercontent.com/915763/209011050-45df0005-37eb-42b7-840f-eb916472d987.png">

</details>


~~@jethr0null FYI displaying all shared exception lists on the rule
details -> add exception flyout is not possible for 8.6. The ability to
add any exception to any list was not part of the original design of the
component and would require more time to update the component and the
data model to allow for this sort of flexibility.~~

Looks like the above is possible if we pass in `null` for the rules
property of the `AddExceptionFlyout` but we might want to finalize a
design to better help users trying to add the exception to a shared list
while **inside** of the rule details page.




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

### 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: Pedro Jaramillo <pedro.jaramillo@elastic.co>
Co-authored-by: Khristinin Nikita <nikita.khristinin@elastic.co>
2022-12-22 17:56:30 +01:00
Matthew Kime
4715e7151f
[discover] Less field list loading (#147825)
## Summary

Looking at why Discover was loading data view field lists were loading
more than needed, I found more reasons than actual field list loads
occurring but I think they're all deserving of improvement.

- Discover was loading the default data view to see if there was an
existing data view. We can rely on the `hasData` api instead.
- We were loading a data view and then refreshing the field list. If the
data view was being loaded fresh, its meant the field list was loaded
twice. Field list refresh has been integrated into the dataViews api.
- We were loading a data view, checking it if was adhoc, and tossing it
if it wasn't. Now we keep the reference.

Previously on page load, discover would make 3 calls to
`fields_for_wildcard`, now it makes two. It loads all the field with one
request and it makes an additional request where it applies the current
filter to find relevant fields.

Closes https://github.com/elastic/kibana/issues/147744
2022-12-22 09:18:19 -06:00
Thomas Watson
f3f4a2efb1
Bump pdfmake v0.2.5 to v0.2.7 (#147999) 2022-12-22 16:08:23 +01:00
Kevin Logan
8103b35b68
[Security Solution] Remove deprecated API call and feature to show enrolling Endpoints (#147718)
## Summary

Removes an old, deprecated feature that calls the Agents API filtered by
Endpoints. This type of call hasn't been supported for some time (over a
year or so). It was realized that it was failing more when we made the
RBAC changes for this release and we were getting `403` errors from the
API.

NOTE: This feature hasn't worked since the creation of Fleet Server, so
it is safe to remove. The required query functionality of getting a set
of Agents filtered by only those running Endpoint was removed when we
switched over to Fleet Server about 1.5 years ago.


### 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>
2022-12-22 09:33:46 -05:00
Yaroslav Kuznietsov
d7bcda4055
[Unified Search] Fixed failing discover on filter with boolean in query. (#147981)
## Summary

### Before:


https://user-images.githubusercontent.com/22456368/209107669-167b8616-6791-46ef-bbe2-8a0dc73a968d.mov


### After:


https://user-images.githubusercontent.com/22456368/209107443-f45f3298-6b2e-44be-9a9e-c84885403bf0.mov
2022-12-22 16:17:03 +02:00
Kibana Machine
03ddae840d skip failing test suite (#147990) 2022-12-22 09:11:07 -05:00
Kibana Machine
0fd9c9fc17 skip failing test suite (#147998) 2022-12-22 08:53:32 -05:00
Mark Hopkin
57c1071a58
[Fleet] remove inactivity timeout feature flag (#147962)
## Summary

Part of https://github.com/elastic/kibana/issues/143455

I forgot to remove the feature flag in
https://github.com/elastic/kibana/pull/147552
2022-12-22 08:32:16 -05:00
Uladzislau Lasitsa
eb8743cb9f
[Lens] Table shows extra rows when embedded on a dashboard (#147925)
## Summary

Fixes: #147922

previously we set `-1` as `pageIndex` if we have empty data, but in this
case it should be `0`.
2022-12-22 15:11:03 +02:00
Kevin Delemme
988120b1eb
feat(slo): Delegate sort and filter to api (#147943) 2022-12-22 07:53:37 -05:00
David Sánchez
8d7f57014f
[Security Solution][Endpoint] Adds new integration tests for Endpoint Artifacts API RBAC (#143273)
## Summary

- Add new test cases checking RBAC privileges for all artifacts
integration tests

### 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 13:35:42 +01:00
Katerina Patticha
549ab35c6d
[APM] Mobile filters are part of mobile template (#147804)
## Summary

part of: #146870

This PR will make it easier to add mobile filters to other pages

- Rename `useFiltersForMobileCharts` to `useFiltersForEmbeddableCharts` 
- Add mobile filters in the mobile template 
- Passing `showMobileFilters=true` will render the component to the page



https://user-images.githubusercontent.com/3369346/209121227-aa923836-335d-4ffb-a604-d82c2b0d34ae.mov
2022-12-22 05:22:08 -07:00
Stratoula Kalafateli
cffcab124d
[Unified search] Improve the SQL documentation (#147838)
## Summary

Part of https://github.com/elastic/kibana/issues/147803

Replaces the text with the proposed text from the docs team

<img width="997" alt="image"
src="https://user-images.githubusercontent.com/17003240/208633280-d6a78732-0034-454f-9f62-cf6ea14ce4f3.png">
2022-12-22 12:22:18 +02:00
Shahzad
27944db45f
[Synthetics] Ignore decryption errors in deletion (#140640) 2022-12-22 11:10:19 +01:00
Yaroslav Kuznietsov
bb4ea946f9
[Unified Search] Filter builder combobox height. (#147931)
## Summary

Limited combobox height for the purpose of Filter Editor usability.



https://user-images.githubusercontent.com/22456368/208945217-fb124e33-8235-42ae-858a-912147bb5175.mov
2022-12-22 11:23:37 +02:00
Uladzislau Lasitsa
9befd6cda3
[Unified search] Added 'Technical preview' badge (#147915)
## Summary

Added 'Technical preview' badge in title

<img width="998" alt="Снимок экрана 2022-12-21 в 14 33 26"
src="https://user-images.githubusercontent.com/16915480/208905936-b530844c-bec6-4573-a08c-5b1210cdd50e.png">

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2022-12-22 11:12:46 +02:00
Kibana Machine
49d4ceea37
[api-docs] 2022-12-22 Daily api_docs build (#147969)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/194
2022-12-22 00:49:15 -05:00
Mark Hopkin
a9166da678
[Fleet] Add per-policy inactivity timeout + use runtime fields for agent status (#147552)
## Summary

Part of #143455 

Previously agents would be unenrolled after a given time by the fleet
server. Instead, they'll be considered `Inactive`. Agents in an
`Inactive` state are hidden from the UI by default, but their API keys
remain active. This allows these agents to check in again at any time
without requesting new API keys.`inactivity_timeout` defaults to 10
minutes or can be configured on a per policy basis.

Agents that are manually unenrolled will go into the new `Unenrolled`
status.


![image](https://user-images.githubusercontent.com/6766512/200406081-78a945bc-861a-4a5e-949c-33af59222558.png)

These changes mean that we now need to get agent policies before knowing
the agents status, we have used a runtime field to calculate the status
at search time, this allows us to easily filter and aggregate on the
status.

### Performance
For 120 agents (20 of each main status):
- filter call with filters: 90ms
- agent status summary call: 83ms

For 12k agents (2k of each main status):
- filter call with filters: 455ms
- agent status summary call: 500ms

For 120k agents (20k of each main status):

- filter call with filters: 2.2s
- agent status summary call: 2.1s

### Manual Testing

the create agent script can be used to test this at scale e.g create 10k
agents of each of the given statuses:

```bash
cd x-pack/plugins/fleet
node scripts/create_agents --count 10000  --kibana http://localhost:5601/myprefix--status offline,online,inactive,error,updating,unenrolled  --inactivityTimeout 360 --delete
```

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

- [ ] 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)
2022-12-21 22:09:05 +00:00
Ying Mao
efb7cdd49e
[Response Ops] [Alerting] Unflattening summarized alerts (#147890)
Towards https://github.com/elastic/kibana/issues/147379

## Summary

When investigating how to [onboard detection alerts onto framework alert
summaries](https://github.com/elastic/kibana/issues/147379), there were
some discrepancies in the format of the alert documents returned. This
PR fixes the formatting so it matches and there will be no difference in
`context.alerts` when we migrate detection alerts to the framework.


### 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
2022-12-21 16:48:28 -05:00
Walter Rafelsberger
d7be514b94
[ML] Explain Log Rate Spikes: Additional unit tests. (#147451)
This breaks out inline code in
`x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts` to
functions in separate files and adds jest unit tests for each function.
The mocks used for jest unit tests are used as expected data in the API
integration tests. This allows to make sure that the static mocks are
still up to date should we have to update API integration tests based on
upstream tests.
2022-12-21 22:37:17 +01:00
Klim Markelov
36978389a0
[Behavioral Analytics] Change Analytics DNS path (#147934)
### Description
Recently it was discovered that our initial path to analytics brings
some inconsistency into Enterprise Search routes, so it was decided to
replace the `analytics/api` path with `api/analytics`.

This PR is dedicated to changing Analytics DNS path from `analytics/api`
to `api/analytics`
2022-12-21 22:19:38 +01:00
hardikpnsp
af2a7d63f4
[Documentation] Fix links to repository files on Best Practices page (#96152) 2022-12-21 14:16:11 -07:00
Catherine Liu
aea6cebb1b
[Canvas] Adds a functional test for expression editor autocomplete (#146943)
## Summary
Fixes https://github.com/elastic/kibana/issues/147887

I added a functional test to check that autocomplete suggestions appear
as you type in the expression editor in Canvas.

[Flaky test runner x
100](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1658)

### 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)
2022-12-21 12:39:06 -07:00
Luke Gmys
2a02b23ef3
[Security Solution] Clean connectors before custom query rule test (#147921) 2022-12-21 20:33:47 +01:00
Kevin Qualters
d632738057
[Security Solution] [Timeline] User current user name instead of 'elastic' when creating notes, rule author for investigation guides (#142280)
## Summary

Resolves: https://github.com/elastic/kibana/issues/139788
Changes the createTimeline function to use the
kibana.alert.rule.created_by string for investigation guide author name
in timeline, and uses the actively logged in user for regular comments,
so that what is displayed does not oscillate from hard coded 'elastic'
to the current user name.

### 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: Michael Olorunnisola <michael.olorunnisola@elastic.co>
2022-12-21 13:56:57 -05:00
Gerard Soldevila
57dad8fc07
Prevent future convertToMultiNamespaceType migrations (#147369)
Addresses https://github.com/elastic/kibana/issues/147344
2022-12-21 18:12:54 +01:00
Quynh Nguyen (Quinn)
b61066d82a
[ML][Fleet] Update Transform installation mechanism to support upgrade paths (#142920)
## Summary

This PR:
- Adds index aliases to the destination index for Transforms:
- It will automatically appends `{{package-version}}` name to the
`destination_index_name` specified in transform.yml
- Create a `{destination_index_name}.all` that points to all the
destination indices from all the previous versions and new version
- Create a `{destination_index_name}.latest` that points to just the
destination index of the new version
- Upgrading package to a new version no longer deletes the destination
index
- Downgrading package to an older version (e.g. from v3 to v1) will:
- Delete the transform from the newer version (v3), create transform for
the older version (v1)
- If the older version was previously installed and the destination
index of the older version v1 already exists: update the alias
`{destination_index_name}.latest` to point to destination index v1.
- If the older version was never installed and destination index of the
older version v1 does not exist: create the destination index with
`{destination_index_name}.all` and `{destination_index_name}.latest`
alias.

- Support installing transforms concurrently and sequentially. 
- If the `order` is specified in the `transform.yml`'s `_meta` section,
and all the numerical order are unique, transforms will be created and
started sequentially. If not, they will be created and started
concurrently.
- Support versioning of transforms. If `fleet_transform_version` is
specified in `transform.yml`'s `_meta` section:
- If `fleet_transform_version` changed (either incremented or
decremented): delete old transform, keep the old destination index,
install new index templates, component templates, and transform
- If `fleet_transform_version` remains the same: keep old transform,
keep the old destination index, do nothing new
- Fixes an issue with the mappings and template not being applied to the
destination index correctly when the destination index has an ingest
pipeline. Previously, when the transform is associated with an ingest
pipeline, we add the ingest pipeline to the settings when calling `PUT
index/{transform-destination-index}`. This in turns makes the settings
and mappings from the component templates not apply correctly to the
destination. This PR changes so that it will add the pipeline to the
component template.

Technical changes:
- [Adds a new `ElasticsearchAssetType` for `index`

](https://github.com/elastic/kibana/pull/142920/files#diff-395b753abcf65cdc07993651d6211a49194a76c0497e5f234ea13736cf24a2c0)
- [Adds a new `version` for `PACKAGES_SAVED_OBJECT_TYPE`

](https://github.com/elastic/kibana/pull/142920/files#diff-4e164e3802d5171bf96a2cf9c91c20e97c5e0b74b2f93187a072d9a3139f1c18)


### 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-21 09:48:49 -07:00
Sander Philipse
e16953e71a
[Enterprise Search] Fix styling for reorderable tables (#147929)
This updates Enterprise Search table styling to match what it was before
recent EUI updates.

Before:
<img width="1244" alt="Screenshot 2022-12-21 at 16 29 58"
src="https://user-images.githubusercontent.com/94373878/208943146-4a17ca9b-6328-4dc5-b3f5-730aa7a5be88.png">

After:
<img width="1254" alt="Screenshot 2022-12-21 at 16 33 29"
src="https://user-images.githubusercontent.com/94373878/208943165-9d56ae7d-58ee-4bea-a6dd-ae2e32b4d9f4.png">
2022-12-21 09:37:39 -07:00
Rodney Norris
9dac4890ec
[Enterprise Search][Engines] Update navigation (#147893)
## Summary

Update the Enterprise Search navigation when engines are enabled.

### Screenshots
With engines FF off:
<img width="276" alt="image"
src="https://user-images.githubusercontent.com/1972968/208766287-baa25089-0e7c-4b9c-9959-189da8e6a771.png">

With engines FF on:
<img width="276" alt="image"
src="https://user-images.githubusercontent.com/1972968/208767248-c4579f87-ad51-41fa-9b7c-b5074f3d4f47.png">
2022-12-21 10:34:46 -06:00
Shahzad
b3ed8261e1
[Synthetics] Fixes errors overview sparklines (#147669) 2022-12-21 17:22:05 +01:00
Kevin Delemme
0b7b8878d9
feat(slo): improve sort and filter capabilities (#147877) 2022-12-21 09:21:29 -07:00
Alison Goryachev
2b6183e11d
[Onboarding] ECMA MVP cleanup (#147702) 2022-12-21 11:02:01 -05:00
Nick Peihl
af77f5a261
[Expressions] Replace React.lazy and withSuspense with async imports in expressions plugins (#147693)
Fixes #147648 

## Summary

Replace React.lazy and withSuspense with async imports in expressions
plugins

The `withSuspense` method shows a loading state (`EuiLoadingSpinner`)
while React.lazy imports the component module. However, expression
renderers have a second loading state after the module is imported. This
causes a flash of two separate loading states . Unfortunately, this
caused a much larger problem with reporting where the report was
triggered before the second loading state was complete.

Using async imports rather than `React.lazy` ensures that components are
fully available before the expression renderers call their `done`
method.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-21 11:00:28 -05:00
Ying Mao
a6232c4835
[ResponseOps] Retry bulk update conflicts in task manager (#147808)
Resolves https://github.com/elastic/kibana/issues/145316,
https://github.com/elastic/kibana/issues/141849,
https://github.com/elastic/kibana/issues/141864

## Summary

Adds a retry on conflict error to the saved objects bulk update call
made by task manager. Errors are returned by the saved object client
inside an array (with a success response). Previously, we were not
inspecting the response array, just returning the full data. With this
PR, we are inspecting the response array specifically for conflict
errors and retrying the update for just those tasks.

This `bulkUpdate` function is used both internally by task manager and
externally by the rules client. I default the number of retries to 0 for
bulk updates from the task manager in order to preserve existing
behavior (and in order not to increase the amount of time it takes for
task manager to run) but use 3 retries when used externally.

Also unskipped the two flaky disable tests and ran them through the
flaky test runner 400 times with no failures.
*
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1652
*
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1653
*
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1660
*
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1661

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-21 10:56:08 -05:00
renovate[bot]
f1de9a4bc0
Update react-query to ^4.20.2 (main) (#147908) 2022-12-21 16:47:17 +01:00
Giorgos Bamparopoulos
042403e606
[APM] Add parallel builds for cypress tests (#142598)
- Tests runs initiated by the flaky test runner are not recorded or
parallelized
2022-12-21 15:36:08 +00:00