kibana/packages
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
..
kbn-babel-preset [Fleet] Handle install status and errors when uninstalling remote integrations is enabled (#220990) 2025-05-28 11:24:00 -05:00
kbn-bazel-runner Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-capture-oas-snapshot-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-check-mappings-update-cli [MVP] Product Intercept Dialog (#209571) 2025-05-27 16:57:58 +02:00
kbn-check-prod-native-modules-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-ci-stats-performance-metrics Disable allowAbsoluteUrls for axios (#215138) 2025-03-25 09:52:36 +01:00
kbn-ci-stats-shipper-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-cli-dev-mode [Kibana Dev Server] Fix DELETE requests without a body in Safari (#220899) 2025-05-20 09:35:30 +02:00
kbn-dependency-ownership Add conditional switching between EUI releases (#219818) 2025-05-28 15:41:19 +02:00
kbn-dependency-usage SKA: Extract list of Kibana solutions into a dedicated package (#213353) 2025-03-20 10:20:07 +01:00
kbn-docs-utils Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-visualizations (#202754) 2025-01-08 12:19:24 +01:00
kbn-eslint-config [Authz] Cleanup of access tags functionality and documentation (#220231) 2025-05-22 08:45:17 +02:00
kbn-eslint-plugin-disable Add ESLINT constraints to detect inter-group dependencies (#194810) 2024-10-22 06:34:19 -05:00
kbn-eslint-plugin-eslint [Authz] Cleanup of access tags functionality and documentation (#220231) 2025-05-22 08:45:17 +02:00
kbn-eslint-plugin-eui-a11y Add support for wrapping elements in eslint-plugin-eui-a11y plugin (#216339) 2025-04-09 18:16:00 +02:00
kbn-eslint-plugin-i18n Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-visualizations (#202754) 2025-01-08 12:19:24 +01:00
kbn-eslint-plugin-imports SKA: Extract list of Kibana solutions into a dedicated package (#213353) 2025-03-20 10:20:07 +01:00
kbn-eslint-plugin-telemetry [chore] Reuse bundled lodash and lodash/fp dependency (#217467) 2025-04-17 14:54:25 +02:00
kbn-failed-test-reporter-cli Disable allowAbsoluteUrls for axios (#215138) 2025-03-25 09:52:36 +01:00
kbn-find-used-node-modules Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-generate SKA: Extract list of Kibana solutions into a dedicated package (#213353) 2025-03-20 10:20:07 +01:00
kbn-generate-console-definitions SKA: Categorise remaining packages (#205875) 2025-01-08 22:20:14 +01:00
kbn-import-locator Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-json-ast Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-kibana-manifest-schema SKA: Extract list of Kibana solutions into a dedicated package (#213353) 2025-03-20 10:20:07 +01:00
kbn-lint-packages-cli [codeowners] Filter kibanamachine (#199404) 2024-11-12 12:39:17 -06:00
kbn-lint-ts-projects-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-lock-manager [LockManager] Update token and metadata when an expired lock is re-acquired (#220476) 2025-05-08 19:40:20 +02:00
kbn-managed-vscode-config SKA: Misc cleanup and enhancements (#212207) 2025-02-24 13:31:00 +00:00
kbn-managed-vscode-config-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-manifest Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
kbn-mock-idp-plugin [workchat] Initial FTR test setup (#216828) 2025-04-09 10:31:12 +02:00
kbn-optimizer [onechat] Introduce plugin and tool registry (#220889) 2025-05-28 00:45:01 +03:00
kbn-peggy-loader SKA: Relocate "platform" packages that remain on /packages (#208704) 2025-02-24 11:03:30 +00:00
kbn-performance-testing-dataset-extractor [CI tools] Use ES 8.x (#213056) 2025-03-05 20:26:57 +01:00
kbn-picomatcher Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-plugin-check SKA: Categorise remaining packages (#205875) 2025-01-08 22:20:14 +01:00
kbn-plugin-generator SKA: Extract list of Kibana solutions into a dedicated package (#213353) 2025-03-20 10:20:07 +01:00
kbn-plugin-helpers Clean up REACT_18=true variable (#213246) 2025-03-05 17:40:05 +01:00
kbn-relocate SKA: Extract list of Kibana solutions into a dedicated package (#213353) 2025-03-20 10:20:07 +01:00
kbn-repo-file-maps Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-repo-linter Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-repo-source-classifier SKA: Extract list of Kibana solutions into a dedicated package (#213353) 2025-03-20 10:20:07 +01:00
kbn-repo-source-classifier-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-set-map SKA: Categorise remaining packages (#205875) 2025-01-08 22:20:14 +01:00
kbn-sort-package-json Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-styled-components-mapping-cli SKA: Relocate "platform" packages that remain on /packages (#208704) 2025-02-24 11:03:30 +00:00
kbn-ts-projects Dependency usage CLI (#198920) 2024-11-25 14:07:40 +01:00
kbn-ts-type-check-cli [CI] Only emit .d.ts when running typecheck (#209259) 2025-03-18 11:48:14 +01:00
kbn-validate-next-docs-cli [ci] Work around docosaurus errors (#206097) 2025-01-09 16:33:30 -06:00
kbn-web-worker-stub Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-whereis-pkg-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-yarn-lock-validator Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00