You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: switch Builder Stream Templates to SchemaForm (#16468)
## What
Adds support for dynamic streams (i.e. `Stream Templates` in the UI) to the schema-form Builder feature branch.
## How
Similar to the other PRs in the stack, switches logic from the old `formValues` to the new `manifest` field in Builder state which SchemaForm writes to.
This PR also involves shifting `generatedStreams`, an ephemeral form state, to the top level of `BuilderState` so that it is no longer part of `formValues`, and updating things accordingly.
---
To achieve the generated streams view, I had to have a nested SchemaForm since `generatedStreams` are not actually part of the manifest (they are ephemeral). This required resolving the refs in the schema so that I could point it to the `DeclarativeStream` definition in the schema. If I didn't resolve first, then there would be unresolved refs in that definition which SchemaForm couldn't resolve since it wasn't given the full schema.
Since resolving all refs in the schema is somewhat slow, I chose to put that into a webworker and show a loading icon in the meantime so that it could just run in the background. Once it has been resolved once, the result is cached and therefore doesn't need to be resolved again.
---
The generated stream view used to put everything inside of a disabled fieldset, but this wasn't a great approach since it also disabled things like `Advanced` collapsibles, so users wouldn't be able to see what was inside of those. It also wasn't obvious that the controls themselves were disabled since they weren't styled any differently - they were just uninteractible, which made it feel somewhat broken.
I took a different approach here, where I added a `disableFormControls` prop to `SchemaForm` and then passed this through as a `disabled` prop on each form control/button/checkbox. This way, we actually use the form controls' own `disabled` styles which is a lot clearer and still allows things like `Advanced` collapsibles to be interacted with.
## Testing
To test, I recommend following the guide at https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/stream-templates - some of it might be slightly outdated from the changes made in this PR but it still should be pretty consistent.
## Recommended reading order
1. `oss/airbyte-webapp/src/components/connectorBuilder/Builder/DynamicStreamConfigView.tsx` main changes for the dynamic stream view
2. `oss/airbyte-webapp/src/components/connectorBuilder/Builder/GeneratedStreamView.tsx` and `oss/airbyte-webapp/src/core/services/connectorBuilder/SchemaResolverWorker.ts` - changes to achieve rendering the generated stream view with a nested SchemaForm and the web-worker needed to resolve the schema
3. `oss/airbyte-webapp/src/components/connectorBuilder/Builder/StreamConfigView.tsx`
4. `oss/airbyte-webapp/src/components/forms/SchemaForm/*` - add ability to disable all controls
0 commit comments