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

Switch order of namespaces and make Destination Default is the defaul… #21047

Merged
merged 3 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Switch order of namespaces and make Destination Default is the defaul…
…t option
  • Loading branch information
grishick committed Jan 5, 2023
commit a93c5bd7ee71111ff3cfbb4d5c457f42ace78ee2
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ExampleSettingsTable } from "./ExampleSettingsTable";
const destinationNamespaceValidationSchema = yup.object().shape({
namespaceDefinition: yup
.string()
.oneOf([NamespaceDefinitionType.source, NamespaceDefinitionType.destination, NamespaceDefinitionType.customformat])
.oneOf([NamespaceDefinitionType.destination, NamespaceDefinitionType.source, NamespaceDefinitionType.customformat])
Copy link
Contributor

Choose a reason for hiding this comment

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

Not strictly necessary to change the order here, since this just enforces that at least one of these options is selected. But it also doesn't hurt 👍

.required("form.empty.error"),
namespaceFormat: yup.string().when("namespaceDefinition", {
is: NamespaceDefinitionType.customformat,
Expand Down Expand Up @@ -48,7 +48,7 @@ export const DestinationNamespaceModal: React.FC<DestinationNamespaceModalProps>
return (
<Formik
initialValues={{
namespaceDefinition: initialValues?.namespaceDefinition ?? NamespaceDefinitionType.source,
namespaceDefinition: initialValues?.namespaceDefinition ?? NamespaceDefinitionType.destination,
Copy link
Contributor

Choose a reason for hiding this comment

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

This will correctly set NamespaceDefinitionType.destination as the default, but it still appears as the second option in the list due to the order in the HTML below:

image

To make it the first option, you could move the destination <Field> component (lines 83-98) before the source component (lines 67-82).

Note: this is only visible in the upcoming stream table redesign, so you need to set REACT_APP_NEW_STREAMS_TABLE=true in airbyte-webapp/.env.development before spinning up the server with npm run start or npm run start:cloud to see this new modal UI.

namespaceFormat: initialValues.namespaceFormat,
}}
enableReinitialize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import { NamespaceDefinitionType } from "../../../../core/request/AirbyteClient"
import styles from "./NamespaceDefinitionField.module.scss";

export const StreamOptions = [
{
value: NamespaceDefinitionType.source,
label: <FormattedMessage id="connectionForm.sourceFormat" />,
testId: "namespaceDefinition-source",
},
{
value: NamespaceDefinitionType.destination,
label: <FormattedMessage id="connectionForm.destinationFormat" />,
testId: "namespaceDefinition-destination",
},
{
value: NamespaceDefinitionType.source,
label: <FormattedMessage id="connectionForm.sourceFormat" />,
testId: "namespaceDefinition-source",
},
{
value: NamespaceDefinitionType.customformat,
label: <FormattedMessage id="connectionForm.customFormat" />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ export const createConnectionValidationSchema = ({
namespaceDefinition: yup
.string()
.oneOf([
NamespaceDefinitionType.source,
NamespaceDefinitionType.destination,
NamespaceDefinitionType.source,
NamespaceDefinitionType.customformat,
Comment on lines 141 to 143
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, not strictly necessary to change the order for the validation schema, but doesn't hurt.

])
.required("form.empty.error"),
Expand Down Expand Up @@ -365,7 +365,7 @@ export const useInitialValues = (
scheduleData: connection.connectionId ? connection.scheduleData ?? null : DEFAULT_SCHEDULE,
nonBreakingChangesPreference: connection.nonBreakingChangesPreference ?? NonBreakingChangesPreference.ignore,
prefix: connection.prefix || "",
namespaceDefinition: connection.namespaceDefinition || NamespaceDefinitionType.source,
namespaceDefinition: connection.namespaceDefinition || NamespaceDefinitionType.destination,
namespaceFormat: connection.namespaceFormat ?? SOURCE_NAMESPACE_TAG,
geography: connection.geography || workspace.defaultGeography || "auto",
};
Expand Down
2 changes: 1 addition & 1 deletion tools/bin/load_test/connection_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
]
},
"prefix": "",
"namespaceDefinition": "source",
"namespaceDefinition": "destination",
"namespaceFormat": "${SOURCE_NAMESPACE}",
"scheduleType": "basic",
"scheduleData": {
Expand Down