Commit 6d96913
committed
feat: use normalization CDK logic in Builder UI (#16708)
## What
In airbytehq/airbyte-python-cdk#599, I made some changes to the manifest normalizer in the CDK to make it ready to be used by the new Builder implementation. See that PR for details on those changes if interested.
This PR makes changes to both SchemaForm and the Builder to make it properly use the manifest normalizer.
At a high level, this looks like:
- When the Builder is first opened, `/resolve` is called with `should_normalize: true`, which causes the CDK to
- Resolve all $refs
- Find matching values for fields with `linkable: true` and point them to shared values placed in `definitions.shared`
- Replace parent stream configs that just duplicate another stream with a $ref that points to that stream instead
- Return the resulting manifest back to the UI
- Builder then passes this result to SchemaForm which now:
- Resolves all $refs pointing to `refTargetPath`, which is the `definitions.shared` field
- RefsHandler keeps track of where those $refs were pointing and propagates changes back and forth between the shared components (most of this logic was already implemented - this PR just cleans up some parts of this logic)
- Parent stream $refs are left alone since they aren't pointing to `refTargetPath` - this is desired since a follow-up PR adds an override to the parent stream field to show a dropdown for selecting the parent stream name, and $refs are used for this in the UI logic
- When saving the manifest to the database, publishing, or exporting YAML, the Builder uses the new `exportValuesWithRefs` method from RefsHandler to re-insert the $refs for the linked fields so that the manifests stay concise and non-duplicative
- If the user switches to YAML mode and makes changes, the updated manifest is again passed to `/resolve` with `should_normalize: true` to get the normalized manifest, and then the new `resetFormAndRefState` method in RefsHandler is used to update the ref mappings and form state to reflect the newly-normalized manifest, as if it was loaded for the first time like the above bullets described.
## Testing
Note that the deploy preview is not enough to test this since this is based on other branches that modify backend services.
To test this, you can deploy locally and see that parent stream $refs and linkable field $refs are properly returned by the `/resolve` call, and that the Builder UI handles this gracefully.1 parent 7b74e6f commit 6d96913
File tree
11 files changed
+266
-135
lines changed- airbyte-webapp/src
- components
- connectorBuilder
- MenuBar
- StreamTestingPanel
- YamlEditor
- forms/SchemaForm
- Controls
- core
- api/hooks
- services/connectorBuilder
- pages/connectorBuilder/ConnectorBuilderEditPage
- services/connectorBuilder
11 files changed
+266
-135
lines changedLines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
| |||
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | | - | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
63 | 73 | | |
64 | | - | |
| 74 | + | |
65 | 75 | | |
66 | 76 | | |
67 | 77 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
0 commit comments