Skip to content

Commit 980d7d8

Browse files
committed
Disable azure devops support for PAYG
1 parent a525cbd commit 980d7d8

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Copyright (c) 2024 Gitpod GmbH. All rights reserved.
3+
* Licensed under the GNU Affero General Public License (AGPL).
4+
* See License.AGPL.txt in the project root for license information.
5+
*/
6+
7+
import { AuthProviderType } from "@gitpod/public-api/lib/gitpod/v1/authprovider_pb";
8+
import { isGitpodIo } from "../../utils";
9+
import { useMemo } from "react";
10+
11+
const optionsForPAYG = [
12+
{ type: AuthProviderType.GITHUB, label: "GitHub" },
13+
{ type: AuthProviderType.GITLAB, label: "GitLab" },
14+
{ type: AuthProviderType.BITBUCKET_SERVER, label: "Bitbucket Server" },
15+
{ type: AuthProviderType.BITBUCKET, label: "Bitbucket Cloud" },
16+
];
17+
18+
const optionsForEnterprise = [...optionsForPAYG, { type: AuthProviderType.AZURE_DEVOPS, label: "Azure DevOps" }];
19+
20+
export const useAuthProviderOptionsQuery = () => {
21+
const isPAYG = isGitpodIo();
22+
return useMemo(() => {
23+
return isPAYG ? optionsForPAYG : optionsForEnterprise;
24+
}, [isPAYG]);
25+
};

components/dashboard/src/teams/git-integrations/GitIntegrationModal.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { useCreateOrgAuthProviderMutation } from "../../data/auth-providers/crea
2424
import { useUpdateOrgAuthProviderMutation } from "../../data/auth-providers/update-org-auth-provider-mutation";
2525
import { authProviderClient, userClient } from "../../service/public-api";
2626
import { LoadingButton } from "@podkit/buttons/LoadingButton";
27+
import { useAuthProviderOptionsQuery } from "../../data/auth-providers/auth-provider-options-query";
2728

2829
type Props = {
2930
provider?: AuthProvider;
@@ -39,6 +40,7 @@ export const GitIntegrationModal: FunctionComponent<Props> = (props) => {
3940
const [clientSecret, setClientSecret] = useState<string>(props.provider?.oauth2Config?.clientSecret ?? "");
4041
const [authorizationUrl, setAuthorizationUrl] = useState(props.provider?.oauth2Config?.authorizationUrl ?? "");
4142
const [tokenUrl, setTokenUrl] = useState(props.provider?.oauth2Config?.tokenUrl ?? "");
43+
const availableProviderOptions = useAuthProviderOptionsQuery();
4244

4345
const [savedProvider, setSavedProvider] = useState(props.provider);
4446
const isNew = !savedProvider;
@@ -261,11 +263,11 @@ export const GitIntegrationModal: FunctionComponent<Props> = (props) => {
261263
topMargin={false}
262264
onChange={(val) => setType(getNumber(val))}
263265
>
264-
<option value={AuthProviderType.GITHUB}>GitHub</option>
265-
<option value={AuthProviderType.GITLAB}>GitLab</option>
266-
<option value={AuthProviderType.BITBUCKET}>Bitbucket Cloud</option>
267-
<option value={AuthProviderType.BITBUCKET_SERVER}>Bitbucket Server</option>
268-
<option value={AuthProviderType.AZURE_DEVOPS}>Azure DevOps</option>
266+
{availableProviderOptions.map((option) => (
267+
<option key={option.type} value={option.type}>
268+
{option.label}
269+
</option>
270+
))}
269271
</SelectInputField>
270272
<TextInputField
271273
label="Provider Host Name"

components/dashboard/src/user-settings/Integrations.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import { useDeleteUserAuthProviderMutation } from "../data/auth-providers/delete
4141
import { Button } from "@podkit/buttons/Button";
4242
import { isOrganizationOwned } from "@gitpod/public-api-common/lib/user-utils";
4343
import { InputWithCopy } from "../components/InputWithCopy";
44+
import { useAuthProviderOptionsQuery } from "../data/auth-providers/auth-provider-options-query";
4445

4546
export default function Integrations() {
4647
return (
@@ -561,6 +562,8 @@ export function GitIntegrationModal(
561562
const createProvider = useCreateUserAuthProviderMutation();
562563
const updateProvider = useUpdateUserAuthProviderMutation();
563564

565+
const availableProviderOptions = useAuthProviderOptionsQuery();
566+
564567
useEffect(() => {
565568
setMode(props.mode);
566569
if (props.mode === "edit") {
@@ -846,10 +849,11 @@ export function GitIntegrationModal(
846849
className="w-full"
847850
onChange={(e) => setType(getNumber(e.target.value))}
848851
>
849-
<option value={AuthProviderType.GITHUB}>GitHub</option>
850-
<option value={AuthProviderType.GITLAB}>GitLab</option>
851-
<option value={AuthProviderType.BITBUCKET_SERVER}>Bitbucket Server</option>
852-
<option value={AuthProviderType.AZURE_DEVOPS}>Azure DevOps</option>
852+
{availableProviderOptions.map((options) => (
853+
<option key={options.type} value={options.type}>
854+
{options.label}
855+
</option>
856+
))}
853857
</select>
854858
</div>
855859
)}

0 commit comments

Comments
 (0)