Commit graph

661 commits

Author SHA1 Message Date
Alex Szabo
f2a3ac796a
[ci] Silence SASS warnings (#225061)
## Summary
Silences SASS module usage warnings around the deprecated `@import`
statements.

While the sass/scss owner teams are migrating these usages, the dev
server is clogged up with deprecation warnings. It's probably best to
disable it, because it's annoying to everyone and not necessarily to the
owners.
2025-06-25 09:28:35 +02:00
Kenneth Kreindler
e3976c9c0f
[Security Solution] [AI assistant] Make the Security AI assistant global (#223936)
## Summary

Fixes https://github.com/elastic/security-team/issues/8934

Summarize your PR. If it involves visual changes include a screenshot or
gif.

This PR enables the Security AI assistant to be used globally - i.e. if
you are outside of the security solution (e.g. Discover), the Security
Assistant can still be opened.

Changes:
- A public module has been added to the elastic-assistant plugin
(previously it was a server-side-only plugin).
- The vast majority of the assistant (flyout and nav bar) has been moved
into the new elastic-assistantpublic plugin.
- Comment actions & message augmentations remain within the
security-solution.
- A new public plugin was created called elastic-assistant-shared state.
This plugin is used to share state between the elastic-assistant public
plugin and other plugins (e.g. security-solution).
- For example, the security solution registers comment actions in the
elastic-assistant-shared-state plugin. The elastic-assistant public
plugin then reads the comment actions from
elastic-assistant-shared-state and renders them in the assistant flyout.


![image](https://github.com/user-attachments/assets/3322e434-f2f4-42c7-ac8a-63070a1cb9ca)

### Considerations:
- Currently, the Security AI assistant is being displayed everywhere
except the observability solution (see implementation
[here](https://github.com/elastic/kibana/pull/223936/files#diff-5dd1ea91c2d5d242203cc58ee59ec283116e5e739ed82bae4e2cd78af322150c)).
This is only for testing while the PR is in review. We plan to add a
setting to the stack management that allows the user to configure where
they would like the assistant to be shown. This will be changed before
the PR is merged.

## How to test

Feel free to use the cloud and serverless deployments created by the CI
pipeline for testing. Credentials can be found on Buildkite.

### Verify that the Security AI assistant works as expected within the
security solution
Expected there to be no changes in how the security AI assistant works
within the Security Solution. Please do some exploratory testing to make
sure nothing has changed.

Start the branch locally and go to http://localhost:5601/app/security/

Things to test:
- Does the assistant open?
- Can I send an alert to the assistant from the alerts page?
- Does the assistant display code blocks correctly?
- Does the assistant display ESQL correctly (can I view the ESQL in the
timeline)?
- Do assistant messages have the correct comment actions? Do the comment
actions work?
- Are conversations displayed correctly?
- Do citations work?
- Does the assistant work in serverless? Does the assistant work as
expected in AI4SOC?
- Do quick prompts work?
- Can you select a system prompt for a new convo?
- Can you send alerts to the Security AI assistant?
- AI assistant in a space that has Security disabled.
- Does attack discovery work?

AI assistant open in Discover app:
<img width="1841" alt="image"
src="https://github.com/user-attachments/assets/0a13a100-d192-4fa4-b395-0951452e14c2"
/>

AI assistant in Security solution:
<img width="1841" alt="image"
src="https://github.com/user-attachments/assets/7ed38f37-79de-41a7-a80f-8b96147bfdf6"
/>


### Verify the Security AI assistant works in Discover (or anywhere
outside of the Security solution)?
Head over to http://localhost:5601/app/discover. Note that some
functionality is removed when using the AI assistant outside of
security:
- Only the "copy" comment action appears on messages.
- Code block augmentations (i.e. the button that opens ESQL inside of
the timeline) don't appear.

Things to test:
- Does the security AI assistant button appear in the nav bar?
- Can you open the security AI assistant?
- Are you able to send messages?
- Are conversations appearing as expected?
- Can you close the assistant?
- Do citations work?
- Can you switch to a different solution while the assistant is open?

Security AI assistant open in AI4SOC Discover:
<img width="1841" alt="image"
src="https://github.com/user-attachments/assets/36537b9b-e945-459e-ac13-43e9444e92b7"
/>


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [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/src/platform/packages/shared/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] 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)
- [X] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [X] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [X] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-24 19:11:43 +01:00
Sergi Romeu
c1563c2f45
[ObsUX] Remove entities v2 code and Inventory (#224696)
Co-authored-by: Milton Hultgren <milton.hultgren@elastic.co>
Co-authored-by: Caue Marcondes <caue.marcondes@elastic.co>
Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-24 08:12:28 -04:00
Edgar Santos
e585c2223d
Add UI for bulk fill gaps (#224585)
## Summary

This draft PR adds the UI to bulk gap filling gaps. This action can be
triggered from the "rules management" table as well as from the gaps
table in the "execution results" tab for any rule.

# How to test
Make sure your `kibana.dev.yaml` contains the following feature flags:
`storeGapsInEventLogEnabled` and `bulkFillRuleGapsEnabled`.

You can just paste this string in the file:
```
xpack.securitySolution.enableExperimental: [ 'storeGapsInEventLogEnabled', 'bulkFillRuleGapsEnabled' ]
```
## Bulk gap filling from the "rules management" table
1. Generate 100 rules, each with 1000 gaps using [this
tool](https://github.com/elastic/security-documents-generator).
`yarn start rules --rules 100 -g 1000 -c -i"5m"`
2. Navigate to the rules management table at
`/app/security/rules/management`
3. Select some rules, click on "Bulk actions" and then on "Fill gaps"

![image](https://github.com/user-attachments/assets/f5d9bcb6-9139-43cb-b023-f1f63a9b8b7a)
4. Select the time window and click on "Run"

![image](https://github.com/user-attachments/assets/0269d00a-2750-4b2d-975e-0ebfbac27e16)
5. You should see a confirmation toast showing that 3 rules were
successfully scheduled

![image](https://github.com/user-attachments/assets/9800c9e2-3c3e-4b87-96e4-17c84f1b024a)
6. Click on any of the rules for which you just executed a gaps fill and
check its gaps by going to "Execution results" and scrolling down to the
"Gaps" table. You can see that the gaps covering the time range you
selected are marked as "in progress"

![image](https://github.com/user-attachments/assets/850dea1c-12cc-46c5-8675-d11445218c24)

If you select one or more rules that are disabled, you should see this
modal:

![image](https://github.com/user-attachments/assets/4a820b92-a9f0-4529-93ee-1fbaf7552888)


## Bulk filling from a rule gaps table
1. From the "rules management" table, click on any rule that has gaps.
2. Click on the "execution results" tab
3. Scroll down to the gaps table, you should see a "Fill all gaps"
button.
4. Click on it and select the time range.

![image](https://github.com/user-attachments/assets/375b0677-9b49-43e4-8820-5186c9343891)
5. If you select a big time range, you should see a toast indicating
that the scheduling is in progress after 5 seconds (you can hit this
case by generating 10000 gaps for 1 rule)

![image](https://github.com/user-attachments/assets/6d6345d9-fbc6-4c14-9c2d-04f40941fd17)

6. You should see a success toast once it is done

![image](https://github.com/user-attachments/assets/089ec2b9-daa5-44df-bfc0-84c69e2f6eec)

---------

Co-authored-by: Khristinin Nikita <nikita.khristinin@elastic.co>
2025-06-23 23:00:17 +02:00
Marta Bondyra
de3604c905
Create @kbn/css-utils package (#223933)
## 🧵 Summary

This PR introduces a few structural and cleanup improvements:

1. Moves core Emotion CSS helpers (`useMemoizedStyles` renamed as
`useMemoCss`, `kbnFullBodyHeightCss`, `kbnFullScreenBgCss`) from
`core/public` to a new package: `@kbn/css-utils`.
2. Removes a significant portion of legacy SCSS from the core plugin. 
3. Replaces scss mixin with emotion `kbnFullScreenBgCss` across Kibana
(we have scss and emotion version, but emotion version wasn't widely
used yet).
4. As a result of (3), some plugin tests were migrated to React Testing
Library. This was necessary because Emotion-generated snapshots in
Enzyme were difficult to read and maintain when moving to emotion.

### Considerations
I initially tried to add the package to the [shared-deps
bundle](8e15517ddd),
but couldn’t get the SVG imports for `kbnFullScreenBgCss` to work
correctly in that setup.

As a workaround, I opted to import the helpers directly from their
source files.

An alternative approach could be to convert the used SVGs into React
components and use those within the shared package. Or explore something
like a static package and try to somehow wire in that in the webpack
internal compilers, but it doesn't seem to be worth the effort at the
moment.


### 💡 Motivation

- These utils don’t need to live in Core and are now decoupled to
improve performance and flexibility.
- Importing from `core/public` (even just for a small hook) was adding
noticeable overhead to test runs:
  - ~1–2s delay on first Jest execution
  - ~200ms added on subsequent runs
  - Occasional CI timeouts due to deep import graph

### 👥 Ownership

I assigned this package to sharedux team. Thank you!

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-20 22:48:44 +02:00
Nathan Reese
5e594b4a82
[Dashboards as code] consolidate URL BWC and add functional tests (#221989)
Closes https://github.com/elastic/kibana/issues/221683

PR does the following
* Consolidates `SharedDashboardState` and `DashboardLocatorParams` types
into a single type `DashboardLocatorParams`.
* Combine URL parsing and locator parsing into single function,
`extractDashboardState`. Previously this was done in 2 seperate code
paths: `loadDashboardHistoryLocationState` for locator state and
`loadAndRemoveDashboardState` for URL state.
* `extractDashboardState` takes `unknown` instead of
`DashboardLocatorParams`. Input value could contain legacy versions of
`DashboardLocatorParams` or really anything since its provided in the
URL by users. `unknown` better reflects that the input could be a lot of
different things.
* `extractDashboardState` uses duck typing to try its best to convert
from legacy versions of `DashboardLocatorParams` to current
`DashboardState` type
* Replaced `bwc_shared_urls` functional test with unit tests
* Added function test `bwc_short_urls` functional tests to ensure stored
URLs continue to work. Added tests for 8.14, 8.18, and 8.19 URL state.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Devon Thomson <devon.thomson@elastic.co>
2025-06-04 18:30:11 -06:00
Luke Gmys
af0b369627
[Security Solution] Move threat intelligence to security solution (#214369)
# Summary

This PR merges Threat Intelligence plugin with security solution, in
order to remove duplicated and unnecessary code introduced as a bridge
between the TI plugin and Security Solution + to simpify maintenance. No
new functionality is implemented here, other than changing imports and
some dependendies to use security solution code directly, without weird
bridges or hacks / indirections.

## Testing

Navigate to threat intelligence plugin / indicators and try clicking
around. It is hard to list every feature we have there
but in general it should work without errors.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-03 16:51:57 +02:00
Pierre Gayvallet
f3b4975c8c
[onechat] Introduce plugin and tool registry (#220889)
## Summary

Implements the onechat tool registry RFC.

Fix https://github.com/elastic/search-team/issues/9938
Fix https://github.com/elastic/search-team/issues/10019

This PR introduces the following artifacts:

**plugins:**
- `onechat`

**packages:**
- `@kbn/onechat-common`
- `@kbn/onechat-server`
- `@kbn/onechat-browser`

## Tool APIs overview

### Registering a tool

```ts
class MyPlugin {
  setup(core: CoreSetup, { onechat }: { onechat: OnechatPluginSetup }) {
    onechat.tools.register({
      id: 'my_tool',
      name: 'My Tool',
      description: 'My very first tool',
      meta: {
        tags: ['foo', 'bar'],
      },
      schema: z.object({
        someNumber: z.number().describe('Some random number'),
      }),
      handler: ({ someNumber }, context) => {
        return 42 + someNumber;
      },
    });
  }
}
```

### Executing a tool

Using the `execute` API:

```ts
const { result } = await onechat.tools.execute({
  toolId: 'my_tool',
  toolParams: { someNumber: 9000 },
  request,
});
```

Using a tool descriptor:

```ts
const tool = await onechat.tools.registry.get({ toolId: 'my_tool', request });
const { result } = await tool.execute({ toolParams: { someNumber: 9000 } });
```

With error handling:

```ts
import { isToolNotFoundError } from '@kbn/onechat-common';

try {
  const { result } = await onechat.tools.execute({
    toolId: 'my_tool',
    toolParams: { someNumber: 9000 },
    request,
  });
} catch (e) {
  if (isToolNotFoundError(e)) {
    throw new Error(`run ${e.meta.runId} failed because tool was not found`);
  }
}
```

### Listing tools

```ts
const tools = await onechat.tools.registry.list({ request });
```

*More details and example in the plugin's readme.*

### What is **not** included in this PR:

- tool access control / authorization - we have a dedicated RFC
- dynamic tool registration / permissions checks part/of depends on the
authorization RFC
- feature / capabilities - will come with browser-side and HTTP APIs
- fully defining tool meta - hard to do now
- filter parameters for the tool list API - depends on the meta being
defined

*Those will be follow-ups*. Everything else from the RFC should be
there.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-05-28 00:45:01 +03:00
Eyo O. Eyo
f635e2a3b0
[MVP] Product Intercept Dialog (#209571)
## Summary

This PR aims to answer questions about the implementation details for
https://github.com/elastic/kibana-team/issues/1328

We'd like to trigger an intercept dialog to users at specific time
intervals that vary and depend on different parameters, see the PRD
linked in the aforementioned issue.

This MVP takes an approach such that the constraints listed below are
resolved;
- Have the intercept be specific to a single user
- Define a strategy to configure triggers that can vary for the
intercept that's not dependent on the client

How does this work?
- A generic plugin has been created which when declared as dependency
can be used to register and schedule an intercept that should be
presented to the user, this plugin is what's been used for the product
intercept dialog.
- To handle rendering the UI component that gets displayed to the users,
in this PR we hook into core's existing notification system, through the
notification coordinator system that's been created so that we don't
have a situation where an intercept is being displayed whilst a user
might have a toast being rendered to them, if there's an intercept to be
displayed said intercept would not be displayed till the user is
completely done interacting with the toast. [See it's implementation
details
here](src/core/packages/notifications/browser-internal/src/notification_coordinator.ts)
and
[here](x-pack/platform/plugins/private/intercepts/public/prompter/service/intercept_dialog_service.tsx)
for how it's integrated.
- The plugin provides some bootstrap data through an endpoint that every
user calls on page load, ideally this would need to happen just the once
on page load, we then compute when a user should see a trigger
leveraging the bootstrap data provided for the particular registered
trigger in question, the returned data returns the following data as
seen below;

<img width="476" alt="Screenshot 2025-03-27 at 18 01 12"
src="https://github.com/user-attachments/assets/c747b6c8-70d0-4305-b555-ec9998b180c1"
/>


Given we have this data we might then have a flow for triggering the
intercept on the client based of the bootstrap data like so;

	```mermaid
	flowchart TD
	 A[State Bootstrap] --> B{Has data?}
	 B -->|No| C(Do Nothing)
B -->|Yes| D{Does computed runs since trigger registration match stored
user trigger run feedback value?}
	 D -->|No| E[setup timer to display an intercept in that time]
E -->|on completion| G[setup interval to display intercept in the
future]
	 D -->|Yes| G
	 G -->|repeat| G
    ```
	reloading the page restarts the entire process.

## Telemetry

The intercept component provided by defaults records telemetry for
intercept registration, acknowledgement (differentiated into dismissal
and completion), alongside registration overload.


## Visuals


<!--
https://github.com/user-attachments/assets/b39a506c-a119-40e8-9152-258d78691f28
-->

<!--
https://github.com/user-attachments/assets/f564b4bc-9ad9-4e19-8158-6e154ef52fc2
-->

<img width="738" alt="Screenshot 2025-05-07 at 19 41 23"
src="https://github.com/user-attachments/assets/902c6d0b-9299-44bd-8808-4ad97227d0da"
/>

## Testing this PR

- Pull this branch to your machine
- Add the following to your `kibana.dev.yml`, to enable the intercept to
run and be visible

```yml
xpack.intercepts.enabled: true
xpack.product_intercept.enabled: true
xpack.product_intercept.interval: '30s'
```

<!--

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-05-27 16:57:58 +02:00
Devon Thomson
3e882d8cd9
[Embeddables] Serialized State Only (#215947)
Closes https://github.com/elastic/kibana/issues/205531
Closes #219877.
Closes https://github.com/elastic/kibana/issues/213153
Closes https://github.com/elastic/kibana/issues/150920
Closes https://github.com/elastic/kibana/issues/203130
 
### Overview
The embeddable framework has two types of state: `SerializedState` and
`RuntimeState`.

`SerializedState` is the form of the state when saved into a Dashboard
saved object. I.e. the References are extracted, and state saved
externally (by reference) is removed. In contrast `RuntimeState` is an
exact snapshot of the state used by the embeddable to render.

<b>Exposing SerializedState and RuntimeState was a mistake</b> that
caused numerous regressions and architectural complexities.

This PR simplifies the embeddable framework by only exposing
`SerializedState`. `RuntimeState` stays localized to the embeddable
implementation and is never leaked to the embeddable framework.

### Whats changed
* `ReactEmbeddableFactory<SerializedState, RuntimeState, Api>` =>
`EmbeddableFactory<SerializedState, Api>`
* `deserializeState` removed from embeddable factory. Instead,
`SerializedState` is passed directly into `buildEmbeddable`.
* `buildEmbeddable` parameter `buildApi` replaced with `finalizeApi`.
`buildApi({ api, comparators })` => `finalizeApi(api)`.
* The embeddable framework previously used its knowledge of
`RuntimeState` to setup and monitor unsaved changes. Now, unsaved
changes setup is pushed down to the embeddable implementation since the
embeddable framework no longer has knowledge of embeddable RuntimeState.

### Reviewer instructions
<b>Please prioritize reviews.</b> This is a large effort from our team
and is blocking many other initiatives. Getting this merged is a top
priority.

This is a large change that would best be reviewed by manually testing
the changes
* adding/editing your embeddable types
* Ensuring dashboard shows unsaved changes as expected
* Ensuring dashboard resets unsaved changes as expected
* Ensuring dashboard does not show unsaved changes after save and reset
* Returning to a dashboard with unsaved changes renders embeddables with
those unsaved changes

---------

Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
Co-authored-by: Nick Peihl <nick.peihl@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Catherine Liu <catherine.liu@elastic.co>
Co-authored-by: Ola Pawlus <98127445+olapawlus@users.noreply.github.com>
2025-05-06 15:08:34 -06:00
Nick Partridge
fa1512572c
[ColorMapping] Store assignments as raw/serialized values (#207957)
## Summary

Refactors color mapping logic to store raw values in save objects.

Main changes:

- Instead assignments having a single rule with many values, we now have
assignments with multiple rules of varying types with a single value.
- As per the previous change, there is no more explicit `auto` rule,
this is now implicit when there are no rules in the assignment.
- Raw values can now be raw and in cases such as `RangeKey`s and
`MultiValueKey`s can be instance values. This is not ok for storing in
redux nor the SO so be have added a `serialize` methods to facilitate
this value storage. Code changes attempt to identify which value is used
based on variable/param names and type aliases as both are `unknown`.
- For values that are non-string or non-number types, we no longer allow
creating custom matching options.
- Values are now correctly formatted.
- Add runtime migration for `xy`, `partition`, `tagcloud` and
`datatable` viz. Requires `formBased` `datasourceState` to determine
best string-to-raw value convertion.

Closes #193080
Fixes #187519

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/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] 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)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

<!-- Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging -->

- [x] Migration from previous stored types.

## Release note

This PR fixes an issue
([#193080](https://github.com/elastic/kibana/issues/193080)) where
custom ranges and multi-field values were not correctly colored based on
selected color mapping configurations.

This change includes a runtime migration to convert old mappings as
strings to their raw value equivalent. This conversion is done at
runtime when the vis is rendered and only updated when the visualization
is saved. Thus this conversion does not dirty the state of the
visualization such as when first opening to edit.

This _should_ have no affect to the user apart from improved value
formatting in the color mapping assignment selection UI. In rare cases,
some assignments may not be correctly converted exactly to the new raw
value but are still preserved to use as string value matches. The only
know case where we are not be able to fully convert the value is when
using labels on custom ranges, the label will not show in the color
mapping assignment UI unless the value is removed as added back.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
2025-05-05 16:20:11 -07:00
Davis McPhee
d536f85005
[Discover] Support Lens fetches across tabs (#218506)
## Summary

This PR implements support for Lens chart fetches across Discover tabs,
and restoring chart state when returning to a tab.

The Lens embeddable does not currently support continuing data fetching
after it's been unmounted, or fully support restoring chart state using
previously fetched data. The Vis team is aware of this request, but in
the meantime we're using an alternative approach that keeps Lens charts
rendered in memory for each tab that's been visited at least once. This
allows fetches to run in the background and displays the resulting chart
when switching back to tabs. Doing this involved some refactoring to
both Discover and Unified Histogram:
- Create a `ChartPortalsRenderer` wrapper component in Discover to lift
chart rendering high up in the React tree and render charts into
[reverse portals](https://github.com/httptoolkit/react-reverse-portal),
ensuring charts are not remounted when switching tabs and continue to be
rendered after switching away from a tab.
- Refactor Unified Histogram from a single "container" component into
three pieces: a `UnifiedHistogramLayout` component, a
`UnifiedHistogramChart` component, and a `useUnifiedHistogram` hook to
tie things together. This approach allows us to render the chart and
hook separately (in a reverse portal) from the layout, making it
possible to separate the lifecycle of both components without keeping
the rest of Discover's components in memory after switching tabs.
- **Important note:** This change had the side effect of bloating the
Unified Histogram page load bundle since we're now exporting a static
hook that isn't dynamically imported. We could have worked around this
by getting creative with dynamic imports, but doing that seemed hacky.
Instead I decided now was a good time to split Unified Histogram out
into a package in order to support tree shaking, which also has the
added benefits of one fewer plugins to load on startup, and simplifying
the Discover async bundles.

There is one flaw with this approach: the `useDiscoverHistogram` hook
currently depends on global services for retrieving the current query
and filters (including global filters) through the `useQuerySubscriber`
hook. This means the values can become out of sync in inactive tabs when
the user modifies them in the current tab. In practice this doesn't seem
to have an effect in most cases since we don't trigger new fetches in
inactive tabs, and sync the the current tab values to the global
services when switching back to a tab. However, we should still fix this
for the MVP with an approach that doesn't leak state since the current
approach is brittle. I avoided doing that in this PR since it would
likely cause more conflicts with #217706, and that PR may introduce a
solution to the issue anyway (syncing global state to the redux store,
which we can rely on in the hook instead).

Resolves #216475.

### 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/src/platform/packages/shared/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
- [ ] 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)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-05-02 13:39:25 -03:00
Tiago Costa
aac2d4788a
chore(NA): updating used polyfills using 3rd party library (#218020)
Closes https://github.com/elastic/kibana-operations/issues/267

This PR is a follow up from the webpack v5 upgrade which makes sure we
stop using the old non maintained webpack v4 polyfills library and use
instead a new supported library called `node-stdlib-browser`.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-30 21:35:22 +01:00
Marco Liberati
ef323daf52
[chore] Import common react-use methods in shared bundle (#218640)
## Summary

Similar to #217034, #217202 and #217467 this time applied to
`react-use`.

This is a slightly different approach than #217034 as we're caching here
only the most common/frequently used methods from the `react-use`
library and leaving the rest to be loaded within the specific plugin
chunks.

What this PR does it fundamentally:
* adds `7.x kb` to the shared bundle
* overall the startup bundle size shrinks about `3.5 kb`
* the async bundle size shrinks of about `350 kb` (mainly due to 3
imports which were targeting `react-use/lib`).

An alternative approach would be to just fix the async import strings in
there, but I thought to it was worth it to make the long step here.
Feedback appreciated.
2025-04-24 14:13:25 +02:00
Pierre Gayvallet
29a81d8972
[workchat] prepare the workflow framework (#218138)
## Summary

Setup the foundations of the workflow framework, adding types and
initial implementation.


## Examples

### Looping over some input to call the LLM

**workflow**
```typescript
{
      id: 'my_test_workflow',
      name: 'Just a test workflow',
      type: 'graph',
      inputs: [
        {
          name: 'input',
          type: 'array',
          required: true,
        },
      ],
      steps: [
        {
          id: 'mainLoop',
          type: NodeType.loop,
          configuration: {
            inputList: 'input',
            itemVar: 'prompt',
            output: {
              source: 'output',
              destination: 'results',
            },
            steps: [
              {
                id: 'step1',
                type: NodeType.prompt,
                configuration: {
                  prompt:
                    'How much is {prompt}? Please just output the result without anything else',
                  output: 'output',
                },
              },
            ],
          },
        },
      ],
      outputs: [
        {
          name: 'results',
          ref: 'results',
        },
      ],
    }
``` 

**Running**
```ts
workchatFramework.workflows.run({
    id: 'my_test_workflow',
    inputs: { input: ['3 + 3', '7 - 1', '4 * 6'] },
    request,
})
```

**Output**

```ts
 {
  runId: '6f254746-57fc-4fd3-8bfa-25014725f53f',
  output: { results: [ '6', '6', '24' ] }
}
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-22 22:04:26 +02:00
Yuliia Naumenko
221c199ed1
[Search Connectors][Serverless] Add Search Connectors UI to the Stack Management data Section (#213509)
**!!MAJORITY OF THE CHANGED FILES ARE MOVED OR COPIED!!**

### Vision

According to the product vision we will build a new simple UI/UX in the
future https://github.com/elastic/security-team/issues/11790

This PR is a first iteration on enabling Content Connectors Management
UI in Serverless Kibana Stack Management.
Elastic Managed content connectors will be available only for Security
and Observability projects.
### Current PR scope

1. Used initial search_connectors plugin and renamed it to
content_connectors + moved from `x-pack/solutions/search` to
`x-pack/platform/plugins/shared`
2. Copy relevant connectors UI and routes from enterprise_search plugin.
3. Introduce the new Stack Management card/navigation option under the
Data section.
4. Enabled this plugin only in Serverless for Security and Observability
projects.
5. For making PR smaller Pipelines tab was not moved. And according to
Search team vision this functionality should be dropped anyway soon.
6. Extended fleet package logic to include elastic_connectors for
security and o11y serverless projects
7. Added back `search:agentless-connectors-manager` task

In Stack Management navigation:
<img width="2062" alt="Screenshot 2025-04-15 at 3 51 43 PM"
src="https://github.com/user-attachments/assets/5c93ba01-9a6a-4eac-a21d-1370f03b8f35"
/>

Stack Management cards:
<img width="2081" alt="Screenshot 2025-04-10 at 8 41 43 PM"
src="https://github.com/user-attachments/assets/3def1c12-561b-4a84-8241-4dd61cd9313d"
/>


Create Elastic Managed Connector UI (on Agentless):

<img width="1822" alt="Screenshot 2025-04-15 at 3 55 29 PM"
src="https://github.com/user-attachments/assets/6e9fea48-85e7-43df-919d-0e5492d0e704"
/>

Create Self Managed Connector UI:

<img width="2064" alt="Screenshot 2025-04-15 at 3 55 49 PM"
src="https://github.com/user-attachments/assets/d5051898-c8fa-4e41-b9ea-b41d4ed4a0d5"
/>

### Next steps

- [ ] Remove duplicated code between content_connectors,
enterprise_search and serverless_search
- [ ] Extract [common server
libs](https://github.com/elastic/kibana/tree/main/x-pack/solutions/search/plugins/enterprise_search/server/lib)
to the shared package `kbn-search-connectors`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Artem Shelkovnikov <artem.shelkovnikov@elastic.co>
Co-authored-by: Artem Shelkovnikov <lavatroublebubble@gmail.com>
Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co>
2025-04-18 04:50:56 +02:00
Catherine Liu
a015e5f9f7
[Canvas] Move expressions used in Canvas only back into Canvas plugin (#214993)
## Summary

Closes [214026](https://github.com/elastic/kibana/issues/214026).

This deletes the following expression plugins/package and moves the code
back into Canvas because they are functions and renderers used
exclusively by Canvas:
- `expression_image`
- `expression_error`
- `expression_repeat_image`
- `expression_reveal_image`
- `expression_shape`
- `kbn-expression-utils`

This reduces the number of plugins loaded on Kibana start and will only
load these functions when using Canvas.

To test, import these Canvas workpad saved objects to enable Canvas:

[test-workpads.ndjson.zip](https://github.com/user-attachments/files/19766567/test-workpads.ndjson.zip)

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-16 22:42:21 +02:00
Alexey Antonov
9ee5741134
fix: [Analytics:Discover page]Elements missing title from announcement (#217821)
Closes: #214335

**Description**
Dialog modal, flyout, field visible title should be announced for the
users, especially using assistive technology to know what dialog modal,
flyout opened, what field is active and what is needed to enter in it.

**Changes made:**
1. Added `aria-labelledby={flyoutTitleId}` for mentioned places
2025-04-15 17:33:40 -06:00
Alex Szabo
a1a0d3462d
[ci] increase inspector limit to allow for recent updates (#218053)
## Summary
It seems there's been some sort of unintended bundle limit branch
through 2 minor changes (greenlit separately on PRs) - and this one
broke the camel's back: https://github.com/elastic/kibana/pull/212163
2025-04-14 10:56:32 +02:00
Marco Liberati
6984530aa0
[Expression] Cached expression can keep their own side effects (#216519)
## Summary

Fixes the #207204 

This PR introduces a new complementary function for an Expression
definition named `sideEffects`, this goes together with the other `fn`
function and it is used to restore any side effect when the caching
system kicks in.


![side_effects_cache](https://github.com/user-attachments/assets/74b1ddff-a45c-4983-ac09-57559155fba8)

I haven't found how to programmatically test this.
Will add an FTR if it can be reliable to reproduce an expression caching
scenario.

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

### Release notes

The request inspector now shows the correct request and response in any
successful scenario.
2025-04-11 14:50:47 +02:00
Melissa Alvarez
f51ac13197
[ML] Moves job and trained model management features into Stack Management (#204290)
## Summary

Updates the navigation for Machine Learning pages, moving admin tasks
for managing ML jobs and models to a single place inside Stack
Management, and leaving exploratory tasks in a consolidated top-level
Machine Learning menu.

The available items vary by solution, so that the navigation for an
Elasticsearch project, for example, contains a single item for managing
trained models.

#### Stack management menu for classic/observability/security nav
<img width="275" alt="Screenshot 2025-04-04 at 16 10 04"
src="https://github.com/user-attachments/assets/14b6e8d4-7111-4fbd-ae5d-9f389f83f23c"
/>

#### Stack management for search:
<img width="271" alt="Screenshot 2025-04-07 at 14 38 45"
src="https://github.com/user-attachments/assets/e104bf20-8a4d-4eed-9b5b-9c05944091ca"
/>


#### Machine Learning menu for Classic nav
<img width="341" alt="Screenshot 2025-04-07 at 14 22 03"
src="https://github.com/user-attachments/assets/610efd59-311f-410f-9881-548359ca7997"
/>


#### Machine Learning menu for Observability
<img width="522" alt="Screenshot 2025-04-04 at 16 11 48"
src="https://github.com/user-attachments/assets/ef16acf1-4d39-4494-a5d3-0fb078d74730"
/>


#### Machine Learning menu for Security
<img width="528" alt="Screenshot 2025-04-04 at 17 46 43"
src="https://github.com/user-attachments/assets/2df20c20-b894-4421-a732-9370bb5d6f2d"
/>


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: Quynh Nguyen <quynh.nguyen@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Timothy Sullivan <tsullivan@elastic.co>
2025-04-08 19:52:16 +02:00
Dominique Clarke
9d56263413
[Chore] Remove Investigate plugin, Investigate app plugin, and Investigation-schema package (#216342)
## Summary

Removes unused code from the Investigate and Investigate app plugin.

Removes all references to those plugins in storybook, i18n, types, etc.

Removes codeowner requirements for those plugins

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-08 12:25:21 -04:00
Tim Sullivan
ef907a32f2
[Security Solution] Use static declaration for navigation hierarchy (#215969)
## Summary

Part of Epic: https://github.com/elastic/kibana-team/issues/1439
Addresses https://github.com/elastic/kibana/issues/212903, but does not
remove the landing page access. The landing page access will be removed
in https://github.com/elastic/kibana/pull/210893

**Changes**
1. Converts the declaration of the Security Solution side navigation for
serverless and stateful projects into a static declaration, rather than
algorithmically parsing registered links to dynamically build the
declaration.
2. Updates the contents of the "Assets" panel to prepare for removal of
that landing page.
3. Eliminates the top-level nesting of the nav items, which removes the
extra space between the project title and the first nav items. See
45454bdc4d

**Known issue**: Clicking the "Browse integrations" button does not
close the secondary nav panel. Doing that will be a relatively simple
chore, but will require some changes in the SharedUX chrome-navigation
package, as well as the `LinkButton` component in the Security Solution
navigation-links package.

### Screenshots
Serverless

![static-nav-declaration-security-serverless-3iorteikghiskhgkseh](https://github.com/user-attachments/assets/47bcbea9-7e3c-481e-b1b8-4b13bb5d63b1)

Stateful/ECH

![static-nav-declaration-security-stateful-3iorteikghiskhgkseh](https://github.com/user-attachments/assets/3d3c8a0e-95d1-4da7-a657-c824577b6ec1)

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [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/src/platform/packages/shared/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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-03 08:38:04 -07:00
Pierre Gayvallet
c05dda37e2
[workchat] reintegrate into main (#215627)
## Summary

~**DO NOT MERGE:** depends on
https://github.com/elastic/kibana/issues/213468~

This PR reintegrates the work from the `workchat_m1` branch into `main`:

- introduces a 4th solution type, `chat`, that will be used for the
*WorkChat* project type.
- edit things in various platform code to introduce/handle that new
project type
- add plugins and packages for the workchat app. 

### To AppEx reviewers:

File change count is scary, but you can safely ignore anything from
`xpack/solutions/chat` (given it's solution code), and focus on your
owned changes, which are way more reasonable

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Joe McElroy <joseph.mcelroy@elastic.co>
Co-authored-by: Rodney Norris <rodney.norris@elastic.co>
Co-authored-by: Jedr Blaszyk <jedrazb@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Meghan Murphy <meghan.murphy@elastic.co>
2025-04-02 11:00:32 +01:00
Marta Bondyra
dc1d36b50b
[Markdown] migrate scss to emotion (#216351)
## Summary

Part of https://github.com/elastic/kibana/issues/207852
Migrates markdown to emotion.
2025-03-31 22:35:13 +02:00
Marta Bondyra
a7142c0d7b
[Inspector] Migrate scss to emotion (#216195)
## Summary

Part of https://github.com/elastic/kibana/issues/207852 for inspector.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-28 16:01:35 +01:00
Nathan Reese
3bc1465365
[unified search] optimize async chunk loading (#214483)
PR reduces unifiedSearch chunks into ui chunk, action chunk, and a
autocomplete chunk.

### Before
<img width="350" alt="Screenshot 2025-03-14 at 8 47 10 AM"
src="https://github.com/user-attachments/assets/f54fe21e-7548-48a1-8874-e36377826701"
/>

### After
The second chunk request is because search bar loads KQL suggestions.
This will be addressed in a follow up PR and the search bar will lazy
load suggestions only when interacted with.
<img width="350" alt="Screenshot 2025-03-14 at 12 56 28 PM"
src="https://github.com/user-attachments/assets/8f23ee56-a57a-489b-aeab-caa30f739d03"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-26 18:39:58 -06:00
Efe Gürkan YALAMAN
62f8027c57
[Query Rules]Query rules UI plugin (#215029)
## Summary

Adds Query Rules UI Plugin. It is disabled and pretty much empty as we
want to split the implementation in multiple parts and enable the
feature once implementation is done.

It is disabled for Security.
It is disabled for Observability.
It is enabled but behind a feature flag for Search while it is not
useful to enable it with partial implementations.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2025-03-21 15:19:25 +01:00
Umberto Pepato
4aab9d4c48
[ResponseOps][Alerts] Create embeddable alerts table plugin (#213909)
## Summary

Creates a wrapper plugin around the alerts table, that registers a basic
alerts table embeddable panel for dashboards.

> [!NOTE]
> This PR is a preparation work for the [embeddable alerts
table](https://github.com/elastic/kibana/issues/197483). The feature is
disabled for end-users while waiting for other dependent PRs to be
integrated with this, and uses a partially hard-coded table
configuration for testing purposes. The final panel will be fully
configurable by the user.

## Verification steps

1. Uncomment this line

4d49e98b4d/x-pack/platform/plugins/shared/embeddable_alerts_table/public/plugin.ts (L34)
(I'm using a comment to avoid polluting the embeddable examples app with
this panel for a short time)
2. Create one or more ES Query rules that fire alerts
3. Visit the Dashboards page and create a dashboard, then enter edit
mode
4. Click "Add panel"
5. Under "Visualizations" choose "Alerts table"
6. Check that the table panel was created correctly
6.1. Shows any alerts fired by the ES Query rule(s)
6.2. Check that the table adapts correctly to the panel when resizing,
and all normal interactions with the alerts table work correctly
(adding/removing fields, opening alerts in flyouts, using row/bulk
actions)
6.3. Check that panels respond to the global time filter (only time
filters, not KQL search or filters)
6.4. Check that panels respond to individual time filters (⛭ icon >
Apply custom time range)
11. Create a role with access to dashboards but without any alerting
capability and a user assigned to that role
12. Repeat steps 3 and 4, and verify that the "Alerts table" option
isn't available under "Visualizations"
13. Add any alerting capability to the role, such as Management > Stack
rules
14. Repeat steps 3 and 4, and verify that the "Alerts table" is
available again

## References

Closes #203611

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-21 12:02:54 +02:00
Gerard Soldevila
adb4bdf8d8
SKA: Extract list of Kibana solutions into a dedicated package (#213353)
## Summary

The intent is to have a centralised place to store the list of Kibana
solutions and serverless project types.
To that end, this PR creates a `@kbn/projects-solutions-groups` package.
It also adds the new solution type `'chat'`.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-20 10:20:07 +01:00
Gonçalo Rica Pais da Silva
54d9cf45cb
[Discover][APM] Refactor APM sources for better trace enablement (#212634)
## Summary

This PR reworks how APM handles getting its sources data, elevating the
necessary code to a private shared plugin so that Discover for Traces
can access the data and handle user provided configuration. It also
removes the need for Discover for Traces to rely on the APM static data
view, so the Trace data source and document profile will work on any
compatible/configured index, even in ESQL mode.

Closes #211414

<img alt="ESQL Discover Traces Screenshot 2025-03-04 173032"
src="https://github.com/user-attachments/assets/f5bbb736-8b8b-45dc-ac23-4bf7083aa47e"
/>

## How to test

Test with olbt-cli instance for now, will post for doing with synthtrace
data. Ensure the following is added to your kibana.dev.yml:

```yaml
discover.experimental.enabledProfiles:
  - observability-traces-data-source-profile
```

- Make sure your space has the Observability solution view configured
- Go to Discover page
- Select Data Views mode if required and create a view with a `traces`
specific index. Or use the APM static data view.
- The default columns on the page should show the summary column with
four of the following badges: `service.name`, `event.outcome`,
`transaction.name`, `transaction.duration.us`, `span.name`,
`span.duration.us`
- Go to ESQL mode with the query targetting a `traces` index
- The default columns should show the same as in Data View mode

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Irene Blanco <irene.blanco@elastic.co>
2025-03-19 15:52:30 +01:00
Davis McPhee
e1bffa6a9b
[Discover] Optimize Discover plugin page load bundle (#208298)
## Summary

This PR optimizes the Discover page load bundle by reducing it to only
code which is actually required on startup, and dynamically loading
other code when it's needed, resulting in a 55% decrease in the bundle
size.

Before (44.15 KB):

![before](https://github.com/user-attachments/assets/989d1626-4dd7-4710-a9bc-8d80220101eb)

After (20.12 KB):

![after](https://github.com/user-attachments/assets/ff68b367-3293-47cf-9d3f-5c35d0aea27a)

### 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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-11 17:30:25 -03:00
Nathan Reese
99d8400328
move static presentationUtil code into package @kbn/expression-utils (#213659)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-11 14:24:00 -06:00
Ido Cohen
aa850d4b9f
Deprecate Cloud Defend 2025-03-11 15:45:13 +02:00
Anton Dosov
e676a6399c
Clean up REACT_18=true variable (#213246)
## Summary

Clean up `REACT_18=true` variable post [react@18
upgrade](https://github.com/elastic/kibana/pull/209337)


Should also address issue reported in slack 

> error https://registry.yarnpkg.com/react/-/react-18.2.0.tgz: Integrity
check failed for "react" [...]

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-05 17:40:05 +01:00
Tomasz Kajtoch
4dd8de807a
Make Amsterdam an opt-in theme (#212787)
## Summary

This PR updates `DEFAULT_THEME_TAGS` used to determine what theme tags
are bundled in Kibana by default to only include the Borealis theme,
specifically `borealislight` and `borealisdark` theme tags. This change
is expected to decrease bundle sizes significantly and get back to
bundling a single theme, not two (4 → 2 theme tags).

Now that Serverless, `9.0`, and `main` all run with Borealis, there's no
risk in removing Amsterdam from the bundle and decreasing Kibana bundle
sizes.

We need to keep the feature flag in code for the time being to easily
test future Borealis iterations.

Amsterdam will still be available as an opt-in theme and is meant to be
used locally when testing changes to be backported to 8.x versions that
use Amsterdam. To do so, Kibana needs to be started/built with
`KBN_OPTIMIZER_THEMES` environment variable set and the feature flag
overridden in `kibana.dev.yml`.

```yml
# config/kibana.dev.yml
feature_flags.overrides.coreRendering.defaultThemeName: amsterdam
```

```shell
# Run dev server with both borealis and Amsterdam theme tags
KBN_OPTIMIZER_THEMES="borealislight,borealisdark,v8light,v8dark" yarn start
```

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [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: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-04 13:40:06 +01:00
Gerard Soldevila
3fcd11ce4d
Decouple some modules from 'webpack' (#212746)
## Summary

Remove extraneous dependencies:
* `canvas` was depending on 'webpack' purely for a type (dev-time).
* `@kbn/optimizer-webpack-helpers` (canvas depends on it 🤨) was
depending on 'webpack' solely for a function that could be defined in
`@kbn/optimizer` (devOnly).
2025-03-03 13:21:50 +01:00
Joe Reuter
8a9bb363aa
🌊 Move streams to platform (#211893)
This PR moves the `streams` and `streams_app` plugins into platform so
they can be used in other solutions in the future. This PR is not
actually making it available in other solutions yet since we are still
discussing the release plans.

## Inlined helpers

As discussed before, this PR inlines a couple simple helper methods for
query building, time zone normalization, a header portal helper and a
data plugin timefilter state react integration hook as there is no good
place for these outside of the observability solution.

## streams_app plugin

The streams_app plugin is not actually registering anything, instead it
simply exports a component that renders the app which needs to be
consumed by another plugin to turn it into a registered app - for now,
`observability_streams_wrapper` takes over this job.

## observability_streams_wrapper plugin

While 99% of the streams logic is moved into the
`platform/shared/streams_app`, two bits are left behind in
`observability_streams_wrapper`:
* The actual app registration
* Integration with the observability_shared `PageTemplate` component

Once we decide streams should be displayed outside of the observability
solution, it's probably not necessary anymore to decouple app definition
and registration like this because it will always be visible no matter
the solution. Once this is the case, the navigation registration can be
moved into the central `observability` plugin, like it's handled with
other apps like infra.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-21 16:34:50 +01:00
Marco Liberati
1e92ae8afb
[Lens][Embeddable] Make UI react faster to click actions like create or edit (#210810)
## Summary

This PR is based on the idea in #209361 and tries to improve perceived
performances for all the scenarios where the `editorFrame` is loaded.

On fast connections this is now perceived very fast:

![esql_fast](https://github.com/user-attachments/assets/efb26416-bf15-449e-912f-a689c689c593)

On Fast 4g is still fast

![esql_fast_4g](https://github.com/user-attachments/assets/acc199be-683d-4a4b-a53c-f37a9117c258)

On Slow 4g is acceptable


![esql_slow_4g](https://github.com/user-attachments/assets/6fed9ec4-dc3f-4557-976c-91d82bddc10f)

Even on 3G connection the feedback is much better now


![esql_3g](https://github.com/user-attachments/assets/27e96c01-9149-4dd1-8a6d-e005202149ff)

As a bonus extra tests have been added for the ES|QL creation flow.

cc @thomasneirynck @nreese 

### 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: Nick Partridge <nick.ryan.partridge@gmail.com>
2025-02-20 18:19:46 +01:00
Tiago Costa
16a9136b93
fix(NA): use filesystem apis on kbn/optimizer populate_bundle_cache plugin (#211231)
This PR solves an issue detected in the populate bundle cache plugin
after the webpack v5 migration. On the new version webpack v5 returns a
lot of incomplete paths when we walk over file dependencies or internal
modules. The heuristic logic used previously was faulty so the fixes
turns to use a cached filesystem api instead.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-14 17:07:41 +00:00
Tiago Costa
203bc28478
chore(NA): upgrade to webpack 5 (#191106)
### Summary

- Closes #89741

This PR contains the resulting work of a massive effort that ports our
on top bundler abstraction (called @kbn/optimizer) from Webpack v4 into
Webpack v5. It's essential in terms of long term maintenance since v4
was not receiving updates any longer but will also unblock some new
features that could be beneficial for our future DevEx endeavours.

Next you can find a small list of all the accomplished tasks on this
journey.

### Completed Tasks
- [x] Upgrade dependencies to match the ones on webpack v5
- [x] Fix null-loader usages
- [x] Fix raw-loader usages
- [x] Fix file-loader usages
- [x] Fix url-loader usages
- [x] Fix `@kbn/optimizer-webpack-helpers` to support webpack v5 
- [x] Adopt previous webpack v4 polyfill-all strategy with
node-polyfill-webpack-plugin
- [x] Fix theme-loader on @kbn/optimizer
- [x] Migrate configurations and ad-hoc loader options on all webpack
configs from v4 to v5
- [x] Fix @kbn/test jest resolver for file-loader cases
- [x] Migrate public-path loader on UiSharedDeps
- [x] Fix all usages of webpack-merge
- [x] Migrate BundleRemoteModule
- [x] Migrate BundleRemotesPlugin
- [x] Correctly migrate PopulateBundleCachePlugin
- [x] Correctly migrate BundleMetricsPlugin
- [x] Check if the profiling plugins still work (--profile flag)
- [x] Recover if possible the previous webpack v4 cacheGroup chunks
rename to something like `data.plugin.chunk.0.js`
- [x] Run `/ci` and make sure we get our first green CI, otherwise work
on the errors until we do
- [x] Profile and solve bottlenecks until we get a cold build
performance similar to the one we had on webpack v4 (`node
scripts/build_kibana_platform_plugins --no-cache`).
- [x] OpenSSL Legacy Warnings: try to remove `--openssl-legacy-provider
` flags
- [x] Add Webpack to Renovate config
- [x] Explore removing `NodePolyfillPlugin`
([here](https://www.npmjs.com/package/node-polyfill-webpack-plugin)) and
add each polyfill needed individually per each webpack config to check
if we get smaller bundles. If we do it's better to go with the case by
case need approach instead of deploying a bunch of polyfills with
NodePolyfillPlugin. As another alternative, create a custom smaller
plugin with only the union of all needed polyfills.
- [x] Evaluate if we want to touch the resolutions on mainFields and
conditionNames
- [x] Understand why `@import 'src/core/public/mixins'` does not work
anymore (not a problem, we should use relative paths anyway but we want
to track why it changed from v4 to v5)
- [x] BUG: Child compilers are having errors hidden and/or changed from
error to warning
- [x] Fix license check for
[Artistic-2.0](https://spdx.org/licenses/Artistic-2.0.html) is the
license for
[domain-browser](https://github.com/bevry/domain-browser?tab=License-1-ov-file).
This package is a dependency of
[NodePolyfillPlugin](https://www.npmjs.com/package/node-polyfill-webpack-plugin).
Artistic 2.0 license is [classified as
yellow](https://github.com/elastic/open-source/blob/main/elastic-product-policy.md#yellow-list)
and should only be used for dev dependencies.
- [x] Make sure `resourceQuery: { not: /raw/ }` is not necessary on
other webpack configs like storybook one
- [x] Find what is being wrongly removed by usedExports optimization;
hint: I believe it is identifying a lot of exports inside the sync entry
of plugins as unused exports and removing them. Then `__kbnBootstrap__`
can't be found
- [x] Rebalance @kbn/optimizer pickMaxWorkerCount
- [x] Re-open the issue to fix sass-warnings
[#190345](https://github.com/elastic/kibana/issues/190345) or downgrade
sass-loader to v10
- [x] Remove previous esm no parse rules
- [x] Confirm esm support is working
- [x] Confirm console override is needed
- [x] Confirm react prod builds on ui shared deps for distributable
- [x] Remove customization for
[xyflow](https://github.com/xyflow/xyflow) from webpack configs
- [x] Clean all the code
- [x] Make sure collected metrics from stats are still aligned with what
we were collecting before; also verify if the modules used for optimizer
caches etc are well generated (@kbn/node-libs-browser)
- [x] Fix watch performance

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Brad White <brad.white@elastic.co>
2025-02-14 03:01:36 +00:00
Nathan Reese
8a30b862cc
[maps] lazy load map actions (#210252)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-11 09:37:34 -07:00
Nathan Reese
8efc247688
[uptime] avoid loading uptime.chunk on every page load (#209815)
Part of https://github.com/elastic/kibana/issues/194171

PR removes all async imports run during uptime plugin setup and start
methods. This causes page load bundle size to increase and accurately
reflect its true size.

### Test instructions
* Start kibana locally
* Open network tab in browser
* Open home page. Verify `uptime.chunk` are not loaded. The screen shots
show the behavior in main where `uptime.chunk` are loaded on home page
<img width="600" alt="Screenshot 2025-02-05 at 9 06 56 AM"
src="https://github.com/user-attachments/assets/14218b85-3814-4e3c-9c04-bd73cf6c4dbd"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-07 12:37:40 -07:00
Thom Heymann
151ce184c5
[OneDiscover] Remove logs explorer (#209565)
Resolves #209261

## Summary

Removes the code used to render Logs Explorer. This does not result in
any functional changes.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-06 17:40:55 +00:00
Bailey Cash
df573d7596
[SLO]: require instance id in slo details schema (#209020)
## Summary

Resolves #180590

Since SLO instanceId is provided in all APIs, it will be made required
for sloWithDataResponseSchema and the SLOWithSummaryResponse type.
Checks for the existence of instanceId have either been removed or
changed to check for ALL_VALUE (`*`)

---------

Co-authored-by: Kevin Delemme <kevin.delemme@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-04 10:20:03 -05:00
Nathan Reese
0fee502ffc
[links] lazy load links actions (#208100)
Page load bundle is reduced by
* lazy load add panel action
* avoid importing `deserialize_from_library.ts` in page load bundle
* avoid loading `links_strings.ts` in page load bundle

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-03 19:40:26 -07:00
Hanna Tamoudi
06d16614a9
[Automatic Import] rename plugin to automatic import (#207325)
## Summary

Rename `integration-assistant` plugin to `automatic-import`.
2025-01-28 21:55:42 +01:00
Gerard Soldevila
fb26c1c683
SKA: Update broken references and URLs (#206836)
## Summary

Updates a number of broken file references and broken links.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alejandro Fernández Haro <afharo@gmail.com>
2025-01-28 03:32:48 +00:00
Rickyanto Ang
a2d36067e9
[Cloud Security] Deleting K8S Dashboard (#207127)
## Summary

As K8S Dashboard is currently hidden on main , the code serves no
purpose other than potentially causing Tech debts whenever a refactor or
a migration happens. As such its better to remove it completely. In case
we want to bring it back later we will just pull it from git history

> [!CAUTION]
> **This should only affect Serverless and Main, 8.x.x should still be
able to see and access K8S Dashboard**

## Related Tickets
- https://github.com/elastic/security-team/issues/11418
- https://github.com/elastic/security-team/issues/10735

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Paulo Silva <paulo.henrique@elastic.co>
Co-authored-by: Maxim Kholod <maxim.kholod@elastic.co>
2025-01-27 14:06:29 +01:00
Nathan Reese
d7f801ab3e
[visualizations] lazy load actions (#207147)
Clean up visualizations page load size by
* lazy loading actions
* avoid exporting from index files to avoid exporting unused code
* move `urlFor` and `getFullPath` into `url_utils` to avoid including
`utils/saved_visualize_utils` in page load bundle

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-01-23 11:33:23 -07:00