Commit graph

6005 commits

Author SHA1 Message Date
Davis McPhee
5aac9c5875
Assign functional tests and example plugins code ownership to Data Discovery (#162740)
## Summary

This PR assigns code ownership to the Data Discovery team for various
functional tests as well as a couple of example plugins. All of the
tests assigned to us in `CODEOWNERS` currently have no one else assigned
to them.

### 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)~
- [ ]
~[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)~

### 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>
2023-08-04 17:21:13 -03:00
Kibana Machine
1d38289d6a skip failing test suite (#163207) 2023-08-04 16:16:05 -04:00
Hannah Mudge
3763a5a134
[Controls] [PresentationUtil] QoL improvements to control creation form (#162067)
Closes https://github.com/elastic/kibana/issues/162697

## Summary

This PR adds a few tiny UI improvements to the control creation
elements, including...
  
**Data view picker:**
- Made the `Data view` form title respond to focus as expected
  | <div align="center">Before</div> | <div align="center">After</div> |
  |--------|--------|
| ![Jul-28-2023
15-55-13](c287978d-a54a-4809-a806-5a2caa41cf5d)
| ![Jul-28-2023
15-56-24](8f403c2d-80a5-4fc1-989a-1ecceb056fc9)
|

- Switched to use `EuiInputPopover` rather than `EuiPopover`
- Removed the redundant popover title

  | <div align="center">Before</div> | <div align="center">After</div> |
  |--------|--------|
|
![image](013fc848-3a9a-4280-9b37-6c1f025f3597)
| ![Screenshot 2023-07-28 at 4 16 18
PM](22a2de30-cae1-49d4-9c33-d1537488d08d)
|

**Field picker:**
- Made the `Field` form row title respond to focus as expected for all
of the inner form elements
  | <div align="center">Before</div> | <div align="center">After</div> |
  |--------|--------|
| ![Jul-28-2023
16-06-01](7dd845bc-0476-4b2a-b9b5-efce3c2e2844)
| ![Jul-28-2023
16-07-00](222a9199-e5c2-4180-9501-e31588020855)
|

- Switched the `FieldTypeFilter` to use `EuiInputPopover` rather than
`EuiPopover`
- Removed the redundant title from the `FieldTypeFilter` popover
  | <div align="center">Before</div> | <div align="center">After</div> |
  |--------|--------|
|
![image](007c61db-989b-4615-a36f-5f6307f04aaf)
|
![image](ed7aea0c-d852-4f1c-ae03-14933fa2888a)
|

- Made changes described in
https://github.com/elastic/eui/issues/6627#issuecomment-1452693611 so
that, when the field type filter is closed (either via `Esc` or through
the natural tab order), the focus returns to the search field
  | <div align="center">Before</div> | <div align="center">After</div> |
  |--------|--------|
| ![Jul-28-2023
16-12-58](aea49501-1f61-4ae8-bc90-1bacbbc232e7)
| ![Jul-28-2023
16-13-54](8068b090-9cca-427f-bc36-2b9e6b2324f1)
|

- If provided, the initial selected field is now brought to the top of
the list

  | <div align="center">Before</div> | <div align="center">After</div> |
  |--------|--------|
|
![image](2bdad643-d184-4c80-b940-5a73820dc8a5)
|
![image](cda382e2-0e15-48c0-bdbf-c530a77570b8)
|

**Controls display settings:**

- Surrounded the `Minimum width` row with a `div` so that it can receive
the `id` passed down from the `EuiFormRow` and respond to focus as
expected

  | <div align="center">Before</div> | <div align="center">After</div> |
  |--------|--------|
| ![Jul-28-2023
16-31-56](125d2a75-bcec-452c-8682-85de3a44185b)
| ![Jul-28-2023
16-31-20](935a17f1-4adc-4b86-811b-334a42e4627e)
|


### Checklist

- [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))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### 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: Jatin Kathuria <jatin.kathuria@elastic.co>
2023-08-04 11:07:09 -06:00
Sander Philipse
a4d3c0203f
[Enterprise Search] Update connectors for 8.10 (#162909)
## Summary

This adds native connectors, updates existing connectors, and rebrands
the Enterprise Search tag to Search in the Integrations page.
2023-08-03 07:14:07 -07:00
Kibana Machine
d6a1e20075 skip failing test suite (#162777) 2023-08-03 08:12:13 -04:00
Matthew Kime
d9f5223e2d
[data views] fix renamed field filters (#162860)
## Summary

Field filters (aka source filters) are given a `clientId` when they're
changed. Unfortunately this is missing from the schema which can result
in schema failures.

The schema has been fixed and a functional test has been added that
verifies field filter renaming functionality.

Closes: https://github.com/elastic/kibana/issues/162611

## Release Note

Resolves potential errors present in v8.9.0 with data views that contain
field filters that have been edited.
2023-08-03 05:48:40 -05:00
Anton Dosov
65fd7ad260
Clean up saved object based embeddable examples (#162987)
## Summary

These examples are outdated and don't show recent embeddable best
practices. They also use client-side saved object client and block
making `SavedObjectFinder` backward compatible
https://github.com/elastic/kibana/pull/162904 as the `foobar` saved
objects need to be added to content management. We decided that it is
better to clean them up, as fixing them is not a small effort and it is
not worth it on this point as a large embeddable refactor is coming.
2023-08-03 03:14:36 -07:00
Yulia Čech
fbfd3ed0dd
[Console] Set up a folder for manual definitions files (#162652)
## Summary
Fixes https://github.com/elastic/kibana/issues/162564

This PR adds a new folder to Console server side where manually created
definitions for endpoint will be stored. This is important before we
switch to the new script. The logic in the new script is to clear the
folder with generated definitions before re-generating them. That is not
the case in the current script. The downside of that is when an endpoint
is removed from the specifications, it won't be removed from
autocomplete definitions automatically. Displaying autocomplete
suggestions for unavailable endpoints might be confusing for users.

Currently, the `manual` folder is empty because there were no
definitions present in the folder `generated` that would not be
re-generated if the script would clear the folder and create all
endpoints defined in ES json specs. I first suspected that endpoints
from these 2 PRs (https://github.com/elastic/kibana/pull/162503,
https://github.com/elastic/kibana/pull/158674) would need to be moved to
the manual folder, but the definitions added there manually can be
re-generated using the script.

I also removed several deprecated/deleted/renamed endpoints from the
`generated` folder. Several files in the `overrides` folder needed
renaming and one was deleted as deprecated.

There are also smaller renaming changes in this PR because I think the
code is more difficult to understand when it's using
"spec/specification" and "definition" interchangeably or even together
as "SpecDefinitions". I believe we should use "specification" for the ES
specifications (i.e. the source) and "definitions" or even better
"autocomplete definitions" for the files that are used for Console
autocomplete engine. The renaming is to be continued in follow up PRs.

I also added a unit test file for the SpecDefinitionsService since it
contains a lot of important logic for endpoints such as loading
generated definitions, overrides and manual ones and filtering out
endpoints not available in the current context.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
2023-08-02 12:37:06 -04:00
Bhavya RM
3e7b172c81
Unskip a11y skipped tests in console & discover (#162903)
Unskipping a11y skipped tests in console and discover as corresponding
bugs are closed
2023-08-02 08:15:08 -04:00
mohamedhamed-ahmed
0c9afa1442
[Logs+] Add Filter Control Customization Point (#162013)
closes https://github.com/elastic/kibana/issues/158561

## 📝  Summary

This PR adds a new customization point to allow for prepending custom
filter controls to the search bar.
At the moment we are only showing a default namespace filter, once this
is ready we will then check how to provide curated filters per
integration.

##   Testing

1. Make sure to have some documents to different data sets with
different namespace, you can use [this
document](https://www.elastic.co/guide/en/elasticsearch/reference/current/set-up-a-data-stream.html)
as an example
2. Navigate to Discover with the log-explorer profile, `/p/log-explorer`
3. Validate that the new filter control is there
4. Filter using this new control and make sure documents are filtered
out

## 🎥 Demo


6828f62f-dd09-42bd-930c-dd7eaf94958b

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-02 10:35:27 +01:00
Dario Gieselaar
f0ebb7097d
[Observability AI Assistant]: Move to new plugin, update design and use connectors (#162243)
This PR makes the following changes:

- Update look & feel of contextual insights (previously called prompts)
according to the new design that is being developed. Some things might
still change, but hopefully not too much.
- Move all the Observability AI Assistant (previously called CoPilot)
code into a separate plugin for better isolation, more specific code
ownership and to solve some circular dependency issues
- Use connectors instead of a kibana.yml setting

Note: for OpenAI, the model is currently hardcoded to `gpt-4` until
https://github.com/elastic/kibana/issues/162204 has been addressed.


557676b6-065a-4b6f-86b2-1f0c2fd5e07e

---------

Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-28 11:52:00 -04:00
Bena Kansara
5a2b80f8db
Add feature flag for new Threshold Alert details page (#162394)
Resolves https://github.com/elastic/kibana/issues/162393

Adds a new feature flag
`xpack.observability.unsafe.alertDetails.observability.enabled` to
show/hide threshold alert details page until it is ready for GA.
2023-07-27 11:53:29 +02:00
Dzmitry Lemechko
f6a90974e9
[es_archives] add 'auto_expand_replicas: 0-1' in index mappings (#162499)
Currently, if you try loading archive with index mappings not having
replica set into stateless ES, it won't work properly: you will get 503
error on calling `GET <index_name>/_stats`:
```
{
  "error": {
    "root_cause": [
      {
        "type": "no_shard_available_action_exception",
        "reason": null
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "indices-stats",
        "node": null,
        "reason": {
          "type": "no_shard_available_action_exception",
          "reason": null
        }
      }
    ]
  },
  "status": 503
}
```
In stateless replica is
[required](https://elastic.slack.com/archives/C037J0RKRAN/p1690218904855299)
in order to perform search requests (the "search shard").

This PR updates index mappings in es_archives with
`"auto_expand_replicas": "0-1"`, in order to be compatible with
stateless ES and so that we can re-use existing data sets rather than
creating new ones.

I checked with Core Team that we should fine to just adapt all mapping
files, but let me know if that doesn't work for you.
The same value is used to create the "real" SO
[indices](c79c09c3d0/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/constants.ts (L21))
in Kibana.
2023-07-26 14:30:54 +01:00
Marco Antonio Ghiani
9bae853586
[Logs+] Add Log Explorer profile deep link (#161939)
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: weltenwort <stuermer@weltenwort.de>
2023-07-24 21:23:58 +02:00
Gerard Soldevila
c3a5da8825
[FTR - esArchiver] Update encrypted_saved_objects_api_integration test archives to reduce flakiness (#162321)
## Summary

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

Updates all archives of the `encrypted_saved_objects_api_integration`
test suite:
* Removing SO index definitions.
* Updating documents defined in `data.json`.
2023-07-24 12:33:42 -04:00
Gerard Soldevila
59450f0a22
[FTR - esArchiver] Update saved_objects_management test archives to reduce flakiness (#162259)
## Summary

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

Updates all archives of the
`test/functional/fixtures/es_archiver/saved_objects_management` test
suite:
* Removing SO index definitions.
* Updating documents defined in `data.json`.
2023-07-24 10:11:39 +02:00
Gerard Soldevila
2e15549b58
[FTR - esArchiver] Update the remaining "dynamic" archives, removing mappings.json (#162029)
## Summary

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

- Updates the remaining "dynamic" es archives (aka those using the
`$KIBANA_PACKAGE_VERSION` variable), deleting mappings.json.
- It also removes the piece of logic in `esArchiver` that replaces that
variable.
2023-07-19 17:43:00 +02:00
Lukas Olson
13372c91ce
[data] Use versioned router for remaining routes (#161919)
## Summary

Uses the versioned router for the remaining routes in the data plugin:
KQL telemetry (opt-in stats), and scripting languages list.

### 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
2023-07-18 14:40:11 -07:00
Sébastien Loix
fde21b15de
[Files management] Fix flaky functional test (#162146) 2023-07-18 07:40:51 -07:00
Sébastien Loix
209d35365f
[Serverless nav] Update footer + project settings cloud links (#161971) 2023-07-18 08:39:14 -05:00
Davis McPhee
a1090ed1e4
[Discover] Re-enable _request_counts saved search test for SQL mode (#162086)
## Summary

This PR re-enables the disabled saved search functional test for SQL
mode in `test/functional/apps/discover/group3/_request_counts.ts`.
Recent improvements we've made to data fetching in SQL mode fixed the
underlying issue and the test now runs as expected.

Flaky test runs:
- x100:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2654
🟢

### 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)~
- [ ]
~[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)
2023-07-18 10:20:50 -03:00
Sébastien Loix
c6deb252b2
[TableListView] Fix regression when resetting search (#162034) 2023-07-18 04:47:01 -07:00
Dzmitry Lemechko
72907cfe1e
convert more tests to use uiSettings for timePicker (#161737)
While searching in test files, I found few more places to replace
`PageObjects.timePicker.setAbsoluteRange` with
`PageObjects.common.setTime`.

Before changing I reviewed tests if it is not important to select
datePicker via UI component, but please double check scenarios because I
might miss the context.
2023-07-18 13:27:47 +02:00
Devon Thomson
a1be033734
[Embeddable] Refactor embeddable panel (#159837)
Update the Embeddable panel and all sub-components to be react function components & removes the embeddable panel HOC in favour of a direct import.
2023-07-17 12:14:31 -04:00
Davis McPhee
9191bd9939
[Discover] Fix duplicate request in Discover when adding a filter (#161992)
This PR fixes a bug in Discover that can cause a duplicate request to be
sent when adding a filter under certain circumstances. It also reenables
the flaky tests that were skipped in #161157 which were failing due to
this bug.

Flaky test runs:
- x50:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2645
🔴
- x100:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2646
🔴
- x100:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2647
🟢

Resolves #161157.
2023-07-17 10:52:51 -03:00
Gerard Soldevila
e28ed4ea33
[FTR - esArchiver] Update deprecations_service archive to NOT delete SO indices (#161937)
## Summary

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

Updates the `test/functional/fixtures/es_archiver/deprecations_service`
archive:
* deleting `mappings.json`
* updating documents in `data.json`

This way, _esArchiver_ will not delete SO indices and recreate them,
eliminating the odds of the related tests being flaky.
2023-07-17 11:28:21 +02:00
Gerard Soldevila
7cee23456e
[FTR - esArchiver] Update delete_unknown_types archive to NOT delete SO indices (#161936)
## Summary

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

Updates the
`test/api_integration/fixtures/es_archiver/saved_objects/delete_unknown_types`
archive:
* deleting `mappings.json`
* updating documents in `data.json`

This way, _esArchiver_ will not delete SO indices and recreate them,
eliminating the odds of the related tests being flaky.
2023-07-17 11:28:10 +02:00
Pierre Gayvallet
a9786dfd6b
[cloud plugin] Add serverless projectId to configuration and contract (#161728)
## Summary

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

Add the `serverless.projectId` config setting to the `cloud` plugin, and
expose the `isCloudServerless` and `serverless.projectId` info from the
cloud plugin's API.
2023-07-14 05:17:12 -07:00
Elena Stoeva
6bc2ee2581
[Console] Filter autocomplete endpoints by availability (#161781)
Closes https://github.com/elastic/kibana/issues/160160

## Summary

This PR adds functionality to the new autocomplete generation script for
creating an `availability` property in the spec files that is used for
filtering out endpoints that are not available in the current
environment (e.g. `serverless` or `stack`). It also adds a config
setting in the console plugin that specifies the current environment.
This setting is also configured accordingly for serverless.


**How to test**
1. Checkout the [ES specification
repo](https://github.com/elastic/elasticsearch-specification)
2. Run the command with `node scripts/generate_console_definitions.js
--source <ES_SPECIFICATION_REPO> --emptyDest` where
`<ES_SPECIFICATION_REPO>` is the absolute path to the root of the ES
specification repo
3. Start the classic Kibana and verify that Console suggests only
endpoints that are available in the `stack` environment.
4. Start Kibana in any of the serverless modes and verify that Console
suggests only endpoints that are available in the `serverless`
environment.

Here are some example endpoints that can be used for testing:
| Endpoint  | Available in Stack | Available in Serverless |
| ------------- | ------------- | ------------- |
| [POST
_bulk](https://github.com/elastic/elasticsearch-specification/blob/main/specification/_global/bulk/BulkRequest.ts)
| Yes | Yes |
| [DELETE
_security/oauth2/token](https://github.com/elastic/elasticsearch-specification/blob/main/specification/security/invalidate_token/SecurityInvalidateTokenRequest.ts)
| Yes | No |
2023-07-14 10:29:27 +01:00
Søren Louv-Jansen
efdc760a42
[APM] Add index.fast_refresh to .apm-custom-link (#159674)
Closes: https://github.com/elastic/kibana/issues/155330

Adds `index.fast_refresh` to `.apm-custom-link` in order to ensure fast
index refreshes on serverless (1 second periodic refreshes instead of 5
second which is the new default on serverless).

This is pending on Elasticsearch adding support for `index.fast_refresh`
(https://github.com/elastic/elasticsearch/pull/96660)

---------

Co-authored-by: miriam.aparicio <miriam.aparicio@gmail.com>
Co-authored-by: Miriam <31922082+MiriamAparicio@users.noreply.github.com>
2023-07-14 11:25:07 +02:00
Pierre Gayvallet
808c28dd8e
Migrate from deprecated EUI components (#161548)
## Summary

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

Migrate away from deprecated EUI components for Core-owned code.

Note: I only tested the production (and examples) pages properly, I
didn't make sure the test plugins where displayed correctly, as long as
the data structure was still here for the tests to pass.

### Screenshots

#### Status page

<img width="1388" alt="Screenshot 2023-07-10 at 17 14 24" 

src="d15adffa-d4fb-4dab-ad91-691a4c103541">

#### AppNotFound page

<img width="1352" alt="Screenshot 2023-07-10 at 17 14 40"
src="77dcc958-db53-4ec8-9a7f-af4ea0804a96">

#### Generated plugin landing page

<img width="1906" alt="Screenshot 2023-07-10 at 17 15 44"
src="7a45d1a3-181d-44c5-a4a1-d3bdb2ba6ee9">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-13 03:22:02 -07:00
Ignacio Rivas
7c333cdc33
[Index Management] Disable certain actions for serverless (#161528) 2023-07-13 07:27:13 +02:00
Dario Gieselaar
4ae94c3502
[Observability] Add feedback buttons for prompts (#160351)
Co-authored-by: Sean Heelan <sean@optimyze.cloud>
2023-07-12 15:58:13 -04:00
Dzmitry Lemechko
85a99c954f
[ftr] migrate time picker GUI selection to uiSettings API call (#161642)
closes #113998

In order to make FTR functional tests faster and less flaky, we started
migrating time picker selection from UI action to Kibana API call:

```
    await this.kibanaServer.uiSettings.update({
      'timepicker:timeDefaults': `{ "from": <startTime>, "to": <endTime>}`,
    });
```

In this PR I updated most of the tests listed in the meta issue, so we
can close it.

Flaky test runner
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2606
2023-07-12 09:06:53 +02:00
Matthew Kime
d9d1404119
[saved search] Remove saved object client from data views plugin for saved search usage (#159109)
## Summary

Previously the data plugin relied on the data view plugin to load saved
searches since the saved searches depend upon the data plugin and
circular dependencies needed to be avoided. This is innovative and
perhaps a bit crazy.

What this PR does
- Data view api no longer loads saved searches, removing browser saved
object client usage
- Moves `kibana_context` expression and getKibanaContext function from
data plugin to saved search plugin since it loads saved searches
- Rename data views `SavedObjectsClientCommon` to `PersistenceAPI` -
this is the abstraction around saved object loading that no longer is
exclusive to the saved objects api.
- Adds saved search server api (plugin contract) for loading saved
searches.
- Functional tests on browser and server for kibana_context expression
when loading saved searches

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-11 08:23:46 -05:00
Stratoula Kalafateli
f8ef18a26b
[Textbased] Depict histogram for timebased adhoc dataviews (#161524)
## Summary

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

We decided that in the case we don't render a Lens suggestion (for
example when we have the SELECT * case) to render the histogram.

**Reminder**: Histogram makes sense only of there is a time field. For
text based mode, time field exists **ONLY** if there is the @timestamp
field.

I don't allow navigation to Lens or open the edit flyout in this case.
When the edit flyout allows the editing of the form based visualizations
(such as histogram) I will enable it then.

FTs have been changed to accomodate this change.


<img width="1751" alt="image"
src="3d28d881-bc60-43de-acf8-8cbcd172a3df">


### 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
2023-07-11 14:32:33 +03:00
Patryk Kopyciński
ba539d7a39
[Defend Workflows] Use Vagrant for real agent Cypress e2e (#160050)
## Summary

Run Real Endpoint Cypress E2E on CI using Vagrant

---------

Co-authored-by: Tomasz Ciecierski <ciecierskitomek@gmail.com>
Co-authored-by: Ashokaditya <am.struktr@gmail.com>
2023-07-11 03:02:51 -07:00
Ignacio Rivas
68b3baec93
[Deployment management] Mark devtools and management sidenav deeplinks as visible on serverless (#161227) 2023-07-11 10:31:21 +02:00
Nathan Reese
d3d0cdba73
[Presentation] Migrate all usages of EuiPage*_Deprecated (#161496)
closes https://github.com/elastic/kibana/issues/161428

PR also updates examples title. Instead of naming the embeddable used,
the title now reflects what the example demonstrates.
* "Hello world embeddable" -> "Render embeddable"
* "Todo embeddable" -> "Update embeddable state"
* "List container embeddable" -> "Groups of embeddables"
* "Dynamically adding children to a container" -> "Context menu"

There is a lot more that could be done to enhance these examples, but I
did not want to get more side tracked then I already did.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-10 12:28:30 -06:00
Julia Rechkunova
ea53763028
[UnifiedFieldList][Discover] Create a high level unified field list building block (#160397)
- Closes https://github.com/elastic/kibana/issues/145162 
- Closes https://github.com/elastic/kibana/issues/147884

## Summary

This PR creates a wrapper/container component (building block) for
unified field list subcomponents:

93acc6f707/packages/kbn-unified-field-list/README.md (L5)

Available customization options are listed here:
93acc6f707/packages/kbn-unified-field-list/src/types.ts (L116)

It's now integrated [into
Discover](93acc6f707/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.tsx (L373))
and [into example
plugin](93acc6f707/examples/unified_field_list_examples/public/field_list_sidebar.tsx (L84)).
Usage of unified field list subcomponents and hooks stays unchanged in
Lens plugin as it requires more complex customization (for example Lens
uses IndexPattern/IndexPatternField types instead of data view types).

Also this PR allows to disable multifields grouping and select a variant
(responsive, list only, button only) via
`UnifiedFieldListSidebarContainer` properties.

There should no visual changes on Discover and Lens pages. Unified Field
List Examples plugin will get the same sidebar UI as it's on Discover.

### Checklist

- [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] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2023-07-10 12:18:40 +02:00
Dzmitry Lemechko
ac8d73ac6d
[ftr] fix test users for serverless (#161280)
## Summary

This PR fixes few issues occurring while running FTR API tests against
actual serverless project.

How to run:
```
TEST_CLOUD=1 ES_SECURITY_ENABLED=1 NODE_TLS_REJECT_UNAUTHORIZED=0 TEST_ES_URL=<your_es_url_with_credentials> TEST_KIBANA_URL=<your_es_url_with_credentials> node  --no-warnings scripts/functional_test_runner --es-version=8.9.0 --config x-pack/test_serverless/api_integration/test_suites/search/config.ts --bail
```

The first error is faced during Elasticsearch version validation

```
ERROR Error: attempted to use the "es" service to fetch Elasticsearch version info but the request failed: ResponseError: {"ok":false,"message":"Unknown resource."}
          at SniffingTransport.request (/Users/dmle/github/kibana/node_modules/@elastic/transport/src/Transport.ts:535:17)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
          at Client.InfoApi [as info] (/Users/dmle/github/kibana/node_modules/@elastic/elasticsearch/src/api/api/info.ts:60:10)
          at FunctionalTestRunner.validateEsVersion (functional_test_runner.ts:129:16)
          at functional_test_runner.ts:64:11
          at FunctionalTestRunner.runHarness (functional_test_runner.ts:251:14)
          at FunctionalTestRunner.run (functional_test_runner.ts:48:12)
          at log.defaultLevel (cli.ts:112:32)
          at run.ts:70:7
          at withProcRunner (with_proc_runner.ts:29:5)
          at run (run.ts:69:5)
          at FunctionalTestRunner.validateEsVersion (functional_test_runner.ts:131:13)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
          at functional_test_runner.ts:64:11
          at FunctionalTestRunner.runHarness (functional_test_runner.ts:251:14)
          at FunctionalTestRunner.run (functional_test_runner.ts:48:12)
          at log.defaultLevel (cli.ts:112:32)
          at run.ts:70:7
          at withProcRunner (with_proc_runner.ts:29:5)
          at run (run.ts:69:5)
```

Since there is no version term in case of serverless, we can skip
version check by using newly added to FTR schema `serverless` property
(`false` by default). It is set to `true` in root FTR config
`/shared/config.base`.

The next error is related to ESArchiver relying on `ES` FTR service to
provide ESClient.

```
ResponseError: security_exception
   │ 	Root causes:
   │ 		security_exception: unable to authenticate user [system_indices_superuser] for REST request [/kibana_sample_data_flights]
```

It is fixed by using the default user (from host url) instead of
`system_indices_superuser` we use in stateful run.
2023-07-10 10:09:07 +02:00
Lukas Olson
4b7d18b5c3
[bfetch] Use versioned router (#161317)
## Summary

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

Uses the new versioned router capabilities for the bfetch plugin.

### Checklist

- [ ]
[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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 16:48:02 -07:00
Nicolas Chaulet
7709670d92
[Fleet] Implement active agent soft limit (#161289) 2023-07-06 14:50:33 -04:00
Matthew Kime
c843c97193
[data views] REST endpoint for swapping saved object references (#157665)
## Summary

Managing large number of saved objects can be cumbersome. This api
endpoint allows the management of references without clicking through a
lot of different UIs.

For example - 

This swaps all data view id `abcd-efg` references to `xyz-123`

```
POST /api/data_views/swap_references
{
     "from_id" : "abcd-efg",
     "to_id" : "xyz-123",
     "preview" : false, // optional, necessary to save changes
     "delete" : true // optional, removes data view which is no longer referenced
}

returns 
{
  preview: false,
  result: [{ id: "123", type: "visualization" }],
  deleteSuccess: true
}
```

Additional params - 
```
from_type: string - specify the saved object type. Default is `index-pattern` for data view
for_id: string | string[] - limit the affected saved objects to one or more by id
for_type: string - limit the affected saved objects by type
```



Closes https://github.com/elastic/kibana/issues/153806
2023-07-06 08:29:01 -05:00
Catherine Liu
112a0f9abf
[Dashboard] Editing toolbar update (#154966) 2023-07-05 10:52:26 -07:00
Matthew Kime
803d139adc
[data views] Fix overwrite param for create (#160953)
## Summary

Under some circumstances passing `override` to `POST
/api/data_views/data_view` would fail. Its now fixed.

To test - Try using the override param from the Kibana dev console. I
found it reproduced the problem before the fix and shows its resolved
after the fix. The problem did not appear in the integration tests.

I suspect the problem had to do with how quickly the delete was
performed - if it completed before the create command then everything
was fine. If it didn't then the error would appear. Passing the
overwrite param to the saved object client eliminates the possibility of
the delete failing to complete.

Closes https://github.com/elastic/kibana/issues/161016
2023-07-04 15:35:40 -05:00
Julia Rechkunova
bfab1b0659
[Discover] Fix shared links flaky test (#161172)
- Closes https://github.com/elastic/kibana/issues/158465

100x
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2550
2023-07-04 18:46:47 +02:00
Dzmitry Lemechko
8a95bf7fab
[ftr] Improve FTR error handling for NoSuchSessionError (#161025)
## Summary

Sometimes browser/driver process dies during test run on CI and FTR
fails with errors cascade, good example is
[here](https://buildkite.com/elastic/kibana-pull-request/builds/138535#0188fd74-9adf-4011-8168-1bdc6e3d0f17)



Current behaviour on `main`: FTR lifecycle hooks, defined in
[remote](57aea91fae/test/functional/services/remote/remote.ts)
service, has no access to the information about test suite run and
particular test failure. These hooks are related to WebDriver (browser)
state management and suppose to reset it to default state.
Currently we silently fail screenshot taking which means tests execution
is continued even if `--bail` flag is passed. It ends with cascade of
failures with the same error `NoSuchSessionError: invalid session id`

<details>

<summary>FTR output on failure</summary>

```
         └- ✖ fail: discover/group1 discover test query should show correct time range string by timepicker
         │      Error: expected 'Sep 19, 2015 @ 06:31:44.000' to equal 'Sep 23, 2015 @ 18:31:44.000'
         │       at Assertion.assert (expect.js💯11)
         │       at Assertion.apply (expect.js:227:8)
         │       at Assertion.be (expect.js:69:22)
         │       at Context.<anonymous> (_discover.ts:53:31)
         │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
         │       at Object.apply (wrap_function.js:73:16)
         │
         │
       └-> "after all" hook: afterTestSuite.trigger for "should reload the saved search with persisted query to show the initial hit count"
         └- ✖ fail: discover/group1 discover test query "after all" hook: afterTestSuite.trigger for "should reload the saved search with persisted query to show the initial hit count"
         │      NoSuchSessionError: invalid session id
         │       at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
         │       at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
         │       at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
         │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
         │       at Task.exec (prevent_parallel_calls.ts:28:20)
         │
         │
       └-> "after all" hook in "discover test"
         │ debg Cleaning all saved objects { space: undefined }
         │ succ deleted 2 objects
       └-> "after all" hook: afterTestSuite.trigger in "discover test"
         └- ✖ fail: discover/group1 discover test "after all" hook: afterTestSuite.trigger in "discover test"
         │      NoSuchSessionError: invalid session id
         │       at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
         │       at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
         │       at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
         │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
         │       at Task.exec (prevent_parallel_calls.ts:28:20)
         │
         │
       └-> "after all" hook: unloadMakelogs in "discover/group1"
         │ info [test/functional/fixtures/es_archiver/logstash_functional] Unloading indices from "mappings.json"
         │ info [test/functional/fixtures/es_archiver/logstash_functional] Deleted existing index "logstash-2015.09.22"
         │ info [test/functional/fixtures/es_archiver/logstash_functional] Deleted existing index "logstash-2015.09.20"
         │ info [test/functional/fixtures/es_archiver/logstash_functional] Deleted existing index "logstash-2015.09.21"
         │ info [test/functional/fixtures/es_archiver/logstash_functional] Unloading indices from "data.json.gz"
       └-> "after all" hook: afterTestSuite.trigger in "discover/group1"
         └- ✖ fail: discover/group1 "after all" hook: afterTestSuite.trigger in "discover/group1"
         │      NoSuchSessionError: invalid session id
         │       at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
         │       at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
         │       at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
         │       at runMicrotasks (<anonymous>)
         │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
         │       at Task.exec (prevent_parallel_calls.ts:28:20)
         │
         │
     │
     │0 passing (15.7s)
     │4 failing
     │
     │1)    discover/group1
     │       discover test
     │         query
     │           should show correct time range string by timepicker:
     │
     │      Error: expected 'Sep 19, 2015 @ 06:31:44.000' to equal 'Sep 23, 2015 @ 18:31:44.000'
     │       at Assertion.assert (expect.js💯11)
     │       at Assertion.apply (expect.js:227:8)
     │       at Assertion.be (expect.js:69:22)
     │       at Context.<anonymous> (_discover.ts:53:31)
     │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
     │       at Object.apply (wrap_function.js:73:16)
     │
     │
     │2)    discover/group1
     │       discover test
     │         query
     │           "after all" hook: afterTestSuite.trigger for "should reload the saved search with persisted query to show the initial hit count":
     │
     │      NoSuchSessionError: invalid session id
     │       at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
     │       at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
     │       at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
     │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
     │       at Task.exec (prevent_parallel_calls.ts:28:20)
     │
     │
     │3)    discover/group1
     │       discover test
     │         "after all" hook: afterTestSuite.trigger in "discover test":
     │
     │      NoSuchSessionError: invalid session id
     │       at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
     │       at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
     │       at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
     │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
     │       at Task.exec (prevent_parallel_calls.ts:28:20)
     │
     │
     │4)    discover/group1
     │       "after all" hook: afterTestSuite.trigger in "discover/group1":
     │
     │      NoSuchSessionError: invalid session id
     │       at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
     │       at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
     │       at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
     │       at runMicrotasks (<anonymous>)
     │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
     │       at Task.exec (prevent_parallel_calls.ts:28:20)
```

</details>

This PR change: I didn't find a good reason why we need to fail silently
on screenshot taking. I added a check WebDriver session status with
`hasOpenWindow` and take failure artefacts only if is still valid.
Next change is to fail FTR after hooks related to WebDriver silently:
there is no help having cascade of the repeated stacktrace so I wrap
WebDriver call in hooks with `tryWebDriverCall` that catches the error
and only prints it for visibility.

<details>

<summary>FTR new output on failure</summary>

```
 │ERROR WebDriver session is no longer valid.
         │      Probably Chrome process crashed when it tried to use more memory than what was available.
         │ERROR Browser is closed, no artifacts were captured for the failure
         └- ✖ fail: discover/group1 discover test query should show correct time range string by timepicker
         │      Error: expected 'Sep 19, 2015 @ 06:31:44.000' to equal 'Sep 23, 2015 @ 18:31:44.000'
         │       at Assertion.assert (expect.js💯11)
         │       at Assertion.apply (expect.js:227:8)
         │       at Assertion.be (expect.js:69:22)
         │       at Context.<anonymous> (_discover.ts:53:31)
         │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
         │       at Object.apply (wrap_function.js:73:16)
         │
         │
       └-> "after all" hook: afterTestSuite.trigger for "should reload the saved search with persisted query to show the initial hit count"
         │ERROR WebDriver session is no longer valid
     └-> "after all" hook in "discover test"
       │ debg Cleaning all saved objects { space: undefined }
       │ warn browser[SEVERE] ERROR FETCHING BROWSR LOGS: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
       │ succ deleted 2 objects
     └-> "after all" hook: afterTestSuite.trigger in "discover test"
       │ERROR WebDriver session is no longer valid
   └-> "after all" hook: unloadMakelogs in "discover/group1"
     │ info [test/functional/fixtures/es_archiver/logstash_functional] Unloading indices from "mappings.json"
     │ info [test/functional/fixtures/es_archiver/logstash_functional] Deleted existing index "logstash-2015.09.22"
     │ info [test/functional/fixtures/es_archiver/logstash_functional] Deleted existing index "logstash-2015.09.20"
     │ info [test/functional/fixtures/es_archiver/logstash_functional] Deleted existing index "logstash-2015.09.21"
     │ info [test/functional/fixtures/es_archiver/logstash_functional] Unloading indices from "data.json.gz"
   └-> "after all" hook: afterTestSuite.trigger in "discover/group1"
     │ERROR WebDriver session is no longer valid

0 passing (16.2s)
1 failing

1)    discover/group1
       discover test
         query
           should show correct time range string by timepicker:

      Error: expected 'Sep 19, 2015 @ 06:31:44.000' to equal 'Sep 23, 2015 @ 18:31:44.000'
       at Assertion.assert (expect.js💯11)
       at Assertion.apply (expect.js:227:8)
       at Assertion.be (expect.js:69:22)
       at Context.<anonymous> (_discover.ts:53:31)
       at processTicksAndRejections (node:internal/process/task_queues:96:5)
       at Object.apply (wrap_function.js:73:16)
```

</details>


Flaky-test-runner verification: started 100x to hopefully catch invalid
session on CI
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2539
Note: locally I was simulating it by calling `this.driver.close()` to
close browser before screenshot taking
2023-07-04 18:26:57 +02:00
Kibana Machine
ad5930927c skip failing test suite (#161157) 2023-07-04 07:25:35 -04:00
Thom Heymann
6b02be4488
Restrict ability to disable features within a Space (#160416)
Resolves https://github.com/elastic/kibana/issues/159392

## Summary

This PR hides the feature visibility section on the space management
screen and disables adding `disabledFeatures` when creating or updating
spaces using the REST API or spaces client on serverless.

## Screenshot

![Spaces-Elastic
(2)](14d4900b-989d-420c-bddf-5ff70d305934)

## Testing

1. Start Kibana in serverless mode: `yarn start --serverless`
2. Edit default space and observe that the feature visibility section is
not rendered
3. Quit Kibana and restart using classic mode: `yarn start`
4. Edit default space and observe that the feature visibility section is
rendered correctly
5. Other considerations:
- Disabling feature visibility in the classic offering should throw an
error (`xpack.spaces.allowFeatureVisibility: false`)
- Enabling feature visibility on serverless should throw an error
(`xpack.spaces.allowFeatureVisibility: true`)
2023-07-03 21:02:31 +01:00