Commit graph

66351 commits

Author SHA1 Message Date
Kibana Machine
4802b0dbfe
[api-docs] 2023-08-14 Daily api_docs build (#163775)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/429
2023-08-14 00:57:09 -04:00
Dario Gieselaar
384a1f16c0
[Observability AI Assistant] Update README.md (#163769)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
2023-08-13 02:01:41 -07:00
Kibana Machine
e67ec4a3d8
[api-docs] 2023-08-13 Daily api_docs build (#163773)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/428
2023-08-13 01:02:09 -04:00
Alejandro Fernández Haro
0284cc158d
[Telemetry] Use header-based versioned APIs instead of path-based (#159839) 2023-08-12 14:20:06 -07:00
Kibana Machine
b336a195e0
[api-docs] 2023-08-12 Daily api_docs build (#163762)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/427
2023-08-12 00:50:44 -04:00
Devin W. Hurley
7b3cc8f573
[Security Solution] [Detections] Fixes flakey exceptions read-only viewer cypress test (#162839)
## Summary

Ref: https://github.com/elastic/kibana/issues/162569

The test was trying to load the exceptions tab before the rule details
page loaded. Now we wait for the rule tab to load before continuing.
Something I was unaware of was that `cy.url()` will [automatically
retry](https://docs.cypress.io/api/commands/url#Assertions) until all
chained assertions have passed, which I think can be an easy way to fix
future flake issues where cypress tries to click on an element before
the new page loads.
2023-08-11 20:35:20 -07:00
Matthew Kime
cafaa9295e
[data views] swap_references api improvements (#163225)
## Summary

Some simple dev UX improvements to the swap_references data views api - 

```
POST /api/data_views/swap_references/_preview
{
     "fromId" : "abcd-efg",
     "toId" : "xyz-123"
}

returns 
{
  result: [{ id: "123", type: "visualization" }],
}
```


```
POST /api/data_views/swap_references
{
     "fromId" : "abcd-efg",
     "toId" : "xyz-123",
     "delete" : true // optional, removes data view which is no longer referenced
}

returns 
{
  result: [{ id: "123", type: "visualization" }],
  deleteStatus: {
    remainingRefs: 0,
    deletePerformed: true
}
```

Additional params - 

```
fromType: string - specify the saved object type. Default is `index-pattern` for data view
forId: string | string[] - limit the affected saved objects to one or more by id
forType: string - limit the affected saved objects by type
```

Improves upon https://github.com/elastic/kibana/pull/157665

Docs will be created in follow up PR
2023-08-11 20:56:46 -05:00
Nick Clark
d59d778555
Add timeWindow type changes to slo docs (#163367) 2023-08-11 19:13:32 -04:00
Philippe Oberti
fda22d0d97
[Security Solution] expandable flyout - inverse Visualizations and Investigation order and expand Investigation by default (#163684) 2023-08-12 00:35:32 +02:00
Garrett Spong
6acf72f25c
[Security Solution] Adds RBAC for Assistant (#163031)
## Summary

Adds `All`/`None` RBAC for the Elastic AI Assistant within the Security
app via Kibana feature privileges, and also via serverless PLI App
Features for the Security `complete` product (see
https://github.com/elastic/security-team/issues/7023).

Added as high-level category to enable future support of sub-features
(included sample `Create Conversation` sub-feature plumbed as example).

<p align="center">
<img width="500"
src="b42ab3fe-65e1-49b9-a379-262f2438c0eb"
/>
</p> 

Note: Since [`minimumLicense:
'enterprise'`](https://github.com/elastic/kibana/pull/163031/files#diff-56de8b6234daf4e0e69efe680e5a4afc4f88d152243b773d90c3991fa9dabc19R28)
is configured on this privilege, when the license check isn't satisfied,
the privilege will be hidden (not disabled).

## Testing

Feature is available for `enterprise` licenses and when `All` privilege
is set, otherwise Assistant is hidden in Timeline, all `Chat` UI
elements are hidden, and the `cmd/ctrl + ;` shortcut is unavailable.

---

### On Prem Testing:
Create two roles, one for each `all`/`none` Security Elastic AI
Assistant privilege (via Dev Tools):

<details><summary>PUT /_security/role/assistant_all</summary>
<p>

``` ts
PUT /_security/role/assistant_all
{
  "cluster": [
    "all"
  ],
  "indices": [
    {
      "names": [
        "*"
      ],
      "privileges": [
        "all"
      ],
      "field_security": {
        "grant": [
          "*"
        ],
        "except": []
      },
      "allow_restricted_indices": false
    }
  ],
  "applications": [
    {
      "application": "kibana-.kibana",
      "privileges": [
        "feature_securitySolutionAssistant.minimal_all",
        "feature_siem.all",
        "feature_securitySolutionCases.all",
        "feature_actions.all"
      ],
      "resources": [
        "*"
      ]
    }
  ],
  "run_as": [],
  "metadata": {},
  "transient_metadata": {
    "enabled": true
  }
}
```
</p>
</details>


<details><summary>PUT /_security/role/assistant_none</summary>
<p>

``` ts
PUT /_security/role/assistant_none
{
  "cluster": [
    "all"
  ],
  "indices": [
    {
      "names": [
        "*"
      ],
      "privileges": [
        "all"
      ],
      "field_security": {
        "grant": [
          "*"
        ],
        "except": []
      },
      "allow_restricted_indices": false
    }
  ],
  "applications": [
    {
      "application": "kibana-.kibana",
      "privileges": [
        "feature_siem.all",
        "feature_securitySolutionCases.all",
        "feature_actions.all"
      ],
      "resources": [
        "*"
      ]
    }
  ],
  "run_as": [],
  "metadata": {},
  "transient_metadata": {
    "enabled": true
  }
}
```
</p>
</details>

Create a new `assistant_user` (assigned both roles above), log in and
test assistant availability, then remove one role at a time testing
each:

<details><summary>POST /_security/user/assistant_user (ALL)</summary>
<p>

``` ts
POST /_security/user/assistant_user
{
    "username": "assistant_user",
    "password": "changeme",
    "roles": [
      "assistant_all",
      "assistant_none"
    ],
    "full_name": "Assistant User",
    "email": "assistant-user@elastic.co",
    "metadata": {},
    "enabled": true
}
```
</p>
</details>

Test that assistant is available in UI via `Chat` buttons and shortcut
keys.

<details><summary>PUT /_security/user/assistant_user (NONE)</summary>
<p>

``` ts
PUT /_security/user/assistant_user
{
    "username": "assistant_user",
    "roles": [
      "assistant_none"
    ],
    "full_name": "Assistant User",
    "email": "assistant-user@elastic.co",
    "metadata": {},
    "enabled": true
}
```
</p>
</details>

Test that assistant is **NOT** available in UI via `Chat` buttons or
shortcut keys.

---

### Serverless Testing:

To test with the Assistant available, set `productTypes` to `complete`
in `config/serverless.security.yml`

```
xpack.securitySolutionServerless.productTypes:
  [
    { product_line: 'security', product_tier: 'complete' },
    { product_line: 'endpoint', product_tier: 'complete' },
  ]
  ```

otherwise to test without the Assistant, pick a different product type like `essentials`:

```
xpack.securitySolutionServerless.productTypes:
  [
    { product_line: 'security', product_tier: 'essentials' },
    { product_line: 'endpoint', product_tier: 'essentials' },
  ]
```

Then start Serverless Kibana: `yarn serverless-security`

---

### 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)
- [ ] [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
2023-08-11 15:48:59 -06:00
Nathan Reese
0a74fa03a0
[controls] fix Dashboard getting stuck at loading in Kibana when Controls is used and mapping changed from integer to keyword (#163529)
Closes https://github.com/elastic/kibana/issues/162474

### Changes
* RangeSliderEmbeddable - call setInitializationFinished when
runRangeSliderQuery throws. This fixes the issue
* Investigated if OptionsListEmbeddable is vulnerable to the same issue.
It's not because it uses its own REST API that has a service wrapper
`OptionsListService`. `OptionsListService` handles REST API errors.
* Add unit test verifying OptionsListService.runOptionsListRequest does
not throw when there are REST API errors and always returns a response.
* Add unit tests ensuring setInitializationFinished is called for both
RangeSliderEmbeddable and OptionsListEmbeddable in all cases
* Other clean up
* Fix uses of `dataViewsService.get`. `dataViewsService.get` throws when
data view is not found. It does not return undefined. PR updates
OptionsListEmbeddable, RangeSliderEmbeddable, and mocked data service
* Fix uses of `dataView.getFieldByName`. `dataView.getFieldByName`
returns undefined when field is not found and never throws. PR updates
OptionsListEmbeddable and RangeSliderEmbeddable
    * Remove `resp` wrapper around mocked `fetch` results.

### Test instructions
1) In console run 
  ```
  PUT test1

  PUT test1/_mapping
  {
    "properties": {
      "value": {
        "type": "integer"
      }
    }
  }

  PUT test1/_doc/1
  {
      "value" : 1
  }

  PUT test1/_doc/2
  {
      "value" : 10
  }
  ```
2) create data view `test*`
3) create dashboard with range slider control on test*.value.
4) select a range in the range slider
5) save dashboard
6) run the following in console
  ```
  PUT test2

  PUT test2/_mapping
  {
    "properties": {
      "value": {
        "type": "keyword"
      }
    }
  }

  PUT test2/_doc/1
  {
      "value" : "foo"
  }

  DELETE test1
  ```
7) Open dashboard saved above. Verify dashboard opens and control
displays an error message about being unable to run aggregation on
keyword field.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Devon Thomson <devon.thomson@elastic.co>
2023-08-11 13:58:19 -06:00
Philippe Oberti
2a67e0f67c
[Security Solution] expandable flyout - expandable panel UI update (#163449) 2023-08-11 21:34:05 +02:00
Rickyanto Ang
349972cd3c
[Cloud Security]Added Beta tag + improvements for CIS GCP (#163663)
## Summary

- Added Beta tag for GCP option on CSPM
- Fix a bug where setup_access is stuck on google_cloud_shell ( This bug
occur when user clicks on Manual option, click the start of Project ID
name, and then click google cloud shell option again)
- Added unit test for getCspmCloudShellDefaultValue to help with
refactor later
<img width="950" alt="Screenshot 2023-08-10 at 2 02 46 PM"
src="ccd45ed1-8b6c-4631-8a01-22d35d1b62aa">
2023-08-11 10:58:04 -07:00
Ying Mao
3762df1a22
[Response Ops][Task Manager] Expose SLI metrics in HTTP API - Take 2 (#163652)
## Summary

Redo of this PR https://github.com/elastic/kibana/pull/162178 but
without the `native-hdr-histogram` library which caused issues in the
serverless build. In the future we may want to pursue generating a
custom build of this native library but for our current purposes, a
simple bucketed histogram should suffice. The only changes from the
original PR are in this commit:
dde5245ded,
where we create a `SimpleHistogram` class to bucket task claim durations
into `100ms` buckets.

Please reference the original PR for more description about this HTTP
API

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 13:54:31 -04:00
Anton Dosov
57c17c4927
[Serverless] Fix sidenav responsiveness (#163700)
## Summary

I was not sure if there are other plans for these stats, but I went
ahead and cleaned those up:

### Issue 1. Sidenav groups are collapsed on a smaller screen 

#### Before 

![Screenshot 2023-08-11 at 11 28
54](a3202f96-05c2-4792-8e9e-a25ea5e471cf)

#### After 

<img width="1456" alt="Screenshot 2023-08-11 at 14 13 23"
src="3e52d05f-12fa-4d38-addb-538239e7d8d1">

### Issue 2. Collapsed sidenav state is empty 

We reserved this for icons, but until we have them, I think it makes
sense to just hide the bar:

#### Berfore

![Screenshot 2023-08-11 at 11 29
01](e8f5f474-15c5-46d1-95cc-c2580d3c7050)


#### After

<img width="1456" alt="Screenshot 2023-08-11 at 14 14 35"
src="99adadb4-637b-404b-9909-fe7e78e0224e">


### Issue 3. Navigation is not initialized when Kibana loaded with
hidden navigation

We initialize the navigation as we render the nav tree (the sidenav).
But if the sidenav is hidden, then the navigation is not initialized.
**So, for example, breadcrumbs are not displayed correctly until the nav
is opened.** As a hack, we will always render the tree, but will make it
hidden.

#### Before 

<img width="1296" alt="Screenshot 2023-08-11 at 14 35 14"
src="499e4a97-b5c3-405d-968b-bae753f15b99">


#### After 

<img width="1296" alt="Screenshot 2023-08-11 at 14 34 37"
src="ae51dea4-8d98-40f6-b3bc-c4d5df8e97fa">
2023-08-11 19:50:05 +02:00
Robert Oskamp
fd08c62f05
Adjust global loading indicator data-test-subj for projects (#163697)
## Summary

This PR adjusts the `data-test-subj` for the global loading indicator in
serverless projects such that at matches the stateful version. This
makes sure that functional tests and corresponding test helper methods
continue to work the same in stateful and serverless environments when
comes to waiting for global loading to finish, which is a key mechanism
to avoid test flakiness.

### Additional information

- The serverless project specific global loading indicator was
introduced with #158523
- The stateful loading indicator `data-test-subj` naming is implemented
here:
https://github.com/elastic/kibana/blob/main/packages/core/chrome/core-chrome-browser-internal/src/ui/loading_indicator.tsx#L61

Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
2023-08-11 10:40:26 -07:00
Faisal Kanout
2093a1fee3
[AO] Update the design of Threshold rule creation form (#163313)
## Summary

Fixes #162768 
Fixes #162544

### After update 
<img width="466" alt="Screenshot 2023-08-09 at 17 53 44"
src="926f0c9e-ca55-4711-be3a-2da39726caa8">
2023-08-11 10:28:04 -07:00
Efe Gürkan YALAMAN
1e7efae56a
[Enterprise Search] Reuse serverless panels on Enterprise Search (#163179)
## Summary

Reuse Serverless panels for API index overview. 
Updated Enterprise Search overview to latests designs.

Note: There will be another PR for layout changes on overview
afterwards.





51537e57-e822-4b9f-b9ed-49d82d192690


a3696897-40a5-4cb3-9fe6-53ce5b8f560f


de752063-04ff-42a3-8538-7fb10a9df1ca

![Screenshot 2023-08-09 at 01 55
33](083504c4-7fa6-424b-a833-89dd73c61e49)



### 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]
[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
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- [ ] 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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2023-08-11 19:00:40 +02:00
Julia
04d8a2646d
fix find tests (#163702)
## Summary

Fix flaky find rule e2e tests.

Tested using this tool:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2858
2023-08-11 18:28:22 +02:00
Kerry Gallagher
00ffe1d791
[Logs+] Create an integration while on-boarding logs (#163219)
## Summary

This closes https://github.com/elastic/kibana/issues/161960, a basic
integration will now be created whilst onboarding logs (though the
custom logs flow).

This implements the *initial* version of this work, and does not include
things like adding a dataset to an existing integration.

## UI / UX

General:

![Screenshot 2023-08-07 at 15 20
21](3ca4e300-41c3-4554-a095-0f3dcf9e9523)

Naming conflict errors:

![Screenshot 2023-08-11 at 13 34
45](2a138eac-73e2-4cc9-b1e8-56c586b852ee)

![Screenshot 2023-08-11 at 13 34
59](6e651de9-debd-46aa-a3d5-2b6eb4e3bb4f)

Lack of permissions error:

![Screenshot 2023-08-09 at 17 10
35](d47b40c8-fe4a-4b86-abf8-d8fda51515fd)

General errors:

![Screenshot 2023-08-07 at 16 49
40](346c28d0-ec3e-4f7e-ae16-3f1adf440c21)

Success callout on the next panel:

![Screenshot 2023-08-07 at 17 20
45](03e78e45-871b-4224-9999-5b3d7e2ccdf0)

Delete previous flow (happens in the background):


![delete_process](44c18793-9df7-4228-b351-5668f098e138)


## Pointers for reviewers  / next steps

- This PR also creates a new package for the `useTrackedPromise` hook,
as this is used in several places and I didn't want to just duplicate it
again (I haven't replaced other current uses in this PR, but will as a
followup).

- `useFetcher` was avoided as A) it's very tightly coupled with the
observability onboarding server route repository (and `callApi` is
scoped to this) and I wanted to call an "external" API in Fleet and B) I
wanted explicit control over when the request is dispatched (not on
mount), and whilst this can sort of be achieved by not returning a
promise from the callback it gets quite messy. I also wanted more
granular error handling control.

- Moving forward I think we'll need to enhance the state management of
the plugin. We'll want to add the ability to "add to existing
integration" and this is going to make the state more complex (even with
chunks of this functionality likely moved to it's own package). I did
actually have the Wizard state moved in to a constate container at one
point (as a starter) but I reverted this commit to make the changeset
less intrusive. It's for this same reason that, for now, I haven't
focussed too closely on extracting things like generating the friendly
error messages etc as we'll likely want to extract some of the "create
integration" hooks / UI in to a standalone package so they can be used
elsewhere (not just onboarding). There are also quite a few `
eslint-disable-next-line react-hooks/exhaustive-deps` rules in the
plugin at the moment due to the references not being stable, we could
improve that at the same time as any state changes.

- You can technically navigate directly to
`/fox/app/observabilityOnboarding/customLogs/installElasticAgent`, but
no state is stored in the URL, so nothing is rehydrated resulting in a
very empty configuration. I'm not entirely sure this is a behaviour we
want, but for now I've just made the callout conditional on state
existing (so coming from the previous panel).

- The Fleet custom integrations API now throws a 409 (conflict) when
using a name that already exists.

## Testing

- Head to `/app/observabilityOnboarding` to trigger the onboarding flow
- Select "Stream log files"
- When hitting "continue" an integration should be created in the
background (check the network requests for
`api/fleet/epm/custom_integrations`)
- When continuing (to install shipper), then going back **and** making
changes to your integration options, when clicking continue again there
should be a network request that deletes the previously created
integration (to clean things up). This should be seamless to the user.
- You should not be able to use a name that already exists (for an
existing custom integration)
- General errors (like permission issues, asset installation issues)
should display at the bottom
- When you hit the next panel (install shipper) there should be a
success callout that also contains the name of the integration that was
created

## In progress

~Two changes still in progress, but they don't need to hold up the
review (8.10 coming soon 👀):~

- ~To have a friendlier error for permissions issues (not just
"forbidden")~
- ~Fleet API integration test for the naming collision~

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 17:18:55 +01:00
Devon Thomson
4de61111b1
[Dashboard] Fix missing state on short URL alias match redirect (#163658)
Fixes an issue where URL state from short URLs could be lost on an alias match redirect.
2023-08-11 12:15:18 -04:00
Cristina Amico
f73746d73b
[Fleet] Remove unneeded deprecation from openapi specs (#163717)
## Summary
In https://github.com/elastic/kibana/pull/161064 the deprecation of the
parameter `kuery` was removed but I forgot to update the openapi specs.
Here I'm fixing it.


### Checklist
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
2023-08-11 17:29:24 +02:00
Julia Rechkunova
74911b6475
[Discover] Fix dark theme issues by removing deprecated components (#163387)
- Closes https://github.com/elastic/kibana/issues/163332

## Summary

This PR fixes dark mode issues which surfaced after
https://github.com/elastic/kibana/pull/161914 and
https://github.com/elastic/kibana/pull/163103

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 17:10:55 +02:00
Aleh Zasypkin
987a850f1c
Support logging out of Serverless projects. (#163154)
## Summary

The Serverless MVP project experience will not include support for
Single Log-out ("SLO"). This means that the cloud console and Kibana
will maintain independent sessions, which must be managed separately.
Due to this limitation, the user avatar menu should not feature an
explicit "Logout" link, as it could mistakenly suggest that we are
terminating their Elastic Session. In reality, we are only invalidating
the Kibana session.

This PR replace the existing "Logout" link with a "Close project" link,
when in Serverless. This link will invalidate the Kibana session
(similar to our current “Logout” link) and redirect the user to their
Serverless projects list.

~~__Blocked by: https://github.com/elastic/kibana/issues/163379__~~

## How to test

### Locally
```yaml
xpack.cloud.id: "foo"
xpack.cloud.base_url: "https://console.qa.cld.elstc.co"
xpack.cloud.projects_url: "/projects"
```
```bash
yarn es snapshot --license trial
yarn start --serverless
```

### MKI
```http
POST {{host}}/api/v1/serverless/projects/elasticsearch
Authorization: ApiKey {{api-key}}
Content-Type: application/json

{
  "name": "xxxx",
  "region_id": "local-k8s",
  "overrides": {
    "kibana": {
      "docker_image": "docker.elastic.co/kibana-ci/kibana-serverless:pr-163154-697c0b749433-arm64"
    }
  }
}
```

__Fixes: https://github.com/elastic/kibana/issues/162887__
2023-08-11 16:49:26 +02:00
Gergő Ábrahám
169d197d1a
[Security Solution] Allow users to sort Endpoint list by every column (#162142)
## Summary

This PR adds sorting to Endpoint list, it works with all columns.

Details:
- by default it sorts as before: by enrollment date descending
- the sorting is persisted in the URL
- the `GET api/endpoint/metadata` route now accepts `sortField` and
`sortDirection` query params, but is quite strict: it only accepts the
fields shown in the table for sorting, otherwise returns `400`. reason:
feels better to fail on schema validation than allowing any string to go
through and returning an internal error
- the API expects the `sortField` to harmonise with the returned
`HostInfoInterface` type, so looking from the outside it is consistent.
internally, it maps the incoming `sortField` to the internal structure
(e.g. `metadata.host.ip` -> `united.endpoint.host.ip`)
- ~**update:** moves `last_checkin` to be a runtime field, so it can be
used for sorting~
- ~**update:** adds `Enrolled at` as a column to the table, and
`enrolled_at` as a new field in the response~

Todo:
- [x] fix typescript type errors
- [x] add tests


![image](https://github-production-user-asset-6210df.s3.amazonaws.com/39014407/254272727-fe1d69d6-b006-4ad2-9649-966d4131ca9e.png)



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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 07:29:28 -07:00
Carlos Crespo
07ad32ff9e
[Infra UI] Smooth out spikey charts (#163608)
## Summary

This PR smooths out spikey charts.

- Dotted line caused by period set in metricbeat to be greater than the
date histogram interval determined by lens
<img width="1464" alt="image"
src="0f24b647-f000-4a09-a9a2-025efc56307a">


- Gap caused by a host that stopped shipping metrics
<img width="1460" alt="image"
src="6bb1c1bd-891a-42b4-bf3b-67d4abea7bb8">

- Before this change
<img width="1448" alt="image"
src="b4d2f0e2-698f-4339-bcea-e32451398a5b">

_The spikes are a result of the `period` set in metricbeat/integration
being greater than the date histogram interval that Lens automatically
sets according to the date range passed to the charts._

### How to test this PR

- Setup a local Kibana instance
- Configure `metricbeat.yml`, enabling the `system` module and setting
the `period` with `1m`. Start a local metricbeat instance.
- Navigate to `Infrastructure` > `Hosts`
- Verify if when date picker is set to < 1h hour interval the graphs
will show the dotted lines
- With 1h+ interval, there shouldn't be dotted lines, *unless*
metricbeat is stopped and restarted after a few minutes
- Configure `metricbeat.yml`, enabling the `system` module and setting
the `period` with `10s`. Restart the metricbeat instance.
  - Verify if the charts maintain the existing behaviour

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 16:25:52 +02:00
James Gowdy
40a666b04e
[ML] Test UI for text expansion models (#159150)
Adds a testing UI for text expansion models. Unlike the other model
testing UIs, only data from an existing index can be used.
After selecting an index and field and entering a search query, 10
random docs are loaded, focusing on the selected field only. These
strings are then run through a pipeline simulate using `.elser_model_1`
to get tokens.

It then runs a similar pipeline simulate on the user entered search
query to get tokens for the query.

For each doc result it compares its tokens to the user’s query tokens
and builds up scores for common tokens.
It then sorts the docs for the ones with the highest score as they are
the most relevant to the user’s input.



![image](c6933c59-a600-453a-b64e-05f69b9682e7)


**Expanded tokens section**
The top 5 matching tokens can be seen in an expandable section per doc.


![image](c90dd0bc-4766-403f-b5ac-8060bb6d11f3)
2023-08-11 15:19:24 +01:00
Ioana Tagirta
34969fd511
Search Applications: use msearch to get indices counts (#163699)
We use the index stats API to get the index counts for each index that
belongs to a Search Application.
The index stats API is internal, we should be using the counts API.
`GET <index>/_count` is equivalent to `GET
<index>/_search?size=0&track_total_hits=true`.
In order to avoid doing a request for each index, we do a single msearch
request to get all index counts.

tested locally, the counts are retrieved correctly:

<img width="1507" alt="Screenshot 2023-08-11 at 13 50 08"
src="3a9d2628-5b85-45d4-91be-561b5a326495">
2023-08-11 16:16:30 +02:00
Walter Rafelsberger
ecaa8a7370
[ML] Transforms: Fix privileges check. (#163687)
Fixes a regression introduced in #154007.

When security is disabled, the check for transform
privileges/capabilities would fail and the transform page would not
render.

- This fixes the endpoint to return data in the correct format should
security be disabled.
- The endpoint's TypeScript has been updated to catch malformed
responses.
- The client side custom `useRequest` is replaced with `useQuery` from
`'@tanstack/react-query'` which also fixes TypeScript support on the
client side.
2023-08-11 15:46:56 +02:00
Marco Antonio Ghiani
f09a5c976c
[Log Explorer] Add test suite for Dataset Selector (#163079)
## 📓 Summary

Closes #160627 

This implementation adds the majority of the tests listed down here for
the Log Explorer current implementation.

 [**Flaky Test Runner - x50
executions**](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2844#_)

```
↳ Discover Log-Explorer profile
   ↳ Columns selection initialization and update
     ↳ when the log explorer profile loads
       ↳ should initialize the table columns to logs' default selection
       ↳ should restore the table columns from the URL state if exists
   ↳ Customizations
     ↳ when Discover is loaded with the log-explorer profile
       ↳ DatasetSelector should replace the DataViewPicker
       ↳ the TopNav bar should hide the New, Open and Save options
       ↳ should add a searchable deep link to the profile page
       ↳ should render a filter controls section as part of the unified search bar
   ↳ DatasetSelection initialization and update
     ↳ when the "index" query param does not exist
       ↳ should initialize the "All log datasets" selection
     ↳ when the "index" query param exists
       ↳ should decode and restore the selection from a valid encoded index
       ↳ should fallback to the "All log datasets" selection and notify the user of an invalid encoded index
     ↳ when navigating back and forth on the page history
       ↳ should decode and restore the selection for the current index
   ↳ Dataset Selector
     ↳ without installed integrations or uncategorized data streams
       ↳ when open on the first navigation level
         ↳ should always display the "All log datasets" entry as the first item
         ↳ should always display the unmanaged datasets entry as the second item
         ↳ should display an error prompt if could not retrieve the integrations
         ↳ should display an empty prompt for no integrations
       ↳ when navigating into Uncategorized data streams
         ↳ should display a loading skeleton while loading
         ↳ should display an error prompt if could not retrieve the data streams
         ↳ should display an empty prompt for no data streams
     ↳ with installed integrations and uncategorized data streams
       ↳ when open on the first navigation level
         ↳ should always display the "All log datasets" entry as the first item
         ↳ should always display the unmanaged datasets entry as the second item
         ↳ should display a list of installed integrations
         ↳ should sort the integrations list by the clicked sorting option
         ↳ should filter the integrations list by the typed integration name
         ↳ should display an empty prompt when the search does not match any result
         ↳ should load more integrations by scrolling to the end of the list
       ↳ when clicking on integration and moving into the second navigation level
         ↳ should display a list of available datasets
         ↳ should sort the datasets list by the clicked sorting option
         ↳ should filter the datasets list by the typed dataset name
         ↳ should update the current selection with the clicked dataset
       ↳ when navigating into Uncategorized data streams
         ↳ should display a list of available datasets
         ↳ should sort the datasets list by the clicked sorting option
         ↳ should filter the datasets list by the typed dataset name
         ↳ should update the current selection with the clicked dataset
       ↳ when open/close the selector
         ↳ should restore the latest navigation panel
         ↳ should restore the latest search results
       ↳ when switching between integration panels
         ↳ should remember the latest search and restore its results for each integration
```

## Note on serverless tests suite

For testing the feature in a serverless environment, we are copying all
the tests into the `x-pack/test_serverless` folder until
https://github.com/elastic/kibana/pull/161574 is merged, which will
provide a new space to write tests independently from the deployment
type, avoiding then tests duplication.

## New `browser` service utils for Network conditions simulation

To properly test that this feature works correctly under poor network
conditions or offline scenarios, the `browser` service now exposes some
new methods for altering network conditions on demand.

Also, network profiles to match the [network profiles provided by Chrome
debugger](da276a3fae/front_end/core/sdk/NetworkManager.ts (L363-L393))
have been created.

In case the browser is not of `chromium` type and the driver does not
support the network simulation, these methods throw an error that can be
caught for skipping the affected test.

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 15:32:42 +02:00
Paul Tavares
27c394c936
[Security Solution][Endpoint] Add API checks to Endpoint Policy create/update for checking endpointPolicyProtections is enabled (#163429)
## Summary

- Adds checks to both the Policy Create and Policy Update APIs (Fleet
API extension points) and turns off all protections if
`endpointPolicyProtections` appFeature is disabled
- Adds migration of policies to the Plugin `start()` that will check if
`endpointPolicyProtections` is disabled and updates all existing
policies (if necessary) to disable protections.
2023-08-11 06:32:25 -07:00
Juan Pablo Djeredjian
2ba659d091
[Security Solution] Fix flaky test: x-pack/test/detection_engine_api_integration/security_and_spaces/update_prebuilt_rules_package/update_prebuilt_rules_package·ts - update_prebuilt_rules_package should allow user to install prebuilt rules from scratch, then install new rules and upgrade existing rules from the new package (#163241)
Fixes: https://github.com/elastic/kibana/issues/162658

## Summary

- Fixes flaky test:
`x-pack/test/detection_engine_api_integration/security_and_spaces/update_prebuilt_rules_package/update_prebuilt_rules_package·ts`
- Test title: `update_prebuilt_rules_package should allow user to
install prebuilt rules from scratch, then install new rules and upgrade
existing rules from the new package`

## Passing flaky test runner

300 runs:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2799

## Root cause and what this PR does

- On initial investigation, the flaky test runner was executed for this
test with 300 iterations and all of them succeeded. This gives us great
confidence that the test is not actually flaky.
- Further investigation showed that @kibanamachine reported this tests
as failing when running the CI for two backport PRs to `8.9`:
-
https://buildkite.com/elastic/kibana-on-merge/builds/33282#0189987d-3a80-49c2-8332-3105ec3c2109
-
https://buildkite.com/elastic/kibana-on-merge/builds/33444#0189b1fa-4bc4-4422-9ce9-5c9a24f11ad5
- These flakiness was caused **by a race condition** between the writing
of rules into indeces, and them being made available for reading. This
is a known issue, already and solved for other integration test, by
manually refreshing ES's indeces.
- In order to reduce the probability of flakiness in a similar scenario,
this PR adds code to refresh the indices after each rule installation or
upgrade during the test.

## Refactor

- Moves the refreshing of the indexes within the utility function that
write to indexes:
    - `installPrebuiltRules`
    - `upgradePrebuiltRules`
    - `installPrebuiltRulesAndTimelines` (legacy, but still used)
    - `installPrebuiltRulesFleetPackage`
- Creates 2 new utils:
- `installPrebuiltRulesPackageByVersion`, which installs
`security_detection_engine` package via Fleet API, with its version
passed in as param
- `getInstalledRules`, reusable function to fetch all installed rules
    -

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 15:30:40 +02:00
Philippe Oberti
a86c016219
[Security Solution] expandable flyout - replace feature flag with advanced settings toggle (#161614) 2023-08-11 15:18:12 +02:00
amyjtechwriter
9bc2150c78
[DOCS] Adds the release notes for the 8.9.1 release. (#163578)
## Summary

Adds the release notes for the 8.9.1 release.

Closes:#163565
2023-08-11 14:03:10 +01:00
Marco Antonio Ghiani
aa45152a4e
[FTR] Implement browser network condition utils (#163633)
## 📓 Summary

The PR implements some utilities into the `browser` service to allow
controlling the network conditions during the execution of a functional
test.

### `getNetworkConditions`

Returns the current network simulation options. If none conditions are
previously set, it returns `undefined`

**N.B.**: _if the testing environment is not a Chromium browser, it
throws an error that can be easily caught to manually skip the test or
handle a fallback scenario._


```ts
it('should display a loading skeleton while loading', async function () {
  // Skip the test in case network condition utils are not available
  try {
    const networkConditions = await browser.getNetworkConditions(); // undefined

    await browser.setNetworkConditions('SLOW_3G');

    const networkConditions = await browser.getNetworkConditions();
    // {
    //   offline: false,
    //   latency: 2000,
    //   download_throughput: 50000,
    //   upload_throughput: 50000,
    // }
  } catch (error) {
    this.skip();
  }
});
```

### `setNetworkConditions`

Set the desired network conditions.
It supports different presets that match the [network profiles provided
by Chrome
debugger](da276a3fae/front_end/core/sdk/NetworkManager.ts (L363-L393)):
- `NO_THROTTLING`
- `FAST_3G`
- `SLOW_3G`
- `OFFLINE`
- `CLOUD_USER` (pre-existing)
It also accepts ad-hoc options to configure more specifically the
network conditions.

**N.B.**: _if the testing environment is not a Chromium browser, it
throws an error that can be easily caught to manually skip the test or
handle a fallback scenario._

```ts
it('should display a loading skeleton while loading', async function () {
  // Skip the test in case network condition utils are not available
  try {
    await browser.setNetworkConditions('NO_THROTTLING');
    await browser.setNetworkConditions('FAST_3G');
    await browser.setNetworkConditions('SLOW_3G');
    await browser.setNetworkConditions('OFFLINE');
    await browser.setNetworkConditions('CLOUD_USER');
    await browser.setNetworkConditions({
      offline: false,
      latency: 5, // Additional latency (ms).
      download_throughput: 500 * 1024, // Maximal aggregated download throughput.
      upload_throughput: 500 * 1024, // Maximal aggregated upload throughput.
    });
  } catch (error) {
    this.skip();
  }
});
```

### restoreNetworkConditions

Restore the original network conditions, setting to `NO_THROTTLING`.
The native implementation of `deleteNetworkConditions` exposed by
selenium is unofficial and didn't consistently work, the recommended
approach by the google dev tools team is to restore the connection
setting the no throttling profile.

**N.B.**: _if the testing environment is not a Chromium browser, it
throws an error that can be easily caught to manually skip the test or
handle a fallback scenario._

```ts
it('should display a loading skeleton while loading', async function () {
  // Skip the test in case network condition utils are not available
  try {
    await browser.setNetworkConditions('SLOW_3G'); // Slow down network conditions
    
    // Do your assertions

    await browser.restoreNetworkConditions(); // Restore network conditions
  } catch (error) {
    this.skip();
  }
});
```

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
2023-08-11 14:24:06 +02:00
Maxim Palenov
589ef228fb
[Security Solution] Unskip rules table auto-refresh Cypress tests (#163451)
**Addresses:** https://github.com/elastic/kibana/issues/154694

## Summary

This PR unskips rules table auto-refresh tests.

## Details

Rules table auto-refresh Cypress tests were outdated so it was hard to determine the original flakiness reason. To make it working the following has been done

- `mockGlobalClock()` moved above `visit()` to mock the time before visiting the page. It didn't look like working so the test had to wait for 60 seconds (our refresh interval)
- removed unnecessary waiting `waitForRulesTableToBeLoaded()` as the test should work without it
- removed `setRowsPerPageTo(5)` as the test doesn't look related to the page size
- `AutoRefreshButtonComponent ` was refactored in attempt to fix popover closing related flakiness but it doesn't seem to help but the refactoring looks improving readability so leaving as a part of this PR
- auto-refresh popover's behavior has been changed. The trigger button gets disabled if there is a rule selected. Clicking the disabled button won't make the auto-refresh popover to appear so this part was changed.

### Encountered issues

- `EuiPopover` should close by clicking the trigger button, clicking outside or pressing `Esc` button. The latter two cause flakiness for some reason. I spent quite some time to investigate the reason but without success. It looks like there is a race condition related to [EuiFocusTrap](https://github.com/elastic/eui/blob/main/src/components/focus_trap/focus_trap.tsx) but it doesn't look to be an issue outside Cypress.
- `waitForRulesTableToBeLoaded()` basically does nothing after changes in the rules table. Looking at tis contents

```ts
export const waitForRulesTableToBeLoaded = () => {
  // Wait up to 5 minutes for the rules to load as in CI containers this can be very slow
  cy.get(RULES_TABLE_INITIAL_LOADING_INDICATOR, { timeout: 300000 }).should('not.exist');
};
```

reveals that `RULES_TABLE_INITIAL_LOADING_INDICATOR` defined as `[data-test-subj="initialLoadingPanelAllRulesTable"]` doesn't exist anymore in our codebase so this function instantly returns. The selector will be fixed in a separate PR.

- invoking `mockGlobalClock()` during the test leads to appearing a lot of `Executing a cancelled action` error messages.


### Flaky test runner

[50 runs succeeded](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2842)
2023-08-11 14:07:35 +02:00
Maxim Palenov
26e5c20238
[Security Solution] Re-enable fixed rule snoozing Cypress test (#160037)
**Addresses:** https://github.com/elastic/kibana/issues/159349

## Summary

This PR fixes and re-enables rule snoozing Cypress test `Rule editing page / actions tab - adds an action to a snoozed rule`. 

## Details

Basically the test wasn't flaky it just failed on the `main` branch and was skipped. The cause lays in interlacing [Rule snooze tests PR](https://github.com/elastic/kibana/pull/158195) with [Rule Editing page refactoring PR](https://github.com/elastic/kibana/pull/157749). Two PRs were merged independently to the `main` branch (while the tests PR was merged the last) so combining them lead to a test failure while each one separately didn't cause any problems.

### The root cause

The root cause is in a combination of factors.

[useForm](https://github.com/elastic/kibana/blob/main/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts#L33) hook has a flaw it can't update its state when new `defaultValue` comes in. The same issue also in [useField](https://github.com/elastic/kibana/blob/main/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts#L77) hook. Rule Editing page fetched a fresh rule's data every time it's rendered via [useRule](https://github.com/elastic/kibana/blob/main/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/pages/rule_editing/index.tsx#L581). As `useRule` hook is based on `React Query` it returns stale data during the first render while firing an HTTP request for the fresh data. Obviously the problem happens if the stale data is passed to `useForm` hook as `defaultValue` and when fresh data is fetched and passed again to `useForm` hook the latter just ignores it.

Staying longer on the Rule Details page helps to avoid the problem as fetched rule's data is cached and returned as stale data on the Rule Editing page after transition. As stale and fresh data are the same the test would pass. Anyway this behaviour can be reproduced in prod with a slow internet connection.

### What was done to fix the problem?

Functionality has been added to update the cached rule's data (React Query cache) upon mutation successful update rule mutation. The mutation if fired by pressing "Save changes" button on the Rule Editing page. It is possible as update rule endpoint returns an updated rule in its response.

Along the way it turned out update rule endpoint's and read rule endpoint's responses weren't properly typed so it lead to types mismatch. To fix it `updateRule`'s and `UseMutationOptions`'s return types were changed to `Rule` instead of  `RuleResponse`.

### Misc

Along the way it turned out `cy.get(RULE_INDICES).should('be.visible');` isn't required anymore to access rule actions form.
2023-08-11 14:05:45 +02:00
Alejandro Fernández Haro
d5c4f461b5
[Flaky Test #111821] Mock moment to avoid midnight TZ issues (#163157) 2023-08-11 04:19:55 -07:00
Thom Heymann
1f79ff4f1c
Document interactive setup (#163619)
## Summary

Add instruction for developer on how to run interactive setup locally

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 04:14:45 -07:00
Marco Liberati
a98dfa1c89
[Lens] Align decoration color with text color for layer actions (#163630)
## Summary

Fix #163390

<img width="367" alt="Screenshot 2023-08-10 at 17 55 50"
src="b869aa60-4c4d-4e5a-ab76-ecbb86cf19a6">
<img width="365" alt="Screenshot 2023-08-10 at 17 55 44"
src="82d551c2-48e9-4b48-add5-35efb1656a7d">
<img width="368" alt="Screenshot 2023-08-10 at 17 55 40"
src="80666cfc-957f-4a51-8f55-7481abcb6de8">



### 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)
2023-08-11 11:52:31 +02:00
Marco Liberati
4c812e3b6d
[Lens] Relax counter field checks for saved visualizations with unsupported operations (#163515)
## Summary

Fix #163473

This PR relaxes a bit the checks on the Lens side for old/saved
visualizations with unsupported operations for the `counter` field type,
while preserving those checks for newer visualizations.

Dashboards with "meaningless" operations will now show a warning
message:
<img width="556" alt="Screenshot 2023-08-09 at 18 31 21"
src="7c8f3739-4957-4d1d-8aaa-e9457b8a4426">

When in editor the warning is shown at the top-right corner as well:
<img width="845" alt="Screenshot 2023-08-09 at 18 30 31"
src="c52a7823-d4b9-4efd-9c5d-ca654f3f03a0">

New visualizations still prevent the user from using the unsupported
operations:
<img width="410" alt="Screenshot 2023-08-09 at 18 30 55"
src="d2364a01-0dc3-409a-9c0b-3e3a77cb2566">
<img width="848" alt="Screenshot 2023-08-09 at 18 31 48"
src="086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a">

There's theoretically a last case where users in old SOs might create a
new metric dimension trying to force to use a unsupported operation for
a counter field: in this case the logic for a "new" visualization will
kick-in, clean the data in the workspace and show a full error.
Cancelling such metric dimension will lead to the previous "relaxed"
state.

Messages are grouped by field and by top referencing column (i.e. a
formula): this means that if a formula uses the same `counter` field
with two different dimensions (i.e. `sum(counter_field) +
median(counter_field)` as `myFormula`) will show up as a single column
(`myFormula`).

The wording of the message mimics the same documentation copy provided
in the ES documentation. Ref:
https://github.com/elastic/elasticsearch/pull/97974

Testing SO:


[export.ndjson.txt](12304924/export.ndjson.txt)


### 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]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2023-08-11 11:52:17 +02:00
David Sánchez
81ca020ad7
[Security Solution][Endpoint] Removes pMap and uses a for loop instead (#163509)
## Summary

Removes pMap and uses a for loop instead when fetching exceptions (as it
was done before) since exceptions are cached and there is no need for
parallel code here.

Original PR with previous changes:
https://github.com/elastic/kibana/pull/160387

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 11:45:14 +02:00
Liam Thompson
c8e5741a0b
[Enterprise Search] Update Workplace Search connectors doclink (#163676)
Small URL update.
2023-08-11 02:27:26 -07:00
renovate[bot]
42d4b6f009
Update APM (main) (#163623)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-11 02:16:46 -07:00
Anton Dosov
e944a19cbd
[Serverless] Partially fix lens/maps/visualize breadcrumbs missing title (#163476)
## Summary

Partially address https://github.com/elastic/kibana/issues/163337 for
lens, visualize, maps

### Context:

In serverless navigation, we changed how breadcrumbs work. Instead of
setting the full path manually, we automatically calculate the main
parts of the path from the side nav + current URL. This was done to keep
side nav and breadcrumbs in sync as much as possible and solve
consistency issues with breadcrumbs across apps.

https://docs.elastic.dev/kibana-dev-docs/serverless-project-navigation#breadcrumbs

Apps can append custom deeper context using the
`serverless.setBreadcrumbs` API. Regular `core.chrome.setBreadcrumbs`
has no effect when the serverless nav is rendered.

### Fix

This PR fixes lens, visualize, and maps to add "title" breadcrumb in
serverless. **Unfortunately, it doesn't fully restore the full
breadcrumbs functionality visualize/maps/lens have in the non-serverless
Kibana:**

In the non-serverless Kibana lens/visualize/maps have sophisticated
breadcrumbs where context takes into account `ByValue` and
`originatingApp` and can switch depending on the context. For example,
if the user is coming from "Dashboard" to edit "byValue" Lens
visualization, Lens breadcrumbs display "Dashboard > Create", instead of
"Visualization > Create".

Currently, we can't repeat this behavior with serverless breadcrumbs
because the context is set by the navigation config, e.g.:


9538fab090/x-pack/plugins/serverless_observability/public/components/side_navigation/index.tsx (L136-L141)

In this PR I attempt to do a quick fix for the serverless breadcrumbs by
simply appending the last ("title") part of the breadcrumb. In a follow
up we need to think about how to bring back the original breadcrumbs
functionality with changing `Visualize <-> Dashboard` context. We also
will need to figure out how to sync the changing context with the side
nav, as we don't want to show "Dashboard" in the breadcrumb, but have
"Visualization" highlighted in the side nav. Here is the issue:
https://github.com/elastic/kibana/issues/163488
2023-08-11 10:33:50 +02:00
Alejandro Fernández Haro
5de69cb567
[Flaky #118272] Unskip tests (#163319) 2023-08-11 10:32:32 +02:00
Giorgos Bamparopoulos
290bf1d978
[APM] Make service group saved objects exportable (#163569)
- Makes the saved objects used by service groups exportable / importable
- Adds a link from the saved object to the service group page
- Renames the saved objects from `APM Service Groups` to `Service Group:
2023-08-11 09:27:21 +01:00
Dario Gieselaar
33ace32c3d
[Observability AI Assistant] Action menu item (#163463)
Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
2023-08-11 09:51:36 +02:00
ruhshan
a29e4aa38b
162224 fix action menu overlaps flyout (#162664)
## Summary

Fixes #162224.

Currently when **create custom link** button is clicked, though the
flyout opens, but action menu persisted over the flyout making the
create custom link flyout unusable.

On this PR necessary restructuring and refactoring was done to fix this
behavior.

[Screencast from 07-28-2023 01:52:15
AM.webm](33b7ad00-d10f-41dc-9901-1ccf3006e895)


### Checklist

- [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))
- [ ] 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: Achyut Jhunjhunwala <achyut.jhunjhunwala@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 09:26:17 +02:00
Maryam Saeidi
feb249314b
Configure "View rule in Kibana" Url for Observability rule types (#163292)
Closes #163168

## Summary

This PR configures the "View rule in Kibana" URL to point to the
observability rule details for observability rule types.


![image](58e625a4-eb8f-491b-962f-30a0e3950fb1)
2023-08-11 09:09:35 +02:00