Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/data/auth-providers/auth-provider-options-query.ts
2501 views
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 isSupportAzureDevOpsIntegration = () => {
21
return isGitpodIo();
22
};
23
24
export const useAuthProviderOptionsQuery = (isOrgLevel: boolean) => {
25
return useMemo(() => {
26
const isPAYG = isGitpodIo();
27
// Azure DevOps is not supported for PAYG users and is only available for org-level integrations
28
// because auth flow is identified by auth provider's host, which will always be `dev.azure.com`
29
//
30
// Don't remove this until we can setup an generial application for Azure DevOps (investigate needed)
31
if (isPAYG || !isOrgLevel) {
32
return optionsForPAYG;
33
}
34
return optionsForEnterprise;
35
}, [isOrgLevel]);
36
};
37
38