diff --git a/components/dashboard/src/settings/Integrations.tsx b/components/dashboard/src/settings/Integrations.tsx index f6ea5578ed4607..2e403830f5a73e 100644 --- a/components/dashboard/src/settings/Integrations.tsx +++ b/components/dashboard/src/settings/Integrations.tsx @@ -448,7 +448,7 @@ export function GitIntegrationModal(props: ({ const [providerEntry, setProviderEntry] = useState(undefined); const [type, setType] = useState("GitLab"); - const [host, setHost] = useState("gitlab.example.com"); + const [host, setHost] = useState(""); const [redirectURL, setRedirectURL] = useState(callbackUrl("gitlab.example.com")); const [clientId, setClientId] = useState(""); const [clientSecret, setClientSecret] = useState(""); @@ -473,15 +473,6 @@ export function GitIntegrationModal(props: ({ validate(); }, [clientId, clientSecret, type]) - useEffect(() => { - if (props.mode === "new") { - // If the host value has been modified e.g. not gitlab.example.com, assume it has been set by user and end operation - if (!host.includes(".example.com")) return; - const exampleHostname = `${type.toLowerCase()}.example.com`; - updateHostValue(exampleHostname); - } - }, [type]); - const onClose = () => props.onClose && props.onClose(); const onUpdate = () => props.onUpdate && props.onUpdate(); @@ -623,6 +614,14 @@ export function GitIntegrationModal(props: ({ ); } + const getPlaceholderForIntegrationType = (type: string) => { + switch (type) { + case "GitHub": return "github.example.com"; + case "GitLab": return "gitlab.example.com"; + default: return ""; + } + } + const copyRedirectUrl = () => { const el = document.createElement("textarea"); el.value = redirectURL; @@ -658,7 +657,7 @@ export function GitIntegrationModal(props: ({ )}
- updateHostValue(e.target.value)} />