Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟🔧 Remove connector form name override #20132

Merged
merged 22 commits into from
Dec 12, 2022

Conversation

flash1293
Copy link
Contributor

Part of #14250

Based on #20127 (wait until merged)

What

This PR removes the special component for the connector name and replaces it with regular schema definition. It also moves this logic into the useBuildForm hook.

How

As the regular form builder can handle name fields just fine, it's simple to do the name and description resolution in the schema modification instead of handling this via a special component. This also allows to remove the "uiOverride" concept from the uiWidget state. In a follow-up PR this will be removed completely.

🚨 User Impact 🚨

No user-visible changes

@flash1293 flash1293 changed the base branch from master to flash1293/connector-form-loading-state December 6, 2022 14:54
@flash1293 flash1293 changed the base branch from flash1293/connector-form-loading-state to master December 6, 2022 14:55
@flash1293 flash1293 marked this pull request as ready for review December 9, 2022 11:16
@flash1293 flash1293 requested a review from a team as a code owner December 9, 2022 11:16
Comment on lines +30 to +45
const jsonSchema: JSONSchema7 = useMemo(
() => ({
type: "object",
properties: {
name: {
type: "string",
title: formatMessage({ id: `form.${formType}Name` }),
description: formatMessage({ id: `form.${formType}Name.message` }),
},
connectionConfiguration:
selectedConnectorDefinitionSpecification.connectionSpecification as JSONSchema7Definition,
},
required: ["name"],
}),
[formType, formatMessage, selectedConnectorDefinitionSpecification.connectionSpecification]
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One potential future issue with putting this in the useBuildForm hook is that when we want to use the connector form in the Connector Builder for the config menu, we don't want to have this "connector name" field in there.

Can definitely be addressed in a later PR but I wanted to call it out since I thought of it

Copy link
Contributor

@lmossman lmossman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small suggestions, but overall this looks like a good incremental improvement to me.

I don't think I'll need to take another look after you address my comments bc they are pretty straightforward, so approving now.

Tested locally and didn't notice any regressions from master, though I did find a bug in master which I captured in an issue here: #20332


// As schema is dynamic, it is possible, that new updated values, will differ from one stored.
const mergedState = useMemo(
() =>
merge(
buildPathInitialState(Array.isArray(formFields) ? formFields : [formFields], formValues),
merge(overriddenWidgetState, uiOverrides)
merge(overriddenWidgetState)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
merge(overriddenWidgetState)
overriddenWidgetState

This merge() call is now unnecessary

): BuildUiWidgetsContextHook => {
const [overriddenWidgetState, setUiWidgetsInfo] = useState<WidgetConfigMap>(uiOverrides ?? {});
const [overriddenWidgetState, setUiWidgetsInfo] = useState<WidgetConfigMap>({});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is no more concept of "ui overrides" here, I think we can just name this something like uiWidgetsInfo instead of overriddenWidgetState

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take care of this in a follow-up PR

@flash1293 flash1293 merged commit c950ea6 into master Dec 12, 2022
@flash1293 flash1293 deleted the flash1293/connector-form-name-override branch December 12, 2022 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform team/extensibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants