Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
40 changes: 40 additions & 0 deletions debezium-platform-stage/src/__fixtures__/collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"catalogs": [
{
"name": null,
"schemas": [
{
"name": "inventory",
"collections": [
{
"name": "spatial_ref_sys",
"fullyQualifiedName": "inventory.spatial_ref_sys"
},
{
"name": "geom",
"fullyQualifiedName": "inventory.geom"
},
{
"name": "products_on_hand",
"fullyQualifiedName": "inventory.products_on_hand"
},
{
"name": "customers",
"fullyQualifiedName": "inventory.customers"
},
{
"name": "orders",
"fullyQualifiedName": "inventory.orders"
},
{
"name": "products",
"fullyQualifiedName": "inventory.products"
}
],
"collectionCount": 6
}
],
"totalCollections": 6
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
}
);

const collectionsError =

Check warning on line 449 in debezium-platform-stage/src/components/CreateSourceSchemaForm.tsx

View workflow job for this annotation

GitHub Actions / TypeScript Type and Lint Check (24.x)

The 'collectionsError' conditional could make the dependencies of useCallback Hook (at line 502) change on every render. Move it inside the useCallback callback. Alternatively, wrap the initialization of 'collectionsError' in its own useMemo() Hook
collectionsQueryError != null
? typeof collectionsQueryError === "object"
? (collectionsQueryError as object)
Expand Down Expand Up @@ -657,7 +657,7 @@
}
const payload = {
databaseType: getDatabaseType(sourceId),
connectionConfig: selectedConnection,
connectionId: selectedConnection.id,
fullyQualifiedTableName: signalCollectionNameVerify,
};
const response = await verifySignals(`${API_URL}/api/sources/signals/verify`, payload);
Expand Down
25 changes: 18 additions & 7 deletions debezium-platform-stage/src/components/TableViewComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type TableViewComponentProps = {
type SelectedItem = {
name: string;
id: string;
fullyQualifiedName?: string;
checkProps: { checked?: boolean | null; "aria-label"?: string };
children?: SelectedItem[];
};
Expand Down Expand Up @@ -60,9 +61,13 @@ export function extractSelections(selectedItems: SelectedItem[]): SelectionResul
}

} else if (isTable) {
const schemaFromId = item.id.match(/^schema-\d+-(.*?)-collection-/)?.[1];
const schemaName = schemaFromId ?? "unknown_schema";
tableSet.add(`${schemaName}.${item.name}`);
// Use fullyQualifiedName if available, otherwise fall back to constructing it
const tableName = item.fullyQualifiedName || (() => {
const schemaFromId = item.id.match(/^schema-\d+-(.*?)-collection-/)?.[1];
const schemaName = schemaFromId ?? "unknown_schema";
return `${schemaName}.${item.name}`;
})();
tableSet.add(tableName);
}
}

Expand Down Expand Up @@ -182,8 +187,12 @@ const TableViewComponent: FC<TableViewComponentProps> = ({ collections, setSelec
newCheckedItems.push(...item.children);
}
} else if (isTableItem) {
const schemaFromId = itemId.match(/^schema-\d+-(.*?)-collection-/)?.[1];
const tableName = `${schemaFromId}.${itemName}`;
// Use fullyQualifiedName if available, otherwise construct it
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const tableName = (item as any).fullyQualifiedName || (() => {
const schemaFromId = itemId.match(/^schema-\d+-(.*?)-collection-/)?.[1];
return `${schemaFromId}.${itemName}`;
})();
if (tables.includes(tableName)) {
newCheckedItems.push(item);
}
Expand Down Expand Up @@ -223,8 +232,10 @@ const TableViewComponent: FC<TableViewComponentProps> = ({ collections, setSelec
name: collection.name,
id: `schema-${schemaIdx}-${schema.name}-collection-${collection.name}`,
icon: <ServerGroupIcon />,
checkProps: { checked: false }
});
checkProps: { checked: false },
fullyQualifiedName: collection.fullyQualifiedName // Store fullyQualifiedName
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any);
});
}
newOptions.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
type AdditionalPropertyRowErrorCode,
type AdditionalPropertyValueKind,
} from "@utils/additionalConfigProperties";
import { getConnectorTypeName } from "@utils/helpers";
import { extractConnectorType, getConnectorTypeName } from "@utils/helpers";
import { AdditionalPropertiesRows } from "@components/AdditionalPropertiesRows";
import { ExclamationCircleIcon, EyeIcon, EyeSlashIcon, PlusIcon } from "@patternfly/react-icons";
import { useState } from "react";
Expand Down Expand Up @@ -221,12 +221,12 @@ const CreateConnection: React.FunctionComponent<ICreateConnectionProps> = ({ sel

return selectedSchema
? ({
type: selectedSchema?.type.toUpperCase() || connectionId?.toUpperCase() || "",
type: selectedSchema?.type.toUpperCase() || extractConnectorType(connectionId || "").toUpperCase(),
config: mergedConfig,
name: name as string,
} as ConnectionPayload)
: {
type: connectionId?.toUpperCase() || "",
type: extractConnectorType(connectionId || "").toUpperCase(),
config: validation.additionalFlat,
name: name as string,
};
Expand Down
27 changes: 27 additions & 0 deletions debezium-platform-stage/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@ export const getConnectionRole = (connectorType: string, catalog: Catalog[]): st
return catalog.find((entry) => entry.class.toLowerCase() === lower || lower.includes(entry.class.toLowerCase()) || entry.class.toLowerCase().includes(lower))?.role;
}

export const extractConnectorType = (connectorClass: string): string => {
// Simple string
if (!connectorClass.includes('.')) {
return connectorClass;
}

// For source connectors: extract after "io.debezium.connector."
const sourcePrefix = "io.debezium.connector.";
if (connectorClass.startsWith(sourcePrefix)) {
const afterPrefix = connectorClass.substring(sourcePrefix.length);
const firstSegment = afterPrefix.split('.')[0];
return firstSegment;
}

// For destination/sink connectors: extract after "io.debezium.server."
const serverPrefix = "io.debezium.server.";
if (connectorClass.startsWith(serverPrefix)) {
const afterPrefix = connectorClass.substring(serverPrefix.length);
const firstSegment = afterPrefix.split('.')[0];
return firstSegment;
}

// Fallback
return connectorClass;
};


export const getConnectorTypeName = (connectorType: string) => {
let name = "";

Expand Down
Loading