From 702a9ccf3f4c0b4ec00ad1ad626dec2b7f26d478 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Gollangi <6123002+pgollangi@users.noreply.github.com> Date: Fri, 13 Jan 2023 12:07:51 +0530 Subject: [PATCH 1/7] feat: source-gitlab accept api_url w/ or w/o scheme --- airbyte-integrations/connectors/source-gitlab/setup.py | 2 +- .../connectors/source-gitlab/source_gitlab/streams.py | 9 ++++++++- .../connectors/source-gitlab/unit_tests/conftest.py | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/airbyte-integrations/connectors/source-gitlab/setup.py b/airbyte-integrations/connectors/source-gitlab/setup.py index 5b1e107930b13..fcc0f699daf7e 100644 --- a/airbyte-integrations/connectors/source-gitlab/setup.py +++ b/airbyte-integrations/connectors/source-gitlab/setup.py @@ -7,7 +7,7 @@ MAIN_REQUIREMENTS = ["airbyte-cdk", "vcrpy==4.1.1"] -TEST_REQUIREMENTS = ["pytest~=6.1", "source-acceptance-test", "requests_mock"] +TEST_REQUIREMENTS = ["pytest~=6.1", "source-acceptance-test", "requests_mock", "pytest-mock"] setup( name="source_gitlab", diff --git a/airbyte-integrations/connectors/source-gitlab/source_gitlab/streams.py b/airbyte-integrations/connectors/source-gitlab/source_gitlab/streams.py index 5d550b7caeb29..90d85be7b0168 100644 --- a/airbyte-integrations/connectors/source-gitlab/source_gitlab/streams.py +++ b/airbyte-integrations/connectors/source-gitlab/source_gitlab/streams.py @@ -6,6 +6,7 @@ from abc import ABC from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional +from urllib.parse import urlparse import pendulum import requests from airbyte_cdk.models import SyncMode @@ -39,7 +40,13 @@ def request_params( @property def url_base(self) -> str: - return f"https://{self.api_url}/api/v4/" + parse_result = urlparse(self.api_url) + # Default scheme to "https" if URL doesn't contain + scheme = parse_result.scheme if parse_result.scheme else "https" + # hostname without a scheme will result in `path` attribute + # Use path if netloc is not detected + host = parse_result.netloc if parse_result.netloc else parse_result.path + return f"{scheme}://{host}/api/v4/" def should_retry(self, response: requests.Response) -> bool: # Gitlab API returns a 403 response in case a feature is disabled in a project (pipelines/jobs for instance). diff --git a/airbyte-integrations/connectors/source-gitlab/unit_tests/conftest.py b/airbyte-integrations/connectors/source-gitlab/unit_tests/conftest.py index e83bbf7a7c3af..d1cda1aff48b0 100644 --- a/airbyte-integrations/connectors/source-gitlab/unit_tests/conftest.py +++ b/airbyte-integrations/connectors/source-gitlab/unit_tests/conftest.py @@ -5,10 +5,10 @@ import pytest -@pytest.fixture -def config(mocker): +@pytest.fixture(params=["gitlab.com", "https://gitlab.com", "https://gitlab.com/api/v4"]) +def config(request): return { "start_date": "2021-01-01T00:00:00Z", - "api_url": "gitlab.com", + "api_url": request.param, "private_token": "secret_token" } From c7b6e249ac8d76d17471265cf0404fdac0d43e4c Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 26 Jan 2023 16:48:05 +0100 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=AA=9F=F0=9F=94=A7=20Refactor=20Conne?= =?UTF-8?q?ctorsView=20(#21531)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIP * WIP * wip * more fixes * fix test * remove some more styled components and improve memoization * review comment --- .../Indicator/Indicator.module.scss | 12 + .../src/components/Indicator/Indicator.tsx | 21 +- .../ReleaseStageBadge/ReleaseStageBadge.tsx | 2 +- airbyte-webapp/src/locales/en.json | 1 - .../pages/ConnectorsPage/DestinationsPage.tsx | 15 +- .../pages/ConnectorsPage/SourcesPage.tsx | 15 +- .../components/ConnectorCell.module.scss | 3 + .../components/ConnectorCell.tsx | 44 +-- .../components/ConnectorsView.module.scss | 13 + .../components/ConnectorsView.tsx | 112 +++--- .../components/ConnectorsViewContext.tsx | 18 + .../CreateConnectorModal.module.scss | 11 +- .../components/CreateConnectorModal.tsx | 365 +++++++----------- .../components/PageComponents.tsx | 11 - .../components/UpgradeAllButton.tsx | 4 +- .../components/VersionCell.module.scss | 35 ++ .../ConnectorsPage/components/VersionCell.tsx | 120 ++---- ...FrequentlyUsedConnectorsCard.test.tsx.snap | 9 + 18 files changed, 394 insertions(+), 417 deletions(-) create mode 100644 airbyte-webapp/src/components/Indicator/Indicator.module.scss create mode 100644 airbyte-webapp/src/pages/SettingsPage/pages/ConnectorsPage/components/ConnectorCell.module.scss create mode 100644 airbyte-webapp/src/pages/SettingsPage/pages/ConnectorsPage/components/ConnectorsView.module.scss create mode 100644 airbyte-webapp/src/pages/SettingsPage/pages/ConnectorsPage/components/ConnectorsViewContext.tsx delete mode 100644 airbyte-webapp/src/pages/SettingsPage/pages/ConnectorsPage/components/PageComponents.tsx create mode 100644 airbyte-webapp/src/pages/SettingsPage/pages/ConnectorsPage/components/VersionCell.module.scss diff --git a/airbyte-webapp/src/components/Indicator/Indicator.module.scss b/airbyte-webapp/src/components/Indicator/Indicator.module.scss new file mode 100644 index 0000000000000..5ecd4ae36e4db --- /dev/null +++ b/airbyte-webapp/src/components/Indicator/Indicator.module.scss @@ -0,0 +1,12 @@ +@use "scss/colors"; + +.indicator { + height: 10px; + width: 10px; + border-radius: 50%; + background: colors.$red; +} + +.hidden { + background-color: transparent; +} diff --git a/airbyte-webapp/src/components/Indicator/Indicator.tsx b/airbyte-webapp/src/components/Indicator/Indicator.tsx index 7332a0017d736..6b684037f417f 100644 --- a/airbyte-webapp/src/components/Indicator/Indicator.tsx +++ b/airbyte-webapp/src/components/Indicator/Indicator.tsx @@ -1,8 +1,15 @@ -import styled from "styled-components"; +import classNames from "classnames"; -export const Indicator = styled.div` - height: 10px; - width: 10px; - border-radius: 50%; - background: ${({ theme }) => theme.dangerColor}; -`; +import styles from "./Indicator.module.scss"; + +export interface IndicatorProps { + /** + * Set to true to render an invisible indicator so reserve the space in the UI + */ + hidden?: boolean; + className?: string; +} + +export const Indicator: React.FC = ({ hidden, className }) => ( +