From 32bec03adfef1f08f3e9b52c58f992c801502631 Mon Sep 17 00:00:00 2001 From: Tuan Dang Date: Fri, 22 Sep 2023 15:19:26 +0100 Subject: [PATCH] Patch self-hosted gitlab integration --- backend/src/helpers/integration.ts | 5 +++++ backend/src/integrations/exchange.ts | 1 + frontend/src/pages/integrations/gitlab/create.tsx | 2 ++ 3 files changed, 8 insertions(+) diff --git a/backend/src/helpers/integration.ts b/backend/src/helpers/integration.ts index 8fe7be9da..6b94d5916 100644 --- a/backend/src/helpers/integration.ts +++ b/backend/src/helpers/integration.ts @@ -15,6 +15,7 @@ import { IntegrationAuthMetadata } from "../models/integrationAuth/types"; interface Update { workspace: string; integration: string; + url?: string; teamId?: string; accountId?: string; metadata?: IntegrationAuthMetadata @@ -63,6 +64,10 @@ export const handleOAuthExchangeHelper = async ({ workspace: workspaceId, integration }; + + if (res.url) { + update.url = res.url; + } switch (integration) { case INTEGRATION_VERCEL: diff --git a/backend/src/integrations/exchange.ts b/backend/src/integrations/exchange.ts index a97a9db09..37382e79e 100644 --- a/backend/src/integrations/exchange.ts +++ b/backend/src/integrations/exchange.ts @@ -423,6 +423,7 @@ const exchangeCodeGitlab = async ({ accessToken: res.access_token, refreshToken: res.refresh_token, accessExpiresAt, + url }; }; diff --git a/frontend/src/pages/integrations/gitlab/create.tsx b/frontend/src/pages/integrations/gitlab/create.tsx index ecf787ee5..33e7ef5e6 100644 --- a/frontend/src/pages/integrations/gitlab/create.tsx +++ b/frontend/src/pages/integrations/gitlab/create.tsx @@ -84,6 +84,7 @@ export default function GitLabCreateIntegrationPage() { const selectedSourceEnvironment = watch("selectedSourceEnvironment"); const targetEntity = watch("targetEntity"); const targetTeamId = watch("targetTeamId"); + const targetAppIdValue = watch("targetAppId"); const { mutateAsync } = useCreateIntegration(); @@ -440,6 +441,7 @@ export default function GitLabCreateIntegrationPage() { size="sm" type="submit" isLoading={isLoading} + isDisabled={targetAppIdValue === "none"} > Create Integration