diff --git a/components/dashboard/src/user-settings/Integrations.tsx b/components/dashboard/src/user-settings/Integrations.tsx index dde1174a6b3510..aaadd3e9c9b720 100644 --- a/components/dashboard/src/user-settings/Integrations.tsx +++ b/components/dashboard/src/user-settings/Integrations.tsx @@ -17,7 +17,6 @@ import { ItemsList } from "../components/ItemsList"; import { SpinnerLoader } from "../components/Loader"; import Modal, { ModalBody, ModalHeader, ModalFooter } from "../components/Modal"; import { Heading2, Subheading } from "../components/typography/headings"; -import copy from "../images/copy.svg"; import exclamation from "../images/exclamation.svg"; import { openAuthorizeWindow, toAuthProviderLabel } from "../provider-utils"; import { gitpodHostUrl } from "../service/service"; @@ -41,6 +40,7 @@ import { useUpdateUserAuthProviderMutation } from "../data/auth-providers/update import { useDeleteUserAuthProviderMutation } from "../data/auth-providers/delete-user-auth-provider-mutation"; import { Button } from "@podkit/buttons/Button"; import { isOrganizationOwned } from "@gitpod/public-api-common/lib/user-utils"; +import { InputWithCopy } from "../components/InputWithCopy"; export default function Integrations() { return ( @@ -699,10 +699,20 @@ export function GitIntegrationModal( let settingsUrl = ``; switch (type) { case AuthProviderType.GITHUB: - settingsUrl = `${host}/settings/developers`; + // if host is empty or untouched by user, use the default value + if (host === "") { + settingsUrl = "github.com/settings/developers"; + } else { + settingsUrl = `${host}/settings/developers`; + } break; case AuthProviderType.GITLAB: - settingsUrl = `${host}/-/profile/applications`; + // if host is empty or untouched by user, use the default value + if (host === "") { + settingsUrl = "gitlab.com/-/profile/applications"; + } else { + settingsUrl = `${host}/-/profile/applications`; + } break; default: return undefined; @@ -749,18 +759,6 @@ export function GitIntegrationModal( } }; - const copyRedirectURI = () => { - const el = document.createElement("textarea"); - el.value = callbackUrl; - document.body.appendChild(el); - el.select(); - try { - document.execCommand("copy"); - } finally { - document.body.removeChild(el); - } - }; - const getNumber = (paramValue: string | null) => { if (!paramValue) { return 0; @@ -793,7 +791,7 @@ export function GitIntegrationModal( -
+
{mode === "new" && (