mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 16:52:38 +00:00
Update github integrations ui for organization and environment
This commit is contained in:
@@ -6,6 +6,7 @@ export {
|
||||
useGetIntegrationAuthBitBucketWorkspaces,
|
||||
useGetIntegrationAuthById,
|
||||
useGetIntegrationAuthChecklyGroups,
|
||||
useGetIntegrationAuthGithubEnvs,
|
||||
useGetIntegrationAuthGithubOrgs,
|
||||
useGetIntegrationAuthNorthflankSecretGroups,
|
||||
useGetIntegrationAuthRailwayEnvironments,
|
||||
|
||||
@@ -40,6 +40,8 @@ const integrationAuthKeys = {
|
||||
}) => [{ integrationAuthId, accountId }, "integrationAuthChecklyGroups"] as const,
|
||||
getIntegrationAuthGithubOrgs: (integrationAuthId: string) =>
|
||||
[{ integrationAuthId }, "integrationAuthGithubOrgs"] as const,
|
||||
getIntegrationAuthGithubEnvs: (integrationAuthId: string, repoName: string, repoOwner: string) =>
|
||||
[{ integrationAuthId, repoName, repoOwner }, "integrationAuthGithubOrgs"] as const,
|
||||
getIntegrationAuthQoveryOrgs: (integrationAuthId: string) =>
|
||||
[{ integrationAuthId }, "integrationAuthQoveryOrgs"] as const,
|
||||
getIntegrationAuthQoveryProjects: ({
|
||||
@@ -186,6 +188,22 @@ const fetchIntegrationAuthGithubOrgs = async (integrationAuthId: string) => {
|
||||
return orgs;
|
||||
};
|
||||
|
||||
const fetchIntegrationAuthGithubEnvs = async (
|
||||
integrationAuthId: string,
|
||||
repoName: string,
|
||||
repoOwner: string
|
||||
) => {
|
||||
if (!repoName || !repoOwner) return [];
|
||||
|
||||
const {
|
||||
data: { envs }
|
||||
} = await apiRequest.get<{ envs: Array<{ name: string; envId: string }> }>(
|
||||
`/api/v1/integration-auth/${integrationAuthId}/github/envs?repoName=${repoName}&repoOwner=${repoOwner}`
|
||||
);
|
||||
|
||||
return envs;
|
||||
};
|
||||
|
||||
const fetchIntegrationAuthQoveryOrgs = async (integrationAuthId: string) => {
|
||||
const {
|
||||
data: { orgs }
|
||||
@@ -485,6 +503,22 @@ export const useGetIntegrationAuthGithubOrgs = (integrationAuthId: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetIntegrationAuthGithubEnvs = (
|
||||
integrationAuthId: string,
|
||||
repoName: string,
|
||||
repoOwner: string
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: integrationAuthKeys.getIntegrationAuthGithubEnvs(
|
||||
integrationAuthId,
|
||||
repoName,
|
||||
repoOwner
|
||||
),
|
||||
queryFn: () => fetchIntegrationAuthGithubEnvs(integrationAuthId, repoName, repoOwner),
|
||||
enabled: true
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetIntegrationAuthQoveryOrgs = (integrationAuthId: string) => {
|
||||
return useQuery({
|
||||
queryKey: integrationAuthKeys.getIntegrationAuthQoveryOrgs(integrationAuthId),
|
||||
|
||||
Reference in New Issue
Block a user