fix rotation account configured detection

This commit is contained in:
x032205
2025-10-20 20:46:15 -04:00
parent 64b3d61325
commit 2b6fcb2564
3 changed files with 7 additions and 2 deletions
@@ -31,6 +31,8 @@ export const BasePamAccountSchemaWithResource = BasePamAccountSchema.extend({
id: true, id: true,
name: true, name: true,
resourceType: true resourceType: true
}).extend({
rotationCredentialsConfigured: z.boolean()
}) })
}); });
@@ -54,7 +54,7 @@ export const PostgresAccountForm = ({ account, resourceId, onSubmit }: Props) =>
} else { } else {
setRotationCredentialsConfigured(!!resource?.rotationAccountCredentials); setRotationCredentialsConfigured(!!resource?.rotationAccountCredentials);
} }
}, [account]); }, [account, resource]);
return ( return (
<FormProvider {...form}> <FormProvider {...form}>
@@ -22,7 +22,10 @@ export const RotateAccountFields = ({
const rotationEnabled = watch("rotationEnabled"); const rotationEnabled = watch("rotationEnabled");
return ( return (
<Tooltip content="The resource which owns this account does not have rotation credentials configured."> <Tooltip
isDisabled={rotationCredentialsConfigured}
content="The resource which owns this account does not have rotation credentials configured."
>
<div <div
className={twMerge( className={twMerge(
"flex h-9 w-fit items-center gap-3", "flex h-9 w-fit items-center gap-3",