kibana/packages/kbn-xstate-utils/index.ts
Kerry Gallagher afcdc59348
[Logs+] Extract custom integration resources to package (#165510)
## Summary 

This closes #163788.

## High level overview

- Adds a new `kbn-custom-integrations` package.
- This package adds a new top level custom integrations state machine,
which manages a child create custom integration state machine. In the
future we will have additional modes (such as adding a dataset to an
existing integration, and various "uplift" flows).
- Adds connected (to the machine) components that consumers can use to
facilitate custom integration workflows.
- Adds a `kbn-xstate-utils` package (as these utils were in 2 plugins
and now 1 package).
- Replaces the integration creation inside of the onboarding wizard flow
with this package.
- At the moment this is locked down to `logs`, and one dataset, but it
can be easily extended in the future to support all types and multiple
datasets. The state machine is ready, it just needs exposed in the UI.
- Some thought has gone in to how this will work with multiple "modes",
and the foundations are there (imagining that certain types will be
unions etc), however it's worth not getting too bogged down in those
specific implementation details as I'd rather base that evolution on the
real world usage when we have it.

The Configure integration section should more or less work the same as
before.

![Screenshot 2023-09-05 at 16 24
44](8891dc0f-0ba2-48e0-83ac-99336369bc50)

## Testing

- When utilising the onboarding flow for custom logs at
`/app/observabilityOnboarding/customLogs` can you:
- Create a custom integration? (It's worth verifying the network
requests, and the assets are installed).
- If you navigate forward, then back, make a change to the integration
fields, and navigate forward again is the previously created integration
deleted?
- Is the success callout with the integration name shown on the next
wizard panel?
  - Do field validations work?
- Are errors displayed when you try to create an integration with a name
that already exists?
- Can you retry when there is a server error? (you can block network
requests to the custom integrations API to test this)

## Screenshots

![Screenshot 2023-09-06 at 10 51
35](95cd895c-02a3-482a-af35-b23f30dcba56)

![Screenshot 2023-09-06 at 10 51
57](9848dfe6-dae8-43b4-892e-bcfe199248f2)

![Screenshot 2023-09-06 at 10 49
40](2cb52e17-bba9-4901-bf77-9e12519f36a9)

![Screenshot 2023-09-06 at 10 52
21](4d871ccb-0948-46ee-a095-d1b60fb63d50)

## State machine diagram

(The top level management machine is super basic, so this is just the
create machine)

![Screenshot 2023-09-08 at 16 30
26](ccbaa270-e450-4eeb-b8cb-8ae9a41afa39)

## Followups

- Tests (the current onboarding UI implementation doesn't have tests so
whilst it's not ideal technically this coverage stays the same)
- Storybook 
- Replace other plugins' usage with xstate-utils (not urgent)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Yngrid Coello <yngrid.coello@elastic.co>
2023-09-12 20:22:25 +01:00

9 lines
378 B
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export * from './src';