From af733ca920a7fcb8c1ce98f50c2a4c91cab51c95 Mon Sep 17 00:00:00 2001 From: Ildar Nurislamov Date: Sat, 28 Dec 2024 17:53:15 +0400 Subject: [PATCH] console: ConnectionEditor choose pk based on data layout --- .../ConnectionEditorPage.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/webapps/console/components/ConnectionEditorPage/ConnectionEditorPage.tsx b/webapps/console/components/ConnectionEditorPage/ConnectionEditorPage.tsx index d415cf4f5..5e77b8af6 100644 --- a/webapps/console/components/ConnectionEditorPage/ConnectionEditorPage.tsx +++ b/webapps/console/components/ConnectionEditorPage/ConnectionEditorPage.tsx @@ -364,7 +364,24 @@ function ConnectionEditor({ component: ( updateOptions({ dataLayout })} + onChange={dataLayout => { + if (existingLink) updateOptions({ dataLayout }); + else { + if (dataLayout === "jitsu-legacy") { + updateOptions({ + dataLayout, + primaryKey: "eventn_ctx_event_id", + timestampColumn: "_timestamp", + }); + } else { + updateOptions({ + dataLayout, + primaryKey: connectionOptionsZodType.parse({}).primaryKey || "message_id", + timestampColumn: "timestamp", + }); + } + } + }} value={connectionOptions.dataLayout || "segment-single-table"} /> ),