-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathazureDevOpsContextHelper.tsx
32 lines (29 loc) · 1.06 KB
/
azureDevOpsContextHelper.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
import { SDKContext } from '../dal/azureDevOpsContextProvider';
import { getHostAuthority } from '../utilities/servicesHelper';
const internalOrgNames = [
'reflect-retrospective-hackathon',
'reflect-demo',
'microsoft',
'microsoftit',
'mseng',
'msazure',
'onebranch',
];
/**
* Returns whether the current org in VSTS context is a recognized internal org.
*/
export const isInternalOrg = () => {
const { SDK } = React.useContext(SDKContext);
const host = SDK.getHost();
return internalOrgNames.indexOf(host.name.toLowerCase().trim()) !== -1;
};
/**
* Returns whether the extension is run in a hosted environment (as opposed to an on-premise environment).
* In Azure DevOps terms, hosted environment is also known as "Azure DevOps Services" and on-premise environment is known as
* "Team Foundation Server" or "Azure DevOps Server".
*/
export const isHostedAzureDevOps = async () => {
const hostAuthority = await getHostAuthority();
return hostAuthority === 'dev.azure.com' || hostAuthority.endsWith('.visualstudio.com');
};