mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-13 06:29:25 +00:00
Addressed PR comments
This commit is contained in:
+13
-12
@@ -21,8 +21,8 @@ export const BitbucketSyncFields = () => {
|
||||
>();
|
||||
|
||||
const connectionId = useWatch({ name: "connection.id", control });
|
||||
const workspace = useWatch({ name: "destinationConfig.workspace", control });
|
||||
const repository = useWatch({ name: "destinationConfig.repository", control });
|
||||
const workspace = useWatch({ name: "destinationConfig.workspaceSlug", control });
|
||||
const repository = useWatch({ name: "destinationConfig.repositorySlug", control });
|
||||
|
||||
const { data: workspaces = [], isPending: isWorkspacesLoading } =
|
||||
useBitbucketConnectionListWorkspaces(connectionId, {
|
||||
@@ -43,14 +43,14 @@ export const BitbucketSyncFields = () => {
|
||||
<>
|
||||
<SecretSyncConnectionField
|
||||
onChange={() => {
|
||||
setValue("destinationConfig.workspace", "");
|
||||
setValue("destinationConfig.repository", "");
|
||||
setValue("destinationConfig.environment", "");
|
||||
setValue("destinationConfig.workspaceSlug", "");
|
||||
setValue("destinationConfig.repositorySlug", "");
|
||||
setValue("destinationConfig.environmentId", "");
|
||||
}}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="destinationConfig.workspace"
|
||||
name="destinationConfig.workspaceSlug"
|
||||
control={control}
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
@@ -67,8 +67,8 @@ export const BitbucketSyncFields = () => {
|
||||
const v = option as SingleValue<TBitbucketWorkspace>;
|
||||
onChange(v?.slug ?? "");
|
||||
// Clear downstream selections
|
||||
setValue("destinationConfig.repository", "");
|
||||
setValue("destinationConfig.environment", "");
|
||||
setValue("destinationConfig.repositorySlug", "");
|
||||
setValue("destinationConfig.environmentId", "");
|
||||
}}
|
||||
options={workspaces}
|
||||
placeholder="Select workspace..."
|
||||
@@ -80,7 +80,7 @@ export const BitbucketSyncFields = () => {
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="destinationConfig.repository"
|
||||
name="destinationConfig.repositorySlug"
|
||||
control={control}
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
@@ -97,7 +97,7 @@ export const BitbucketSyncFields = () => {
|
||||
const v = option as SingleValue<TBitbucketRepo>;
|
||||
onChange(v?.slug ?? "");
|
||||
// Clear downstream selections
|
||||
setValue("destinationConfig.environment", "");
|
||||
setValue("destinationConfig.environmentId", "");
|
||||
}}
|
||||
options={repositories}
|
||||
placeholder="Select repository..."
|
||||
@@ -109,13 +109,14 @@ export const BitbucketSyncFields = () => {
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="destinationConfig.environment"
|
||||
name="destinationConfig.environmentId"
|
||||
control={control}
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
isError={Boolean(error)}
|
||||
errorText={error?.message}
|
||||
label="Bitbucket Deployment Environment (optional)"
|
||||
isOptional
|
||||
label="Bitbucket Deployment Environment"
|
||||
tooltipClassName="max-w-md"
|
||||
>
|
||||
<FilterableSelect
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@ import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
|
||||
export const BitbucketSyncReviewFields = () => {
|
||||
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Bitbucket }>();
|
||||
const repository = watch("destinationConfig.repository");
|
||||
const environment = watch("destinationConfig.environment");
|
||||
const workspace = watch("destinationConfig.workspace");
|
||||
const repository = watch("destinationConfig.repositorySlug");
|
||||
const environment = watch("destinationConfig.environmentId");
|
||||
const workspace = watch("destinationConfig.workspaceSlug");
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
+7
-3
@@ -7,9 +7,13 @@ export const BitbucketSyncDestinationSchema = BaseSecretSyncSchema().merge(
|
||||
z.object({
|
||||
destination: z.literal(SecretSync.Bitbucket),
|
||||
destinationConfig: z.object({
|
||||
repository: z.string().trim().min(1, "Repository slug required").describe("Repository slug"),
|
||||
environment: z.string().trim().optional().describe("Deployment environment uuid"),
|
||||
workspace: z.string().trim().min(1, "Workspace slug required").describe("Workspace slug")
|
||||
repositorySlug: z
|
||||
.string()
|
||||
.trim()
|
||||
.min(1, "Repository slug required")
|
||||
.describe("Repository slug"),
|
||||
environmentId: z.string().trim().optional().describe("Deployment environment uuid"),
|
||||
workspaceSlug: z.string().trim().min(1, "Workspace slug required").describe("Workspace slug")
|
||||
})
|
||||
})
|
||||
);
|
||||
|
||||
@@ -5,9 +5,9 @@ import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
|
||||
export type TBitbucketSync = TRootSecretSync & {
|
||||
destination: SecretSync.Bitbucket;
|
||||
destinationConfig: {
|
||||
workspace: string;
|
||||
repository: string;
|
||||
environment?: string;
|
||||
workspaceSlug: string;
|
||||
repositorySlug: string;
|
||||
environmentId?: string;
|
||||
};
|
||||
connection: {
|
||||
app: AppConnection.Bitbucket;
|
||||
|
||||
+2
-2
@@ -175,8 +175,8 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
|
||||
secondaryText = "Supabase Project";
|
||||
break;
|
||||
case SecretSync.Bitbucket:
|
||||
primaryText = destinationConfig.workspace;
|
||||
secondaryText = destinationConfig.repository;
|
||||
primaryText = destinationConfig.workspaceSlug;
|
||||
secondaryText = destinationConfig.repositorySlug;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unhandled Destination Col Values ${destination}`);
|
||||
|
||||
+5
-5
@@ -7,15 +7,15 @@ type Props = {
|
||||
|
||||
export const BitbucketSyncDestinationSection = ({ secretSync }: Props) => {
|
||||
const {
|
||||
destinationConfig: { workspace, repository, environment }
|
||||
destinationConfig: { workspaceSlug, repositorySlug, environmentId }
|
||||
} = secretSync;
|
||||
|
||||
return (
|
||||
<>
|
||||
<GenericFieldLabel label="Workspace">{workspace}</GenericFieldLabel>
|
||||
<GenericFieldLabel label="Repository">{repository}</GenericFieldLabel>
|
||||
{environment && (
|
||||
<GenericFieldLabel label="Deployment Environment">{environment}</GenericFieldLabel>
|
||||
<GenericFieldLabel label="Workspace">{workspaceSlug}</GenericFieldLabel>
|
||||
<GenericFieldLabel label="Repository">{repositorySlug}</GenericFieldLabel>
|
||||
{environmentId && (
|
||||
<GenericFieldLabel label="Deployment Environment">{environmentId}</GenericFieldLabel>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user