fix: disabled repo env until repo selected

This commit is contained in:
Salman
2024-03-16 08:01:28 +05:30
parent 5f99e58674
commit 2b7784718d
@@ -17,6 +17,7 @@ import { yupResolver } from "@hookform/resolvers/yup";
import axios from "axios"; import axios from "axios";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import queryString from "query-string"; import queryString from "query-string";
import { twMerge } from "tailwind-merge";
import * as yup from "yup"; import * as yup from "yup";
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
@@ -124,6 +125,7 @@ export default function GitHubCreateIntegrationPage() {
}); });
const scope = watch("scope"); const scope = watch("scope");
const repoId = watch("repoId");
const repoIds = watch("repoIds"); const repoIds = watch("repoIds");
const repoName = watch("repoName"); const repoName = watch("repoName");
const repoOwner = watch("repoOwner"); const repoOwner = watch("repoOwner");
@@ -133,7 +135,7 @@ export default function GitHubCreateIntegrationPage() {
repoName, repoName,
repoOwner repoOwner
); );
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
useEffect(() => { useEffect(() => {
@@ -237,7 +239,7 @@ export default function GitHubCreateIntegrationPage() {
}; };
return integrationAuth && workspace && integrationAuthApps ? ( return integrationAuth && workspace && integrationAuthApps ? (
<div className="flex w-full h-full flex-col items-center justify-center py-4"> <div className="flex h-full w-full flex-col items-center justify-center py-4">
<Head> <Head>
<title>Set Up GitHub Integration</title> <title>Set Up GitHub Integration</title>
<link rel="icon" href="/infisical.ico" /> <link rel="icon" href="/infisical.ico" />
@@ -508,7 +510,11 @@ export default function GitHubCreateIntegrationPage() {
<Select <Select
value={field.value} value={field.value}
onValueChange={onChange} onValueChange={onChange}
className="w-full border border-mineshaft-500" isDisabled={!repoId}
className={twMerge(
"w-full border border-mineshaft-500",
!repoId && "h-10 cursor-not-allowed"
)}
> >
{integrationAuthGithubEnvs?.length ? ( {integrationAuthGithubEnvs?.length ? (
integrationAuthGithubEnvs.map((githubEnv) => { integrationAuthGithubEnvs.map((githubEnv) => {