mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 14:27:23 +00:00
Finish adding support for build-configuration level syncs for TeamCity integration
This commit is contained in:
@@ -7,6 +7,7 @@ export {
|
||||
useGetIntegrationAuthNorthflankSecretGroups,
|
||||
useGetIntegrationAuthRailwayEnvironments,
|
||||
useGetIntegrationAuthRailwayServices,
|
||||
useGetIntegrationAuthTeamCityBuildConfigs,
|
||||
useGetIntegrationAuthTeams,
|
||||
useGetIntegrationAuthVercelBranches,
|
||||
useSaveIntegrationAccessToken
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
IntegrationAuth,
|
||||
NorthflankSecretGroup,
|
||||
Service,
|
||||
Team
|
||||
} from "./types";
|
||||
Team,
|
||||
TeamCityBuildConfig} from "./types";
|
||||
|
||||
const integrationAuthKeys = {
|
||||
getIntegrationAuthById: (integrationAuthId: string) =>
|
||||
@@ -49,7 +49,14 @@ const integrationAuthKeys = {
|
||||
}: {
|
||||
integrationAuthId: string;
|
||||
appId: string;
|
||||
}) => [{ integrationAuthId, appId }, "integrationAuthNorthflankSecretGroups"] as const,
|
||||
}) => [{ integrationAuthId, appId }, "integrationAuthNorthflankSecretGroups"] as const,
|
||||
getIntegrationAuthTeamCityBuildConfigs: ({
|
||||
integrationAuthId,
|
||||
appId
|
||||
}: {
|
||||
integrationAuthId: string;
|
||||
appId: string;
|
||||
}) => [{ integrationAuthId, appId }, "integrationAuthTeamCityBranchConfigs"] as const,
|
||||
};
|
||||
|
||||
const fetchIntegrationAuthById = async (integrationAuthId: string) => {
|
||||
@@ -183,6 +190,27 @@ const fetchIntegrationAuthNorthflankSecretGroups = async ({
|
||||
return secretGroups;
|
||||
};
|
||||
|
||||
const fetchIntegrationAuthTeamCityBuildConfigs = async ({
|
||||
integrationAuthId,
|
||||
appId
|
||||
}: {
|
||||
integrationAuthId: string;
|
||||
appId: string;
|
||||
}) => {
|
||||
const {
|
||||
data: { buildConfigs }
|
||||
} = await apiRequest.get<{ buildConfigs: TeamCityBuildConfig[] }>(
|
||||
`/api/v1/integration-auth/${integrationAuthId}/teamcity/build-configs`,
|
||||
{
|
||||
params: {
|
||||
appId
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return buildConfigs;
|
||||
};
|
||||
|
||||
export const useGetIntegrationAuthById = (integrationAuthId: string) => {
|
||||
return useQuery({
|
||||
queryKey: integrationAuthKeys.getIntegrationAuthById(integrationAuthId),
|
||||
@@ -312,6 +340,26 @@ export const useGetIntegrationAuthNorthflankSecretGroups = ({
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetIntegrationAuthTeamCityBuildConfigs = ({
|
||||
integrationAuthId,
|
||||
appId
|
||||
}: {
|
||||
integrationAuthId: string;
|
||||
appId: string;
|
||||
}) => {
|
||||
return useQuery({
|
||||
queryKey: integrationAuthKeys.getIntegrationAuthTeamCityBuildConfigs({
|
||||
integrationAuthId,
|
||||
appId
|
||||
}),
|
||||
queryFn: () => fetchIntegrationAuthTeamCityBuildConfigs({
|
||||
integrationAuthId,
|
||||
appId
|
||||
}),
|
||||
enabled: true
|
||||
});
|
||||
};
|
||||
|
||||
export const useAuthorizeIntegration = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
||||
@@ -40,4 +40,9 @@ export type BitBucketWorkspace = {
|
||||
export type NorthflankSecretGroup = {
|
||||
name: string;
|
||||
groupId: string;
|
||||
}
|
||||
|
||||
export type TeamCityBuildConfig = {
|
||||
name: string;
|
||||
buildConfigId: string;
|
||||
}
|
||||
Reference in New Issue
Block a user