mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 08:29:55 +00:00
Type fix
This commit is contained in:
+8
-8
@@ -20,7 +20,7 @@ import {
|
||||
useGitlabConnectionListProjects
|
||||
} from "@app/hooks/api/appConnections/gitlab";
|
||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
import { GitlabSyncScope } from "@app/hooks/api/secretSyncs/types/gitlab-sync";
|
||||
import { GitLabSyncScope } from "@app/hooks/api/secretSyncs/types/gitlab-sync";
|
||||
|
||||
import { TSecretSyncForm } from "../schemas";
|
||||
|
||||
@@ -71,7 +71,7 @@ export const GitLabSyncFields = () => {
|
||||
const shouldMaskSecrets = useWatch({ name: "destinationConfig.shouldMaskSecrets", control });
|
||||
|
||||
const { data: groups, isLoading: isGroupsLoading } = useGitlabConnectionListGroups(connectionId, {
|
||||
enabled: Boolean(connectionId) && scope === GitlabSyncScope.Group
|
||||
enabled: Boolean(connectionId) && scope === GitLabSyncScope.Group
|
||||
});
|
||||
|
||||
const { data: projects, isLoading: isProjectsLoading } = useGitlabConnectionListProjects(
|
||||
@@ -82,21 +82,21 @@ export const GitLabSyncFields = () => {
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="h-[calc(100vh-28rem)] overflow-auto">
|
||||
<div className="h-full overflow-auto">
|
||||
<SecretSyncConnectionField
|
||||
onChange={() => {
|
||||
setValue("destinationConfig.projectId", "");
|
||||
setValue("destinationConfig.projectName", "");
|
||||
setValue("destinationConfig.groupId", "");
|
||||
setValue("destinationConfig.groupName", "");
|
||||
setValue("destinationConfig.scope", GitlabSyncScope.Project);
|
||||
setValue("destinationConfig.scope", GitLabSyncScope.Project);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="destinationConfig.scope"
|
||||
control={control}
|
||||
defaultValue={GitlabSyncScope.Project}
|
||||
defaultValue={GitLabSyncScope.Project}
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl errorText={error?.message} isError={Boolean(error?.message)} label="Scope">
|
||||
<Select
|
||||
@@ -113,7 +113,7 @@ export const GitLabSyncFields = () => {
|
||||
placeholder="Select a scope..."
|
||||
dropdownContainerClassName="max-w-none"
|
||||
>
|
||||
{Object.values(GitlabSyncScope).map((projectScope) => (
|
||||
{Object.values(GitLabSyncScope).map((projectScope) => (
|
||||
<SelectItem className="capitalize" value={projectScope} key={projectScope}>
|
||||
{projectScope.replace("-", " ")}
|
||||
</SelectItem>
|
||||
@@ -123,7 +123,7 @@ export const GitLabSyncFields = () => {
|
||||
)}
|
||||
/>
|
||||
|
||||
{scope === GitlabSyncScope.Group && (
|
||||
{scope === GitLabSyncScope.Group && (
|
||||
<Controller
|
||||
name="destinationConfig.groupId"
|
||||
control={control}
|
||||
@@ -166,7 +166,7 @@ export const GitLabSyncFields = () => {
|
||||
/>
|
||||
)}
|
||||
|
||||
{scope === GitlabSyncScope.Project && (
|
||||
{scope === GitLabSyncScope.Project && (
|
||||
<Controller
|
||||
name="destinationConfig.projectId"
|
||||
control={control}
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@ import { useFormContext } from "react-hook-form";
|
||||
import { GenericFieldLabel } from "@app/components/secret-syncs";
|
||||
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
|
||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
import { GitLabSyncScope } from "@app/hooks/api/secretSyncs/types/gitlab-sync";
|
||||
|
||||
export const GitLabSyncReviewFields = () => {
|
||||
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.GitLab }>();
|
||||
@@ -17,10 +18,10 @@ export const GitLabSyncReviewFields = () => {
|
||||
return (
|
||||
<>
|
||||
<GenericFieldLabel label="Scope">{scope}</GenericFieldLabel>
|
||||
{scope === GitlabSyncScope.Project && (
|
||||
{scope === GitLabSyncScope.Project && (
|
||||
<GenericFieldLabel label="Project Name">{projectName}</GenericFieldLabel>
|
||||
)}
|
||||
{scope === GitlabSyncScope.Group && (
|
||||
{scope === GitLabSyncScope.Group && (
|
||||
<GenericFieldLabel label="Group Name">{groupName}</GenericFieldLabel>
|
||||
)}
|
||||
{targetEnvironment && (
|
||||
|
||||
+3
-3
@@ -2,14 +2,14 @@ import { z } from "zod";
|
||||
|
||||
import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
|
||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
import { GitlabSyncScope } from "@app/hooks/api/secretSyncs/types/gitlab-sync";
|
||||
import { GitLabSyncScope } from "@app/hooks/api/secretSyncs/types/gitlab-sync";
|
||||
|
||||
export const GitlabSyncDestinationSchema = BaseSecretSyncSchema().merge(
|
||||
z.object({
|
||||
destination: z.literal(SecretSync.GitLab),
|
||||
destinationConfig: z.discriminatedUnion("scope", [
|
||||
z.object({
|
||||
scope: z.literal(GitlabSyncScope.Project),
|
||||
scope: z.literal(GitLabSyncScope.Project),
|
||||
projectId: z.string().trim().min(1, "Project ID required"),
|
||||
projectName: z.string().trim().min(1, "Project name required"),
|
||||
targetEnvironment: z.string().optional(),
|
||||
@@ -18,7 +18,7 @@ export const GitlabSyncDestinationSchema = BaseSecretSyncSchema().merge(
|
||||
shouldHideSecrets: z.boolean().optional().default(false)
|
||||
}),
|
||||
z.object({
|
||||
scope: z.literal(GitlabSyncScope.Group),
|
||||
scope: z.literal(GitLabSyncScope.Group),
|
||||
targetEnvironment: z.string().optional(),
|
||||
groupId: z.string().trim().min(1, "Group ID required"),
|
||||
groupName: z.string().trim().min(1, "Group name required"),
|
||||
|
||||
Reference in New Issue
Block a user