mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 15:41:27 +00:00
feature: add support for deployment environment scope for bitbucket and refactor bitbucket create UI
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useMutation, useQuery, useQueryClient, UseQueryOptions } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { workspaceKeys } from "../workspace";
|
||||
import {
|
||||
App,
|
||||
BitBucketEnvironment,
|
||||
BitBucketWorkspace,
|
||||
ChecklyGroup,
|
||||
Environment,
|
||||
@@ -94,6 +95,17 @@ const integrationAuthKeys = {
|
||||
}) => [{ integrationAuthId, appId }, "integrationAuthRailwayServices"] as const,
|
||||
getIntegrationAuthBitBucketWorkspaces: (integrationAuthId: string) =>
|
||||
[{ integrationAuthId }, "integrationAuthBitbucketWorkspaces"] as const,
|
||||
getIntegrationAuthBitBucketEnvironments: (
|
||||
integrationAuthId: string,
|
||||
workspaceSlug: string,
|
||||
repoSlug: string
|
||||
) =>
|
||||
[
|
||||
{ integrationAuthId },
|
||||
workspaceSlug,
|
||||
repoSlug,
|
||||
"integrationAuthBitbucketEnvironments"
|
||||
] as const,
|
||||
getIntegrationAuthNorthflankSecretGroups: ({
|
||||
integrationAuthId,
|
||||
appId
|
||||
@@ -403,6 +415,25 @@ const fetchIntegrationAuthBitBucketWorkspaces = async (integrationAuthId: string
|
||||
return workspaces;
|
||||
};
|
||||
|
||||
const fetchIntegrationAuthBitBucketEnvironments = async (
|
||||
integrationAuthId: string,
|
||||
workspaceSlug: string,
|
||||
repoSlug: string
|
||||
) => {
|
||||
const {
|
||||
data: { environments }
|
||||
} = await apiRequest.get<{ environments: BitBucketEnvironment[] }>(
|
||||
`/api/v1/integration-auth/${integrationAuthId}/bitbucket/environments`,
|
||||
{
|
||||
params: {
|
||||
workspaceSlug,
|
||||
repoSlug
|
||||
}
|
||||
}
|
||||
);
|
||||
return environments;
|
||||
};
|
||||
|
||||
const fetchIntegrationAuthNorthflankSecretGroups = async ({
|
||||
integrationAuthId,
|
||||
appId
|
||||
@@ -727,6 +758,30 @@ export const useGetIntegrationAuthBitBucketWorkspaces = (integrationAuthId: stri
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetIntegrationAuthBitBucketEnvironments = (
|
||||
{
|
||||
integrationAuthId,
|
||||
workspaceSlug,
|
||||
repoSlug
|
||||
}: {
|
||||
integrationAuthId: string;
|
||||
workspaceSlug: string;
|
||||
repoSlug: string;
|
||||
},
|
||||
options?: UseQueryOptions<BitBucketEnvironment[]>
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: integrationAuthKeys.getIntegrationAuthBitBucketEnvironments(
|
||||
integrationAuthId,
|
||||
workspaceSlug,
|
||||
repoSlug
|
||||
),
|
||||
queryFn: () =>
|
||||
fetchIntegrationAuthBitBucketEnvironments(integrationAuthId, workspaceSlug, repoSlug),
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetIntegrationAuthNorthflankSecretGroups = ({
|
||||
integrationAuthId,
|
||||
appId
|
||||
|
||||
@@ -79,6 +79,12 @@ export type BitBucketWorkspace = {
|
||||
slug: string;
|
||||
};
|
||||
|
||||
export type BitBucketEnvironment = {
|
||||
uuid: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
|
||||
export type NorthflankSecretGroup = {
|
||||
name: string;
|
||||
groupId: string;
|
||||
|
||||
Reference in New Issue
Block a user