Commit graph

3236 commits

Author SHA1 Message Date
Spencer
2fd840a570
[generate/pkg] Fix BUILD.bazel template 2022-12-19 13:23:08 -07:00
Jeramy Soucy
88733fc48f
[Saved Objects] Consolidates Check & Enforce Authz Extension Methods (#147287)
Resolves #147045 

Combines the Saved Objects Security Extension's Check Authorization and
Enforce Authorization methods into a single Perform Authorization method
to simplify usage and prepare for migration of audit & authorization
logic from the Saved Objects Repository to the Security Extension.

## Follow-on Work:
- https://github.com/elastic/kibana/issues/147048
- https://github.com/elastic/kibana/issues/147049

## Testing

### Unit Tests
[ ] repository.security_extension.test.ts
[ ] repository.spaces_extension.test.ts
[ ] collect_multi_namespace_references.test.ts
[ ] internal_bulk_resolve.test.ts
[ ] update_objects_spaces.test.ts
[ ] saved_objects_security_extension.test.ts
[ ] secure_spaces_client_wrapper.test.ts

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-19 15:00:29 -05:00
Thomas Watson
800f45180c
[@kbn/handlebars] Ensure only decorators have an options.args property (#147791)
After adding support for decorators an `args` property has added to
`HelperOptions` (which is shared with decorators). To not leak this into
regular helpers and to align with the upstream handlebars, this PR
removes the `args` property from regular helpers so that it's only
visible to decorators.
2022-12-19 20:40:18 +01:00
Spencer
2763af3a4e
[ftr] remove @types/mocha, define custom ambient-ftr-types (#147284)
After moving away from composite projects in the IDE we now have an
issue where projects like security solutions are getting `@types/jest`
and `@types/mocha` loaded up, even though the "types" compiler option in
security solutions focuses on jest. To fix this I've removed the
`@types/mocha` package, implemented/copied a portion of the mocha types
into a new `@kbn/ambient-ftr-types` package which can be used in ftr
packages to define the describe/it/etc. globals.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-19 10:42:12 -07:00
Thomas Watson
b00a2643cd
[@kbn/handlebars] Code cleanup (#147425) 2022-12-19 10:24:26 -07:00
Alejandro Fernández Haro
5568ad86df
[core-http] net.socket.timeout is now documented (#147754) 2022-12-19 16:45:28 +01:00
Anton Dosov
74ab0759f1
Image Embeddable (#146421)
close https://github.com/elastic/kibana/issues/81345

Adds an image embeddable - a new embeddable type that allows to
insert images into dashboard using the new file service
2022-12-19 14:50:29 +01:00
Nodir Latipov
3c4ab973be
[Unified Search] Supports complex filters with AND/OR relationships (#143928)
## Describe the feature:
Closes https://github.com/elastic/kibana/issues/144775

This PR allows users to create more than one filter at a time. It
enhances the query builder by enabling users to create multiple filters
simultaneously. It adds the capability to nest queries and use the
logical OR operator in filter pills.

<img width="981" alt="image"
src="https://user-images.githubusercontent.com/4016496/207942022-3256590d-00f6-45c8-b566-c184d5d18953.png">

## Tasks:

- [x] Add the ability to add/edit multiple filters in one form:
- [x] Replace the current implementation of adding and editing a filter
with a filtersBuilder - `Vis-Editor`;
- [x] Add combined filter support to Data plugin (mapAndFlattenFilters)
- `App-Services`;
- [x] Add the ability to update data in the Data plugin when updating
values ​​in the filters builder - `App-Services`;
- [x] Add hide `Edit as Query DSL` in popover case the filter inside
FiltersBuilder is combinedFilter - `App-Services`;
- [x] Update filter badge to display nested filters:
- [x] Replace the current badge filter implementation with a new one -
`Vis-Editor`;
- [x] Clean up `FilterLabel` component after replace `FIlterBadge`
component - `Vis-Editor`;
- [x] When editing filters, those filters that belong to the same filter
group should be edited - `Vis-Editor`;
- [x] Update jest and functional tests with new functionality -
`Vis-Editor`;
- [x] Fix drag and drop behavior - `Vis-Editor`;

Co-authored-by: Lukas Olson <lukas@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Yaroslav Kuznietsov <kuznetsov.yaroslav.yk@gmail.com>
Co-authored-by: Andrea Del Rio <andrea.delrio@elastic.co>
2022-12-19 15:18:30 +02:00
Thom Heymann
5f21dbe618
Revert "Include client IP address in audit log" (#147747)
Reverts elastic/kibana#147526

Reverting due to errors when using `FakeRequest`:

```
TypeError: Cannot read properties of undefined (reading 'remoteAddress')
    at KibanaSocket.get remoteAddress [as remoteAddress] (/Users/shahzad-16/elastic/kibana/node_modules/@kbn/core-http-router-server-internal/target_node/src/socket.js:25:24)
    at Object.log (/Users/shahzad-16/elastic/kibana/x-pack/plugins/security/server/audit/audit_service.ts:95:32)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Terminating process...
 server crashed  with status code 1
```
2022-12-19 12:33:21 +01:00
Sébastien Loix
bafe2132ba
[Table list view] Add state in URL (#145517) 2022-12-19 10:34:43 +00:00
Thom Heymann
a02c7dce50
Include client IP address in audit log (#147526)
Resolves #127481

## Release notes

Include IP address in audit log

## Testing

1. Update `kibana.dev.yaml`:

```yaml
xpack.security.audit.enabled: true
xpack.security.audit.appender:
  type: console
  layout:
    type: json
```

2. Observe audit logs in console when interacting with Kibana:

```json
{
  "@timestamp": "2022-12-13T15:50:42.236+00:00",
  "message": "User is requesting [/dev/internal/security/me] endpoint",
  "client": {
    "ip": "127.0.0.1"
  },
  "http": {
    "request": {
      "headers": {
        "x-forwarded-for": "1.1.1.1, 127.0.0.1"
      }
    }
  }
}
```

Note: You will see the `x-forwarded-for` field populated when running
Kibana in development mode (`yarn start`) since Kibana runs behind a
development proxy.

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
2022-12-16 15:54:38 -07:00
claracruz
e868b3aa77
[Platform Onboarding] Elastic cloud migration assistant page (#145523) 2022-12-16 10:31:03 -05:00
Carlos Crespo
4a3af9c97b
[Infrastructure UI] Add parameter Snapshot API to not query using histogram (#146573)
## Summary

closes #146517 

This PR expands the current `includeTimeseries` parameter behaviour, by
not using the `date_histogram` in the `composite` aggregation when it is
set to `false`.

This way, not only the API won't return a `timeseries` object, but the
query will calculate the aggregations on ES side as opposed to when
`includeTimeseries` is true, that does an extra `avg` and `max`
calculation on TS side using the histogram buckets.

The main motivation behind this change is to run the snapshot query
without the need of returning buckets, to avoid the max bucket error.

### How to test
- Enable the system module on metricbeat
- Start a local Kibana 
- Start metricbeat
- Explore `Infrastructure > Metrics`, `Infrastructure > Inventory` and
`Infrastructure > Hosts` and play with the filters

#### cURL

##### Run a query with Composite aggregation
###### With timeseries
```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"memory"}],"groupBy":[],"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":true}' \
  -u elastic:changeme
```

###### Without timeseries
```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"memory"}],"groupBy":[],"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":false}' \
  -u elastic:changeme
```

##### Run a query with just Date Histogram
###### With timeseries
```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"memory"}],"groupBy":null,"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":true}' \
  -u elastic:changeme
```
##### Without timeseries
```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"memory"}],"groupBy":null,"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":false}' \
  -u elastic:changeme
```

### For maintainers
The `logRate` metric type <b>doesn't</b> work without being in a date
histogram, because it uses [cumulative
sum](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-cumulative-sum-aggregation.html).
Therefore `includeTimeseries` false in a `composite` aggregation will
return a 400 error. I haven't found anywhere that would make a request
like below.

#### 400 error

```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"logRate"}],"groupBy":[],"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":false}' \
  -u elastic:changeme
```

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-16 14:34:29 +01:00
Sébastien Loix
b052917e31
[ContentEditor] Replace "Inspector" with "ContentEditor" (#147606) 2022-12-16 12:20:08 +00:00
Yulia Čech
e709523410
[Guided onboarding] Loading state/error handling (#147374)
## Summary
Fixes https://github.com/elastic/kibana/issues/146437
Fixes https://github.com/elastic/kibana/issues/139799

This PR adds a loading state indicator to the landing page when a user
clicks the "view/continue guide" button. It also adds a loading
indicator to the header button and to the dropdown panel (step buttons).
This is implemented via a new observable in the api service `isLoading$`
which is being updated every time a request is sent to the guided
onboarding API. There is also a new error section in the panel that is
displayed when the plugin state is `error` or the guide config is not
found.

_Note for copy reviewers_: Could you please have a look at the new text
is in the screenshot "Error state in the panel"?

### Screenshots/screencasts
#### Landing page buttons


https://user-images.githubusercontent.com/6585477/207427764-a17cdc9a-1b85-4a47-aaa5-6fabc193c99e.mov

Note: the loading indicator blocks individual buttons, so the user could
click view one guide and before the request completes and the panel is
shown, they could click to view another guide. Instead we could consider
blocking all buttons at once on the landing page.

#### Header button and panel


https://user-images.githubusercontent.com/6585477/207428327-7465a5e3-a395-42d1-aa6b-32d339194a00.mov


#### Error state in the panel
<img width="535" alt="Screenshot 2022-12-15 at 15 11 04"
src="https://user-images.githubusercontent.com/6585477/207883802-09e44b62-cfb3-484a-9db8-3832b1683729.png">


Note: since the api service logic prevents it from sending multiple
requests once the plugin state or guide config has been initialized from
the backend, the user can't retry the request. That is why the button in
the error panel reloads the page.

### How to test
I recommend using [tweak](https://tweak-extension.com/) browser
extension to simulate errors in API requests. Here are 2 requests I'm
mocking for the tests:
<img width="778" alt="Screenshot 2022-12-13 at 20 54 33"
src="https://user-images.githubusercontent.com/6585477/207431207-03eb71c0-60b0-4d9f-ad30-0ecc092707ac.png">

<img width="782" alt="Screenshot 2022-12-13 at 20 52 02"
src="https://user-images.githubusercontent.com/6585477/207430965-7f2bb370-cc43-459e-ab14-bfc92ce504dd.png">


### Checklist


- [ ] 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)
- [ ] [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-15 16:38:44 +01:00
Steph Milovic
d31f2f982e
Introduces new @kbn/ecs package (#147408) 2022-12-15 07:53:00 -07:00
Christos Nasikas
9fcb5d5f5f
[Cases] Add cases information to the alert's schema (#147013)
## Summary

This PR adds case information to the alerts' schema. More information
here: https://github.com/elastic/kibana/issues/146864.

### 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>
2022-12-15 15:56:39 +02:00
Maja Grubic
92d6047fef
[CoreSetup/CoreStart] Add settings service; deprecate uiSettings (#147229)
## Summary
### Background
This is the last PR relating to:
https://github.com/elastic/kibana/issues/144909
The support for global settings has already been added on both the
server side and the client side. Since we went with the "two saved
objects" approach, we added a new `UiSettingsGlobalClient` on both the
[server](https://github.com/elastic/kibana/blob/main/packages/core/ui-settings/core-ui-settings-server-internal/src/clients/ui_settings_global_client.ts)
and the
[browser](https://github.com/elastic/kibana/blob/main/packages/core/ui-settings/core-ui-settings-browser-internal/src/ui_settings_global_client.ts)
to be used for setting / retrieval of globally-available settings.

### What now?
We will need to replace the signature of `uiSettings` on `CoreStart` and
`CoreSetup` as we need a way to expose a global client from there.
We had considered a few approaches:
1. Just add a new `global client` -> the easiest, but clutters the
interface
2. Change `uiSettings` to look something like: 
```
uiSettings:  {
  client: IUiSettingsClient;
  globalClient: IUiSettingsClient;
}
```
This is the cleanest, but would require changes to (almost) all plugins

3. @clintandrewhall 's idea, and something that @pgayvallet and myself
agreed on was that we would deprecate the existing `uiSettings` and
introduce a new `settings` property that would have two properties:
`client` & `globalClient`. This way we can let the teams know they
should switch to using the new service in a minimally destructive way.
The downside is that the signature differs slightly from the
server-side.

4. Open to suggestions on this.

### This PR
1. Adds a new `SettingsService` that exposes client/global client for
retrieving namespace-scoped / global settings
2. Deprecates `UISettingsService`
3. Add `globalUiSettings` to `injectedMetadata`
4. Changes `render` signature of `rendering_service`


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-15 10:14:00 +01:00
Yulia Čech
c697611f24
[Guided onboarding] Fix the kubernetes logo (#147548)
## Summary

Follow up to https://github.com/elastic/kibana/pull/147443
This is a tiny fix to update the logo for the kubernetes guide card
(make is separate from the infrastructure card).

### Screenshots

<img width="437" alt="Screenshot 2022-12-14 at 17 50 02"
src="https://user-images.githubusercontent.com/6585477/207657819-8af3ca46-9299-49c0-90c1-acea89b340e0.png">

<img width="396" alt="Screenshot 2022-12-14 at 17 50 28"
src="https://user-images.githubusercontent.com/6585477/207657827-1e64a098-ecdf-42ab-b3b6-4ddece04e8ba.png">
2022-12-14 13:18:38 -05:00
Jean-Louis Leysens
229ec79675
Support cgroup v2 in core metric collection (#147082)
## Summary

* Add support for reading cgroup metrics from the new v2 unified
hierarchy (https://www.kernel.org/doc/Documentation/cgroup-v2.txt)
* Refactored files for improved readability
* Close https://github.com/elastic/kibana/issues/140874

### Checklist
- [x] Manually test this script docker images built on the newer kernel
- [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-14 10:17:41 -07:00
Cindy Chang
f7394339f1
[Guided Onboarding] Use new images for landing page (#147443)
Replacing the landing page with new images, addresses [issue
#147384](https://github.com/elastic/kibana/issues/147384)

<img width="1710" alt="image"
src="https://user-images.githubusercontent.com/11224465/207354781-70600f14-1187-4d10-ab65-3fd7e380fe4a.png">

@yuliacech @alisonelizabeth : a couple of notes:
- I was given both SVG and PNGs, in this task I just replaced the old
PNGS with the new ones, do you think I should use SVGs instead - or does
not really matter?
- The branding team made a unique image for the "Observe my Kubernetes
infrastructure" card - I uploaded the image (`kubernetes.png` and
`kubernetes-dark.png`), but did not replace it. I tried too initially,
but kept getting errors when adding it to the`UseCase` map, so left it
for now as the page now does not show a unique image. That being said I
am more than happy to replace it - I just might need some direction 😜,
or I can create a future task for that. Whatever you think is best.
2022-12-14 17:43:51 +01:00
Yulia Čech
d1e7f50426
[Guided onboarding] Update guide IDs (#147348)
## Summary

Fixes https://github.com/elastic/kibana/issues/144452

This PR updates the guide IDs used in guided onboarding from generic
values (`observability` and `security`) to more specific values
(`kubernetes` and `siem`) which will allow us to add more guides for
observability and security in the future.


### 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-14 15:51:51 +01:00
Alejandro Fernández Haro
b70c70c6ad
[API Docs] Fix --plugin filter (#147500) 2022-12-14 14:24:48 +00:00
Gerard Soldevila
4f72a2eb5b
Do not skip UPDATE_TARGET_MAPPINGS if upgrading to a newer stack version (#147503)
Fixes https://github.com/elastic/kibana/issues/147450
2022-12-14 14:39:47 +01:00
Zacqary Adam Xeper
cbcc675811
[RAM] Fix docLink for Connectors (#147395)
## Summary

Fixes #146164 

Documentation for Connectors didn't make it into the PR that added the
new page. This fixes the broken link.


### 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: Lisa Cawley <lcawley@elastic.co>
2022-12-13 16:39:42 -07:00
Michael Dokolin
6f3a191811
[SO] Prevent source mappings from being merged on migration (#147296) 2022-12-12 16:32:22 +01:00
Thomas Watson
e5d02f5b97
[@kbn/handlebars] Improve print_ast.js script (#147086) 2022-12-12 10:09:01 -05:00
Cindy Chang
e6cbfac277
[Guided Onboarding] Add shadow to landing page cards #144809 (#147121)
Adding a drop shadow to cards on guided onboarding landing page:

![image](https://user-images.githubusercontent.com/11224465/205962845-c4a1da02-dba0-4f53-a606-59dd5e6ef400.png)

**Notes:**
From the [docs](https://elastic.github.io/eui/#/display/card), setting
the `display` value removes the shadow. So I removed that and I tried to
use `$euiTheme` vars but there was no color that matched the subdued one
(`subduedText` and `lightestShade` were all too dark), so I made this as
an inline style, let me know if you think it should be done differently.
2022-12-12 14:43:17 +01:00
Pierre Gayvallet
6c9e8f4bf9
Add APM span for capabilities resolving (#147232)
## Summary

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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-12 04:38:11 -07:00
Michael Dokolin
1bf581af01
[Health Gateway] Add integration tests (#146334) 2022-12-08 22:51:04 +01:00
Thomas Watson
39d27bb868
Add custom Buildkite pipeline for @kbn/handlebars (#146964)
Closes #146963
2022-12-08 18:28:33 +01:00
Maja Grubic
8e3fbe22ae
[GlobalExperience] Global UI settings: API & service changes (#147069)
## Summary

This is a follow-up on: https://github.com/elastic/kibana/pull/146270
This PR:
1. adds server-side service changes
2. registers new routes for global settings
3. add a new `UiSettingsGlobalClient` on the browser side, similarly to
what was done on the server side

There are no browser-side service changes yet, as this will be bigger
change worthy of its own PR.


### Checklist

Delete any items that are not applicable to this PR.

~- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~
~- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
~- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard
accessibility](https://webaim.org/techniques/keyboard/))~
~- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~
~- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
~- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~
~- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)~


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-08 13:20:46 +01:00
Spencer
8b89a5bd5c
[shared-ux] remove circular dependency in solution-nav (#147201)
While working on another project I found a circular dependency between
the `@kbn/shared-ux-page-solution-nav` and
`@kbn/shared-ux-page-kibana-template-types` packages. My upcoming PR
will prevent this from happening in the future, but for now this is just
a small change to fix the issue.
2022-12-07 18:48:19 -06:00
Pierre Gayvallet
42319a79b3
fix cyclic imports in core packages (#147200) 2022-12-07 10:43:28 -07:00
Alexander Wert
6872f82a52
Added mobile synthtrace scenario (#146985)
Extended APM synthtrace to support mobile use cases and added a mobile
scenario that generates trace data.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Kate Patticha <aikaterini.patticha@elastic.co>
2022-12-07 15:28:56 +01:00
Kevin Delemme
f179279e5c
feat(slo): SLO selector component (#147010) 2022-12-07 08:49:53 -05:00
Alexey Antonov
464a9f7cf0
[Step 1][ESQL] Syntax part (#146379)
Part of: #144296

## Summary

First step of `[ESQL] Improve the typing experience` (#144296). This PR
is the skeleton for later parts, but already supports basic parsing
scenarios.

## What was done: 
- [x] Added new `ESQL` language in `@kbn/monaco` package. Parsing was
done using the `antl` syntax;
- [x] `kbnUiSharedDeps`-srcJs bundle has been optimised, all workers
have been moved into separate chunks. This gave almost minus` 2 MB` 🕺
- [x] existing `esql` lang was renamed to `sql`. In order not to confuse
anyone in the future
- [x] some code from `painless` folder was moved to `common` and reused
in ESQL (probably needs some refactoring in future)

## Next steps: 
- [ ]  improving `ANLT` syntax to cover all cases
- [ ]  implementing `Autocomplete` feature

## How to use new `ESQL Lang`:
To use new language 2 properties should be set for `CodeEditor`
component

```ts
import { ESQL_LANG_ID, ESQL_THEME_ID  } from '@kbn/monaco';
import { CodeEditor  } from '@kbn/kibana-react-plugin/public';

 <CodeEditor
      ...
      languageId={ESQL_LANG_ID}
      options={{
        ...
        theme: ESQL_THEME_ID,
      }}
 />
```

Currently syntax highlighting looks like: 

<img width="450" alt="image"
src="https://user-images.githubusercontent.com/20072247/205685072-0658fad1-d034-4d36-a44d-6a49e7365ab3.png">

<img width="450" alt="image"
src="https://user-images.githubusercontent.com/20072247/205685220-c67db50c-6f3b-49b5-9576-d1ee68428184.png">


Will be updated in Step 2

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
2022-12-07 14:12:28 +03:00
Maja Grubic
62e4d7b620
[Global Experience] Add a new global ui settings client (#146270)
## Summary

This PR adds a new:
1 . saved object type `config-global`
2. `UiSettingsGlobalClient` for handling global ui settings read/writes

I've refactored some of the existing logic for ui settings client and
moved them to a separate `clients` folder. There are no functional
changes to the existing `ui_settings_client`. I have a follow-up PR with
the changes to the service and the api, but for the sake of keeping them
small, I think it's better to issue them as separate PRs.


### Checklist

Delete any items that are not applicable to this PR.

~- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~
~- []
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
~- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard
accessibility](https://webaim.org/techniques/keyboard/))~
~- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~
~- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
~- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~
~- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)~


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Vadim Kibana <82822460+vadimkibana@users.noreply.github.com>
2022-12-06 20:08:14 +01:00
Alejandro Fernández Gómez
00df93eb1d
[Synthetics UI] Render a 404 error if a monitor doesn't exist (#145569)
## Summary

Closes #144366.

This PR needs to wait for https://github.com/elastic/kibana/pull/145598
to use a shared `<NotFound />` component instead of creating its own.

### How to test
- Visit a monitor page with a bogus ID, like
`http://<kibana-base-path>/app/synthetics/monitor/i-dont-exist`

Before:

<img width="1276" alt="Screenshot 2022-11-17 at 15 07 51"
src="https://user-images.githubusercontent.com/57448/202469421-3d065d43-740d-4878-9a64-504c711ddcf9.png">


After:

<img width="1279" alt="Screenshot 2022-11-17 at 15 06 38"
src="https://user-images.githubusercontent.com/57448/202469433-6a6d22e3-8b1a-48f1-9934-f5094b89bac1.png">

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-06 08:59:55 -07:00
Matthew Kime
bf103ef725
[data views] Support include_unmapped in field caps request (#146953)
## Summary

Allows data views API `getFieldsForWildcard` to support
`include_unmapped` param.

Closes https://github.com/elastic/kibana/issues/144772
2022-12-06 07:31:30 -06:00
Wafaa Nasr
81635fca73
[Security Solution]: List details page fix Linked Rules max height (#147039)
## Summary

- Applying a max-height to the `Linked Rules` combobox in the List
Shared details as well as in the Add Exception Items
2022-12-05 22:02:05 +01:00
Alexey Antonov
4735ad81cf
Update code owner for kbn-monaco package (#146967)
## Summary

Replace @elastic/kibana-app-services ->
@elastic/kibana-global-experience for `kbn-monaco` package

While working on #146379 I just saw that the plugin has the wrong
code-owner. Let's fix it

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-05 16:06:54 +03:00
Thomas Watson
aa344928d8
[@kbn/handlebars] add support for decorators (#146181)
Closes #145322
2022-12-05 00:45:23 -07:00
Spencer
c107f8a73a
[jest/ci] disable console methods (#146910)
Removes all the noise from poorly written React tests and includes a
warning to explain the situation to folks

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-02 15:28:55 -07:00
Spencer
c38315f91c
[jest] parse CLI flags correctly (#146844)
Fixes https://github.com/elastic/kibana/issues/144051

Rather than just parsing process.argv with the default config of
getopts, which treats flags like `-u` into a "value collecting" flag,
this updates the way we call getopts so that all known jest CLI flags
are properly handled. This is accomplished by parsing the output of
`yarn jest --help` and then using that information to power `node
scripts/jest`.

To update the known CLI flags we just need to run `yarn jest --help |
node scripts/read_jest_help.mjs` (for some reason I don't understand,
Jest does not produce it's entire `--help` output when called from node,
only when called from a terminal).
2022-12-02 10:04:15 -07:00
Trevor Pierce
7376d9cd63
Bumping EUI to v70.4.0 (#145888)
`eui@70.2.4`  `eui@70.4.0`

- "Fixed EuiButtonGroup firing onChange twice" required changing some
tests from `click` to `change`
___

## [`70.4.0`](https://github.com/elastic/eui/tree/v70.4.0)

- Updated `EuiTourStep.footerAction` type to accept `ReactNode[]`
([#6384](https://github.com/elastic/eui/pull/6384))
- Vertically aligned all footer content so that `euiTourStepIndicator`
is always centered ([#6384](https://github.com/elastic/eui/pull/6384))
- Added `filterInCircle` glyph to `EuiIcon`
([#6385](https://github.com/elastic/eui/pull/6385))
- Added `color` prop to `EuiBeacon`
([#6420](https://github.com/elastic/eui/pull/6420))
- Added the `euiMaxBreakpoint` and `euiMinBreakpoint` CSS-in-JS
utilities for creating min/max-width media queries
([#6431](https://github.com/elastic/eui/pull/6431))

**Bug fixes**

- Restores the previous match operator behaviour when the query value is
split into multiple terms after analysis.
([#6409](https://github.com/elastic/eui/pull/6409))
- Fixed missing slide-in animation on `EuiCollapsibleNav`s and left-side
`EuiFlyout`s ([#6422](https://github.com/elastic/eui/pull/6422))
- Fix bug in `EuiCard` where footer were not aligned to the bottom of
the card ([#6424](https://github.com/elastic/eui/pull/6424))
- Fixed multiple component media queries for consumers with custom theme
breakpoints ([#6431](https://github.com/elastic/eui/pull/6431))

## [`70.3.0`](https://github.com/elastic/eui/tree/v70.3.0)

- `EuiSearchBar` now automatically wraps special characters not used by
query syntax in quotes
([#6356](https://github.com/elastic/eui/pull/6356))
- Added `alignment` prop to `EuiBetaBadge`
([#6361](https://github.com/elastic/eui/pull/6361))
- `EuiButton` now accepts `minWidth={false}`
([#6373](https://github.com/elastic/eui/pull/6373))

**Bug fixes**

- Fixed `EuiPageTemplate` not correctly passing the `component` prop to
the inner main content wrapper.
([#6352](https://github.com/elastic/eui/pull/6352))
- `EuiSkipLink` now correctly calls `onClick` even when
`fallbackDestination` is invalid
([#6355](https://github.com/elastic/eui/pull/6355))
- Permanently fixed `EuiModal` to not cause scroll-jumping issues on
modal open ([#6360](https://github.com/elastic/eui/pull/6360))
- Re-fixed `EuiPageSection` not correctly merging `contentProps.css`
([#6365](https://github.com/elastic/eui/pull/6365))
- Fixed `EuiTab` not defaulting to size `m`
([#6366](https://github.com/elastic/eui/pull/6366))
- Fixed the shadow sizes of `.eui-yScrollWithShadows` and
`.eui-xScrollWithShadows`
([#6374](https://github.com/elastic/eui/pull/6374))
- Fixed bug in `EuiCard` where the inner content in vertical cards was
not growing 100% in width
([#6377](https://github.com/elastic/eui/pull/6377))
- Fixed incorrect margins in `EuiSuperDatePicker` caused by `EuiFlex`
CSS gap change ([#6380](https://github.com/elastic/eui/pull/6380))
- Fixed visual bug in nested `EuiFlexGroup`s, where the parent
`EuiFlexGroup` is responsive but a child `EuiFlexGroup` is not
([#6381](https://github.com/elastic/eui/pull/6381))

**CSS-in-JS conversions**

- Converted `EuiModal` to Emotion
([#6321](https://github.com/elastic/eui/pull/6321))

**Fixes**

- `EuiButton` no longer outputs unnecessary inline styles for
`minWidth={0}` or `minWidth={false}`
([#6373](https://github.com/elastic/eui/pull/6373))
- `EuiFacetButton` no longer reports type issues when passing props
accepted by `EuiButton`
([#6373](https://github.com/elastic/eui/pull/6373))

Co-authored-by: Constance Chen <constance.chen@elastic.co>
2022-12-02 08:17:13 -06:00
Wafaa Nasr
78b4851a21
[Security Solution][Exception]: Add to shared lists fixes (#146750)
## Summary

- Continuing from [PR](https://github.com/elastic/kibana/pull/146121) to
apply the same changes to the `Add to Shared Lists`.
- Fix showing the number of Linked rules correctly => in `route.ts` use
the `list.namespaceType` instead of namespaceTypes array
- Apply docs comment on the text
- Use the HeaderMenu item from the `kbn` package for the `Number of
Linked rules` menu
- Allow displaying the HeaderMenu without iconType
- Update snapshots and add tests in HeaderMenu
2022-12-02 15:02:33 +01:00
Kevin Logan
ecc165c487
[Security Solution] Update docs link for es connection errors (#146827)
## Summary

Updates the docs link we need to provide for Endpoint ES connection
errors

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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-02 07:42:51 -05:00
Spencer
2e314db2ce
Wrap rison-node to improve types (#146649)
@maximpn brought up the issues caused by the types required by the
rison-node package, which attempted to communicate that "encoded values
must be primitive values, or recursive arrays/object of primitive
values". This isn't actually expressible in TypeScript, which lead to
many instances of `rison.encode(value as unknown as RisonValue)` which
is useless. Additionally, the rison-node library actually supports any
value and will either produce valid rison or `undefined` for that value.

To address this I'm adding a wrapper function which accepts `any` and
returns a `string`. If rison-node is totally unable to produce any rison
for the value (because the value is `undefined` or some other type like
Symbol or BigInt) the `encode()` function will throw. If you're
accepting arbitrary input you can use the `encodeUnknown()` function,
which will return a string or undefined, if the value you provided has
zero rison representation.

Like JSON.stringify() any non-circular primitive, object, or array can
be encoded with either function. If the values within those objects are
not encodable (functions, RegExps, etc) then they will be skipped. Any
object/array with the `toJSON()` method will be converted to JSON first,
and if the prototype of the object has the `encode_rison()` method it
will be used to convert he value into rison.

The changes in this PR are mostly updating usage of rison-node to use
`@kbn/rison` (which is also enforced by eslint). There are also several
changes which remove unnecessary casting.
2022-12-01 08:33:56 -07:00
Alejandro Fernández Gómez
df41bfa9fe
[Shared UX] Add <NotFound /> prompt (#145598)
## Summary

Creates a shared `<NotFound />` prompt to be used when any given
consumer needs to show a 404 error.

<img width="1278" alt="Screenshot 2022-11-17 at 18 06 12"
src="https://user-images.githubusercontent.com/57448/202511151-a35f489b-d988-46cc-9810-5fc725e29b18.png">

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-01 09:44:56 -05:00