Review fixes

This commit is contained in:
x032205
2025-07-04 01:50:41 -04:00
parent 456107fbf3
commit 218338e5d2
15 changed files with 46 additions and 35 deletions
@@ -120,7 +120,7 @@ export const OCIVaultSyncFields = () => {
menuPlacement="top"
isLoading={isVaultsLoading && Boolean(connectionId)}
isDisabled={!connectionId || !selectedCompartment}
value={vaults?.find((v) => v.id === value) ?? null}
value={vaults?.find((v) => v.id === value) || null}
onChange={(option) => {
onChange((option as SingleValue<{ id: string }>)?.id ?? null);
setValue("destinationConfig.keyOcid", "");
@@ -10,12 +10,12 @@ import {
TBitbucketWorkspace
} from "./types";
const bitBucketConnectionKeys = {
const bitbucketConnectionKeys = {
all: [...appConnectionKeys.all, "bitbucket"] as const,
listRepos: (connectionId: string, workspaceSlug: string) =>
[...bitBucketConnectionKeys.all, "repos", connectionId, workspaceSlug] as const,
[...bitbucketConnectionKeys.all, "repos", connectionId, workspaceSlug] as const,
listWorkspaces: (connectionId: string) =>
[...bitBucketConnectionKeys.all, "workspaces", connectionId] as const
[...bitbucketConnectionKeys.all, "workspaces", connectionId] as const
};
export const useBitbucketConnectionListWorkspaces = (
@@ -25,13 +25,13 @@ export const useBitbucketConnectionListWorkspaces = (
TBitbucketWorkspace[],
unknown,
TBitbucketWorkspace[],
ReturnType<typeof bitBucketConnectionKeys.listWorkspaces>
ReturnType<typeof bitbucketConnectionKeys.listWorkspaces>
>,
"queryKey" | "queryFn"
>
) => {
return useQuery({
queryKey: bitBucketConnectionKeys.listWorkspaces(connectionId),
queryKey: bitbucketConnectionKeys.listWorkspaces(connectionId),
queryFn: async () => {
const { data } = await apiRequest.get<TBitbucketConnectionListWorkspacesResponse>(
`/api/v1/app-connections/bitbucket/${connectionId}/workspaces`
@@ -52,18 +52,18 @@ export const useBitbucketConnectionListRepositories = (
unknown,
TBitbucketRepo[],
// The ReturnType here will be a supertype of the actual queryKey, which is acceptable
ReturnType<typeof bitBucketConnectionKeys.listRepos>
ReturnType<typeof bitbucketConnectionKeys.listRepos>
>,
"queryKey" | "queryFn"
>
) => {
return useQuery({
// Append workspaceSlug to the existing query key for unique caching
queryKey: bitBucketConnectionKeys.listRepos(connectionId, workspaceSlug),
queryKey: bitbucketConnectionKeys.listRepos(connectionId, workspaceSlug),
queryFn: async () => {
const { data } = await apiRequest.get<TBitbucketConnectionListRepositoriesResponse>(
// Include workspaceSlug in the API endpoint path
`/api/v1/app-connections/bitbucket/${connectionId}/repositories?workspaceSlug=${workspaceSlug}`
`/api/v1/app-connections/bitbucket/${connectionId}/repositories?workspaceSlug=${encodeURIComponent(workspaceSlug)}`
);
return data.repositories;
@@ -89,8 +89,8 @@ export const BitbucketConfigurePage = () => {
}
});
const bitBucketWorkspace = watch("targetWorkspace");
const bitBucketRepo = watch("targetRepo");
const bitbucketWorkspace = watch("targetWorkspace");
const bitbucketRepo = watch("targetRepo");
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.BitbucketConfigurePage.id,
@@ -103,17 +103,17 @@ export const BitbucketConfigurePage = () => {
const { data: bitbucketRepos, isPending: isBitbucketReposLoading } = useGetIntegrationAuthApps({
integrationAuthId: (integrationAuthId as string) ?? "",
workspaceSlug: bitBucketWorkspace?.slug
workspaceSlug: bitbucketWorkspace?.slug
});
const { data: bitbucketEnvironments, isPending: isBitbucketEnvironmentsLoading } =
useGetIntegrationAuthBitbucketEnvironments(
{
integrationAuthId: (integrationAuthId as string) ?? "",
workspaceSlug: bitBucketWorkspace?.slug ?? "",
repoSlug: bitBucketRepo?.appId ?? ""
workspaceSlug: bitbucketWorkspace?.slug ?? "",
repoSlug: bitbucketRepo?.appId ?? ""
},
{ enabled: Boolean(bitBucketWorkspace?.slug && bitBucketRepo?.appId) }
{ enabled: Boolean(bitbucketWorkspace?.slug && bitbucketRepo?.appId) }
);
const onSubmit = async ({
@@ -167,8 +167,8 @@ export const BitbucketConfigurePage = () => {
useEffect(() => {
if (
bitBucketWorkspace ||
bitBucketRepo ||
bitbucketWorkspace ||
bitbucketRepo ||
!bitbucketRepos ||
!bitbucketWorkspaces ||
!currentWorkspace
@@ -325,7 +325,7 @@ export const BitbucketConfigurePage = () => {
? "Select an environment..."
: "No environments found..."
}
isLoading={isBitbucketEnvironmentsLoading && Boolean(bitBucketRepo)}
isLoading={isBitbucketEnvironmentsLoading && Boolean(bitbucketRepo)}
isDisabled={!bitbucketEnvironments?.length || isBitbucketEnvironmentsLoading}
/>
</FormControl>