kibana/packages/kbn-babel-preset
Cristina Amico b7506d70af
[Fleet] Handle install status and errors when uninstalling remote integrations is enabled (#220990)
Closes https://github.com/elastic/kibana/issues/217683

## Summary

Follow up of https://github.com/elastic/kibana/pull/217144

Handle errors occurring when `sync_uninstalled_integrations` is enabled
on remote outputs; these errors are now saved under
`latest_uninstall_failed_attempts` and will be reported by
`api/fleet/remote_synced_integrations/<output_id>/remote_status` and
`api/fleet/remote_synced_integrations/remote_status`.
- I added a new field in the response of these apis that allows to
understand at a glance the install status of an integration on both
cluster:

```
 install_status: {
  main: 'installed',
  remote: 'not_installed',
}
```
- Added a new "warning" state for synced integrations 
- Handled the case when an integration was successfully uninstalled from
both clusters (marked as complete)
- Removed the "throw error" for the case of `outputId` in favour of a
regular error in the response

### Testing
- Follow steps in  https://github.com/elastic/kibana/pull/217144
- Check that the errors reported in `latest_uninstall_failed_attempts`
are now visible when querying
`api/fleet/remote_synced_integrations/<output_id>/remote_status` under
the new "warning" field. This can be done also from the UI, checking the
network tab
- 
<img width="2111" alt="Screenshot 2025-05-20 at 11 17 13"
src="https://github.com/user-attachments/assets/80a077e7-8b1b-4d04-abe9-0ef0cc44def8"
/>

Response for the failed uninstalled integration:
```
 {
      "package_name": "akamai",
      "package_version": "2.28.0",
      "install_status": {
        "main": "not_installed",
        "remote": "installed"
      },
      "updated_at": "2025-05-21T09:34:34.492Z",
      "sync_status": "warning",
      "warning": "Unable to remove package akamai:2.28.0 with existing package policy(s) in use by agent(s) at Fri, 23 May 2025 07:54:41 GMT"
    },
```

### UI changes
The integrations uninstalled from the main cluster are now shown with a
greyed out text and the warning is shown on screen as well:
<img width="703" alt="Screenshot 2025-05-23 at 10 37 57"
src="https://github.com/user-attachments/assets/a6900e0b-96cc-4bcc-8f16-db0001f55de3"
/>



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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-05-28 11:24:00 -05:00
..
BUILD.bazel chore(NA): upgrade to webpack 5 (#191106) 2025-02-14 03:01:36 +00:00
common_babel_parser_options.js Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
common_preset.js Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
istanbul_preset.js Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kibana.jsonc Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
node_preset.js Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
package.json Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
README.mdx Initialize ops documentation section (#132262) 2022-05-17 15:22:38 -05:00
styled_components_files.js [Fleet] Handle install status and errors when uninstalling remote integrations is enabled (#220990) 2025-05-28 11:24:00 -05:00
tsconfig.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
webpack_preset.js chore(NA): upgrade to webpack 5 (#191106) 2025-02-14 03:01:36 +00:00

---
id: kibDevDocsOpsBabelPreset
slug: /kibana-dev-docs/ops/babel-preset
title: "@kbn/babel-preset"
description: A package holding the main babel configs on Kibana
date: 2022-05-17
tags: ['kibana', 'dev', 'contributor', 'operations', 'babel', 'custom', 'preset']
---

This package contains the shared bits of babel config that we use for transpiling our source code to code compatible with Node.JS and the various [browsers we support](https://www.elastic.co/support/matrix#matrix_browsers).

## Usage

To use those presets add either `@kbn/babel-preset/node_preset` or `@kbn/babel-preset/webpack_preset` into the babel config file.

`@kbn/babel-preset/node_preset` is usually placed in a [`babel.config.js` file](https://babeljs.io/docs/en/configuration#babelconfigjs).

`@kbn/babel-preset/webpack_preset` is usually placed directly in a `webpack` configuration.

If you're transpiling code that will be run in both the browser and node you must transpile your code twice, once for each target. 

Along with the introduction of Bazel to build packages we also provide now an easier way to easily use the babel transpiler by using the `js_ts_tarnspiler` rule with our without the `web` property enabled. 
Take a look for example at `@kbn/i18n` to see how that can look.