mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
misc: added neat check all condition
This commit is contained in:
@@ -32,10 +32,21 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
|
||||
const {
|
||||
handleSubmit,
|
||||
control,
|
||||
watch,
|
||||
formState: { isSubmitting }
|
||||
} = useForm({ resolver: zodResolver(formSchema) });
|
||||
const { mutateAsync: upgradePrivilegeSystem } = useUpgradePrivilegeSystem();
|
||||
|
||||
const isProjectPrivilegesUpdated = watch("isProjectPrivilegesUpdated");
|
||||
const isOrgPrivilegesUpdated = watch("isOrgPrivilegesUpdated");
|
||||
const isInfrastructureUpdated = watch("isInfrastructureUpdated");
|
||||
const acknowledgesPermanentChange = watch("acknowledgesPermanentChange");
|
||||
const isAllChecksCompleted =
|
||||
isProjectPrivilegesUpdated &&
|
||||
isOrgPrivilegesUpdated &&
|
||||
isInfrastructureUpdated &&
|
||||
acknowledgesPermanentChange;
|
||||
|
||||
const handlePrivilegeSystemUpgrade = async () => {
|
||||
try {
|
||||
await upgradePrivilegeSystem();
|
||||
@@ -231,7 +242,7 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
|
||||
</div>
|
||||
<Button
|
||||
type="submit"
|
||||
isDisabled={!isAdmin}
|
||||
isDisabled={!isAdmin || !isAllChecksCompleted}
|
||||
isLoading={isSubmitting}
|
||||
className="mt-5 w-full"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user