Commit graph

64976 commits

Author SHA1 Message Date
Clint Andrew Hall
4af25273cf Reflect changes from kibana/159638, remove hook, rely on EuiProvider instead 2023-07-11 22:09:09 -04:00
Clint Andrew Hall
ce3e43aa2f Merge branch 'main' into kibana_context 2023-07-11 15:33:06 -04:00
Clint Andrew Hall
13ee15433e Update test snapshots 2023-07-11 15:19:35 -04:00
Clint Andrew Hall
50f0d3ad08 Update to remove provider composer; prep for commit 2023-07-11 15:17:50 -04:00
Rodney Norris
5935c4312e
[Enterprise Search] rebrand ent-search Kibana nav category to Search (#161593)
## Summary

Updated the Kibana collapsible nav Enterprise Search category to Search.
Updated the App Search & Workplace Search app navLinkStatuses to
`hidden` to remove them from the Kibana nav.

### Screenshots
<img width="270" alt="image"
src="1397e701-ca87-46f2-8c15-565bc3a9202c">
2023-07-11 13:59:46 -05:00
Luke
26334b5111
[Security Solution] Close the assistant dialog on add to case #6973 (#161686) 2023-07-11 12:57:43 -06:00
Yara Tercero
fc53c18fa4
[Detection Engine] - Unskip flakey test after running through test runner (#161566)
## Summary

Resolving 155122 . Unskipping
after running through flakey test runner 100 times.
2023-07-11 11:48:19 -07:00
Jatin Kathuria
091b5c133b
[Security Solution][Security Assistant] Investigate in timeline control should be visible only on eligible queries. (#161240)
## Summary

Handles elastic/security-team#6971

This PR mainly resolved below 3 issues:

### Rename to `Add To Timeline` control in conversation code blocks to
`Investigate in Timeline`
 
- `Add to Timeline` according to existing Security Solution actions
means, adding a condition to the timeline with an `OR` clause without
affecting the existing Timeline.

- But the `Add to Timeline` control in the Security Assistant, creates a
new timeline on each action by the user, which contradicts the above
workflow. Hence, it might confuse user.

- `Investigate in Timeline` already means that a new timeline will be
created.

### `Add To Timeline` control was visible on types of codeblock. For
example, it does not make sense for a `Query DSL` to have an `Add to
Timeline` control.

- This PR adds the list of eligible types of queries/code blocks on
which `Add To Timeline` action can be added.

- Currently, that list only contains `kql`, `dsl` and `eql`. Below is
the complete list of types of query that can occur in code blocks.

- Please feel free to suggest a change.
    ```
    'eql' | 'kql' | 'dsl' | 'json' | 'no-type';
    ```

### Lazy calculation of CodeBlockPortals and CodeBlock Action container

- To add controls to the conversation code blocks, we need to follow
below 2 steps.
    1. get the codeBlock containers on which the controls can be added.
2. create portals in the HTML container with our `Add to Timeline`
control.
  
- Below are issues these steps sometime created.
1. We get codeBlock container in the `useLayoutEffect` but at the time,
all conversations might not have loaded because of which containers are
returns as the undefined.
2. Then, we try to create portal in the `undefined` container, which
fails and hence, `Add to Timeline` controls are not visible.
 
- Solution:
1. Instead of getting the codeblock container in useLayoutEffect, we get
the function which will eventually return that container, whenever we
are creating the portal.
2. Converted codeBlock Portal to a callback such that callback can be
called during the rendering which makes sure that all needed
conversations are available and using above step we can easily get the
portal containers.
Feel free to let me know if there are any issues with above strategy. 

### Better Pattern matching.

- Currently, when we are trying to identify the type of codeblock it
might result in unexpected output because of below reason.
1. Let say, we are trying to identify KQL Query and for that we use
below phrases to match in the `OpenAI` response.
        `'Kibana Query Language', 'KQL Query'`
2. Because of this, if the `OpenAI` response contains the phrase `KQL
query` or `kql query`, that fails because of case senstivity when
searching the above phrases.
    3. This PR makes that part of pattern matching case insensitive


### Before



b472178a-0145-42d8-8fb9-ab107915086a



### After


b499f099-a7a1-435f-99b2-ab27ee1f5680



### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
2023-07-11 12:09:33 -06:00
Kurt
323b0477e3
Changing where CodeEditor fields get useDarkMode value (#159638)
## Summary

Closes https://github.com/elastic/kibana/issues/157203
Closes https://github.com/elastic/kibana/issues/158051
Closes https://github.com/elastic/kibana/issues/158049

With the addition of Per User Dark Mode, components can no longer rely
on `uiSettings` as the source of truth for theme.

CodeEditor fields used to call `uiSettings` to determine if Dark Mode
was enabled, which had been provided in each callers Kibana React
Context.

The new source of truth for theme is the `CoreStart >
ThemeServiceStart`.

Currently, not all callers of CodeEditor provide the `theme` service in
their Kibana Context in a similar way and some callers don't provide it
at all.

This PR updates CodeEditor to get theme values from the Kibana Context
using a new `useKibanaTheme` react hook.

It also attempts audit the callers of CodeEditor to see if their Kibana
Context contains the theme service at the top level (Where I could add
theme to a caller's Context without major changes, I did. Some cases
will require CodeOwner guidance).

The new `useKibanaTheme` react hook will throw a TypeError if theme
isn't found in the top level of the Kibana Context, this will help with
testing as the component will not render. I will remove this after
testing so as not to introduce breaking changes.

## Testing

Please review files for which you are CODEOWNER.

I've attempted to tag all usages of `CodeEditor`/`CodeEditorFIeld` with
a TODO comment with one of the following scenarios:

1) a note where theme was provided already/where I made changes to
provide it in the appropriate context
2) I've asked for CODEOWNER guidance

For scenario 1, please pull and test that CodeEditor locally:

1. Enable Dark Mode from Edit User Profiles by clicking on the Profile
Icon on the top right, and updating your profile.
2. Navigate to the CodeEditors in the plugins you own. If they render
and display in Dark Mode - add a green check to the table below - and
you're done!
3. If it is not rendering, please help me figure out where the theme
service should be provided in the context.

For scenario 2, we will need to figure out where to make changes so your
context is providing theme. Some of the more complex usages may need to
addressed in separate issues.


## Tracking
| Team | Plugin | Theme in Context ? | Verified Working |
| - | - | - | - |
| apm-ui | apm | APM Storybook broken | ? |
| kibana-presentation | presentation_util | Yes. | Yes |
| response-ops | trigger_actions_ui | Yes | Yes |
| response-ops | stack_alerts | Yes | Yes |
| kibana-security | security  | Yes | Yes |
| security-defend-workflows | osquery | Yes | Yes |
| kibana-app-services | examples/expression_explorer | Yes | Yes |
| ml-ui | transform | Yes | Yes |
| ml-ui | ml | Yes | Yes |
| uptime | synthetics | Yes | Yes |
| kibana-gis | maps | Yes | Yes |
| kibana-gis | file_upload | Yes | Yes |
| platform-deployment-management | watcher | Yes | [AG] Yes |
| platform-deployment-management | snapshot_restore | Yes | [AG] Yes |
| platform-deployment-management | runtime_fields | Yes | [AG] Yes |
| platform-deployment-management | painless_lab | Yes | [AG] Yes |
| platform-deployment-management | ingest_pipelines | Yes | [AG] Yes |
| platform-deployment-management | index_management | Yes | [AG] Yes |
| platform-deployment-management | grokdebugger | Yes | [AG] Yes |
| platform-deployment-management | es_ui_shared | Yes | [AG] Yes |
| fleet | fleet | Yes | Yes |
| enterprise-search-frontend | enterprise_search | Yes | [AG] Yes |
| kibana-cloud-security-posture | cloud-security-posture | Yes | yes |
| sec-cloudnative-integrations | cloud_defend | Yes | Yes |
| kibana-visualizations/kibana-data-discovery | data | Yes | Yes |
| kibana-visualizations | examples/testing_embedded_lens | Yes | Yes |
| kibana-visualizations | vis_types | Yes | Yes |
| kibana-visualizations | vis_default_editor | Yes | Yes |
| kibana-visualizations | unified_search | Yes | Yes |
| kibana-visualizations | packages/kbn-text-based-editor | Yes | Yes |
| kibana-visualizatons | lens | Yes | Yes|
| kibana-core | saved_objects_management | Yes | Yes |
| kibana-presentation | inspector | Yes | Yes |
| kibana-presentation | canvas | Yes | Yes |
| kibana-data-discovery | discover | Yes | Yes |
| kibana-data-discovery | data_view_management | Yes | Yes |
| kibana-data-discovery | data_view_field_editor | Yes | Yes |
| appex-sharedux | advanced_settings | Yes | Yes |
| enterprise-search-frontend | serverless_search | Yes | [AG] Yes |
| - | - | - | - |

## Unit tests

Currently, many tests are failing since they are probably not providing
`theme` in the context. Once CODEOWNERs have weighed in on CodeEditors
usages that require discussion, I will update the accompanying tests.

## Release note
- Fixes theming of CodeEditors

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co>
Co-authored-by: Dima Arnautov <arnautov.dima@gmail.com>
2023-07-11 14:02:42 -04:00
Lisa Cawley
4ce8b3f4eb
[DOCS] Edits FormatNumber examples for rule action variables (#161678) 2023-07-11 10:39:30 -07:00
Xavier Mouligneau
dd292b70b7
[RAM] Remove allow slack channels (#161674)
## Summary

Remove allow slack channels feature for 8.9 until we have a better way
to deal with channels


### 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 10:25:20 -07:00
Kibana Machine
f4e9cd15d5 skip failing test suite (#157711) 2023-07-11 12:35:49 -04:00
Alexi Doak
b83f47560f
[Response Ops][Alerting] Allow runtime fields to be selected for Elasticsearch query rule type group by or aggregate over options (#160319)
Resolves https://github.com/elastic/kibana/issues/157258

## Summary

Gets the runtime_mappings from the es query, and includes them in the
query to retrieve the fields.
Also gets runtime mappings from data views.


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


### To verify

- Create a new Es Query rule using DSL
- Include runtime mappings in your query and verify that the runtime
fields are listed in the group by or aggregate over options below the
query
- Create a dataview and include runtime fields
- Create a new Es Query rule using KQL
- Verify that the runtime fields are listed in the group by or aggregate
over options below the query
2023-07-11 12:31:30 -04:00
Kevin Delemme
586e8db0d2
chore(slo): update open api spec (#161670) 2023-07-11 12:26:00 -04:00
christineweng
08a57b9e3a
[Security Solution] Add validations for insight form in timeline and rules (#161034)
## Summary

Currently user can add a note in timeline with invalid markdown syntax
in insight forms. Same goes to the investigation guide in rule creation
-> About.

### Before
**In timeline -> Notes**

![image](33b05592-f97a-41d8-a394-fc111f4cc039)


**On rules -> about**

![image](ca09ac1a-7798-4b13-820b-85e5cf0f61c7)


### After
**Timeline -> Notes**
Add note button should be disabled if markdown is invalid

![image](d34b0ab1-c39b-443a-a309-00aba251731e)

**On rules -> about**
Field is red if markdown is invalid

![image](850f9f4a-71a7-44f8-a9e1-bbfbdb07b0dd)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-11 11:13:02 -05:00
Shahzad
70ed200434
[Synthetics] De-dupe overview status request on load (#161627) 2023-07-11 17:55:49 +02:00
Tim Sullivan
787491e2bb
[Reporting] Allow Chromium to work by default in Docker (#149080)
## Summary

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


### Checklist

Delete any items that are not applicable to this PR.

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

## Release Note
Fixed a bug where Kibana Reporting would not work in Elastic Docker
without adding a special setting in kibana.yml.
2023-07-11 08:16:03 -07:00
Nathan Reese
a92432869f
[embeddable] add should_fetch unit test (#161596)
While messing around with time slider control and custom time ranges, I
noticed shouldFetch$ is triggered (turns out search session id is
changing - maybe a separate issue).

During investigation, I found it difficult to explore without unit test
for shouldFetch$.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-11 08:58:39 -06:00
Jon
9ab807796c
[ci] Add support for label ci:build-serverless-image (#161583)
Adding the label `ci:build-serverless-image` will build and push the
serverless image to our registry. The url will be available as an
annotation at the top of Buildkite

Closes https://github.com/elastic/kibana/issues/161562
2023-07-11 07:58:24 -07:00
Kibana Machine
32b06938be skip failing test suite (#161514) 2023-07-11 10:41:32 -04:00
Ievgen Sorokopud
9b6ad7280d
[Security Solution] Rule is created when the conditional logic "If alert matches a query" is left blank (#159690)
## Summary

Original ticket: https://github.com/elastic/kibana/issues/156706

These changes prevent user from creating/updating the rule when alert
filter is selected and query left blank on the rule's action page. We
gonna show an error saying "A custom query is required." in this case.

<img width="1739" alt="Screenshot 2023-06-14 at 14 36 35"
src="0456f211-603c-44d9-9271-9cfdf59f12b6">

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-11 16:27:24 +02:00
Adam Demjen
8f01d85966
[8.10] [ESRE] Filter already attached pipelines (#161590)
## Summary

Filter out pipelines from the existing pipeline selection dropdown that
are already attached to the current index. This also updates the
evaluation of the "Existing pipeline" option in the configuration panel.

Example: 2 pipelines that are already attached are filtered from the
dropdown; when attaching the 3rd one, the existing pipelines option is
disabled.

![filter_attached_pipelines](b401fcc4-e72a-4f62-ac37-a20dfab106f6)

### 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 07:23:37 -07:00
amyjtechwriter
811fb7c4fd
[Docs] Try to make it clear drilldows only available in dashboard (#161469)
## Summary

Issue [raised on
Slack](https://elastic.slack.com/archives/C0D8P2XK5/p1688661541837369)
that it was a bit unclear on our [docs
page](https://www.elastic.co/guide/en/kibana/8.8/maps-create-filter-from-map.html#maps-spatial-filters)
that to use drilldowns you had to embed your map in Dashboard, and can't
be used from the Maps application.

Original:
<img width="808" alt="Screenshot 2023-07-07 at 15 32 27"
src="176e7f22-1bb3-4dd0-95d5-4a601487aa6b">

Updated:
<img width="843" alt="Screenshot 2023-07-07 at 11 47 45"
src="4d33a39f-2cee-4097-b730-3b24d613c498">

---------

Co-authored-by: David Kilfoyle <41695641+kilfoyle@users.noreply.github.com>
2023-07-11 15:08:31 +01:00
Marta Bondyra
6b3a29b4ec
[Lens] fix drag and drop small styling details (#161121)
## Summary

Fixes two subtle visual drag and drop thingies:

1. When reordering, the styles should look slightly differently:
before:


b0f0d053-f6cc-414b-96cb-0b8ad892b613

after:


c52f8786-72e2-4ef3-a943-8050d7acf348

2. When picking up a dragging item, the whole dimension panel is jumping
very slightly because we add `border`:

before:


8efa71ec-d449-4dc9-8390-d4c33c62c1e0

after:


dbec7e64-5cb3-4b32-afcc-2c376cfda4a2
2023-07-11 09:56:16 -04:00
Marta Bondyra
7e7293a520
[Lens] Fix a11y issues & small styling issues (#161073)
## Summary

Fixes the following issues:

1. Suggestions are not reachable by keyboard navigation (it was actually
broken when fixing the [accesibility axe
warning](https://github.com/elastic/kibana/issues/154787), I ran it now
and it doesn't show now)


46c9eb70-4df7-462b-a878-b7d190aaf8c9

2. Dimension removal button is not reachable by keyboard navigation

before:


5011679b-b05a-48ca-a877-bbc940607b56

after:


9d056512-a622-4c1c-aa5b-242e2762e9ae

3. The padding for the reordering groups got a distance between the
empty dimension button (btw I have more little fixes for drag and drop
look but want to submit it in a separate PR to not ping here Discover
team):
 
<img width="421" alt="Screenshot 2023-07-03 at 17 42 41"
src="a1d22267-07b6-4179-89f9-b4c7ec5da030">
<img width="459" alt="Screenshot 2023-07-03 at 17 39 11"
src="a7b697ca-4ff3-4c18-bf96-a8710615a9df">

4. The focus outline for dataview selector and layer chart selector got
a nicer rectangular shape

before:
<img width="343" alt="Screenshot 2023-07-03 at 10 50 52"
src="0ca305b8-cdbf-4c43-b73d-0058046ab919">
<img width="360" alt="Screenshot 2023-07-03 at 17 41 18"
src="54e61646-5d4e-4512-b6e1-6d758e2b7498">

after:
<img width="350" alt="Screenshot 2023-07-03 at 11 11 01"
src="8ddd81dd-8072-4cf8-a98b-ae5eb9998add">
<img width="415" alt="Screenshot 2023-07-03 at 17 39 51"
src="1c36b3bd-cb15-4cb8-858e-92fc19e3181f">

5. The focus outline was corrected for dimension buttons. I also
refactored code here to make margins, paddings and gaps the property of
the containers and not the items themselves. I think this way it's more
correct.

before:

<img width="418" alt="Screenshot 2023-07-03 at 17 40 54"
src="b8ce4a22-dc69-44a7-8689-70928340ac24">

after:


712e2ac8-f81d-4896-b384-164fc2854766
2023-07-11 15:51:58 +02:00
Ashokaditya
f6f5986376
[Security Solution][Endpoint] Unskip mocked response actions history cypress test (#161533)
## Summary

Unskip test that was timing out at indexing test hosts. The timeout has
since been increased in elastic/kibana/pull/159518

It was added in elastic/kibana/pull/157777 and skipped in
elastic/kibana/pull/156933 thus should be backported to `8.8.1` and
`8.9.0`
2023-07-11 06:41:35 -07: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
672c90a9c1
[Dashboard] Panel settings action improvements (#161616)
## Summary

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

- Replaces the Edit panel settings text with the simpler Panel settings
- Replaces the documentation
- Replaces the icon

<img width="1757" alt="image"
src="e0ea6c19-8a65-44b8-906e-c364c00536a0">

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
2023-07-11 16:22:57 +03:00
Dmitrii Shevchenko
a5627bec57
[Security Solution] Fix endpoint permissions for rule installation and update (#161641)
**Related to: https://github.com/elastic/kibana/issues/161443,
https://github.com/elastic/kibana/pull/161454**

## Summary

The `access:securitySolution-all` access level prevents a properly
configured role from installing or updating detection rules. This PR
aligns the access level for the `installation/_perform` and
`upgrade/_perform` endpoints with the rest of the detection engine APIs.

### Test instructions

Configure a role with the following permissions:

```json
{
  "test": {
    "cluster": [],
    "indices": [
      {
        "names": [
          ".alerts-security.alerts-default",
          ".lists-default",
          ".items-default"
        ],
        "privileges": [
          "read",
          "write",
          "view_index_metadata",
          "maintenance"
        ],
        "field_security": {
          "grant": [
            "*"
          ]
        },
        "allow_restricted_indices": false
      }
    ],
    "applications": [
      {
        "application": "kibana-.kibana",
        "privileges": [
          "feature_siem.all"
        ],
        "resources": [
          "*"
        ]
      }
    ],
    "run_as": [],
    "metadata": {},
    "transient_metadata": {
      "enabled": true
    }
  }
}
```

Call the upgrade/install APIs on behalf of that role to see that no 403
is returned:

```sh
curl --location 'http://localhost:5601/kbn/internal/detection_engine/prebuilt_rules/installation/_perform' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
    "mode": "ALL_RULES"
}'

curl --location 'http://localhost:5601/kbn/internal/detection_engine/prebuilt_rules/upgrade/_perform' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
    "mode": "ALL_RULES"
}'
```
2023-07-11 15:07:35 +02:00
Aleh Zasypkin
cdc862a618
[Serverless] Allow authentication via the Elasticsearch JWT realm with the shared_secret client authentication type. (#161564) 2023-07-11 15:06:34 +02:00
Marta Bondyra
95e50875e1
[Lens] Remove <NativeRenderer /> (#161521)
## Summary

The NativeRenderer component is currently used to mount another
component in a separate mounting point. As far as I recall, we
introduced <NativeRenderer/> to allow users to create visualizations in
non-React frameworks. The idea was that users could write their own Lens
visualizations or datasources code and integrate it with our system.
However, it seems that this concept hasn't gained traction and we don’t
have it prioritized. Even if users express interest in writing their
visualizations outside of React, it is still possible to do so with some
additional boilerplate code (which we could provide as an example
non-React visualization).
Pros:

1. Simplifies and shortens the code:
1.1. Testing and debugging become easier as we no longer need to check
separate React trees when integrating frame, data source, and
visualization components.
1.2. Components communicate using standard React patterns, making
maintenance and comprehension simpler.
1.3. Context providers no longer need to be passed to each separate
component since they are already within the context.
1.4. Easier propagation of events or any other form of inter-component
communication.

2. Greatly improves performance and facilitates maintenance:
2.1. Directly accessing context inside the DatasourcePanel eliminates
the need for context passing, resulting in better performance.
2.2. Removing the requirement for a separate React root also contributes
to improved performance.

3. The render method will be removed when we upgrade to React 18. While
we could replace it with the new createRoot method, it makes sense to
perform some cleanup ;)

Cons:
1. Setting up non-React visualization or data source code might become
slightly more complex.

Performance improvement for drag and drop action with these changes:

before:

<img width="1110" alt="Screenshot 2023-07-10 at 07 14 39"
src="45a1b09b-5189-46f5-af2b-7781fcf4e774">

after:

<img width="1117" alt="Screenshot 2023-07-10 at 07 16 24"
src="0e704da1-3220-4eb9-8fa0-cc3584a90090">

## Single render when dragging:

(the first image is 3 screenshots from 3 different react roots as they
have separate mounting point. The complete render time is ~380ms)
<img width="1117" alt="Screenshot 2023-07-10 at 07 16 24"
src="6d7f2d9f-a758-476e-8efb-38693ae90097">

After we have one common render tree. Because we don't have to pass
context down as a prop, we greatly reduced the number of components
rerendered. (I will be working on reducing the render time for workspace
panel as this seems to still be a bottleneck point)
<img width="732" alt="Screenshot 2023-07-10 at 14 52 41"
src="03ec97b3-8225-490e-8884-0fd4e69587e8">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-11 14:05:45 +02:00
Ashokaditya
5d066944fc
[Defend Workflows] Unskip policy response test (#161588)
## Summary

Unskip test that was timing out at indexing test hosts. 
The timeout has since been increased in elastic/kibana/pull/159518

Was added in elastic/kibana/pull/154505 and skipped in
elastic/kibana/pull/156104
2023-07-11 13:58:42 +02: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
Marta Bondyra
91a0d2f454
[Lens] Refactor drag and drop (#161257)
## Summary

When I created drag and drop for Lens, the API I went for was not the
most readable one. It was designed this way because I wanted to gain
some performance, but it was very hard to maintain the performance gain
with a lot of changes in the drag and drop area because all the pieces
of the code needed to memoized in a tricky way and it wasn't
communicated well.
In the end it works even without these tricks so I decided to simplify
it in this PR.

The main changes include:

1. Instead of multiple `useState` per parameter, we keep all the state
in reducer both for `ReorderProvider` and `RootDragDropProvider`. Thanks
to that we get multiple improvements:
2. The code in `DragDrop` component becomes more descriptive as we don't
run multiple state updates when user executes an action but one state
update describing what actually happens (eg. `dispatchDnd({type:
'selectDropTarget' ....})`. The internal logic of the update lives in
the reducer.
3. We don't have to pass `trackUiCounterEvents` as another prop to
`DragDrop` and run it wherever we need - instead we pass it as a
middleware to the context and run before dispatching (and it's very easy
to add more middlewares if we need extra integrations at some point!)
4. We also run a11y announcements as a middleware instead of inside
`DragDrop` component
5. The `ChildDragDropProvider` props look much cleaner:
    before:
```
      <ChildDragDropProvider
        keyboardMode={keyboardModeState}
        setKeyboardMode={setKeyboardModeState}
        dragging={draggingState.dragging}
        setA11yMessage={setA11yMessage}
        setDragging={setDragging}
        activeDropTarget={activeDropTargetState}
        setActiveDropTarget={setActiveDropTarget}
        registerDropTarget={registerDropTarget}
        dropTargetsByOrder={dropTargetsByOrderState}
        dataTestSubjPrefix={dataTestSubj}
        onTrackUICounterEvent={onTrackUICounterEvent}
      >
        {children}
      </ChildDragDropProvider>
```
after:
```
<ChildDragDropProvider value={[state, dispatch]}>{children}</ChildDragDropProvider>
```
6. Created custom hook `useDragDropContext` instead of using
`useContext(DragContext)` and making DragContext private. This way we
will avoid potential problems with using context outside of root.
7. Bonus thing - if we ever decide to move to redux, the structure is
there already



What I am still not happy with is that the tests are very
domain-dependant instead of user-driven - instead of checking the store
actions, I should check the interface from the user perspective. I will
try to work on it once I find some time between more important tasks
though.
2023-07-11 13:05:03 +02:00
Tomasz Ciecierski
203c9b04b6
[Defend Workflows] Fix response actions copy (#161615) 2023-07-11 12:49:58 +02:00
Sébastien Loix
7ea0dd6b11
[TableListView] Fix dark mode for content editor (#161570) 2023-07-11 03:37:15 -07:00
Sander Philipse
8228c2afc2
[Enterprise Search] Remove GitHub connector and GCS native (#161620)
## Summary

This removes the GitHub connector (which is not ready yet) and moves the
Google Cloud Storage connector to non-native.
2023-07-11 03:06:01 -07: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
Jean-Louis Leysens
bda0195982
[http] Fix running FTR tests locally (#161336)
## Summary

Running FTR tests locally (not on CI) that make API requests to public
versioned Kibana endpoints is currently broken. This is because:

* we require version headers to be set for both internal and **public**
endpoints in **dev** by way of a runtime check (ensures our code is
locked to a version)
* the vast majority of FTR tests do not set these headers for talking to
public endpoints
* on CI, this is different as we run these tests against a distributable
build (i.e., non-dev)

This manifests locally as a 400 response. E.g. the current
api_integration tests for data views by running:

```
node scripts/functional_test_runner.js --config ./test/api_integration/config.js --grep 'index_pattern_crud'
```

---

There are a few ways to resolve this, this PR proposes that we:

* Keep FTR tests as they are (i.e., don't update all of them to set
headers when making requests to public versioned endpoints), this is a
useful way to exercise our intended end-user behaviour
* Make the version resolution behaviour not depend on `--dev`: rather
set the default resolution to `none` (new setting) when we run in
`--dev` so that it can be configured to behave as we want for tests.

In this way we keep the runtime check for its intended purpose and can
run our FTR tests "as end users" of our endpoints.

---

Close https://github.com/elastic/kibana/issues/161435
2023-07-11 11:51:05 +02:00
Georgii Gorbachev
15a86c355a
[Security Solution] Move test plans from /cypress to /docs (#161517)
**Related to:** https://github.com/elastic/security-team/issues/6867
(internal)

## Summary

As requested in
https://github.com/elastic/kibana/pull/160685#issuecomment-1621635262.

In test plans, we mention how scenarios are going to be automated --
whether a given scenario will be automated using Cypress for e2e tests,
Jest for integration tests and unit tests, etc. But currently, test
plans are under `x-pack/plugins/security_solution/cypress/`.

Since test plans are in fact technology agnostic, it does not make much
sense to keep them inside a specific framework technology folder. That's
why we're moving them to a generic
`x-pack/plugins/security_solution/docs/testing` folder.
2023-07-11 02:27:00 -07:00
Walter Rafelsberger
a39531edce
[ML] Explain Log Rate Spikes: Reenable API integration tests. (#160180)
Fixes #155737. This passed 350 flaky test runner runs, reenabling. These API
integration tests were missing from CODEOWNERS, adding that in this PR
too (`/x-pack/test/api_integration/apis/aiops/ @elastic/ml-ui`).
2023-07-11 11:21:43 +02:00
Gerard Soldevila
5396f1be91
Move some IT to a separate group (#161535)
The goal is to prevent the following warning and reduce overall CI
times:

```
The following "Jest Integration Tests" config has a duration that exceeds the maximum amount of time desired for a single CI job. This is not an error, and if you don't own this config then you can ignore this warning. If you own this config please split it up ASAP and ask Operations if you have questions about how to do that.

src/core/server/integration_tests/saved_objects/migrations/group3/jest.integration.config.js: 40.7 minutes
```

Source https://buildkite.com/elastic/kibana-pull-request/builds/140963
2023-07-11 10:35:45 +02: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
Sébastien Loix
31c081a1d7
Add cloud links in serverless.yml (#161534) 2023-07-11 09:23:25 +01:00
Jill Guyonnet
557dc27eb4
[Fleet] Add format query param to package policies API (#160921)
Closes https://github.com/elastic/kibana/issues/155044

## Summary

This PR implements a new `format` query parameter for the package
policies API endpoints that return one or a list of package policies.
This parameter is optional and is allowed the following two values:
* `legacy` (default behaviour): the package policy inputs are formatted
as they are currently, i.e. in an array.
* `simplified`: the package policy inputs are formatted in a key-value
map, which is the new preferred format.

Example:
```
GET kbn:/api/fleet/package_policies -> current format (array) for inputs
GET kbn:/api/fleet/package_policies?format=simplified -> new simplified format (map) for inputs
GET kbn:/api/fleet/package_policies?format=legacy -> current format (array) for inputs
GET kbn:/api/fleet/package_policies?format=foo -> 400 bad request
```

Endpoints with the new `format` query parameter:
* [GET
/package_policies](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#getPackagePolicies)
* [GET
/package_policies/{packagePolicyId}](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#getPackagePolicy)
* [POST
/package_policies](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#createPackagePolicy)
* [POST
/package_policies/_bulk_get](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#bulkGetPackagePolicies)
* [PUT
/package_policies/{packagePolicyId}](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#updatePackagePolicy)

Unaffected endpoints:
* [DELETE
/package_policies/{packagePolicyId}](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#deletePackagePolicy)
* [POST
/package_policies/delete](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#postDeletePackagePolicy)
* [POST
/package_policies/upgrade](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#upgradePackagePolicy)
* [POST
/package_policies/upgrade/dryrun](https://www.elastic.co/guide/en/fleet/master/fleet-apis.html#upgradePackagePolicyDryRun)
(⚠️ TO CHECK)

Note: with this implementation, it is possible in the `POST
/package_policies` and `PUT /package_policies/{packagePolicyId}`
endpoints to provide an inputs list in the deprecated array format and
still get the inputs in the new map format in the response by passing
`?format=simplified`. Conversely, it is possible to pass a map in the
body and get an array in the response.

⚠️ **Important**: as can be seen in the failing CI builds, adding the
`format` query param to `GET /package_policies` caused requests such as
```
GET /api/fleet/package_policies?perPage=10000&page=1&kuery=ingest-package-policies.package.name%3Atomcat
```
to fail with 400 Bad Request as `perPage`, `page` and `kuery` were not
listed as query params in the schema. I've added them, which fixed the
tests, but this might be risky, as I'm not sure whether this is also
needed elsewhere.

### Swagger screenshots

See [latest
commit](7dc8da691f/x-pack/plugins/fleet/common/openapi/bundled.json#/).

![Screenshot 2023-07-07 at 12 19
24](9888437d-4160-4aaa-82ee-5b0a1a2237a5)

![Screenshot 2023-07-07 at 12 19
32](6ab0a91b-d191-410a-be45-ff9c59c20eae)

![Screenshot 2023-07-07 at 12 19
43](608b6ea1-73e0-4481-88ad-3098d159da67)

![Screenshot 2023-07-07 at 12 20
07](9d6e6b6f-1138-42b1-a1e0-8d86db104e55)

![Screenshot 2023-07-07 at 12 20
23](5e02daba-4643-498b-9572-09ddffa51fc3)

### Checklist

Delete any items that are not applicable to this PR.

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

### 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-07-11 10:16:51 +02:00
Nikita Indik
c30a7d47eb
[Security Solution] Tests: Filter by rule execution status (#160502)
**Resolves: https://github.com/elastic/kibana/issues/138903**

## Summary

Adds an E2E Cypress test to check filtering by execution status in the
rules table.
<img width="953" alt="Screenshot 2023-06-26 at 14 10 10"
src="e1eb67ed-779c-42ad-8194-04a26598cfbc">
2023-07-11 10:12:37 +02:00
Katerina Patticha
8e80f192e3
Cypress for observability serverless (#160674)
Created a separated PR in order setup a basic setup for cypress and test
https://github.com/elastic/kibana/pull/160620 for serverless.


 Basic setup to run cypress for serverless-oblt

#### How to  run it 

from
`x-pack/test_serverless/functional/test_suites/observability/cypress`
```
yarn cypress:serverless:open
```


![image](8ba7dd80-a9a4-4777-898b-4d9f39bee118)
2023-07-11 09:43:06 +02:00
Philippe Oberti
a792697f41
[Security Solution] expandable flyout - move visualizations section up (#161549) 2023-07-11 09:08:59 +02:00
Philippe Oberti
33ece6eea8
[Security Solution] expandable flyout - rename description section to about (#161547) 2023-07-11 07:10:39 +02:00
Kibana Machine
0e1477a0de
[api-docs] 2023-07-11 Daily api_docs build (#161612)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/395
2023-07-11 01:04:18 -04:00