Skip to content

Commit 7ca8c86

Browse files
AlexTugarevroboquat
authored andcommitted
[dashboard] disable Bitbucket integration on gitpod.io
1 parent 6bc660c commit 7ca8c86

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

components/dashboard/src/App.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { StartWorkspaceModal } from "./workspaces/StartWorkspaceModal";
4747
import { parseProps } from "./start/StartWorkspace";
4848
import SelectIDEModal from "./settings/SelectIDEModal";
4949
import { StartPage, StartPhase } from "./start/StartPage";
50+
import { isGitpodIo } from "./utils";
5051

5152
const Setup = React.lazy(() => import(/* webpackPrefetch: true */ "./Setup"));
5253
const Workspaces = React.lazy(() => import(/* webpackPrefetch: true */ "./workspaces/Workspaces"));
@@ -86,15 +87,6 @@ function Loading() {
8687
return <></>;
8788
}
8889

89-
function isGitpodIo() {
90-
return (
91-
window.location.hostname === "gitpod.io" ||
92-
window.location.hostname === "gitpod-staging.com" ||
93-
window.location.hostname.endsWith("gitpod-dev.com") ||
94-
window.location.hostname.endsWith("gitpod-io-dev.com")
95-
);
96-
}
97-
9890
function isWebsiteSlug(pathName: string) {
9991
const slugs = [
10092
"about",

components/dashboard/src/admin/License.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ReactComponent as CheckSvg } from "../images/check.svg";
1919
import { ReactComponent as LinkSvg } from "../images/external-link.svg";
2020
import SolidCard from "../components/SolidCard";
2121
import Card from "../components/Card";
22+
import { isGitpodIo } from "../utils";
2223

2324
export default function License() {
2425
const { license, setLicense } = useContext(LicenseContext);
@@ -212,7 +213,3 @@ function communityPlan(userCount: number, seats: number, fallbackAllowed: boolea
212213

213214
return [licenseLevel("Community"), additionalLicenseInfo("Free"), alertMessage(aboveLimit)];
214215
}
215-
216-
function isGitpodIo() {
217-
return window.location.hostname === "gitpod.io" || window.location.hostname === "gitpod-staging.com";
218-
}

components/dashboard/src/admin/Settings.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { getGitpodService } from "../service/service";
1313
import { adminMenu } from "./admin-menu";
1414
import { useEffect, useState } from "react";
1515
import InfoBox from "../components/InfoBox";
16+
import { isGitpodIo } from "../utils";
1617

1718
export default function Settings() {
1819
const { adminSettings, setAdminSettings } = useContext(AdminContext);
@@ -69,7 +70,3 @@ export default function Settings() {
6970
</div>
7071
);
7172
}
72-
73-
function isGitpodIo() {
74-
return window.location.hostname === "gitpod.io" || window.location.hostname === "gitpod-staging.com";
75-
}

components/dashboard/src/settings/Integrations.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { PaymentContext } from "../payment-context";
2121
import { openAuthorizeWindow } from "../provider-utils";
2222
import { getGitpodService, gitpodHostUrl } from "../service/service";
2323
import { UserContext } from "../user-context";
24+
import { isGitpodIo } from "../utils";
2425
import { SelectAccountModal } from "./SelectAccountModal";
2526
import getSettingsMenu from "./settings-menu";
2627

@@ -553,6 +554,13 @@ export function GitIntegrationModal(
553554
validate();
554555
}, [clientId, clientSecret, type]);
555556

557+
// "bitbucket.org" is set as host value whenever "Bitbucket" is selected
558+
useEffect(() => {
559+
if (props.mode === "new") {
560+
updateHostValue(type === "Bitbucket" ? "bitbucket.org" : "");
561+
}
562+
}, [type]);
563+
556564
const onClose = () => props.onClose && props.onClose();
557565
const onUpdate = () => props.onUpdate && props.onUpdate();
558566

@@ -764,7 +772,7 @@ export function GitIntegrationModal(
764772
>
765773
<option value="GitHub">GitHub</option>
766774
<option value="GitLab">GitLab</option>
767-
<option value="Bitbucket">Bitbucket</option>
775+
{!isGitpodIo() && <option value="Bitbucket">Bitbucket</option>}
768776
<option value="BitbucketServer">Bitbucket Server</option>
769777
</select>
770778
</div>

components/dashboard/src/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@ export const poll = async <T>(
4848
}
4949
}
5050
};
51+
52+
export function isGitpodIo() {
53+
return (
54+
window.location.hostname === "gitpod.io" ||
55+
window.location.hostname === "gitpod-staging.com" ||
56+
window.location.hostname.endsWith("gitpod-dev.com") ||
57+
window.location.hostname.endsWith("gitpod-io-dev.com")
58+
);
59+
}

0 commit comments

Comments
 (0)