From 7164e1c70070043aac2c3f88527efd33f1bd001d Mon Sep 17 00:00:00 2001 From: Joey Marshment-Howell Date: Mon, 7 Nov 2022 13:21:00 +0100 Subject: [PATCH 001/279] =?UTF-8?q?=F0=9F=AA=9F=20=F0=9F=90=9B=20Fix=20wro?= =?UTF-8?q?ng=20geography=20dropdown=20type=20#19021?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workspaces/DataResidencyView/DataResidencyView.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/airbyte-webapp/src/packages/cloud/views/workspaces/DataResidencyView/DataResidencyView.tsx b/airbyte-webapp/src/packages/cloud/views/workspaces/DataResidencyView/DataResidencyView.tsx index a24475b5e8345..b2a83b27de98e 100644 --- a/airbyte-webapp/src/packages/cloud/views/workspaces/DataResidencyView/DataResidencyView.tsx +++ b/airbyte-webapp/src/packages/cloud/views/workspaces/DataResidencyView/DataResidencyView.tsx @@ -18,11 +18,6 @@ import { links } from "utils/links"; import styles from "./DataResidencyView.module.scss"; -interface SelectGeographyOption { - label: Geography; - value: Geography; -} - interface DefaultDataResidencyFormValues { defaultGeography: Geography | undefined; } @@ -78,7 +73,7 @@ export const DataResidencyView: React.FC = () => { {({ isSubmitting, dirty, isValid, resetForm }) => (
- {({ field, form }: FieldProps) => ( + {({ field, form }: FieldProps) => (
Date: Mon, 7 Nov 2022 14:02:09 +0100 Subject: [PATCH 002/279] =?UTF-8?q?=F0=9F=AA=9F=F0=9F=A7=AA=20[Experiment]?= =?UTF-8?q?=20Move=20OAuth=20to=20top=20of=20signup=20page=20(#18899)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🪟🧪 [Experiment] Move OAuth to top of signup page * bring separator back to login page --- .../hooks/services/Experiment/experiments.ts | 1 + .../cloud/views/auth/LoginPage/LoginPage.tsx | 3 ++ .../auth/OAuthLogin/OAuthLogin.module.scss | 26 ----------------- .../views/auth/OAuthLogin/OAuthLogin.tsx | 3 -- .../auth/SignupPage/SignupPage.module.scss | 6 ++++ .../views/auth/SignupPage/SignupPage.tsx | 19 +++++++++++-- .../components/Separator.module.scss | 28 +++++++++++++++++++ .../auth/SignupPage/components/Separator.tsx | 10 +++++++ .../auth/SignupPage/components/SignupForm.tsx | 4 +-- 9 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/Separator.module.scss create mode 100644 airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/Separator.tsx diff --git a/airbyte-webapp/src/hooks/services/Experiment/experiments.ts b/airbyte-webapp/src/hooks/services/Experiment/experiments.ts index d7f4e8274f44b..86e7363781cc7 100644 --- a/airbyte-webapp/src/hooks/services/Experiment/experiments.ts +++ b/airbyte-webapp/src/hooks/services/Experiment/experiments.ts @@ -19,4 +19,5 @@ export interface Experiments { "authPage.oauth.google.signUpPage": boolean; "authPage.oauth.github.signUpPage": boolean; "onboarding.speedyConnection": boolean; + "authPage.oauth.position": "top" | "bottom"; } diff --git a/airbyte-webapp/src/packages/cloud/views/auth/LoginPage/LoginPage.tsx b/airbyte-webapp/src/packages/cloud/views/auth/LoginPage/LoginPage.tsx index 412ede696f786..3a1c517032b88 100644 --- a/airbyte-webapp/src/packages/cloud/views/auth/LoginPage/LoginPage.tsx +++ b/airbyte-webapp/src/packages/cloud/views/auth/LoginPage/LoginPage.tsx @@ -17,6 +17,7 @@ import { BottomBlock, FieldItem, Form } from "packages/cloud/views/auth/componen import { FormTitle } from "packages/cloud/views/auth/components/FormTitle"; import { OAuthLogin } from "../OAuthLogin"; +import { Separator } from "../SignupPage/components/Separator"; import { Disclaimer } from "../SignupPage/components/SignupForm"; import styles from "./LoginPage.module.scss"; @@ -112,6 +113,8 @@ const LoginPage: React.FC = () => { )} + +
diff --git a/airbyte-webapp/src/packages/cloud/views/auth/OAuthLogin/OAuthLogin.module.scss b/airbyte-webapp/src/packages/cloud/views/auth/OAuthLogin/OAuthLogin.module.scss index 0b693bf1259b0..311bfd566727a 100644 --- a/airbyte-webapp/src/packages/cloud/views/auth/OAuthLogin/OAuthLogin.module.scss +++ b/airbyte-webapp/src/packages/cloud/views/auth/OAuthLogin/OAuthLogin.module.scss @@ -1,32 +1,6 @@ @use "../../../../../scss/variables" as vars; @use "../../../../../scss/colors"; -.separator { - display: flex; - margin: vars.$spacing-xl 0; - font-size: 16px; - text-align: center; - font-weight: bold; - color: colors.$grey-800; - text-transform: uppercase; - - &::before, - &::after { - content: ""; - flex: 1 1; - border-bottom: 1px solid colors.$grey-300; - margin: auto; - } - - &::before { - margin-right: vars.$spacing-md; - } - - &::after { - margin-left: vars.$spacing-md; - } -} - .buttons { display: grid; grid-template-columns: 1fr; diff --git a/airbyte-webapp/src/packages/cloud/views/auth/OAuthLogin/OAuthLogin.tsx b/airbyte-webapp/src/packages/cloud/views/auth/OAuthLogin/OAuthLogin.tsx index cca35f8290aa3..869cdfc406089 100644 --- a/airbyte-webapp/src/packages/cloud/views/auth/OAuthLogin/OAuthLogin.tsx +++ b/airbyte-webapp/src/packages/cloud/views/auth/OAuthLogin/OAuthLogin.tsx @@ -100,9 +100,6 @@ export const OAuthLogin: React.FC = ({ isSignUpPage }) => { return (
-
- -
{isLoading && (
diff --git a/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/SignupPage.module.scss b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/SignupPage.module.scss index 409f7a190f348..64407c1b10a70 100644 --- a/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/SignupPage.module.scss +++ b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/SignupPage.module.scss @@ -1,6 +1,12 @@ @use "../../../../../scss/colors"; @use "../../../../../scss/variables"; +.container { + display: flex; + flex-direction: column; + gap: variables.$spacing-xl; +} + .title { width: 250px; margin-bottom: variables.$spacing-md; diff --git a/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/SignupPage.tsx b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/SignupPage.tsx index aec02663556d9..a8200d1059c7f 100644 --- a/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/SignupPage.tsx +++ b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/SignupPage.tsx @@ -5,8 +5,10 @@ import { HeadTitle } from "components/common/HeadTitle"; import { Heading } from "components/ui/Heading"; import { PageTrackingCodes, useTrackPage } from "hooks/services/Analytics"; +import { useExperiment } from "hooks/services/Experiment"; import { OAuthLogin } from "../OAuthLogin"; +import { Separator } from "./components/Separator"; import { Disclaimer, SignupForm } from "./components/SignupForm"; import SpecialBlock from "./components/SpecialBlock"; import styles from "./SignupPage.module.scss"; @@ -17,8 +19,10 @@ interface SignupPageProps { const SignupPage: React.FC = ({ highlightStyle }) => { useTrackPage(PageTrackingCodes.SIGNUP); + const oAuthPosition = useExperiment("authPage.oauth.position", "bottom"); + return ( -
+
= ({ highlightStyle }) => { /> + {oAuthPosition === "top" && ( + <> + + + + )} - + {oAuthPosition === "bottom" && ( + <> + + + + )}
); diff --git a/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/Separator.module.scss b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/Separator.module.scss new file mode 100644 index 0000000000000..aedcba0ca9853 --- /dev/null +++ b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/Separator.module.scss @@ -0,0 +1,28 @@ +@use "../../../../../../scss/variables" as vars; +@use "../../../../../../scss/colors"; + +.separator { + display: flex; + padding: vars.$spacing-md 0; + font-size: 16px; + text-align: center; + font-weight: bold; + color: colors.$grey-800; + text-transform: uppercase; + + &::before, + &::after { + content: ""; + flex: 1 1; + border-bottom: 1px solid colors.$grey-300; + margin: auto; + } + + &::before { + margin-right: vars.$spacing-md; + } + + &::after { + margin-left: vars.$spacing-md; + } +} diff --git a/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/Separator.tsx b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/Separator.tsx new file mode 100644 index 0000000000000..a1265c439453c --- /dev/null +++ b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/Separator.tsx @@ -0,0 +1,10 @@ +import { FormattedMessage } from "react-intl"; + +import styles from "./Separator.module.scss"; +export const Separator: React.FC = () => { + return ( +
+ +
+ ); +}; diff --git a/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/SignupForm.tsx b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/SignupForm.tsx index 2b65f471128ca..93d3ffd715e65 100644 --- a/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/SignupForm.tsx +++ b/airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/SignupForm.tsx @@ -1,4 +1,4 @@ -import { Field, FieldProps, Formik } from "formik"; +import { Field, FieldProps, Formik, Form } from "formik"; import React, { useMemo } from "react"; import { FormattedMessage, useIntl } from "react-intl"; import { useSearchParams } from "react-router-dom"; @@ -15,7 +15,7 @@ import { isGdprCountry } from "utils/dataPrivacy"; import { links } from "utils/links"; import CheckBoxControl from "../../components/CheckBoxControl"; -import { BottomBlock, FieldItem, Form, RowFieldItem } from "../../components/FormComponents"; +import { BottomBlock, FieldItem, RowFieldItem } from "../../components/FormComponents"; import styles from "./SignupForm.module.scss"; interface FormValues { From 8969824b41c03bbdcc55927901b1a7f46b7b3960 Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Mon, 7 Nov 2022 14:52:49 +0100 Subject: [PATCH 003/279] :window: :wrench: Add a start:cloud command to the webapp (#19026) * Add a start:cloud command to the webapp * Update airbyte-webapp/scripts/environment.js Co-authored-by: Joey Marshment-Howell Co-authored-by: Joey Marshment-Howell --- airbyte-webapp/package-lock.json | 32 +++++++++++++++++++++------ airbyte-webapp/package.json | 3 +++ airbyte-webapp/scripts/environment.js | 25 +++++++++++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 airbyte-webapp/scripts/environment.js diff --git a/airbyte-webapp/package-lock.json b/airbyte-webapp/package-lock.json index 4b9bff7b1037e..0f322fcbe13fa 100644 --- a/airbyte-webapp/package-lock.json +++ b/airbyte-webapp/package-lock.json @@ -93,6 +93,7 @@ "@types/unist": "^2.0.5", "@typescript-eslint/eslint-plugin": "^5.27.1", "@typescript-eslint/parser": "^5.27.1", + "dotenv": "^16.0.3", "eslint-config-prettier": "^8.5.0", "eslint-config-react-app": "^7.0.1", "eslint-plugin-css-modules": "^2.11.0", @@ -20660,12 +20661,12 @@ } }, "node_modules/dotenv": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", - "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", "dev": true, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/dotenv-expand": { @@ -30037,6 +30038,15 @@ "yarn": ">=1.0.0" } }, + "node_modules/lazy-universal-dotenv/node_modules/dotenv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -63414,9 +63424,9 @@ } }, "dotenv": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", - "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", "dev": true }, "dotenv-expand": { @@ -70657,6 +70667,14 @@ "core-js": "^3.0.4", "dotenv": "^8.0.0", "dotenv-expand": "^5.1.0" + }, + "dependencies": { + "dotenv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "dev": true + } } }, "leven": { diff --git a/airbyte-webapp/package.json b/airbyte-webapp/package.json index 9c35073c50227..04f34f5173b11 100644 --- a/airbyte-webapp/package.json +++ b/airbyte-webapp/package.json @@ -9,6 +9,8 @@ "prepare": "cd .. && husky install airbyte-webapp/.husky", "prestart": "npm run generate-client", "start": "craco start", + "prestart:cloud": "npm run generate-client", + "start:cloud": "AB_ENV=frontend-dev node -r ./scripts/environment.js ./node_modules/.bin/craco start", "prebuild": "npm run generate-client", "build": "BUILD_PATH='./build/app' craco build", "pretest": "npm run generate-client", @@ -110,6 +112,7 @@ "@types/unist": "^2.0.5", "@typescript-eslint/eslint-plugin": "^5.27.1", "@typescript-eslint/parser": "^5.27.1", + "dotenv": "^16.0.3", "eslint-config-prettier": "^8.5.0", "eslint-config-react-app": "^7.0.1", "eslint-plugin-css-modules": "^2.11.0", diff --git a/airbyte-webapp/scripts/environment.js b/airbyte-webapp/scripts/environment.js new file mode 100644 index 0000000000000..4978c2502fc8d --- /dev/null +++ b/airbyte-webapp/scripts/environment.js @@ -0,0 +1,25 @@ +const fs = require("fs"); +const path = require("path"); + +const dotenv = require("dotenv"); + +if (!process.env.AB_ENV) { + return; +} + +const envFile = path.resolve( + __dirname, + "../../../airbyte-cloud/cloud-webapp/development", + `.env.${process.env.AB_ENV}` +); + +if (!fs.existsSync(envFile)) { + console.error( + `~~~ This mode is for Airbyte employees only. ~~~\n` + + `Could not find .env file for environment ${process.env.AB_ENV} (looking at ${envFile}).\n` + + `Make sure you have the latest airbyte-cloud repository checked out in a directory directly next to the airbyte OSS repository.\n` + ); + process.exit(42); +} + +dotenv.config({ path: envFile }); From 3aacda45b5d65db8b156bebbf6dd7078c722735f Mon Sep 17 00:00:00 2001 From: letiescanciano <45267095+letiescanciano@users.noreply.github.com> Date: Mon, 7 Nov 2022 14:59:48 +0100 Subject: [PATCH 004/279] =?UTF-8?q?=F0=9F=AA=9F=C2=A0=F0=9F=8E=A8=20Adapt?= =?UTF-8?q?=20Osano=20banner=20to=20new=20UI=20(#19029)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- airbyte-webapp/src/utils/dataPrivacy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airbyte-webapp/src/utils/dataPrivacy.ts b/airbyte-webapp/src/utils/dataPrivacy.ts index 95217589c9220..53f7424bbabfb 100644 --- a/airbyte-webapp/src/utils/dataPrivacy.ts +++ b/airbyte-webapp/src/utils/dataPrivacy.ts @@ -61,8 +61,9 @@ export const loadOsano = (): void => { style.appendChild( document.createTextNode(` .osano-cm-widget { display: none; } + .osano-cm-dialog__close { display: none; } .osano-cm-button--type_denyAll { display: none; } - .osano-cm-button--type_manage { background-color: inherit; border: 1px inherit; font-weight: 200; }`) + .osano-cm-button--type_manage { background-color: inherit; border: 1px #1a194d solid; color: #1a194d; font-weight: 200; }`) ); document.head.appendChild(style); From 41a12f6a43c4d796c6d1fda74db1c12083ddc048 Mon Sep 17 00:00:00 2001 From: Joey Marshment-Howell Date: Mon, 7 Nov 2022 15:34:55 +0100 Subject: [PATCH 005/279] =?UTF-8?q?=F0=9F=AA=9F=20=F0=9F=94=A7=20=20Add=20?= =?UTF-8?q?typings=20to=20mock=20data=20(#19022)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor mockConnection to TS * refactor mockDestination to TS * refactor mockWorkspace to TS --- .../CreateConnectionForm.test.tsx | 9 +- .../ConnectionEditService.test.tsx | 8 +- .../ConnectionFormService.test.tsx | 21 +- .../ConnectionReplicationTab.test.tsx | 8 +- .../test-utils/mock-data/mockConnection.json | 353 ----------------- .../test-utils/mock-data/mockConnection.ts | 356 ++++++++++++++++++ .../test-utils/mock-data/mockDestination.ts | 338 +++++++++++++++++ .../mock-data/mockDestinationDefinition.json | 329 ---------------- .../test-utils/mock-data/mockWorkspace.json | 14 - .../src/test-utils/mock-data/mockWorkspace.ts | 15 + .../ConnectionForm/formConfig.test.ts | 36 +- 11 files changed, 738 insertions(+), 749 deletions(-) delete mode 100644 airbyte-webapp/src/test-utils/mock-data/mockConnection.json create mode 100644 airbyte-webapp/src/test-utils/mock-data/mockConnection.ts create mode 100644 airbyte-webapp/src/test-utils/mock-data/mockDestination.ts delete mode 100644 airbyte-webapp/src/test-utils/mock-data/mockDestinationDefinition.json delete mode 100644 airbyte-webapp/src/test-utils/mock-data/mockWorkspace.json create mode 100644 airbyte-webapp/src/test-utils/mock-data/mockWorkspace.ts diff --git a/airbyte-webapp/src/components/CreateConnection/CreateConnectionForm.test.tsx b/airbyte-webapp/src/components/CreateConnection/CreateConnectionForm.test.tsx index 77e420a7ef5d4..7bdb51a45d438 100644 --- a/airbyte-webapp/src/components/CreateConnection/CreateConnectionForm.test.tsx +++ b/airbyte-webapp/src/components/CreateConnection/CreateConnectionForm.test.tsx @@ -3,18 +3,17 @@ import { act, render as tlr } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import React from "react"; import selectEvent from "react-select-event"; -import mockConnection from "test-utils/mock-data/mockConnection.json"; -import mockDest from "test-utils/mock-data/mockDestinationDefinition.json"; +import { mockConnection } from "test-utils/mock-data/mockConnection"; +import { mockDestination } from "test-utils/mock-data/mockDestination"; import { TestWrapper } from "test-utils/testutils"; -import { AirbyteCatalog } from "core/request/AirbyteClient"; import { defaultFeatures, FeatureItem } from "hooks/services/Feature"; import * as sourceHook from "hooks/services/useSourceHook"; import { CreateConnectionForm } from "./CreateConnectionForm"; jest.mock("services/connector/DestinationDefinitionSpecificationService", () => ({ - useGetDestinationDefinitionSpecification: () => mockDest, + useGetDestinationDefinitionSpecification: () => mockDestination, })); jest.mock("services/workspaces/WorkspacesService", () => ({ @@ -40,7 +39,7 @@ describe("CreateConnectionForm", () => { const baseUseDiscoverSchema = { schemaErrorStatus: null, isLoading: false, - schema: mockConnection.syncCatalog as AirbyteCatalog, + schema: mockConnection.syncCatalog, catalogId: "", onDiscoverSchema: () => Promise.resolve(), }; diff --git a/airbyte-webapp/src/hooks/services/ConnectionEdit/ConnectionEditService.test.tsx b/airbyte-webapp/src/hooks/services/ConnectionEdit/ConnectionEditService.test.tsx index 2610a828122d0..b6ef1f3145134 100644 --- a/airbyte-webapp/src/hooks/services/ConnectionEdit/ConnectionEditService.test.tsx +++ b/airbyte-webapp/src/hooks/services/ConnectionEdit/ConnectionEditService.test.tsx @@ -1,8 +1,8 @@ import { act, renderHook } from "@testing-library/react-hooks"; import React from "react"; -import mockConnection from "test-utils/mock-data/mockConnection.json"; -import mockDest from "test-utils/mock-data/mockDestinationDefinition.json"; -import mockWorkspace from "test-utils/mock-data/mockWorkspace.json"; +import { mockConnection } from "test-utils/mock-data/mockConnection"; +import { mockDestination } from "test-utils/mock-data/mockDestination"; +import { mockWorkspace } from "test-utils/mock-data/mockWorkspace"; import { TestWrapper } from "test-utils/testutils"; import { WebBackendConnectionUpdate } from "core/request/AirbyteClient"; @@ -11,7 +11,7 @@ import { useConnectionFormService } from "../ConnectionForm/ConnectionFormServic import { ConnectionEditServiceProvider, useConnectionEditService } from "./ConnectionEditService"; jest.mock("services/connector/DestinationDefinitionSpecificationService", () => ({ - useGetDestinationDefinitionSpecification: () => mockDest, + useGetDestinationDefinitionSpecification: () => mockDestination, })); jest.mock("services/workspaces/WorkspacesService", () => ({ diff --git a/airbyte-webapp/src/hooks/services/ConnectionForm/ConnectionFormService.test.tsx b/airbyte-webapp/src/hooks/services/ConnectionForm/ConnectionFormService.test.tsx index 4098958ca9584..35dc40bff32dc 100644 --- a/airbyte-webapp/src/hooks/services/ConnectionForm/ConnectionFormService.test.tsx +++ b/airbyte-webapp/src/hooks/services/ConnectionForm/ConnectionFormService.test.tsx @@ -1,11 +1,10 @@ import { act, renderHook } from "@testing-library/react-hooks"; import React from "react"; -import mockConnection from "test-utils/mock-data/mockConnection.json"; -import mockDest from "test-utils/mock-data/mockDestinationDefinition.json"; -import mockWorkspace from "test-utils/mock-data/mockWorkspace.json"; +import { mockConnection } from "test-utils/mock-data/mockConnection"; +import { mockDestination } from "test-utils/mock-data/mockDestination"; +import { mockWorkspace } from "test-utils/mock-data/mockWorkspace"; import { TestWrapper } from "test-utils/testutils"; -import { AirbyteCatalog, WebBackendConnectionRead } from "core/request/AirbyteClient"; import { FormError } from "utils/errorStatusMessage"; import { @@ -15,7 +14,7 @@ import { } from "./ConnectionFormService"; jest.mock("services/connector/DestinationDefinitionSpecificationService", () => ({ - useGetDestinationDefinitionSpecification: () => mockDest, + useGetDestinationDefinitionSpecification: () => mockDestination, })); jest.mock("services/workspaces/WorkspacesService", () => ({ @@ -37,7 +36,7 @@ describe("ConnectionFormService", () => { it("should take a partial Connection", async () => { const partialConnection: ConnectionOrPartialConnection = { - syncCatalog: mockConnection.syncCatalog as AirbyteCatalog, + syncCatalog: mockConnection.syncCatalog, source: mockConnection.source, destination: mockConnection.destination, }; @@ -57,7 +56,7 @@ describe("ConnectionFormService", () => { const { result } = renderHook(useConnectionFormService, { wrapper: Wrapper, initialProps: { - connection: mockConnection as WebBackendConnectionRead, + connection: mockConnection, mode: "create", refreshSchema, }, @@ -71,7 +70,7 @@ describe("ConnectionFormService", () => { const { result } = renderHook(useConnectionFormService, { wrapper: Wrapper, initialProps: { - connection: mockConnection as WebBackendConnectionRead, + connection: mockConnection, mode: "create", refreshSchema, }, @@ -86,7 +85,7 @@ describe("ConnectionFormService", () => { const { result } = renderHook(useConnectionFormService, { wrapper: Wrapper, initialProps: { - connection: mockConnection as WebBackendConnectionRead, + connection: mockConnection, mode: "create", refreshSchema, }, @@ -99,7 +98,7 @@ describe("ConnectionFormService", () => { const { result } = renderHook(useConnectionFormService, { wrapper: Wrapper, initialProps: { - connection: mockConnection as WebBackendConnectionRead, + connection: mockConnection, mode: "create", refreshSchema, }, @@ -112,7 +111,7 @@ describe("ConnectionFormService", () => { const { result } = renderHook(useConnectionFormService, { wrapper: Wrapper, initialProps: { - connection: mockConnection as WebBackendConnectionRead, + connection: mockConnection, mode: "create", refreshSchema, }, diff --git a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.test.tsx b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.test.tsx index 816cf1b023209..c14ce0022589f 100644 --- a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.test.tsx +++ b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.test.tsx @@ -5,9 +5,9 @@ import { render as tlr, act } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import React, { Suspense } from "react"; import selectEvent from "react-select-event"; -import mockConnection from "test-utils/mock-data/mockConnection.json"; -import mockDest from "test-utils/mock-data/mockDestinationDefinition.json"; -import mockWorkspace from "test-utils/mock-data/mockWorkspace.json"; +import { mockConnection } from "test-utils/mock-data/mockConnection"; +import { mockDestination } from "test-utils/mock-data/mockDestination"; +import { mockWorkspace } from "test-utils/mock-data/mockWorkspace"; import { mockWorkspaceId } from "test-utils/mock-data/mockWorkspaceId"; import { TestWrapper } from "test-utils/testutils"; @@ -19,7 +19,7 @@ import * as connectionHook from "hooks/services/useConnectionHook"; import { ConnectionReplicationTab } from "./ConnectionReplicationTab"; jest.mock("services/connector/DestinationDefinitionSpecificationService", () => ({ - useGetDestinationDefinitionSpecification: () => mockDest, + useGetDestinationDefinitionSpecification: () => mockDestination, })); jest.setTimeout(10000); diff --git a/airbyte-webapp/src/test-utils/mock-data/mockConnection.json b/airbyte-webapp/src/test-utils/mock-data/mockConnection.json deleted file mode 100644 index d3ece6b96a8a8..0000000000000 --- a/airbyte-webapp/src/test-utils/mock-data/mockConnection.json +++ /dev/null @@ -1,353 +0,0 @@ -{ - "connectionId": "a9c8e4b5-349d-4a17-bdff-5ad2f6fbd611", - "name": "Scrafty <> Heroku Postgres", - "namespaceDefinition": "source", - "namespaceFormat": "${SOURCE_NAMESPACE}", - "prefix": "", - "sourceId": "a3295ed7-4acf-4c0b-b16b-07a00e624a52", - "destinationId": "083a53bc-8bc2-4dc0-b05a-4273a96f3b93", - "geography": "auto", - "syncCatalog": { - "streams": [ - { - "stream": { - "name": "pokemon", - "jsonSchema": { - "type": "object", - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "id": { - "type": ["null", "integer"] - }, - "name": { - "type": ["null", "string"] - }, - "forms": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - } - }, - "moves": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "move": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - }, - "version_group_details": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "version_group": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - }, - "level_learned_at": { - "type": ["null", "integer"] - }, - "move_learn_method": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - } - } - } - } - } - } - }, - "order": { - "type": ["null", "integer"] - }, - "stats": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "stat": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - }, - "effort": { - "type": ["null", "integer"] - }, - "base_stat": { - "type": ["null", "integer"] - } - } - } - }, - "types": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "slot": { - "type": ["null", "integer"] - }, - "type": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - } - } - } - }, - "height": { - "type": ["null", "integer"] - }, - "weight": { - "type": ["null", "integer"] - }, - "species": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - }, - "sprites": { - "type": ["null", "object"], - "properties": { - "back_shiny": { - "type": ["null", "string"] - }, - "back_female": { - "type": ["null", "string"] - }, - "front_shiny": { - "type": ["null", "string"] - }, - "back_default": { - "type": ["null", "string"] - }, - "front_female": { - "type": ["null", "string"] - }, - "front_default": { - "type": ["null", "string"] - }, - "back_shiny_female": { - "type": ["null", "string"] - }, - "front_shiny_female": { - "type": ["null", "string"] - } - } - }, - "abilities": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "slot": { - "type": ["null", "integer"] - }, - "ability": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - }, - "is_hidden": { - "type": ["null", "boolean"] - } - } - } - }, - "held_items": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "item": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - }, - "version_details": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "rarity": { - "type": ["null", "integer"] - }, - "version": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - } - } - } - } - } - } - }, - "is_default ": { - "type": ["null", "boolean"] - }, - "game_indices": { - "type": ["null", "array"], - "items": { - "type": ["null", "object"], - "properties": { - "version": { - "type": ["null", "object"], - "properties": { - "url": { - "type": ["null", "string"] - }, - "name": { - "type": ["null", "string"] - } - } - }, - "game_index": { - "type": ["null", "integer"] - } - } - } - }, - "base_experience": { - "type": ["null", "integer"] - }, - "location_area_encounters": { - "type": ["null", "string"] - } - } - }, - "supportedSyncModes": ["full_refresh"], - "defaultCursorField": [], - "sourceDefinedPrimaryKey": [] - }, - "config": { - "syncMode": "full_refresh", - "cursorField": [], - "destinationSyncMode": "append", - "primaryKey": [], - "aliasName": "pokemon", - "selected": true - } - } - ] - }, - "scheduleType": "manual", - "status": "active", - "operationIds": ["8af8ef4d-01b1-49c8-b145-23775f34a74b"], - "source": { - "sourceDefinitionId": "6371b14b-bc68-4236-bfbd-468e8df8e968", - "sourceId": "a3295ed7-4acf-4c0b-b16b-07a00e624a52", - "workspaceId": "47c74b9b-9b89-4af1-8331-4865af6c4e4d", - "connectionConfiguration": { - "pokemon_name": "scrafty" - }, - "name": "Scrafty", - "sourceName": "PokeAPI" - }, - "destination": { - "destinationDefinitionId": "25c5221d-dce2-4163-ade9-739ef790f503", - "destinationId": "083a53bc-8bc2-4dc0-b05a-4273a96f3b93", - "workspaceId": "47c74b9b-9b89-4af1-8331-4865af6c4e4d", - "connectionConfiguration": { - "ssl": false, - "host": "asdf", - "port": 5432, - "schema": "public", - "database": "asdf", - "password": "**********", - "username": "asdf", - "tunnel_method": { - "tunnel_method": "NO_TUNNEL" - } - }, - "name": "Heroku Postgres", - "destinationName": "Postgres" - }, - "operations": [ - { - "workspaceId": "47c74b9b-9b89-4af1-8331-4865af6c4e4d", - "operationId": "8af8ef4d-01b1-49c8-b145-23775f34a74b", - "name": "Normalization", - "operatorConfiguration": { - "operatorType": "normalization", - "normalization": { - "option": "basic" - } - } - } - ], - "latestSyncJobCreatedAt": 1660227512, - "latestSyncJobStatus": "succeeded", - "isSyncing": false, - "catalogId": "bf31d1df-d7ba-4bae-b1ec-dac617b4f70c", - "schemaChange": "no_change", - "notifySchemaChanges": true, - "nonBreakingChangesPreference": "ignore" -} diff --git a/airbyte-webapp/src/test-utils/mock-data/mockConnection.ts b/airbyte-webapp/src/test-utils/mock-data/mockConnection.ts new file mode 100644 index 0000000000000..8abb464f8788d --- /dev/null +++ b/airbyte-webapp/src/test-utils/mock-data/mockConnection.ts @@ -0,0 +1,356 @@ +/* eslint-disable no-template-curly-in-string */ +import { WebBackendConnectionRead } from "core/request/AirbyteClient"; + +export const mockConnection: WebBackendConnectionRead = { + connectionId: "a9c8e4b5-349d-4a17-bdff-5ad2f6fbd611", + name: "Scrafty <> Heroku Postgres", + namespaceDefinition: "source", + namespaceFormat: "${SOURCE_NAMESPACE}", + prefix: "", + sourceId: "a3295ed7-4acf-4c0b-b16b-07a00e624a52", + destinationId: "083a53bc-8bc2-4dc0-b05a-4273a96f3b93", + geography: "auto", + syncCatalog: { + streams: [ + { + stream: { + name: "pokemon", + jsonSchema: { + type: "object", + $schema: "http://json-schema.org/draft-07/schema#", + properties: { + id: { + type: ["null", "integer"], + }, + name: { + type: ["null", "string"], + }, + forms: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + }, + moves: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + move: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + version_group_details: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + version_group: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + level_learned_at: { + type: ["null", "integer"], + }, + move_learn_method: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + }, + }, + }, + }, + }, + }, + order: { + type: ["null", "integer"], + }, + stats: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + stat: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + effort: { + type: ["null", "integer"], + }, + base_stat: { + type: ["null", "integer"], + }, + }, + }, + }, + types: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + slot: { + type: ["null", "integer"], + }, + type: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + }, + }, + }, + height: { + type: ["null", "integer"], + }, + weight: { + type: ["null", "integer"], + }, + species: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + sprites: { + type: ["null", "object"], + properties: { + back_shiny: { + type: ["null", "string"], + }, + back_female: { + type: ["null", "string"], + }, + front_shiny: { + type: ["null", "string"], + }, + back_default: { + type: ["null", "string"], + }, + front_female: { + type: ["null", "string"], + }, + front_default: { + type: ["null", "string"], + }, + back_shiny_female: { + type: ["null", "string"], + }, + front_shiny_female: { + type: ["null", "string"], + }, + }, + }, + abilities: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + slot: { + type: ["null", "integer"], + }, + ability: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + is_hidden: { + type: ["null", "boolean"], + }, + }, + }, + }, + held_items: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + item: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + version_details: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + rarity: { + type: ["null", "integer"], + }, + version: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + }, + }, + }, + }, + }, + }, + "is_default ": { + type: ["null", "boolean"], + }, + game_indices: { + type: ["null", "array"], + items: { + type: ["null", "object"], + properties: { + version: { + type: ["null", "object"], + properties: { + url: { + type: ["null", "string"], + }, + name: { + type: ["null", "string"], + }, + }, + }, + game_index: { + type: ["null", "integer"], + }, + }, + }, + }, + base_experience: { + type: ["null", "integer"], + }, + location_area_encounters: { + type: ["null", "string"], + }, + }, + }, + supportedSyncModes: ["full_refresh"], + defaultCursorField: [], + sourceDefinedPrimaryKey: [], + }, + config: { + syncMode: "full_refresh", + cursorField: [], + destinationSyncMode: "append", + primaryKey: [], + aliasName: "pokemon", + selected: true, + }, + }, + ], + }, + scheduleType: "manual", + status: "active", + operationIds: ["8af8ef4d-01b1-49c8-b145-23775f34a74b"], + source: { + sourceDefinitionId: "6371b14b-bc68-4236-bfbd-468e8df8e968", + sourceId: "a3295ed7-4acf-4c0b-b16b-07a00e624a52", + workspaceId: "47c74b9b-9b89-4af1-8331-4865af6c4e4d", + connectionConfiguration: { + pokemon_name: "scrafty", + }, + name: "Scrafty", + sourceName: "PokeAPI", + }, + destination: { + destinationDefinitionId: "25c5221d-dce2-4163-ade9-739ef790f503", + destinationId: "083a53bc-8bc2-4dc0-b05a-4273a96f3b93", + workspaceId: "47c74b9b-9b89-4af1-8331-4865af6c4e4d", + connectionConfiguration: { + ssl: false, + host: "asdf", + port: 5432, + schema: "public", + database: "asdf", + password: "**********", + username: "asdf", + tunnel_method: { + tunnel_method: "NO_TUNNEL", + }, + }, + name: "Heroku Postgres", + destinationName: "Postgres", + }, + operations: [ + { + workspaceId: "47c74b9b-9b89-4af1-8331-4865af6c4e4d", + operationId: "8af8ef4d-01b1-49c8-b145-23775f34a74b", + name: "Normalization", + operatorConfiguration: { + operatorType: "normalization", + normalization: { + option: "basic", + }, + }, + }, + ], + latestSyncJobCreatedAt: 1660227512, + latestSyncJobStatus: "succeeded", + isSyncing: false, + catalogId: "bf31d1df-d7ba-4bae-b1ec-dac617b4f70c", + schemaChange: "no_change", + notifySchemaChanges: true, + nonBreakingChangesPreference: "ignore", +}; diff --git a/airbyte-webapp/src/test-utils/mock-data/mockDestination.ts b/airbyte-webapp/src/test-utils/mock-data/mockDestination.ts new file mode 100644 index 0000000000000..2209c29d26730 --- /dev/null +++ b/airbyte-webapp/src/test-utils/mock-data/mockDestination.ts @@ -0,0 +1,338 @@ +import { DestinationDefinitionSpecificationRead } from "core/request/AirbyteClient"; + +export const mockDestination: DestinationDefinitionSpecificationRead = { + destinationDefinitionId: "25c5221d-dce2-4163-ade9-739ef790f503", + documentationUrl: "https://docs.airbyte.io/integrations/destinations/postgres", + connectionSpecification: { + type: "object", + title: "Postgres Destination Spec", + $schema: "http://json-schema.org/draft-07/schema#", + required: ["host", "port", "username", "database", "schema"], + properties: { + ssl: { + type: "boolean", + order: 6, + title: "SSL Connection", + default: false, + description: "Encrypt data using SSL. When activating SSL, please select one of the connection modes.", + }, + host: { + type: "string", + order: 0, + title: "Host", + description: "Hostname of the database.", + }, + port: { + type: "integer", + order: 1, + title: "Port", + default: 5432, + maximum: 65536, + minimum: 0, + examples: ["5432"], + description: "Port of the database.", + }, + schema: { + type: "string", + order: 3, + title: "Default Schema", + default: "public", + examples: ["public"], + description: + 'The default schema tables are written to if the source does not specify a namespace. The usual value for this field is "public".', + }, + database: { + type: "string", + order: 2, + title: "DB Name", + description: "Name of the database.", + }, + password: { + type: "string", + order: 5, + title: "Password", + description: "Password associated with the username.", + airbyte_secret: true, + }, + ssl_mode: { + type: "object", + oneOf: [ + { + title: "disable", + required: ["mode"], + properties: { + mode: { + enum: ["disable"], + type: "string", + const: "disable", + order: 0, + default: "disable", + }, + }, + description: "Disable SSL.", + additionalProperties: false, + }, + { + title: "allow", + required: ["mode"], + properties: { + mode: { + enum: ["allow"], + type: "string", + const: "allow", + order: 0, + default: "allow", + }, + }, + description: "Allow SSL mode.", + additionalProperties: false, + }, + { + title: "prefer", + required: ["mode"], + properties: { + mode: { + enum: ["prefer"], + type: "string", + const: "prefer", + order: 0, + default: "prefer", + }, + }, + description: "Prefer SSL mode.", + additionalProperties: false, + }, + { + title: "require", + required: ["mode"], + properties: { + mode: { + enum: ["require"], + type: "string", + const: "require", + order: 0, + default: "require", + }, + }, + description: "Require SSL mode.", + additionalProperties: false, + }, + { + title: "verify-ca", + required: ["mode", "ca_certificate"], + properties: { + mode: { + enum: ["verify-ca"], + type: "string", + const: "verify-ca", + order: 0, + default: "verify-ca", + }, + ca_certificate: { + type: "string", + order: 1, + title: "CA certificate", + multiline: true, + description: "CA certificate", + airbyte_secret: true, + }, + client_key_password: { + type: "string", + order: 4, + title: "Client key password (Optional)", + description: + "Password for keystorage. This field is optional. If you do not add it - the password will be generated automatically.", + airbyte_secret: true, + }, + }, + description: "Verify-ca SSL mode.", + additionalProperties: false, + }, + { + title: "verify-full", + required: ["mode", "ca_certificate", "client_certificate", "client_key"], + properties: { + mode: { + enum: ["verify-full"], + type: "string", + const: "verify-full", + order: 0, + default: "verify-full", + }, + client_key: { + type: "string", + order: 3, + title: "Client key", + multiline: true, + description: "Client key", + airbyte_secret: true, + }, + ca_certificate: { + type: "string", + order: 1, + title: "CA certificate", + multiline: true, + description: "CA certificate", + airbyte_secret: true, + }, + client_certificate: { + type: "string", + order: 2, + title: "Client certificate", + multiline: true, + description: "Client certificate", + airbyte_secret: true, + }, + client_key_password: { + type: "string", + order: 4, + title: "Client key password (Optional)", + description: + "Password for keystorage. This field is optional. If you do not add it - the password will be generated automatically.", + airbyte_secret: true, + }, + }, + description: "Verify-full SSL mode.", + additionalProperties: false, + }, + ], + order: 7, + title: "SSL modes", + description: + 'SSL connection modes. \n disable - Chose this mode to disable encryption of communication between Airbyte and destination database\n allow - Chose this mode to enable encryption only when required by the source database\n prefer - Chose this mode to allow unencrypted connection only if the source database does not support encryption\n require - Chose this mode to always require encryption. If the source database server does not support encryption, connection will fail\n verify-ca - Chose this mode to always require encryption and to verify that the source database server has a valid SSL certificate\n verify-full - This is the most secure mode. Chose this mode to always require encryption and to verify the identity of the source database server\n See more information - in the docs.', + }, + username: { + type: "string", + order: 4, + title: "User", + description: "Username to use to access the database.", + }, + tunnel_method: { + type: "object", + oneOf: [ + { + title: "No Tunnel", + required: ["tunnel_method"], + properties: { + tunnel_method: { + type: "string", + const: "NO_TUNNEL", + order: 0, + description: "No ssh tunnel needed to connect to database", + }, + }, + }, + { + title: "SSH Key Authentication", + required: ["tunnel_method", "tunnel_host", "tunnel_port", "tunnel_user", "ssh_key"], + properties: { + ssh_key: { + type: "string", + order: 4, + title: "SSH Private Key", + multiline: true, + description: + "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + airbyte_secret: true, + }, + tunnel_host: { + type: "string", + order: 1, + title: "SSH Tunnel Jump Server Host", + description: "Hostname of the jump server host that allows inbound ssh tunnel.", + }, + tunnel_port: { + type: "integer", + order: 2, + title: "SSH Connection Port", + default: 22, + maximum: 65536, + minimum: 0, + examples: ["22"], + description: "Port on the proxy/jump server that accepts inbound ssh connections.", + }, + tunnel_user: { + type: "string", + order: 3, + title: "SSH Login Username", + description: "OS-level username for logging into the jump server host.", + }, + tunnel_method: { + type: "string", + const: "SSH_KEY_AUTH", + order: 0, + description: "Connect through a jump server tunnel host using username and ssh key", + }, + }, + }, + { + title: "Password Authentication", + required: ["tunnel_method", "tunnel_host", "tunnel_port", "tunnel_user", "tunnel_user_password"], + properties: { + tunnel_host: { + type: "string", + order: 1, + title: "SSH Tunnel Jump Server Host", + description: "Hostname of the jump server host that allows inbound ssh tunnel.", + }, + tunnel_port: { + type: "integer", + order: 2, + title: "SSH Connection Port", + default: 22, + maximum: 65536, + minimum: 0, + examples: ["22"], + description: "Port on the proxy/jump server that accepts inbound ssh connections.", + }, + tunnel_user: { + type: "string", + order: 3, + title: "SSH Login Username", + description: "OS-level username for logging into the jump server host", + }, + tunnel_method: { + type: "string", + const: "SSH_PASSWORD_AUTH", + order: 0, + description: "Connect through a jump server tunnel host using username and password authentication", + }, + tunnel_user_password: { + type: "string", + order: 4, + title: "Password", + description: "OS-level password for logging into the jump server host", + airbyte_secret: true, + }, + }, + }, + ], + title: "SSH Tunnel Method", + description: + "Whether to initiate an SSH tunnel before connecting to the database, and if so, which kind of authentication to use.", + }, + jdbc_url_params: { + type: "string", + order: 8, + title: "JDBC URL Params", + description: + "Additional properties to pass to the JDBC URL string when connecting to the database formatted as 'key=value' pairs separated by the symbol '&'. (example: key1=value1&key2=value2&key3=value3).", + }, + }, + additionalProperties: true, + }, + jobInfo: { + id: "7c3ae799-cb25-4c05-9685-f7bb1885d662", + configType: "get_spec", + configId: "Optional.empty", + createdAt: 1661365436880, + endedAt: 1661365436880, + succeeded: true, + logs: { + logLines: [], + }, + }, + supportedDestinationSyncModes: ["overwrite", "append", "append_dedup"], + supportsDbt: true, + supportsNormalization: true, +}; diff --git a/airbyte-webapp/src/test-utils/mock-data/mockDestinationDefinition.json b/airbyte-webapp/src/test-utils/mock-data/mockDestinationDefinition.json deleted file mode 100644 index 40a038b7bc6a0..0000000000000 --- a/airbyte-webapp/src/test-utils/mock-data/mockDestinationDefinition.json +++ /dev/null @@ -1,329 +0,0 @@ -{ - "destinationDefinitionId": "25c5221d-dce2-4163-ade9-739ef790f503", - "documentationUrl": "https://docs.airbyte.io/integrations/destinations/postgres", - "connectionSpecification": { - "type": "object", - "title": "Postgres Destination Spec", - "$schema": "http://json-schema.org/draft-07/schema#", - "required": ["host", "port", "username", "database", "schema"], - "properties": { - "ssl": { - "type": "boolean", - "order": 6, - "title": "SSL Connection", - "default": false, - "description": "Encrypt data using SSL. When activating SSL, please select one of the connection modes." - }, - "host": { - "type": "string", - "order": 0, - "title": "Host", - "description": "Hostname of the database." - }, - "port": { - "type": "integer", - "order": 1, - "title": "Port", - "default": 5432, - "maximum": 65536, - "minimum": 0, - "examples": ["5432"], - "description": "Port of the database." - }, - "schema": { - "type": "string", - "order": 3, - "title": "Default Schema", - "default": "public", - "examples": ["public"], - "description": "The default schema tables are written to if the source does not specify a namespace. The usual value for this field is \"public\"." - }, - "database": { - "type": "string", - "order": 2, - "title": "DB Name", - "description": "Name of the database." - }, - "password": { - "type": "string", - "order": 5, - "title": "Password", - "description": "Password associated with the username.", - "airbyte_secret": true - }, - "ssl_mode": { - "type": "object", - "oneOf": [ - { - "title": "disable", - "required": ["mode"], - "properties": { - "mode": { - "enum": ["disable"], - "type": "string", - "const": "disable", - "order": 0, - "default": "disable" - } - }, - "description": "Disable SSL.", - "additionalProperties": false - }, - { - "title": "allow", - "required": ["mode"], - "properties": { - "mode": { - "enum": ["allow"], - "type": "string", - "const": "allow", - "order": 0, - "default": "allow" - } - }, - "description": "Allow SSL mode.", - "additionalProperties": false - }, - { - "title": "prefer", - "required": ["mode"], - "properties": { - "mode": { - "enum": ["prefer"], - "type": "string", - "const": "prefer", - "order": 0, - "default": "prefer" - } - }, - "description": "Prefer SSL mode.", - "additionalProperties": false - }, - { - "title": "require", - "required": ["mode"], - "properties": { - "mode": { - "enum": ["require"], - "type": "string", - "const": "require", - "order": 0, - "default": "require" - } - }, - "description": "Require SSL mode.", - "additionalProperties": false - }, - { - "title": "verify-ca", - "required": ["mode", "ca_certificate"], - "properties": { - "mode": { - "enum": ["verify-ca"], - "type": "string", - "const": "verify-ca", - "order": 0, - "default": "verify-ca" - }, - "ca_certificate": { - "type": "string", - "order": 1, - "title": "CA certificate", - "multiline": true, - "description": "CA certificate", - "airbyte_secret": true - }, - "client_key_password": { - "type": "string", - "order": 4, - "title": "Client key password (Optional)", - "description": "Password for keystorage. This field is optional. If you do not add it - the password will be generated automatically.", - "airbyte_secret": true - } - }, - "description": "Verify-ca SSL mode.", - "additionalProperties": false - }, - { - "title": "verify-full", - "required": ["mode", "ca_certificate", "client_certificate", "client_key"], - "properties": { - "mode": { - "enum": ["verify-full"], - "type": "string", - "const": "verify-full", - "order": 0, - "default": "verify-full" - }, - "client_key": { - "type": "string", - "order": 3, - "title": "Client key", - "multiline": true, - "description": "Client key", - "airbyte_secret": true - }, - "ca_certificate": { - "type": "string", - "order": 1, - "title": "CA certificate", - "multiline": true, - "description": "CA certificate", - "airbyte_secret": true - }, - "client_certificate": { - "type": "string", - "order": 2, - "title": "Client certificate", - "multiline": true, - "description": "Client certificate", - "airbyte_secret": true - }, - "client_key_password": { - "type": "string", - "order": 4, - "title": "Client key password (Optional)", - "description": "Password for keystorage. This field is optional. If you do not add it - the password will be generated automatically.", - "airbyte_secret": true - } - }, - "description": "Verify-full SSL mode.", - "additionalProperties": false - } - ], - "order": 7, - "title": "SSL modes", - "description": "SSL connection modes. \n disable - Chose this mode to disable encryption of communication between Airbyte and destination database\n allow - Chose this mode to enable encryption only when required by the source database\n prefer - Chose this mode to allow unencrypted connection only if the source database does not support encryption\n require - Chose this mode to always require encryption. If the source database server does not support encryption, connection will fail\n verify-ca - Chose this mode to always require encryption and to verify that the source database server has a valid SSL certificate\n verify-full - This is the most secure mode. Chose this mode to always require encryption and to verify the identity of the source database server\n See more information - in the docs." - }, - "username": { - "type": "string", - "order": 4, - "title": "User", - "description": "Username to use to access the database." - }, - "tunnel_method": { - "type": "object", - "oneOf": [ - { - "title": "No Tunnel", - "required": ["tunnel_method"], - "properties": { - "tunnel_method": { - "type": "string", - "const": "NO_TUNNEL", - "order": 0, - "description": "No ssh tunnel needed to connect to database" - } - } - }, - { - "title": "SSH Key Authentication", - "required": ["tunnel_method", "tunnel_host", "tunnel_port", "tunnel_user", "ssh_key"], - "properties": { - "ssh_key": { - "type": "string", - "order": 4, - "title": "SSH Private Key", - "multiline": true, - "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", - "airbyte_secret": true - }, - "tunnel_host": { - "type": "string", - "order": 1, - "title": "SSH Tunnel Jump Server Host", - "description": "Hostname of the jump server host that allows inbound ssh tunnel." - }, - "tunnel_port": { - "type": "integer", - "order": 2, - "title": "SSH Connection Port", - "default": 22, - "maximum": 65536, - "minimum": 0, - "examples": ["22"], - "description": "Port on the proxy/jump server that accepts inbound ssh connections." - }, - "tunnel_user": { - "type": "string", - "order": 3, - "title": "SSH Login Username", - "description": "OS-level username for logging into the jump server host." - }, - "tunnel_method": { - "type": "string", - "const": "SSH_KEY_AUTH", - "order": 0, - "description": "Connect through a jump server tunnel host using username and ssh key" - } - } - }, - { - "title": "Password Authentication", - "required": ["tunnel_method", "tunnel_host", "tunnel_port", "tunnel_user", "tunnel_user_password"], - "properties": { - "tunnel_host": { - "type": "string", - "order": 1, - "title": "SSH Tunnel Jump Server Host", - "description": "Hostname of the jump server host that allows inbound ssh tunnel." - }, - "tunnel_port": { - "type": "integer", - "order": 2, - "title": "SSH Connection Port", - "default": 22, - "maximum": 65536, - "minimum": 0, - "examples": ["22"], - "description": "Port on the proxy/jump server that accepts inbound ssh connections." - }, - "tunnel_user": { - "type": "string", - "order": 3, - "title": "SSH Login Username", - "description": "OS-level username for logging into the jump server host" - }, - "tunnel_method": { - "type": "string", - "const": "SSH_PASSWORD_AUTH", - "order": 0, - "description": "Connect through a jump server tunnel host using username and password authentication" - }, - "tunnel_user_password": { - "type": "string", - "order": 4, - "title": "Password", - "description": "OS-level password for logging into the jump server host", - "airbyte_secret": true - } - } - } - ], - "title": "SSH Tunnel Method", - "description": "Whether to initiate an SSH tunnel before connecting to the database, and if so, which kind of authentication to use." - }, - "jdbc_url_params": { - "type": "string", - "order": 8, - "title": "JDBC URL Params", - "description": "Additional properties to pass to the JDBC URL string when connecting to the database formatted as 'key=value' pairs separated by the symbol '&'. (example: key1=value1&key2=value2&key3=value3)." - } - }, - "additionalProperties": true - }, - "jobInfo": { - "id": "7c3ae799-cb25-4c05-9685-f7bb1885d662", - "configType": "get_spec", - "configId": "Optional.empty", - "createdAt": 1661365436880, - "endedAt": 1661365436880, - "succeeded": true, - "logs": { - "logLines": [] - } - }, - "supportedDestinationSyncModes": ["overwrite", "append", "append_dedup"], - "supportsDbt": true, - "supportsNormalization": true -} diff --git a/airbyte-webapp/src/test-utils/mock-data/mockWorkspace.json b/airbyte-webapp/src/test-utils/mock-data/mockWorkspace.json deleted file mode 100644 index a87976333a3cc..0000000000000 --- a/airbyte-webapp/src/test-utils/mock-data/mockWorkspace.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "workspaceId": "47c74b9b-9b89-4af1-8331-4865af6c4e4d", - "customerId": "55dd55e2-33ac-44dc-8d65-5aa7c8624f72", - "email": "krishna@airbyte.com", - "name": "47c74b9b-9b89-4af1-8331-4865af6c4e4d", - "slug": "47c74b9b-9b89-4af1-8331-4865af6c4e4d", - "initialSetupComplete": true, - "defaultGeography": "auto", - "displaySetupWizard": false, - "anonymousDataCollection": false, - "news": false, - "securityUpdates": false, - "notifications": [] -} diff --git a/airbyte-webapp/src/test-utils/mock-data/mockWorkspace.ts b/airbyte-webapp/src/test-utils/mock-data/mockWorkspace.ts new file mode 100644 index 0000000000000..2cca8228b73e6 --- /dev/null +++ b/airbyte-webapp/src/test-utils/mock-data/mockWorkspace.ts @@ -0,0 +1,15 @@ +import { WorkspaceRead } from "core/request/AirbyteClient"; + +export const mockWorkspace: WorkspaceRead = { + workspaceId: "47c74b9b-9b89-4af1-8331-4865af6c4e4d", + customerId: "55dd55e2-33ac-44dc-8d65-5aa7c8624f72", + email: "krishna@airbyte.com", + name: "47c74b9b-9b89-4af1-8331-4865af6c4e4d", + slug: "47c74b9b-9b89-4af1-8331-4865af6c4e4d", + initialSetupComplete: true, + displaySetupWizard: false, + anonymousDataCollection: false, + news: false, + securityUpdates: false, + notifications: [], +}; diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/formConfig.test.ts b/airbyte-webapp/src/views/Connection/ConnectionForm/formConfig.test.ts index 968ff286f5b73..d79693be6c190 100644 --- a/airbyte-webapp/src/views/Connection/ConnectionForm/formConfig.test.ts +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/formConfig.test.ts @@ -1,17 +1,12 @@ import { renderHook } from "@testing-library/react-hooks"; -import mockConnection from "test-utils/mock-data/mockConnection.json"; -import mockDestinationDefinition from "test-utils/mock-data/mockDestinationDefinition.json"; -import mockWorkspace from "test-utils/mock-data/mockWorkspace.json"; +import { mockConnection } from "test-utils/mock-data/mockConnection"; +import { mockDestination } from "test-utils/mock-data/mockDestination"; +import { mockWorkspace } from "test-utils/mock-data/mockWorkspace"; import { TestWrapper as wrapper } from "test-utils/testutils"; import { frequencyConfig } from "config/frequencyConfig"; import { NormalizationType } from "core/domain/connection"; -import { - ConnectionScheduleTimeUnit, - DestinationDefinitionSpecificationRead, - OperationRead, - WebBackendConnectionRead, -} from "core/request/AirbyteClient"; +import { ConnectionScheduleTimeUnit, OperationRead } from "core/request/AirbyteClient"; import { mapFormPropsToOperation, useFrequencyDropdownData, useInitialValues } from "./formConfig"; @@ -176,36 +171,19 @@ describe("#mapFormPropsToOperation", () => { describe("#useInitialValues", () => { it("should generate initial values w/ no 'not create' mode", () => { - const { result } = renderHook(() => - useInitialValues( - mockConnection as WebBackendConnectionRead, - mockDestinationDefinition as DestinationDefinitionSpecificationRead - ) - ); + const { result } = renderHook(() => useInitialValues(mockConnection, mockDestination)); expect(result.current).toMatchSnapshot(); expect(result.current.name).toBeDefined(); }); it("should generate initial values w/ 'not create' mode: false", () => { - const { result } = renderHook(() => - useInitialValues( - mockConnection as WebBackendConnectionRead, - mockDestinationDefinition as DestinationDefinitionSpecificationRead, - false - ) - ); + const { result } = renderHook(() => useInitialValues(mockConnection, mockDestination, false)); expect(result.current).toMatchSnapshot(); expect(result.current.name).toBeDefined(); }); it("should generate initial values w/ 'not create' mode: true", () => { - const { result } = renderHook(() => - useInitialValues( - mockConnection as WebBackendConnectionRead, - mockDestinationDefinition as DestinationDefinitionSpecificationRead, - true - ) - ); + const { result } = renderHook(() => useInitialValues(mockConnection, mockDestination, true)); expect(result.current).toMatchSnapshot(); expect(result.current.name).toBeUndefined(); }); From 91bb1bfa50451bcce559c5572b29a1c93e55706f Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Mon, 7 Nov 2022 15:41:04 +0100 Subject: [PATCH 006/279] Cleanup alt attributes on images (#19000) --- airbyte-webapp/public/index.html | 2 +- .../src/components/Placeholder/Placeholder.tsx | 2 +- .../EmptyResourceBlock/EmptyResourceBlock.tsx | 2 +- .../workspaces/WorkspacesPage/WorkspacesPage.tsx | 2 +- .../OnboardingPage/components/LetterLine.tsx | 2 +- .../NotificationPage/components/WebHookForm.tsx | 16 ++-------------- 6 files changed, 7 insertions(+), 19 deletions(-) diff --git a/airbyte-webapp/public/index.html b/airbyte-webapp/public/index.html index 9d9d4611d7f2f..b04f783d9e6e1 100644 --- a/airbyte-webapp/public/index.html +++ b/airbyte-webapp/public/index.html @@ -17,7 +17,7 @@