feat: add test connection bitbucket and gitlab

This commit is contained in:
Mauricio Siu
2024-09-01 21:49:59 -06:00
parent d261fd4efe
commit 99f63597a8
32 changed files with 1120 additions and 596 deletions

View File

@@ -58,7 +58,7 @@ interface Props {
export const SaveBitbucketProvider = ({ applicationId }: Props) => {
const { data: bitbucketProviders } =
api.gitProvider.bitbucketProviders.useQuery();
api.bitbucket.bitbucketProviders.useQuery();
const { data, refetch } = api.application.one.useQuery({ applicationId });
const { mutateAsync, isLoading: isSavingBitbucketProvider } =
@@ -85,15 +85,20 @@ export const SaveBitbucketProvider = ({ applicationId }: Props) => {
isLoading: isLoadingRepositories,
error,
isError,
} = api.gitProvider.getBitbucketRepositories.useQuery({
bitbucketId,
});
} = api.bitbucket.getBitbucketRepositories.useQuery(
{
bitbucketId,
},
{
enabled: !!bitbucketId,
},
);
const {
data: branches,
fetchStatus,
status,
} = api.gitProvider.getBitbucketBranches.useQuery(
} = api.bitbucket.getBitbucketBranches.useQuery(
{
owner: repository?.owner,
repo: repository?.repo,

View File

@@ -56,7 +56,7 @@ interface Props {
}
export const SaveGithubProvider = ({ applicationId }: Props) => {
const { data: githubProviders } = api.gitProvider.githubProviders.useQuery();
const { data: githubProviders } = api.github.githubProviders.useQuery();
const { data, refetch } = api.application.one.useQuery({ applicationId });
const { mutateAsync, isLoading: isSavingGithubProvider } =
@@ -79,15 +79,20 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
const githubId = form.watch("githubId");
const { data: repositories, isLoading: isLoadingRepositories } =
api.gitProvider.getGithubRepositories.useQuery({
githubId,
});
api.github.getGithubRepositories.useQuery(
{
githubId,
},
{
enabled: !!githubId,
},
);
const {
data: branches,
fetchStatus,
status,
} = api.gitProvider.getGithubBranches.useQuery(
} = api.github.getGithubBranches.useQuery(
{
owner: repository?.owner,
repo: repository?.repo,

View File

@@ -59,7 +59,7 @@ interface Props {
}
export const SaveGitlabProvider = ({ applicationId }: Props) => {
const { data: gitlabProviders } = api.gitProvider.gitlabProviders.useQuery();
const { data: gitlabProviders } = api.gitlab.gitlabProviders.useQuery();
const { data, refetch } = api.application.one.useQuery({ applicationId });
const { mutateAsync, isLoading: isSavingGitlabProvider } =
@@ -87,15 +87,20 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
data: repositories,
isLoading: isLoadingRepositories,
error,
} = api.gitProvider.getGitlabRepositories.useQuery({
gitlabId,
});
} = api.gitlab.getGitlabRepositories.useQuery(
{
gitlabId,
},
{
enabled: !!gitlabId,
},
);
const {
data: branches,
fetchStatus,
status,
} = api.gitProvider.getGitlabBranches.useQuery(
} = api.gitlab.getGitlabBranches.useQuery(
{
owner: repository?.owner,
repo: repository?.repo,

View File

@@ -25,10 +25,10 @@ interface Props {
}
export const ShowProviderForm = ({ applicationId }: Props) => {
const { data: githubProviders } = api.gitProvider.githubProviders.useQuery();
const { data: gitlabProviders } = api.gitProvider.gitlabProviders.useQuery();
const { data: githubProviders } = api.github.githubProviders.useQuery();
const { data: gitlabProviders } = api.gitlab.gitlabProviders.useQuery();
const { data: bitbucketProviders } =
api.gitProvider.bitbucketProviders.useQuery();
api.bitbucket.bitbucketProviders.useQuery();
const { data: application } = api.application.one.useQuery({ applicationId });
const [tab, setSab] = useState<TabState>(application?.sourceType || "github");