Skip to content
Merged
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
1,620 changes: 1,376 additions & 244 deletions debezium-platform-stage/src/__fixtures__/catalog.json

Large diffs are not rendered by default.

114 changes: 0 additions & 114 deletions debezium-platform-stage/src/__mocks__/data/DestinationCatalog.json

This file was deleted.

44 changes: 0 additions & 44 deletions debezium-platform-stage/src/__mocks__/data/SourceCatalog.json

This file was deleted.

1 change: 1 addition & 0 deletions debezium-platform-stage/src/apis/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface CatalogApiResponse {
components: {
converter: CatalogComponentEntry[];
"custom-converter": CatalogComponentEntry[];
"server-sink": CatalogComponentEntry[];
"sink-connector": CatalogComponentEntry[];
"source-connector": CatalogComponentEntry[];
transformation: CatalogComponentEntry[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
} from "@utils/helpers";
import { useNotification } from "@appContext/index";
import { Catalog, CatalogApiResponse, ConnectorSchema, SchemaGroup, SchemaProperty } from "../apis/types";
import destinationCatalog from "../__mocks__/data/DestinationCatalog.json";
import ConnectorImage from "./ComponentImage";
import TableViewComponent from "./TableViewComponent";
import SchemaGroupSection from "./SchemaGroupSection";
Expand All @@ -92,15 +91,15 @@
import { buildSourceConnectorDisplayGroupedProperties } from "@utils/sourceConnectorDisplayGroups";
import { splitSourceConfigForHydration } from "@utils/sourceConfigSplit";
import _ from "lodash";
import "./CreateSourceSchemaForm.css";
import "./CreateSchemaForm.css";

interface connectionsList extends Connection {
role: string;
}

type AdditionalProp = { key: string; value: string };

interface CreateSourceSchemaFormProps {
interface CreateSchemaFormProps {
connectorSchema: ConnectorSchema;
sourceId: string;
dataType?: string;
Expand All @@ -109,9 +108,10 @@
readOnly?: boolean;
/** Initial layout; user can still switch via the toggle. Pipeline designer modal uses "tabs". */
defaultLayoutMode?: "jumplinks" | "tabs";
hideSignalCollections?: boolean;
}

export interface CreateSourceSchemaFormHandle {
export interface CreateSchemaFormHandle {
validate: () => boolean;
submit: () => void;
/** Populated after the most recent failed `validate()` */
Expand Down Expand Up @@ -219,10 +219,10 @@
return t("source:form.validationFailedInMultipleSections", { list: sections.join(", ") });
}

const CreateSourceSchemaForm = React.forwardRef<
CreateSourceSchemaFormHandle,
CreateSourceSchemaFormProps
>(({ connectorSchema, sourceId, dataType, onSubmit, initialSource, readOnly = false, defaultLayoutMode = "jumplinks" }, ref) => {
const CreateSchemaForm = React.forwardRef<
CreateSchemaFormHandle,
CreateSchemaFormProps
>(({ connectorSchema, sourceId, dataType, onSubmit, initialSource, readOnly = false, defaultLayoutMode = "jumplinks", hideSignalCollections = false }, ref) => {
const { t } = useTranslation();
const { addNotification } = useNotification();
const hydratedSourceIdRef = useRef<number | null>(null);
Expand Down Expand Up @@ -357,9 +357,11 @@
}
}
sections.push({ id: "additional-properties", label: "Additional Properties", type: "custom" });
sections.push({ id: "signal-collections", label: "Signal Collections", type: "custom" });
if (!hideSignalCollections) {
sections.push({ id: "signal-collections", label: "Signal Collections", type: "custom" });
}
return sections;
}, [orderedGroups, groupedProperties]);
}, [orderedGroups, groupedProperties, hideSignalCollections]);

useEffect(() => {
if (layoutMode !== "jumplinks") return;
Expand Down Expand Up @@ -405,6 +407,17 @@
}
);

const { data: destinationCatalog = [] } = useQuery<Catalog[], Error>(
"destinationConnectorCatalog",
async () => {
const response = await fetchData<CatalogApiResponse>(`${API_URL}/api/catalog`);
return (response.components["server-sink"] ?? []).map((entry) => ({
...entry,
role: "destination",
}));
}
);

const catalog: Catalog[] = [...sourceCatalog, ...destinationCatalog];

const { isLoading: isConnectionsLoading } = useQuery<Connection[], Error>(
Expand Down Expand Up @@ -446,7 +459,7 @@
}
);

const collectionsError =

Check warning on line 462 in debezium-platform-stage/src/components/CreateSchemaForm.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 515) 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 @@ -1120,9 +1133,11 @@
</section>

{/* Signal Collections */}
<section id="signal-collections" className="jumplinks-section-bordered">
{renderSignalCollections()}
</section>
{!hideSignalCollections && (
<section id="signal-collections" className="jumplinks-section-bordered">
{renderSignalCollections()}
</section>
)}
</div>
</div>
);
Expand Down Expand Up @@ -1183,9 +1198,11 @@
</FormFieldGroup>
</div>

<div style={{ marginTop: "1rem" }}>
{renderSignalCollections()}
</div>
{!hideSignalCollections && (
<div style={{ marginTop: "1rem" }}>
{renderSignalCollections()}
</div>
)}
</CardBody>
</Card>
</div>
Expand Down Expand Up @@ -1281,5 +1298,5 @@
);
});

CreateSourceSchemaForm.displayName = "CreateSourceSchemaForm";
export default CreateSourceSchemaForm;
CreateSchemaForm.displayName = "CreateSchemaForm";
export default CreateSchemaForm;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { screen } from "@testing-library/react";
import { describe, it, expect, vi, beforeAll, beforeEach } from "vitest";
import { useQuery } from "react-query";
import SourceSchemaReviewView from "./SourceSchemaReviewView";
import SchemaReviewView from "./SchemaReviewView";
import type { Source } from "../apis/apis";
import type { ConnectorSchema } from "../apis/types";
import { render } from "../__test__/unit/test-utils";
Expand Down Expand Up @@ -55,7 +55,7 @@ beforeAll(() => {
} as unknown as typeof IntersectionObserver;
});

describe("SourceSchemaReviewView", () => {
describe("SchemaReviewView", () => {
beforeEach(() => {
vi.clearAllMocks();
});
Expand All @@ -69,7 +69,7 @@ describe("SourceSchemaReviewView", () => {
} as any);

render(
<SourceSchemaReviewView source={baseSource} connectorSchema={minimalSchema} />,
<SchemaReviewView source={baseSource} connectorSchema={minimalSchema} />,
);

expect(await screen.findByText("Review Source")).toBeInTheDocument();
Expand All @@ -87,7 +87,7 @@ describe("SourceSchemaReviewView", () => {
} as any);

render(
<SourceSchemaReviewView source={baseSource} connectorSchema={minimalSchema} />,
<SchemaReviewView source={baseSource} connectorSchema={minimalSchema} />,
);

const unsetValues = await screen.findAllByText("—");
Expand Down Expand Up @@ -143,7 +143,7 @@ describe("SourceSchemaReviewView", () => {
};

render(
<SourceSchemaReviewView source={withConnection} connectorSchema={filtersSchema} />,
<SchemaReviewView source={withConnection} connectorSchema={filtersSchema} />,
);

expect(
Expand Down
Loading
Loading