mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 22:27:22 +00:00
fixed merged conflicts for gitlab and added animation for tabs
This commit is contained in:
@@ -145,58 +145,66 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
</div>
|
</div>
|
||||||
</TabList>
|
</TabList>
|
||||||
<TabPanel value={TabSections.Connection}>
|
<TabPanel value={TabSections.Connection}>
|
||||||
<FormControl label="Infisical Project Environment">
|
<motion.div
|
||||||
<Select
|
key="panel-1"
|
||||||
value={selectedSourceEnvironment}
|
transition={{ duration: 0.15 }}
|
||||||
onValueChange={(val) => setSelectedSourceEnvironment(val)}
|
initial={{ opacity: 0, translateX: 30 }}
|
||||||
className="w-full border border-mineshaft-500"
|
animate={{ opacity: 1, translateX: 0 }}
|
||||||
>
|
exit={{ opacity: 0, translateX: 30 }}
|
||||||
{workspace?.environments.map((sourceEnvironment) => (
|
>
|
||||||
<SelectItem
|
<FormControl label="Infisical Project Environment">
|
||||||
value={sourceEnvironment.slug}
|
<Select
|
||||||
key={`source-environment-${sourceEnvironment.slug}`}
|
value={selectedSourceEnvironment}
|
||||||
>
|
onValueChange={(val) => setSelectedSourceEnvironment(val)}
|
||||||
{sourceEnvironment.name}
|
className="w-full border border-mineshaft-500"
|
||||||
</SelectItem>
|
>
|
||||||
))}
|
{workspace?.environments.map((sourceEnvironment) => (
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
<FormControl label="Secrets Path">
|
|
||||||
<Input
|
|
||||||
value={secretPath}
|
|
||||||
onChange={(evt) => setSecretPath(evt.target.value)}
|
|
||||||
placeholder="Provide a path, default is /"
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
<FormControl label="Checkly Account">
|
|
||||||
<Select
|
|
||||||
value={targetApp}
|
|
||||||
onValueChange={(val) => setTargetApp(val)}
|
|
||||||
className="w-full border border-mineshaft-500"
|
|
||||||
isDisabled={integrationAuthApps.length === 0}
|
|
||||||
>
|
|
||||||
{integrationAuthApps.length > 0 ? (
|
|
||||||
integrationAuthApps.map((integrationAuthApp) => (
|
|
||||||
<SelectItem
|
<SelectItem
|
||||||
value={integrationAuthApp.name}
|
value={sourceEnvironment.slug}
|
||||||
key={`target-app-${integrationAuthApp.name}`}
|
key={`source-environment-${sourceEnvironment.slug}`}
|
||||||
>
|
>
|
||||||
{integrationAuthApp.name}
|
{sourceEnvironment.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))
|
))}
|
||||||
) : (
|
</Select>
|
||||||
<SelectItem value="none" key="target-app-none">
|
</FormControl>
|
||||||
No apps found
|
<FormControl label="Secrets Path">
|
||||||
</SelectItem>
|
<Input
|
||||||
)}
|
value={secretPath}
|
||||||
</Select>
|
onChange={(evt) => setSecretPath(evt.target.value)}
|
||||||
</FormControl>
|
placeholder="Provide a path, default is /"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormControl label="Checkly Account">
|
||||||
|
<Select
|
||||||
|
value={targetApp}
|
||||||
|
onValueChange={(val) => setTargetApp(val)}
|
||||||
|
className="w-full border border-mineshaft-500"
|
||||||
|
isDisabled={integrationAuthApps.length === 0}
|
||||||
|
>
|
||||||
|
{integrationAuthApps.length > 0 ? (
|
||||||
|
integrationAuthApps.map((integrationAuthApp) => (
|
||||||
|
<SelectItem
|
||||||
|
value={integrationAuthApp.name}
|
||||||
|
key={`target-app-${integrationAuthApp.name}`}
|
||||||
|
>
|
||||||
|
{integrationAuthApp.name}
|
||||||
|
</SelectItem>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<SelectItem value="none" key="target-app-none">
|
||||||
|
No apps found
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
</motion.div>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={TabSections.Options}>
|
<TabPanel value={TabSections.Options}>
|
||||||
<motion.div
|
<motion.div
|
||||||
key="panel-1"
|
key="panel-1"
|
||||||
transition={{ duration: 0.15 }}
|
transition={{ duration: 0.15 }}
|
||||||
initial={{ opacity: 0, translateX: 30 }}
|
initial={{ opacity: 0, translateX: -30 }}
|
||||||
animate={{ opacity: 1, translateX: 0 }}
|
animate={{ opacity: 1, translateX: 0 }}
|
||||||
exit={{ opacity: 0, translateX: 30 }}
|
exit={{ opacity: 0, translateX: 30 }}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -293,89 +293,97 @@ export default function GCPSecretManagerCreateIntegrationPage() {
|
|||||||
</motion.div>
|
</motion.div>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={TabSections.Options}>
|
<TabPanel value={TabSections.Options}>
|
||||||
<Controller
|
<motion.div
|
||||||
control={control}
|
key="panel-1"
|
||||||
name="secretPrefix"
|
transition={{ duration: 0.15 }}
|
||||||
render={({ field, fieldState: { error } }) => (
|
initial={{ opacity: 0, translateX: -30 }}
|
||||||
<FormControl
|
animate={{ opacity: 1, translateX: 0 }}
|
||||||
label="Secret Prefix"
|
exit={{ opacity: 0, translateX: 30 }}
|
||||||
isError={Boolean(error)}
|
>
|
||||||
errorText={error?.message}
|
|
||||||
>
|
|
||||||
<Input
|
|
||||||
{...field}
|
|
||||||
placeholder="INFISICAL_"
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Controller
|
|
||||||
control={control}
|
|
||||||
name="secretSuffix"
|
|
||||||
render={({ field, fieldState: { error } }) => (
|
|
||||||
<FormControl
|
|
||||||
label="Secret Suffix"
|
|
||||||
isError={Boolean(error)}
|
|
||||||
errorText={error?.message}
|
|
||||||
>
|
|
||||||
<Input
|
|
||||||
{...field}
|
|
||||||
placeholder="_INFISICAL"
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<div className="mt-8 mb-[2.36rem]">
|
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="shouldLabel"
|
name="secretPrefix"
|
||||||
render={({ field: { onChange, value } }) => (
|
render={({ field, fieldState: { error } }) => (
|
||||||
<Switch
|
<FormControl
|
||||||
id="label-gcp"
|
label="Secret Prefix"
|
||||||
onCheckedChange={(isChecked) => onChange(isChecked)}
|
isError={Boolean(error)}
|
||||||
isChecked={value}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
Label in GCP Secret Manager
|
<Input
|
||||||
</Switch>
|
{...field}
|
||||||
|
placeholder="INFISICAL_"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
<Controller
|
||||||
{shouldLabel && (
|
control={control}
|
||||||
<div className="mt-8">
|
name="secretSuffix"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="Secret Suffix"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
{...field}
|
||||||
|
placeholder="_INFISICAL"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="mt-8 mb-[2.36rem]">
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="labelName"
|
name="shouldLabel"
|
||||||
render={({ field, fieldState: { error } }) => (
|
render={({ field: { onChange, value } }) => (
|
||||||
<FormControl
|
<Switch
|
||||||
label="Label Name"
|
id="label-gcp"
|
||||||
isError={Boolean(error)}
|
onCheckedChange={(isChecked) => onChange(isChecked)}
|
||||||
errorText={error?.message}
|
isChecked={value}
|
||||||
>
|
>
|
||||||
<Input
|
Label in GCP Secret Manager
|
||||||
{...field}
|
</Switch>
|
||||||
placeholder="managed-by"
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Controller
|
|
||||||
control={control}
|
|
||||||
name="labelValue"
|
|
||||||
render={({ field, fieldState: { error } }) => (
|
|
||||||
<FormControl
|
|
||||||
label="Label Name"
|
|
||||||
isError={Boolean(error)}
|
|
||||||
errorText={error?.message}
|
|
||||||
>
|
|
||||||
<Input
|
|
||||||
{...field}
|
|
||||||
placeholder="infisical"
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
{shouldLabel && (
|
||||||
|
<div className="mt-8">
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="labelName"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="Label Name"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
{...field}
|
||||||
|
placeholder="managed-by"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="labelValue"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="Label Name"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
{...field}
|
||||||
|
placeholder="infisical"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</motion.div>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { faArrowUpRightFromSquare, faBookOpen, faBugs, faCircleInfo } from "@fortawesome/free-solid-svg-icons";
|
import { faArrowUpRightFromSquare, faBookOpen, faBugs, faCircleInfo } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { motion } from "framer-motion";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
import * as yup from "yup";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useCreateIntegration
|
useCreateIntegration
|
||||||
@@ -18,7 +22,11 @@ import {
|
|||||||
FormControl,
|
FormControl,
|
||||||
Input,
|
Input,
|
||||||
Select,
|
Select,
|
||||||
SelectItem
|
SelectItem,
|
||||||
|
Tab,
|
||||||
|
TabList,
|
||||||
|
TabPanel,
|
||||||
|
Tabs
|
||||||
} from "../../../components/v2";
|
} from "../../../components/v2";
|
||||||
import {
|
import {
|
||||||
useGetIntegrationAuthApps,
|
useGetIntegrationAuthApps,
|
||||||
@@ -32,8 +40,43 @@ const gitLabEntities = [
|
|||||||
{ name: "Group", value: "group" }
|
{ name: "Group", value: "group" }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
enum TabSections {
|
||||||
|
Connection = "connection",
|
||||||
|
Options = "options"
|
||||||
|
}
|
||||||
|
|
||||||
|
const schema = yup.object({
|
||||||
|
targetEntity: yup.string().oneOf(gitLabEntities.map(entity => entity.value), "Invalid entity type"),
|
||||||
|
targetTeamId: yup.string(),
|
||||||
|
selectedSourceEnvironment: yup.string().required("Source environment is required"),
|
||||||
|
secretPath: yup.string().required("Secret path is required"),
|
||||||
|
targetAppId: yup.string().required("GitLab project is required"),
|
||||||
|
targetEnvironment: yup.string(),
|
||||||
|
secretPrefix: yup.string(),
|
||||||
|
secretSuffix: yup.string()
|
||||||
|
});
|
||||||
|
|
||||||
|
type FormData = yup.InferType<typeof schema>;
|
||||||
|
|
||||||
export default function GitLabCreateIntegrationPage() {
|
export default function GitLabCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
setValue,
|
||||||
|
watch
|
||||||
|
} = useForm<FormData>({
|
||||||
|
resolver: yupResolver(schema),
|
||||||
|
defaultValues: {
|
||||||
|
targetEntity: "individual",
|
||||||
|
secretPath: "/"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const selectedSourceEnvironment = watch("selectedSourceEnvironment");
|
||||||
|
const targetEntity = watch("targetEntity");
|
||||||
|
const targetTeamId = watch("targetTeamId");
|
||||||
|
|
||||||
const { mutateAsync } = useCreateIntegration();
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
@@ -41,8 +84,6 @@ export default function GitLabCreateIntegrationPage() {
|
|||||||
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
|
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
|
||||||
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
|
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
|
||||||
|
|
||||||
const [targetTeamId, setTargetTeamId] = useState<string | null>(null);
|
|
||||||
|
|
||||||
const { data: integrationAuthApps, isLoading: isintegrationAuthAppsLoading } = useGetIntegrationAuthApps({
|
const { data: integrationAuthApps, isLoading: isintegrationAuthAppsLoading } = useGetIntegrationAuthApps({
|
||||||
integrationAuthId: (integrationAuthId as string) ?? "",
|
integrationAuthId: (integrationAuthId as string) ?? "",
|
||||||
...(targetTeamId ? { teamId: targetTeamId } : {})
|
...(targetTeamId ? { teamId: targetTeamId } : {})
|
||||||
@@ -51,26 +92,20 @@ export default function GitLabCreateIntegrationPage() {
|
|||||||
(integrationAuthId as string) ?? ""
|
(integrationAuthId as string) ?? ""
|
||||||
);
|
);
|
||||||
|
|
||||||
const [targetEntity, setTargetEntity] = useState(gitLabEntities[0].value);
|
|
||||||
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
|
||||||
const [secretPath, setSecretPath] = useState("/");
|
|
||||||
const [targetAppId, setTargetAppId] = useState("");
|
|
||||||
const [targetEnvironment, setTargetEnvironment] = useState("");
|
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (workspace) {
|
if (workspace) {
|
||||||
setSelectedSourceEnvironment(workspace.environments[0].slug);
|
setValue("selectedSourceEnvironment", workspace.environments[0].slug);
|
||||||
}
|
}
|
||||||
}, [workspace]);
|
}, [workspace]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (integrationAuthApps) {
|
if (integrationAuthApps) {
|
||||||
if (integrationAuthApps.length > 0) {
|
if (integrationAuthApps.length > 0) {
|
||||||
setTargetAppId(integrationAuthApps[0].appId as string);
|
setValue("targetAppId", String(integrationAuthApps[0].appId as string));
|
||||||
} else {
|
} else {
|
||||||
setTargetAppId("none");
|
setValue("targetAppId", "none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [integrationAuthApps]);
|
}, [integrationAuthApps]);
|
||||||
@@ -80,18 +115,25 @@ export default function GitLabCreateIntegrationPage() {
|
|||||||
if (integrationAuthTeams) {
|
if (integrationAuthTeams) {
|
||||||
if (integrationAuthTeams.length > 0) {
|
if (integrationAuthTeams.length > 0) {
|
||||||
// case: user is part of at least 1 group in GitLab
|
// case: user is part of at least 1 group in GitLab
|
||||||
setTargetTeamId(integrationAuthTeams[0].teamId);
|
setValue("targetTeamId", String(integrationAuthTeams[0].teamId));
|
||||||
} else {
|
} else {
|
||||||
// case: user is not part of any groups in GitLab
|
// case: user is not part of any groups in GitLab
|
||||||
setTargetTeamId("none");
|
setValue("targetTeamId", "none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (targetEntity === "individual") {
|
} else if (targetEntity === "individual") {
|
||||||
setTargetTeamId(null);
|
setValue("targetTeamId", undefined);
|
||||||
}
|
}
|
||||||
}, [targetEntity, integrationAuthTeams]);
|
}, [targetEntity, integrationAuthTeams]);
|
||||||
|
|
||||||
const handleButtonClick = async () => {
|
const onFormSubmit = async ({
|
||||||
|
selectedSourceEnvironment: sse,
|
||||||
|
secretPath,
|
||||||
|
targetAppId,
|
||||||
|
targetEnvironment,
|
||||||
|
secretPrefix,
|
||||||
|
secretSuffix
|
||||||
|
}: FormData) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
if (!integrationAuth?._id) return;
|
if (!integrationAuth?._id) return;
|
||||||
@@ -99,27 +141,34 @@ export default function GitLabCreateIntegrationPage() {
|
|||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: integrationAuthApps?.find((integrationAuthApp) => integrationAuthApp.appId === targetAppId)?.name,
|
app: integrationAuthApps?.find((integrationAuthApp) => String(integrationAuthApp.appId) === targetAppId)?.name,
|
||||||
appId: String(targetAppId),
|
appId: String(targetAppId),
|
||||||
sourceEnvironment: selectedSourceEnvironment,
|
sourceEnvironment: sse,
|
||||||
targetEnvironment: targetEnvironment === "" ? "*" : targetEnvironment,
|
targetEnvironment: targetEnvironment === "" ? "*" : targetEnvironment,
|
||||||
secretPath
|
secretPath,
|
||||||
|
metadata: {
|
||||||
|
secretPrefix,
|
||||||
|
secretSuffix
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
|
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
return integrationAuth &&
|
return integrationAuth &&
|
||||||
workspace &&
|
workspace &&
|
||||||
selectedSourceEnvironment &&
|
selectedSourceEnvironment &&
|
||||||
integrationAuthApps &&
|
integrationAuthApps &&
|
||||||
integrationAuthTeams &&
|
integrationAuthTeams ? (
|
||||||
targetAppId ? (
|
<form
|
||||||
<div className="flex flex-col h-full w-full items-center justify-center">
|
onSubmit={handleSubmit(onFormSubmit)}
|
||||||
|
className="flex flex-col h-full w-full items-center justify-center"
|
||||||
|
>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Set Up GitLab Integration</title>
|
<title>Set Up GitLab Integration</title>
|
||||||
<link rel='icon' href='/infisical.ico' />
|
<link rel='icon' href='/infisical.ico' />
|
||||||
@@ -150,105 +199,233 @@ export default function GitLabCreateIntegrationPage() {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<FormControl label="Project Environment" className="px-6">
|
<Tabs defaultValue={TabSections.Connection} className="px-6">
|
||||||
<Select
|
<TabList>
|
||||||
value={selectedSourceEnvironment}
|
<div className="flex flex-row border-b border-mineshaft-600 w-full">
|
||||||
onValueChange={(val) => setSelectedSourceEnvironment(val)}
|
<Tab value={TabSections.Connection}>Connection</Tab>
|
||||||
className="w-full border border-mineshaft-500"
|
<Tab value={TabSections.Options}>Options</Tab>
|
||||||
>
|
</div>
|
||||||
{workspace?.environments.map((sourceEnvironment) => (
|
</TabList>
|
||||||
<SelectItem
|
<TabPanel value={TabSections.Connection}>
|
||||||
value={sourceEnvironment.slug}
|
<motion.div
|
||||||
key={`source-environment-${sourceEnvironment.slug}`}
|
key="panel-1"
|
||||||
>
|
transition={{ duration: 0.15 }}
|
||||||
{sourceEnvironment.name}
|
initial={{ opacity: 0, translateX: 30 }}
|
||||||
</SelectItem>
|
animate={{ opacity: 1, translateX: 0 }}
|
||||||
))}
|
exit={{ opacity: 0, translateX: 30 }}
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
<FormControl label="Secrets Path" className="px-6">
|
|
||||||
<Input
|
|
||||||
value={secretPath}
|
|
||||||
onChange={(evt) => setSecretPath(evt.target.value)}
|
|
||||||
placeholder="Provide a path, default is /"
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
<FormControl label="GitLab Integration Type" className="px-6">
|
|
||||||
<Select
|
|
||||||
value={targetEntity}
|
|
||||||
onValueChange={(val) => setTargetEntity(val)}
|
|
||||||
className="w-full border border-mineshaft-500"
|
|
||||||
>
|
|
||||||
{gitLabEntities.map((entity) => {
|
|
||||||
return (
|
|
||||||
<SelectItem value={entity.value} key={`target-entity-${entity.value}`}>
|
|
||||||
{entity.name}
|
|
||||||
</SelectItem>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
{targetEntity === "group" && targetTeamId && (
|
|
||||||
<FormControl label="GitLab Group" className="px-6">
|
|
||||||
<Select
|
|
||||||
value={targetTeamId}
|
|
||||||
onValueChange={(val) => setTargetTeamId(val)}
|
|
||||||
className="w-full border border-mineshaft-500"
|
|
||||||
>
|
>
|
||||||
{integrationAuthTeams.length > 0 ? (
|
<div>
|
||||||
integrationAuthTeams.map((integrationAuthTeam) => (
|
<Controller
|
||||||
<SelectItem
|
control={control}
|
||||||
value={integrationAuthTeam.teamId}
|
name="selectedSourceEnvironment"
|
||||||
key={`target-team-${integrationAuthTeam.teamId}`}
|
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
|
||||||
>
|
<FormControl
|
||||||
{integrationAuthTeam.name}
|
label="Project Environment"
|
||||||
</SelectItem>
|
errorText={error?.message}
|
||||||
))
|
isError={Boolean(error)}
|
||||||
) : (
|
>
|
||||||
<SelectItem value="none" key="target-team-none">
|
<Select
|
||||||
No groups found
|
defaultValue={field.value}
|
||||||
</SelectItem>
|
{...field}
|
||||||
)}
|
onValueChange={(e) => onChange(e)}
|
||||||
</Select>
|
className="w-full"
|
||||||
</FormControl>
|
>
|
||||||
)}
|
{workspace?.environments.map((sourceEnvironment) => (
|
||||||
<FormControl label="GitLab Project" className="px-6">
|
<SelectItem
|
||||||
<Select
|
value={sourceEnvironment.slug}
|
||||||
value={targetAppId}
|
key={`source-environment-${sourceEnvironment.slug}`}
|
||||||
onValueChange={(val) => setTargetAppId(val)}
|
>
|
||||||
className="w-full border border-mineshaft-500"
|
{sourceEnvironment.name}
|
||||||
isDisabled={integrationAuthApps.length === 0}
|
</SelectItem>
|
||||||
>
|
))}
|
||||||
{integrationAuthApps.length > 0 ? (
|
</Select>
|
||||||
integrationAuthApps.map((integrationAuthApp) => (
|
</FormControl>
|
||||||
<SelectItem
|
)}
|
||||||
value={integrationAuthApp.appId as string}
|
/>
|
||||||
key={`target-app-${integrationAuthApp.appId}`}
|
<Controller
|
||||||
>
|
control={control}
|
||||||
{integrationAuthApp.name}
|
defaultValue=""
|
||||||
</SelectItem>
|
name="secretPath"
|
||||||
))
|
render={({ field, fieldState: { error } }) => (
|
||||||
) : (
|
<FormControl
|
||||||
<SelectItem value="none" key="target-app-none">
|
label="Secrets Path"
|
||||||
No projects found
|
isError={Boolean(error)}
|
||||||
</SelectItem>
|
errorText={error?.message}
|
||||||
)}
|
>
|
||||||
</Select>
|
<Input
|
||||||
</FormControl>
|
{...field}
|
||||||
<FormControl label="GitLab Environment Scope (Optional)" className="px-6">
|
placeholder="/"
|
||||||
<Input
|
/>
|
||||||
placeholder="*"
|
</FormControl>
|
||||||
value={targetEnvironment}
|
)}
|
||||||
onChange={(e) => setTargetEnvironment(e.target.value)}
|
/>
|
||||||
/>
|
<Controller
|
||||||
</FormControl>
|
control={control}
|
||||||
|
name="targetEntity"
|
||||||
|
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="GitLab Integration Type"
|
||||||
|
errorText={error?.message}
|
||||||
|
isError={Boolean(error)}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
{...field}
|
||||||
|
onValueChange={(e) => onChange(e)}
|
||||||
|
className="w-full"
|
||||||
|
>
|
||||||
|
{gitLabEntities.map((entity) => {
|
||||||
|
return (
|
||||||
|
<SelectItem value={entity.value} key={`target-entity-${entity.value}`}>
|
||||||
|
{entity.name}
|
||||||
|
</SelectItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{targetEntity === "group" && targetTeamId && (
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="targetTeamId"
|
||||||
|
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="GitLab Group"
|
||||||
|
errorText={error?.message}
|
||||||
|
isError={Boolean(error)}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
{...field}
|
||||||
|
onValueChange={(e) => onChange(e)}
|
||||||
|
className="w-full"
|
||||||
|
>
|
||||||
|
{integrationAuthTeams.length > 0 ? (
|
||||||
|
integrationAuthTeams.map((integrationAuthTeam) =>
|
||||||
|
(
|
||||||
|
<SelectItem
|
||||||
|
value={String(integrationAuthTeam.teamId as string)}
|
||||||
|
key={`target-team-${String(integrationAuthTeam.teamId)}`}
|
||||||
|
>
|
||||||
|
{integrationAuthTeam.name}
|
||||||
|
</SelectItem>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<SelectItem value="none" key="target-team-none">
|
||||||
|
No groups found
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="targetAppId"
|
||||||
|
render={({ field: { onChange, ...field }, fieldState: { error } }) => {
|
||||||
|
return (
|
||||||
|
<FormControl
|
||||||
|
label="GitLab Project"
|
||||||
|
errorText={error?.message}
|
||||||
|
isError={Boolean(error)}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
{...field}
|
||||||
|
onValueChange={(e) => {
|
||||||
|
if (e === "") return;
|
||||||
|
onChange(e)
|
||||||
|
}}
|
||||||
|
className="w-full"
|
||||||
|
>
|
||||||
|
{integrationAuthApps.length > 0 ? (
|
||||||
|
integrationAuthApps.map((integrationAuthApp) => (
|
||||||
|
<SelectItem
|
||||||
|
value={String(integrationAuthApp.appId as string)}
|
||||||
|
key={`target-app-${String(integrationAuthApp.appId)}`}
|
||||||
|
>
|
||||||
|
{integrationAuthApp.name}
|
||||||
|
</SelectItem>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<SelectItem value="none" key="target-app-none">
|
||||||
|
No projects found
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
)}}
|
||||||
|
/>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
defaultValue=""
|
||||||
|
name="targetEnvironment"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="GitLab Environment Scope (Optional)"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
{...field}
|
||||||
|
placeholder="*"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel value={TabSections.Options}>
|
||||||
|
<motion.div
|
||||||
|
key="panel-1"
|
||||||
|
transition={{ duration: 0.15 }}
|
||||||
|
initial={{ opacity: 0, translateX: -30 }}
|
||||||
|
animate={{ opacity: 1, translateX: 0 }}
|
||||||
|
exit={{ opacity: 0, translateX: 30 }}
|
||||||
|
className="pb-[14.25rem]"
|
||||||
|
>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="secretPrefix"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="Secret Prefix"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
{...field}
|
||||||
|
placeholder="INFISICAL_"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="secretSuffix"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="Secret Suffix"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
{...field}
|
||||||
|
placeholder="_INFISICAL"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</motion.div>
|
||||||
|
</TabPanel>
|
||||||
|
</Tabs>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleButtonClick}
|
|
||||||
colorSchema="primary"
|
colorSchema="primary"
|
||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
className="mb-6 mt-2 ml-auto mr-6 w-min"
|
className="mb-8 ml-auto mr-6 w-min"
|
||||||
|
size="sm"
|
||||||
|
type="submit"
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
isDisabled={integrationAuthApps.length === 0}
|
|
||||||
>
|
>
|
||||||
Create Integration
|
Create Integration
|
||||||
</Button>
|
</Button>
|
||||||
@@ -258,7 +435,7 @@ export default function GitLabCreateIntegrationPage() {
|
|||||||
<div className="flex flex-row items-center"><FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-200 text-xl"/> <span className="ml-3 text-md text-mineshaft-100">Pro Tips</span></div>
|
<div className="flex flex-row items-center"><FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-200 text-xl"/> <span className="ml-3 text-md text-mineshaft-100">Pro Tips</span></div>
|
||||||
<span className="text-mineshaft-300 text-sm mt-4">After creating an integration, your secrets will start syncing immediately. This might cause an unexpected override of current secrets in GitLab with secrets from Infisical.</span>
|
<span className="text-mineshaft-300 text-sm mt-4">After creating an integration, your secrets will start syncing immediately. This might cause an unexpected override of current secrets in GitLab with secrets from Infisical.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex justify-center items-center w-full h-full">
|
<div className="flex justify-center items-center w-full h-full">
|
||||||
<Head>
|
<Head>
|
||||||
|
|||||||
Reference in New Issue
Block a user