Skip to content

Commit 21ef33f

Browse files
committed
Set sourceCatalogId when creating a new connection
1 parent 4cce7a9 commit 21ef33f

File tree

6 files changed

+13
-1
lines changed

6 files changed

+13
-1
lines changed

airbyte-webapp/src/components/CreateConnectionContent/CreateConnectionContent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const CreateConnectionContent: React.FC<IProps> = ({
5454
schema,
5555
isLoading,
5656
schemaErrorStatus,
57+
catalogId,
5758
onDiscoverSchema,
5859
} = useDiscoverSchema(source.sourceId);
5960

@@ -79,6 +80,7 @@ const CreateConnectionContent: React.FC<IProps> = ({
7980
name: destination?.name ?? "",
8081
destinationDefinitionId: destination?.destinationDefinitionId ?? "",
8182
},
83+
sourceCatalogId: catalogId,
8284
});
8385

8486
if (afterSubmitConnection) {

airbyte-webapp/src/core/domain/catalog/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { JobInfo } from "../job";
44
export interface SourceDiscoverSchemaRead {
55
catalog: SyncSchema;
66
jobInfo?: JobInfo;
7+
catalogId: string;
78
}
89

910
export type SchemaFields = JSONSchema7;

airbyte-webapp/src/core/resources/Connection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default class ConnectionResource
4343
readonly syncCatalog: SyncSchema = { streams: [] };
4444
readonly isSyncing: boolean = false;
4545
readonly operationIds: string[] = [];
46+
readonly sourceCatalogId: string = "";
4647

4748
pk(): string {
4849
return this.connectionId?.toString();

airbyte-webapp/src/core/resources/Schema.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default class SchemaResource extends BaseResource implements Schema {
1313
readonly catalog: SyncSchema = { streams: [] };
1414
readonly id: string = "";
1515
readonly jobInfo?: JobInfo = undefined;
16+
readonly catalogId = "";
1617

1718
pk(): string {
1819
return this.id?.toString();
@@ -38,6 +39,7 @@ export default class SchemaResource extends BaseResource implements Schema {
3839
catalog: result.catalog,
3940
jobInfo: result.jobInfo,
4041
id: params.sourceId,
42+
catalogId: result.catalogId,
4143
};
4244
},
4345
schema: this,

airbyte-webapp/src/hooks/services/useConnectionHook.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type CreateConnectionProps = {
4242
| SourceDefinition
4343
| { name: string; sourceDefinitionId: string };
4444
destinationDefinition?: { name: string; destinationDefinitionId: string };
45+
sourceCatalogId: string;
4546
};
4647

4748
type UpdateConnection = {
@@ -126,6 +127,7 @@ const useConnection = (): {
126127
destination,
127128
sourceDefinition,
128129
destinationDefinition,
130+
sourceCatalogId,
129131
}: CreateConnectionProps) => {
130132
try {
131133
const result = await createConnectionResource(
@@ -135,6 +137,7 @@ const useConnection = (): {
135137
destinationId: destination?.destinationId,
136138
...values,
137139
status: "active",
140+
sourceCatalogId: sourceCatalogId,
138141
},
139142
[
140143
[

airbyte-webapp/src/hooks/services/useSchemaHook.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ export const useDiscoverSchema = (
1111
isLoading: boolean;
1212
schema: SyncSchema;
1313
schemaErrorStatus: { status: number; response: JobInfo } | null;
14+
catalogId: string;
1415
onDiscoverSchema: () => Promise<void>;
1516
} => {
1617
const [schema, setSchema] = useState<SyncSchema>({ streams: [] });
18+
const [catalogId, setCatalogId] = useState("");
1719
const [isLoading, setIsLoading] = useState(false);
1820
const [schemaErrorStatus, setSchemaErrorStatus] = useState<{
1921
status: number;
@@ -28,6 +30,7 @@ export const useDiscoverSchema = (
2830
try {
2931
const data = await fetchDiscoverSchema({ sourceId: sourceId || "" });
3032
setSchema(data.catalog);
33+
setCatalogId(data.catalogId);
3134
} catch (e) {
3235
setSchemaErrorStatus(e);
3336
} finally {
@@ -43,5 +46,5 @@ export const useDiscoverSchema = (
4346
})();
4447
}, [onDiscoverSchema, sourceId]);
4548

46-
return { schemaErrorStatus, isLoading, schema, onDiscoverSchema };
49+
return { schemaErrorStatus, isLoading, schema, catalogId, onDiscoverSchema };
4750
};

0 commit comments

Comments
 (0)