Skip to content

Commit

Permalink
Switch order of namespaces and make Destination Default is the defaul… (
Browse files Browse the repository at this point in the history
#21047)

* Switch order of namespace options to make Destination Default appear as the first option
* Destination Default is the default option
* Update expected HTML
  • Loading branch information
grishick authored Jan 5, 2023
1 parent 199b7e9 commit 80504d9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ exports[`CreateConnectionForm should render 1`] = `
<div
class="<removed-for-snapshot-test>"
>
Mirror source structure
Destination default
</div>
</div>
</div>
Expand Down Expand Up @@ -303,7 +303,7 @@ exports[`CreateConnectionForm should render 1`] = `
<input
name="namespaceDefinition"
type="hidden"
value="source"
value="destination"
/>
</div>
</div>
Expand Down Expand Up @@ -796,9 +796,9 @@ exports[`CreateConnectionForm should render 1`] = `
/>
<div
class="<removed-for-snapshot-test>"
title="'<source schema>"
title="'<destination schema>"
>
'&lt;source schema&gt;
'&lt;destination schema&gt;
</div>
<div
class="<removed-for-snapshot-test>"
Expand Down
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])
.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,
namespaceFormat: initialValues.namespaceFormat,
}}
enableReinitialize
Expand All @@ -69,14 +69,14 @@ export const DestinationNamespaceModal: React.FC<DestinationNamespaceModalProps>
<LabeledRadioButton
{...field}
className={styles.radioButton}
id="destinationNamespace.source"
id="destinationNamespace.destination"
label={
<Text as="span">
<FormattedMessage id="connectionForm.modal.destinationNamespace.option.source" />
<FormattedMessage id="connectionForm.modal.destinationNamespace.option.destination" />
</Text>
}
value={NamespaceDefinitionType.source}
checked={field.value === NamespaceDefinitionType.source}
value={NamespaceDefinitionType.destination}
checked={field.value === NamespaceDefinitionType.destination}
/>
)}
</Field>
Expand All @@ -85,14 +85,14 @@ export const DestinationNamespaceModal: React.FC<DestinationNamespaceModalProps>
<LabeledRadioButton
{...field}
className={styles.radioButton}
id="destinationNamespace.destination"
id="destinationNamespace.source"
label={
<Text as="span">
<FormattedMessage id="connectionForm.modal.destinationNamespace.option.destination" />
<FormattedMessage id="connectionForm.modal.destinationNamespace.option.source" />
</Text>
}
value={NamespaceDefinitionType.destination}
checked={field.value === NamespaceDefinitionType.destination}
value={NamespaceDefinitionType.source}
checked={field.value === NamespaceDefinitionType.source}
/>
)}
</Field>
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,
])
.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

0 comments on commit 80504d9

Please sign in to comment.