mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 18:27:19 +00:00
Fix: Use unique parameter for passing devops org name
Used to be teamId, now it's azureDevopsOrgName.
This commit is contained in:
@@ -293,6 +293,7 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
|||||||
}),
|
}),
|
||||||
querystring: z.object({
|
querystring: z.object({
|
||||||
teamId: z.string().trim().optional(),
|
teamId: z.string().trim().optional(),
|
||||||
|
azureDevOpsOrgName: z.string().trim().optional(),
|
||||||
workspaceSlug: z.string().trim().optional()
|
workspaceSlug: z.string().trim().optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
|
|||||||
@@ -1030,11 +1030,10 @@ const getAppsCloud66 = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
return apps;
|
return apps;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAppsAzureDevOps = async ({ accessToken, orgId }: { accessToken: string; orgId: string }) => {
|
const getAppsAzureDevOps = async ({ accessToken, orgName }: { accessToken: string; orgName: string }) => {
|
||||||
console.log({ accessToken, orgId });
|
|
||||||
const res = (
|
const res = (
|
||||||
await request.get<{ count: number; value: Record<string, string>[] }>(
|
await request.get<{ count: number; value: Record<string, string>[] }>(
|
||||||
`${IntegrationUrls.AZURE_DEVOPS_API_URL}/${orgId}/_apis/projects?api-version=7.2-preview.2`,
|
`${IntegrationUrls.AZURE_DEVOPS_API_URL}/${orgName}/_apis/projects?api-version=7.2-preview.2`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Basic ${accessToken}`
|
Authorization: `Basic ${accessToken}`
|
||||||
@@ -1055,6 +1054,7 @@ export const getApps = async ({
|
|||||||
accessToken,
|
accessToken,
|
||||||
accessId,
|
accessId,
|
||||||
teamId,
|
teamId,
|
||||||
|
azureDevOpsOrgName,
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
url
|
url
|
||||||
}: {
|
}: {
|
||||||
@@ -1062,6 +1062,7 @@ export const getApps = async ({
|
|||||||
accessToken: string;
|
accessToken: string;
|
||||||
accessId?: string;
|
accessId?: string;
|
||||||
teamId?: string | null;
|
teamId?: string | null;
|
||||||
|
azureDevOpsOrgName?: string | null;
|
||||||
workspaceSlug?: string;
|
workspaceSlug?: string;
|
||||||
url?: string | null;
|
url?: string | null;
|
||||||
}): Promise<App[]> => {
|
}): Promise<App[]> => {
|
||||||
@@ -1207,7 +1208,7 @@ export const getApps = async ({
|
|||||||
case Integrations.AZURE_DEVOPS:
|
case Integrations.AZURE_DEVOPS:
|
||||||
return getAppsAzureDevOps({
|
return getAppsAzureDevOps({
|
||||||
accessToken,
|
accessToken,
|
||||||
orgId: teamId as string // small hack to pass orgId as teamId
|
orgName: azureDevOpsOrgName as string
|
||||||
});
|
});
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -440,6 +440,7 @@ export const integrationAuthServiceFactory = ({
|
|||||||
actorOrgId,
|
actorOrgId,
|
||||||
actorAuthMethod,
|
actorAuthMethod,
|
||||||
teamId,
|
teamId,
|
||||||
|
azureDevOpsOrgName,
|
||||||
id,
|
id,
|
||||||
workspaceSlug
|
workspaceSlug
|
||||||
}: TIntegrationAuthAppsDTO) => {
|
}: TIntegrationAuthAppsDTO) => {
|
||||||
@@ -462,6 +463,7 @@ export const integrationAuthServiceFactory = ({
|
|||||||
accessToken,
|
accessToken,
|
||||||
accessId,
|
accessId,
|
||||||
teamId,
|
teamId,
|
||||||
|
azureDevOpsOrgName,
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
url: integrationAuth.url
|
url: integrationAuth.url
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export type TDeleteIntegrationAuthsDTO = TProjectPermission & {
|
|||||||
export type TIntegrationAuthAppsDTO = {
|
export type TIntegrationAuthAppsDTO = {
|
||||||
id: string;
|
id: string;
|
||||||
teamId?: string;
|
teamId?: string;
|
||||||
|
azureDevOpsOrgName?: string;
|
||||||
workspaceSlug?: string;
|
workspaceSlug?: string;
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
|
|
||||||
|
|||||||
@@ -120,16 +120,22 @@ const fetchIntegrationAuthById = async (integrationAuthId: string) => {
|
|||||||
const fetchIntegrationAuthApps = async ({
|
const fetchIntegrationAuthApps = async ({
|
||||||
integrationAuthId,
|
integrationAuthId,
|
||||||
teamId,
|
teamId,
|
||||||
|
azureDevOpsOrgName,
|
||||||
workspaceSlug
|
workspaceSlug
|
||||||
}: {
|
}: {
|
||||||
integrationAuthId: string;
|
integrationAuthId: string;
|
||||||
teamId?: string;
|
teamId?: string;
|
||||||
|
azureDevOpsOrgName?: string;
|
||||||
workspaceSlug?: string;
|
workspaceSlug?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const params: Record<string, string> = {};
|
const params: Record<string, string> = {};
|
||||||
if (teamId) {
|
if (teamId) {
|
||||||
params.teamId = teamId;
|
params.teamId = teamId;
|
||||||
}
|
}
|
||||||
|
if (azureDevOpsOrgName) {
|
||||||
|
params.azureDevOpsOrgName = azureDevOpsOrgName;
|
||||||
|
}
|
||||||
|
|
||||||
if (workspaceSlug) {
|
if (workspaceSlug) {
|
||||||
params.workspaceSlug = workspaceSlug;
|
params.workspaceSlug = workspaceSlug;
|
||||||
}
|
}
|
||||||
@@ -452,10 +458,12 @@ export const useGetIntegrationAuthById = (integrationAuthId: string) => {
|
|||||||
export const useGetIntegrationAuthApps = ({
|
export const useGetIntegrationAuthApps = ({
|
||||||
integrationAuthId,
|
integrationAuthId,
|
||||||
teamId,
|
teamId,
|
||||||
|
azureDevOpsOrgName,
|
||||||
workspaceSlug
|
workspaceSlug
|
||||||
}: {
|
}: {
|
||||||
integrationAuthId: string;
|
integrationAuthId: string;
|
||||||
teamId?: string;
|
teamId?: string;
|
||||||
|
azureDevOpsOrgName?: string;
|
||||||
workspaceSlug?: string;
|
workspaceSlug?: string;
|
||||||
}) => {
|
}) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
@@ -464,6 +472,7 @@ export const useGetIntegrationAuthApps = ({
|
|||||||
fetchIntegrationAuthApps({
|
fetchIntegrationAuthApps({
|
||||||
integrationAuthId,
|
integrationAuthId,
|
||||||
teamId,
|
teamId,
|
||||||
|
azureDevOpsOrgName,
|
||||||
workspaceSlug
|
workspaceSlug
|
||||||
}),
|
}),
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default function AzureDevopsCreateIntegrationPage() {
|
|||||||
const { mutateAsync } = useSaveIntegrationAccessToken();
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [orgId, setOrgId] = useState("");
|
const [devopsOrgName, setDevopsOrgName] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export default function AzureDevopsCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
localStorage.setItem("azure-devops-org-id", orgId);
|
localStorage.setItem("azure-devops-org-name", devopsOrgName);
|
||||||
|
|
||||||
const integrationAuth = await mutateAsync({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
@@ -52,12 +52,16 @@ export default function AzureDevopsCreateIntegrationPage() {
|
|||||||
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} />
|
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl
|
<FormControl
|
||||||
label="AzureDevops Organization Slug"
|
label="AzureDevops Organization Name"
|
||||||
tooltipText="This is not the organization ID, but the slug of the organization. An example would be 'my-acme-org'"
|
tooltipText="This is not the organization ID, but the slug of the organization. An example would be 'my-acme-org'"
|
||||||
errorText={apiKeyErrorText}
|
errorText={apiKeyErrorText}
|
||||||
isError={apiKeyErrorText !== "" ?? false}
|
isError={apiKeyErrorText !== "" ?? false}
|
||||||
>
|
>
|
||||||
<Input placeholder="" value={orgId} onChange={(e) => setOrgId(e.target.value)} />
|
<Input
|
||||||
|
placeholder=""
|
||||||
|
value={devopsOrgName}
|
||||||
|
onChange={(e) => setDevopsOrgName(e.target.value)}
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -66,7 +70,7 @@ export default function AzureDevopsCreateIntegrationPage() {
|
|||||||
className="mt-4"
|
className="mt-4"
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
>
|
>
|
||||||
Connect to AzureDevops
|
Connect to AzureDevOps
|
||||||
</Button>
|
</Button>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default function AzureDevopsCreateIntegrationPage() {
|
|||||||
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
|
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
|
||||||
const { data: integrationAuthApps } = useGetIntegrationAuthApps({
|
const { data: integrationAuthApps } = useGetIntegrationAuthApps({
|
||||||
integrationAuthId: (integrationAuthId as string) ?? "",
|
integrationAuthId: (integrationAuthId as string) ?? "",
|
||||||
teamId: localStorage.getItem("azure-devops-org-id") ?? ""
|
azureDevOpsOrgName: localStorage.getItem("azure-devops-org-name") ?? ""
|
||||||
});
|
});
|
||||||
|
|
||||||
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
||||||
@@ -63,7 +63,7 @@ export default function AzureDevopsCreateIntegrationPage() {
|
|||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?.id,
|
integrationAuthId: integrationAuth?.id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: localStorage.getItem("azure-devops-org-id") || "",
|
app: localStorage.getItem("azure-devops-org-name") || "",
|
||||||
appId: targetApp,
|
appId: targetApp,
|
||||||
sourceEnvironment: selectedSourceEnvironment,
|
sourceEnvironment: selectedSourceEnvironment,
|
||||||
secretPath
|
secretPath
|
||||||
|
|||||||
Reference in New Issue
Block a user