Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kbn-server-route-repository] Support returning IKibanaResponse #2

Closed
wants to merge 1,002 commits into from

Conversation

miltonhultgren
Copy link
Owner

Summary

This PR changes registerRoutes to:

  1. Pass the response object into the handler inside of the wrappedHandler to give access to the route handler to create Kibana responses
  2. Check if the result of the handler is already a Kibana response and only wrap it into a Kibana response if it isn't.

jughosta and others added 30 commits April 30, 2024 00:08
- Related to elastic#181662

## Summary

This PR adds a `timeout` param so "View all matches" functionality does
not create long running requests.

For testing I used oblt edge cluster with
`remote_cluster:logs*,kibana_sample_data_logs` as an index pattern and
`css*` as a query.
## Summary

Enables ES|QL in serverless.

I am working on tests on a follow up PR
elastic#181570

This is going to be merged when ES is being merged
elastic/elasticsearch-serverless#1588

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
… to generate correct ES|QL queries etc (elastic#181001)

## Summary

Sets the index pattern correctly in the obs ai assistant. 
The Obs ai assistant is part of Discover in serverless Oblt project and
can also be set up everywhere from the Observability AI Assistant scope
advanced setting. It is a very useful tool for the Discover users and
for moving from KQL to ES|QL world.

This is important for prompts such as:

- Transform the KQL and filters to ES|QL


![meow](https://github.com/elastic/kibana/assets/17003240/e9b1be13-667a-4fdb-addb-fb77e485b99e)

- More

<img width="579" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/91b6b0ac-754f-47f3-98a2-ed09e7be646b">


Other interesting prompts:

- Equivalent of KQL of where filters

<img width="640" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/f203bc5e-a037-49c9-9e6c-5e68c9fcb864">

- Explain the ES|QL query
<img width="658" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/b2f9abfb-577d-4c06-b715-553ebd626e28">


- Run questions on your dataset and unified search bar selection
<img width="687" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/e095ced8-5bf9-4846-ac54-644c4fd8de04">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Typescript was temporarily out, so some type issues snuck in.
This PR attempts to fix it, by adding missed field
`enableTogglingDataRetention` on type `RouteDependencies`

---------

Co-authored-by: Ignacio Rivas <rivasign@gmail.com>
## Summary

Validation:
 - [x] RREs checked locally
 - [x] Pipelines staged
- [x] kibana / single-user-performance
(https://buildkite.com/elastic/kibana-migration-pipeline-staging/builds/62
✅ )
- [x] kibana / performance-data-set-extraction
(https://buildkite.com/elastic/kibana-migration-pipeline-staging/builds/60#018f0b96-7703-4e36-9924-f405073d0747
✅ )
- [x] kibana / scalability-benchmarking
(https://buildkite.com/elastic/kibana-migration-pipeline-staging/builds/68
✅ )
- [x] kibana / apis-capacity-testing
(https://buildkite.com/elastic/kibana-migration-pipeline-staging/builds/60#018f0b96-7703-4e36-9924-f405073d0747
✅ )
 - [x] 7.17 / 8.14 validation ( ⚪  not needed, no branch builds set up)


Part of: elastic/kibana-operations#79

Migrates: 
- kibana / single-user-performance
[kibana-performance-daily.yml](https://buildkite.com/elastic/kibana-single-user-performance)
- kibana / performance-data-set-extraction
[kibana-performance-data-set-extraction-daily.yml](https://buildkite.com/elastic/kibana-performance-data-set-extraction)
- kibana / scalability-benchmarking
[scalability_testing-daily.yml](https://buildkite.com/elastic/kibana-scalability-benchmarking-1)
- kibana / apis-capacity-testing
[kibana-apis-capacity-testing-daily.yml](https://buildkite.com/elastic/kibana-apis-capacity-testing)

chore(BK): Migrate batch 7 - performance and testing

Depends on: https://elasticco.atlassian.net/browse/ENGPRD-524
…stic#182006)

## Summary

Update search tag from "Connectors" to "Connector"


### Checklist

Delete any items that are not applicable to this PR.

- [ ] [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
…text api to generate correct ES|QL queries etc (elastic#181001)" (elastic#182088)

This reverts commit 9edb9d5.
…es (elastic#182001)

Related to elastic#180677
closes elastic#181886

There's still a small difference on the CO2 values, but that's due to
different formats returned by ES apis:
```
TopN Functions
"self_annual_co2_tons": 0.0068555964801996295

Flamegraph
"AnnualCO2TonsInclusive": [
    0.0069,
```

After:
<img width="1765" alt="Screenshot 2024-04-29 at 16 34 57"
src="https://github.com/elastic/kibana/assets/55978943/092a704f-69fe-4dd0-99d5-9ac9bce77188">
<img width="1788" alt="Screenshot 2024-04-29 at 16 35 03"
src="https://github.com/elastic/kibana/assets/55978943/da4a1406-fad7-48de-81ac-e8aae64cba67">
## Summary
The PR elastic#182001 was verified at a
point where typechecking was missing for a bit, this allowed a missing
field to slip in. This PR tries to fix it.
## Summary
As usual, the diff through the migration revealed some drifting between
our assumed defaults and the defaults on the new infra.

This PR re-adjusts the settings to how it was before the migration.
…ges in entity risk tabs (elastic#180954)

## Summary

This PR adds a check against the risk scoring privileges and shows the
appropriate message in case they are missing.
Previously, in the entity pages, if a user did not have the correct
privileges, clicking on the risk tab would show a message to "Enable
risk scoring". This was incorrect as the risk engine could be enabled
but the user might not have the permissions to view risk scores.

Previously, in **Hosts/Users page -> Host risk / User risk tab**

![image](https://github.com/elastic/kibana/assets/2423976/0d3f8073-0e5b-4e71-91b0-7d8e3fd5357c)

Now:
![Screenshot 2024-04-16 at 17 41
34](https://github.com/elastic/kibana/assets/2423976/304e8af9-54af-4acf-9037-58316734bd15)


## How to test

1. Create a role which has access to all security related indices and
Security Permissions.
2. Ensure that the user does not have permissions to view the
`.risk-score*` index
3. Create a new user with said role from step 1
4. Login with that user and navigate to **Hosts/Users page -> Host risk
/ User risk tab**
…g added by bulk actions select all (elastic#182007)

## Summary

Related issue: elastic#181972

When the useBulkActions hook in the alerts table is used with the
optionally defined at registration time hook useBulkActionsConfig, and
that hook returns a stable array, the hook calls a function that mutates
this array directly, which causes duplicate items to appear in the alert
context menu. This is due to the useBulkActions hook using the bulk
actions state via context, and so runs every time a user selects a
row/all rows. Doing this via filter might not be the most performant
way, but in order to have everything referentially stable, I think the
arguments to useBulkActions/useBulkUntrackActions should be changed a
bit, but that can be a discussion for another time. The test case added
below will currently fail on main/8.14.

Before:

![bulk_actions_with_dupe](https://github.com/elastic/kibana/assets/56408403/7f730bb9-fcb2-4a8e-93f8-3e08523e3a34)


After:

![bulk_actions_no_dupe](https://github.com/elastic/kibana/assets/56408403/01f76c6b-59fb-459f-8950-1fc1fe8dfe12)


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

Refactors the Observability AI Assistant server-side client. Instead of
using a mix of promises and Observables, we know use Observables where
possible. This leads to more readable code, and makes things like error
handling and logging easier.

This refactor purposely leaves the existing tests in place as much as
possible. The functionality has however been broken into separate
functions so we should be able to break up the existing tests into
smaller pieces.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…gins/observability_solution` (elastic#181970)

## Summary

Title says it all.
…rt of the integration (elastic#182097)

Closes elastic#181542

## 📝  Summary

This PR uses`IndicesDataStream` metadata info to determine whether a
non-default dataset belongs to an integration or not

## 🎥 Demo

### Before changes


https://github.com/elastic/kibana/assets/1313018/23fbbb9d-ae52-4e30-b525-8176f89d6462


### After changes


https://github.com/elastic/kibana/assets/1313018/5423dba2-fbcf-47b4-87b7-2987f5a1f6d2

---------

Co-authored-by: mohamedhamed-ahmed <mohamed.ahmed@elastic.co>
…1391)

A fix for the way the human precise formatting is handled when duration formatting is applied. It changes the calculation of the fractional part to be based on seconds.

Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@elastic/charts](https://togithub.com/elastic/elastic-charts) |
[`64.0.2` ->
`64.1.0`](https://renovatebot.com/diffs/npm/@elastic%2fcharts/64.0.2/64.1.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@elastic%2fcharts/64.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@elastic%2fcharts/64.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@elastic%2fcharts/64.0.2/64.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@elastic%2fcharts/64.0.2/64.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>elastic/elastic-charts (@&elastic#8203;elastic/charts)</summary>

###
[`v64.1.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#6410-2024-03-13)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v64.0.2...v64.1.0)

##### Features

- **theme:** move annotation default styles to `Theme`
([#&elastic#8203;2357](https://togithub.com/elastic/elastic-charts/issues/2357))
([fe19ae2](https://togithub.com/elastic/elastic-charts/commit/fe19ae2cec3077ee34765d9be560935dd094a4ad))

####
[64.0.2](https://togithub.com/elastic/elastic-charts/compare/v64.0.1...v64.0.2)
(2024-03-12)

##### Bug Fixes

- **bullet:** full circle overlapping tick labels
([#&elastic#8203;2350](https://togithub.com/elastic/elastic-charts/issues/2350))
([edbff68](https://togithub.com/elastic/elastic-charts/commit/edbff681737ba319b455c81604e5ffff02b89f17))
- **deps:** update dependency
[@&elastic#8203;elastic/eui](https://togithub.com/elastic/eui) to ^93.3.0
([#&elastic#8203;2356](https://togithub.com/elastic/elastic-charts/issues/2356))
([cf9ce81](https://togithub.com/elastic/elastic-charts/commit/cf9ce81c08b8d0ae93fce48504d2de3539d045d0))
- **deps:** update dependency
[@&elastic#8203;playwright/test](https://togithub.com/playwright/test) to
^1.42.1
([#&elastic#8203;2354](https://togithub.com/elastic/elastic-charts/issues/2354))
([03581bc](https://togithub.com/elastic/elastic-charts/commit/03581bc44fae02309af9fbfa42c297f7414ec156))

####
[64.0.1](https://togithub.com/elastic/elastic-charts/compare/v64.0.0...v64.0.1)
(2024-03-10)

##### Bug Fixes

- **bullet:** add a11y summary and debugState
([#&elastic#8203;2352](https://togithub.com/elastic/elastic-charts/issues/2352))
([49a1b35](https://togithub.com/elastic/elastic-charts/commit/49a1b358b21fbda4e15a96ce984d460786396899))
- **deps:** update dependency
[@&elastic#8203;elastic/eui](https://togithub.com/elastic/eui) to ^93.2.0
([#&elastic#8203;2343](https://togithub.com/elastic/elastic-charts/issues/2343))
([0701985](https://togithub.com/elastic/elastic-charts/commit/0701985a470ed98936439ccf4e21bb1d52df5e18))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/elastic/kibana).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNDUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
… to generate correct ES|QL queries etc (elastic#182090)

## Summary

Reverting the revert of
elastic#181001 (comment)

the only change is the removal of the ml plugin dependency from the
obs-ai-assistant

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Resolves elastic#181618 by adding
delete by query AutoComplete for the query.

Here's what it looks like now: 


https://github.com/elastic/kibana/assets/63422879/ff2c0c18-4f1e-41f3-b18d-b9a4a5377dd1

Also fixes a syntax issue with rule query AutoComplete where we added an
extra `query` that would result in a syntax error.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary

Parent Issue: elastic#157883
Issue: elastic#181263

Versions the GET rule endpoint with added input and output validation.

```
GET /internal/alerting/rule/{id}
GET /api/alerting/rule/{id}
```
### 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
## Summary
Parent Issue: elastic#157883
Issue: elastic#179669

Versions the `PATCH /internal/alerting/rules/_bulk_enable` endpoint with
added input and output validation.

### 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>
updates the `limits.yml` to reflect that Canvas is actually _much_ smaller than it appears.
…80321)

Fixes elastic#180218

## Summary

This PR fixes the highlighting issue in the Monaco editor that is caused
when using a theme in the output panel that is different from the theme
in the editor. This fix is implemented by unifying the themes for both
editors into one.

The PR also fixes the issue with Console theme overwriting theme in
other code editors (e.g. embeddable Console in the index detail tabs) by
reusing the `euiTheme`.

Note: This solution changes some of the original highlighting colors in
Console (e.g. comments were green and now they are grey, background
color is also different now). We might be able to fix the text colors by
specifying unique token names in the Console language (e.g. using
`consoleComment` instead of `comment` token name). cc: @yuliacech


https://github.com/elastic/kibana/assets/59341489/d77d4ea3-61b5-43fa-81ef-7e4ac239aadd



https://github.com/elastic/kibana/assets/59341489/1dab2eca-08e5-421b-acd4-38e0b3d91a3e


<img width="1494" alt="Screenshot 2024-04-22 at 15 34 45"
src="https://github.com/elastic/kibana/assets/59341489/a4241574-77ad-42db-8707-ae38761d52d0">




<!--
### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

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

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

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

| Risk | Probability | Severity | Mitigation/Notes |

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


### For maintainers

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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Part of elastic/kibana-team#769

## Summary

This PR adds a "created by" filter to the dashboard listing page. We've
added the created_by field recently
[here](elastic#179344) so only newly
created by interactive users dashboards will be populated with
`created_by`

### Demo 

<img width="1510" alt="Screenshot 2024-04-25 at 16 32 03"
src="https://github.com/elastic/kibana/assets/7784120/ac70ffea-05be-4d70-bbfa-c1cc9d5dd747">

<img width="1510" alt="Screenshot 2024-04-25 at 16 32 11"
src="https://github.com/elastic/kibana/assets/7784120/9889ccae-08d0-4fb6-977e-c42e85337e0e">


### Implementation notes

#### Suggesting users

We suggest only the users that have at least one dashboard. We do this
by aggregating dashboard saved objects by `created_by`. Because we don't
have server-side pagination or sorting yet, in this initial version, I
decided to do this client-side to keep it as simple as possible for now.

Initially, I did this server-side inside a dashboard plugin as an
internal API route. In the long term, this should probably be moved to
content management in some form, but it is not clear how it should look
yet. This is the commit where I reverted and moved it to client-side
elastic@06316ee

#### Clint side filtering 

The user filter is simply a client-side filter because we anyway
currently have an in-memory table with client-side sorting and
pagination. There is no much practical value in server-side filter atm
The filter allows to filter-in by multiple users. It also allows to
filter items without creators

#### `created_by` filter isn't part of the query string

I introduced a separate state for this filter, similar to `tableSort`
and `pagination`. The reason why the `created_by` filter isn't a part of
the `searchQuery` is because we use `profile_id` which looks ugly for
the user, e.g. `u_mGBROF_q5bmFCATLXAcCwKa0k8JvONAwSruelyKA5E_0` so we
can't just add it to a user-facing search query like we do with tags.
`profile_id` is the correct identified we should use, `username` might
not be enough in some cases + `username` in cloud is unreadble account
number. The best alternative could be email, but it isn't always
available. This is why I decided to keep the `created_by` filter hidden
from the user behind the user picker popover and not expose it to the
search bar. The `created_by` filter is synced into the URL just like the
rest of the table state.

#### No distinguishing the current user

There is no logic in place that somehow highlights or renames the
current user in the filter. This can be added, but to limit the scope of
the MVP I didn't do it.


#### User filter component 

We use the `UsersProfilePopover` provided by the security team. We use
it without any overrides, so the component decides how to show users in
a popover. I noticed a small visual issue with an email truncation in a
smaller popover. Might be worth a separate issue.



### Testing 

1. Create multiple new users 
2. Login for each of them 
3. Created a dashboard for each of them 
4. Play with the filter 


#### Next Steps 


The next step would be to add a column with the user: 


![image
(5)](https://github.com/elastic/kibana/assets/7784120/9a3fe30e-6a41-4718-a7aa-53fbe0affd22)
…lastic#181165)

## Summary

Added endpoint `GET kbn:/internal/security/roles/{space-id}` to get all
roles for provided space id.

**Note**: changes needed for application `*` privileges were
cherry-picked [to a separate
PR].(elastic#181400)

## Example
Request  `GET kbn:/internal/security/roles/space-b`

Response
```
[
  {
    "name": "role-a",
    "metadata": {},
    "transient_metadata": {
      "enabled": true
    },
    "elasticsearch": {
      "cluster": [
        "all"
      ],
      "indices": [],
      "run_as": []
    },
    "kibana": [
      {
        "base": [],
        "feature": {
          "dev_tools": [
            "all"
          ]
        },
        "spaces": [
          "default",
          "space-b"
        ]
      }
    ],
    "_transform_error": [],
    "_unrecognized_applications": []
  },
 {
    "name": "superuser",
    "metadata": {
      "_reserved": true
    },
    "transient_metadata": {},
    "elasticsearch": {
      "cluster": [
        "all"
      ],
      "indices": [
        {
          "names": [
            "*"
          ],
          "privileges": [
            "all"
          ],
          "allow_restricted_indices": false
        },
        {
          "names": [
            "*"
          ],
          "privileges": [
            "monitor",
            "read",
            "view_index_metadata",
            "read_cross_cluster"
          ],
          "allow_restricted_indices": true
        }
      ],
      "remote_indices": [
        {
          "names": [
            "*"
          ],
          "privileges": [
            "all"
          ],
          "allow_restricted_indices": false,
          "clusters": [
            "*"
          ]
        },
        {
          "names": [
            "*"
          ],
          "privileges": [
            "monitor",
            "read",
            "view_index_metadata",
            "read_cross_cluster"
          ],
          "allow_restricted_indices": true,
          "clusters": [
            "*"
          ]
        }
      ],
      "run_as": [
        "*"
      ]
    },
    "kibana": [
      {
        "base": [
          "all"
        ],
        "feature": {},
        "spaces": [
          "*"
        ]
      }
    ],
    "_transform_error": [],
    "_unrecognized_applications": [
      "*"
    ]
  }
]
```


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

### For maintainers

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

__Fixes: https://github.com/elastic/kibana/issues/180718__

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary

Issue: elastic#180079
Parent Issue: elastic#157883

Versions the clone rule API and adds input/output validation

### 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>
Create an empty assets data access plugin so we can start registering
the services(APIs) that will be used to fetch assets type documents.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
mistic and others added 25 commits May 3, 2024 19:59
This PR is a simple update of our versions file after the recent bumps.
This PR is a simple update of our versions file after the recent bumps.
…rules (elastic#179680)

**Resolves: elastic#173593
**Fixes: elastic#164234

## Summary

Adds a number component in the create and edit rule forms so that users
are able to customize the `max_signals` value for custom rules from the
UI. Also adds validations to the rule API's for invalid values being
passed in.

This PR also exposes the `xpack.alerting.rules.run.alerts.max` config
setting from the alerting framework to the frontend and backend so that
we can validate against it as it supersedes our own `max_signals` value.

[Flaky test run (internal)

](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5601)

### Screenshots
**Form component**
<p align="center">
<img width="887" alt="Screenshot 2024-04-08 at 11 02 12 PM"
src="https://github.com/elastic/kibana/assets/56367316/58cd2f6d-61b6-4343-8025-ff867c050dd7">
</p>

**Details Page**
<p align="center">
<img width="595" alt="Screenshot 2024-04-08 at 11 04 04 PM"
src="https://github.com/elastic/kibana/assets/56367316/d2c61593-3d35-408e-b047-b4d1f68898f8">
</p>

**Error state**
<p align="center">
<img width="857" alt="Screenshot 2024-04-08 at 11 01 55 PM"
src="https://github.com/elastic/kibana/assets/56367316/86e64280-7b81-46f2-b223-fde8c20066c8">
</p>

**Warning state**
<p align="center">
<img width="601" alt="Screenshot 2024-04-16 at 3 20 00 PM"
src="https://github.com/elastic/kibana/assets/56367316/eab07d62-3d3e-4c85-8468-36c3e56c5a99">
</p>

### 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] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))


### 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: Juan Pablo Djeredjian <jpdjeredjian@gmail.com>
elastic#182063)

## Summary

These commits are split out from my working branch for elastic#181963 to make
reviewing easier.

Our state management code is currently split between a folder called
`services` and the `utils` folder. This makes working with the code more
difficult, especially where One Discover will soon introduce additional
complexity. To make the state management code easier to work with, I
moved all of the related files into a single folder called
`state_management` with a `utils` subfolder for its utility functions.

Similarly, all of our data fetching code was spread between files in the
`utils` folder. For the same reason, I moved these files into a new
folder called `data_fetching`, since they will also undergo a lot of
changes for One Discover.

Part of elastic#181963.

### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)
…81244)

Kibana may be unresponsive while backing indices in write block.
…actions in timeline (elastic#181376)

## Summary 

This pr adds pinned events, notes, and row actions to the unified data
table within timeline. Uses the existing shared hooks and components
from timeline, with only a few casts to make everything work. As with
the other parts of the unified timeline, this is hidden behind the
feature flag 'unifiedComponentsInTimelineEnabled'.

![timeline_notes_pinned](https://github.com/elastic/kibana/assets/56408403/6aa5d951-a98e-4a84-9fc5-8546db3e9167)

Correlation/EQL tab:
<img width="862" alt="image"
src="https://github.com/elastic/kibana/assets/56408403/5b7facfc-e385-41a2-b14c-e36cf134fe00">

Improved header controls positioning:
<img width="1456" alt="image"
src="https://github.com/elastic/kibana/assets/56408403/a87e39d3-3f53-4266-9a2d-5bc33a37cfdc">



### Checklist


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

---------

Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
…ackfills (elastic#182420)

Resolves elastic#182208

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary

[Try catch
statement](https://github.com/elastic/kibana/blob/9473241cf8f02eed535c846546114ee94b1ab5fc/.buildkite/scripts/pipelines/security_solution_quality_gate/api_integration/api_ftr_execution.ts#L144)
in the PR for the [API Ftr Integration
tests](elastic#182245), introduced a
cover above the target fix of the specific PR.

The tests were failing however the exit code was still 0 so the failures
are hidden. This PR addresses the specific issue.
## Summary

Revives this elastic#181969

To do so, I had to create a new package `search-types` and move the
types I need there.

The Discovery team can take it from here.

Note: It also does a cleanup on the types I move, some of them were
declared twice.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary

Cloudflare 8.24 doesn't install properly and the config tab also fails
with the same error. This PR fixes this error and also fixes a small UI
issue with max width not sets in configs tab.

The integration defines two possible options for auth (auth key or
token) but only one should be used. When both are set the [compile
template](https://github.com/elastic/kibana/blob/be3f66fd45db4001b9437281a2cb075e817fa25f/x-pack/plugins/fleet/server/services/epm/agent/agent.ts#L27)
fails with an error

## Before
![Screenshot 2024-05-03 at 16 16
35](https://github.com/elastic/kibana/assets/16084106/cb90e72a-7cef-46eb-8542-324cce45ac37)
![Screenshot 2024-05-03 at 16 20
01](https://github.com/elastic/kibana/assets/16084106/4ffacea4-ffa7-4a1a-bf81-24213fee48f3)

## After
![Screenshot 2024-05-06 at 10 58
57](https://github.com/elastic/kibana/assets/16084106/36ca8bea-87d7-4d01-8fda-50190feb9fbb)
… security APIs in serverless tests (elastic#182584)

## Summary

Revert of elastic#178705: `API keys`
request strict validation is already enabled by default in production,
and the decision regarding enabling `Has Privileges` request strict
validation has been reverted and replaced with warnings in response
headers.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…actions from alerts (elastic#182102)

## Summary

Re-enable skipped test for automated response actions from alerts.
closes elastic/issues/169828

#### Flaky runner
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5809
x 50 (1 fail)
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5851
x 50 (all pass)

### 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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
Instead of the static text `CI Build` when reporting a test failure,
this writes the pipeline slug. The intention here is to enable test
failure reporting for
https://buildkite.com/elastic/kibana-elasticsearch-serverless-verify-and-promote
and https://buildkite.com/elastic/kibana-elasticsearch-snapshot-verify
and keep the test failures consolidated in one issue.
## Summary

Addresses elastic#177782

Autostep for prebuilt rules on getstarted page is not showing up
correctly. It's either hidden on load or gets toggled and eventually
hidden after continuous expand and collapse of the autostep panel.

Precondition for testing:
Enable at least one prebuilt rule to to observe the behavior.

before:

https://github.com/elastic/kibana/assets/1625373/e9f825d6-1d06-403e-a8ac-7002bdd11471

after:

https://github.com/elastic/kibana/assets/1625373/97d432be-8dcd-4448-8ac3-267b1a6c48d8
…stic#182641)

## 📓 Summary

Closes elastic#181968 

The issue, where the Logs Explorer app was not correctly loading data,
was the result of the following investigation.
The issue was affecting, without major problems, also other
Observability apps.

**Before**


https://github.com/elastic/kibana/assets/34506779/5beb300c-f397-401a-b24b-2a125139a79e

**After**


https://github.com/elastic/kibana/assets/34506779/3f3132d5-19cc-4086-ac24-bd3629878c95

### Why the UI and state management are not synced upon navigation?

Looking at the state management for Logs Explorer and the initialization
flow, everything looked good.
The UI was de-synced from the initialized services and state due to a
forced unmount/remount of the main app (to not confuse it with a
rerender, the app was completely removed and remounted in the react
tree), the DiscoverContainer.

### Why the main app was remounted?

Checking level by level the react tree, the remount didn't occur due to
Logs Explorer or Discover state changes, but at the level of the
`ObservabilityPageTemplate` template wrapper component.
Any component using this wrapper and performing client-side navigation
to/from the same page was triggering the following react warning:

```
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    at DiscoverMainRoute 
    // ...
    at KibanaPageTemplateInner (http://localhost:5601/ftw/XXXXXXXXXXXX/bundles/plugin/observabilityShared/1.0.0/observabilityShared.chunk.0.js:2959:3)
    at WithSolutionNav (http://localhost:5601/ftw/XXXXXXXXXXXX/bundles/plugin/observabilityShared/1.0.0/observabilityShared.chunk.0.js:3988:107)
```

Given this, something was causing an immediate rerender of the
`WithSolutionNav` HoC, de-syncing the UI tree from the state handled at
a higher level through the state machine of the Logs Explorer app.

### Where was the issue

The bug causing the double render of the whole app was in the
[`createLazyObservabilityPageTemplate`](https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability_solution/observability_shared/public/components/page_template/lazy_page_template.tsx#L27)
function:

```tsx
const showSolutionNav = !!showSolutionNavProp || isSidebarEnabled;
```

and in the default value for this property in the
[`ObservabilityPageTemplate`](https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability_solution/observability_shared/public/components/page_template/page_template.tsx#L100)
component:

```tsx
showSolutionNav = true,
```

`isSidebarEnabled` can either be a boolean or `undefined`. Given how the
statement is written, `showSolutionNav` can so result in a boolean value
or `undefined` too, since `isSidebarEnabled` is the last variable in the
boolean OR condition.

If the property resulted is undefined and passed to the component, JS
consider it as if it was not passed, using the default value for that
specific argument, for example:

<img width="1545" alt="Screenshot 2024-05-06 at 09 56 44"
src="https://github.com/elastic/kibana/assets/34506779/90f0ce62-b7d9-4f0b-a54a-baee9b6194a0">

Saying this, the `showSolutionNav` property, instead of always being set
to a `false` value, was flapping between true and `false` since the
`isSidebarEnabled` variable was not immediately resolved to a boolean.

An explicit casting to a boolean for `showSolutionNav` exclude the case
where `ObservabilityPageTemplate` used the default truthy value,
removing the extra mount and keeping the state in sync with the UI.

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
For some other changes I'm working on, I need to be able to distinguish
if a route handler returned a `IKibanaResponse` / `KibanaResponse`
object or some other object that needs to be wrapped before being sent
back.

Rather than duplicating this little helper I want to expose it as part
of the public API of `core.http`.
@miltonhultgren miltonhultgren changed the base branch from expose-is-kibana-response-helper to main May 6, 2024 13:10
miltonhultgren pushed a commit that referenced this pull request May 21, 2024
## Summary
Set `security.session.cleanupInterval` to 5h for session concurrency
test.

### **Prerequisites**

- Task for session cleanup with [default schedule set to
1h](https://github.com/elastic/kibana/blob/main/x-pack/plugins/security/server/config.ts#L222).
- Task polling interval is set to
[3000ms](https://github.com/elastic/kibana/blob/main/x-pack/plugins/task_manager/server/config.ts#L13).
- We override `scheduledAt` once we make a request in
[runCleanupTaskSoon](https://github.com/elastic/kibana/blob/main/x-pack/test/security_api_integration/tests/session_concurrent_limit/cleanup.ts#L145).

### **Hypothesis**

Taking into consideration that:

- `session_cleanup` task is not the only one scheduled during test run.
- There is sort of an exponential backoff implemented for task polling
if there are too many retries.
- Clock jitter.

I had a hypothesis that if our whole test run exceeds 1h or polling
interval gets adjusted because of retries we might end up executing the
scheduled cleanup before we trigger `runCleanupTaskSoon` (this is there
we drop 1 session already).

### **FTR runs (x55 each)**

- `cleanupInterval` set to 5h:
[#1](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5986)
:green_circle:,
[#2](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5987)
:green_circle:
- `cleanupInterval` set to default 1h:
[#1](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5983)
:green_circle:,
[#2](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5982)
:red_circle: (has 2 failures out of 55)


### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### For maintainers

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

__Fixes: https://github.com/elastic/kibana/issues/149091__
miltonhultgren pushed a commit that referenced this pull request Aug 14, 2024
## Summary

Resolves elastic#143905. This PR adds support for integration-level outputs.
This means that different integrations within the same agent policy can
now be configured to send data to different locations. This feature is
gated behind `enterprise` level subscription.

For each input, the agent policy will configure sending data to the
following outputs in decreasing order of priority:
1. Output set specifically on the integration policy
2. Output set specifically on the integration's parent agent policy
(including the case where an integration policy belongs to multiple
agent policies)
3. Global default data output set via Fleet Settings

Integration-level outputs will respect the same rules as agent
policy-level outputs:
- Certain integrations are disallowed from using certain output types,
attempting to add them to each other via creation, updating, or
"defaulting", will fail
- `fleet-server`, `synthetics`, and `apm` can only use same-cluster
Elasticsearch output
- When an output is deleted, any integrations that were specifically
using it will "clear" their output configuration and revert back to
either `#2` or `#3` in the above list
- When an output is edited, all agent policies across all spaces that
use it will be bumped to a new revision, this includes:
- Agent policies that have that output specifically set in their
settings (existing behavior)
- Agent policies that contain integrations which specifically has that
output set (new behavior)
- When a proxy is edited, the same new revision bump above will apply
for any outputs using that proxy

The final agent policy YAML that is generated will have:
- `outputs` block that includes:
- Data and monitoring outputs set at the agent policy level (existing
behavior)
- Any additional outputs set at the integration level, if they differ
from the above
- `outputs_permissions` block that includes permissions for each
Elasticsearch output depending on which integrations and/or agent
monitoring are assigned to it

Integration policies table now includes `Output` column. If the output
is defaulting to agent policy-level output, or global setting output, a
tooltip is shown:

<img width="1392" alt="image"
src="https://github.com/user-attachments/assets/5534716b-49b5-402a-aa4a-4ba6533e0ca8">

Configuring an integration-level output is done under Advanced options
in the policy editor. Setting to the blank value will "clear" the output
configuration. The list of available outputs is filtered by what outputs
are available for that integration (see above):

<img width="799" alt="image"
src="https://github.com/user-attachments/assets/617af6f4-e8f8-40b1-b476-848f8ac96e76">

An example of failure: ES output cannot be changed to Kafka while there
is an integration
<img width="1289" alt="image"
src="https://github.com/user-attachments/assets/11847eb5-fd5d-4271-8464-983d7ab39218">


## TODO
- [x] Adjust side effects of editing/deleting output when policies use
it across different spaces
- [x] Add API integration tests
- [x] Update OpenAPI spec
- [x] Create doc issue

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
miltonhultgren pushed a commit that referenced this pull request Sep 30, 2024
…193441)

## Summary
More files to be regenerated with a different shape since the js-yaml
update: elastic#190678
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.