Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

misc: fix lint issues

Sheen Capadngan03241b19c4b0
diff --git a/frontend/src/hooks/api/pam/types/base-account.ts b/frontend/src/hooks/api/pam/types/base-account.ts
index 2b9b80df0d..b58ea2e0cc 100644
--- a/frontend/src/hooks/api/pam/types/base-account.ts
+++ b/frontend/src/hooks/api/pam/types/base-account.ts
@@ -14,7 +14,7 @@ export interface TBasePamAccount {
name: string;
description?: string | null;
rotationEnabled: boolean;
- rotationIntervalSeconds?: number | null;
+ rotationIntervalSeconds?: number;
requireMfa?: boolean | null;
lastRotatedAt?: string | null;
lastRotationMessage?: string | null;
diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.ts
index 6715e5de2a..79bd93941d 100644
--- a/frontend/src/hooks/api/pam/types/index.ts
+++ b/frontend/src/hooks/api/pam/types/index.ts
@@ -143,29 +143,13 @@ export type TListPamAccountsDTO = {
export type TCreatePamAccountDTO = Pick<
TPamAccount,
- | "name"
- | "description"
- | "credentials"
- | "projectId"
- | "resourceId"
- | "folderId"
- | "rotationEnabled"
- | "rotationIntervalSeconds"
- | "requireMfa"
+ "name" | "description" | "credentials" | "projectId" | "resourceId" | "folderId" | "requireMfa"
> & {
resourceType: PamResourceType;
};
export type TUpdatePamAccountDTO = Partial<
- Pick<
- TPamAccount,
- | "name"
- | "description"
- | "credentials"
- | "rotationEnabled"
- | "rotationIntervalSeconds"
- | "requireMfa"
- >
+ Pick<TPamAccount, "name" | "description" | "credentials" | "requireMfa">
> & {
accountId: string;
resourceType: PamResourceType;
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PostgresAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PostgresAccountForm.tsx
index a641e03aab..b1ee506eb9 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PostgresAccountForm.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PostgresAccountForm.tsx
@@ -71,10 +71,14 @@ export const PostgresAccountForm = ({ account, resourceId, resourceType, onSubmi
return (
<FormProvider {...form}>
- <form onSubmit={handleSubmit(onSubmit)}>
+ <form
+ onSubmit={(e) => {
+ handleSubmit(onSubmit)(e);
+ }}
+ >
<GenericAccountFields />
<SqlAccountFields isUpdate={isUpdate} />
- {rotationCredentialsConfigured && <RotateAccountFields />}
+ <RotateAccountFields rotationCredentialsConfigured={rotationCredentialsConfigured} />
<RequireMfaField />
<div className="mt-6 flex items-center">
<Button
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx
index f33c51c19a..32a7040ec4 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx
@@ -1,24 +1,34 @@
import { Controller, useFormContext } from "react-hook-form";
+import { twMerge } from "tailwind-merge";
import { z } from "zod";
import { FormControl, Select, SelectItem, Switch, Tooltip } from "@app/components/v2";
export const rotateAccountFieldsSchema = z.object({
rotationEnabled: z.boolean(),
- rotationIntervalSeconds: z.number().nullable().optional()
+ rotationIntervalSeconds: z.number()
});
-export const RotateAccountFields = () => {
+export const RotateAccountFields = ({
+ rotationCredentialsConfigured
+}: {
+ rotationCredentialsConfigured: boolean;
+}) => {
const { control, watch } = useFormContext<{
rotationEnabled: boolean;
- rotationIntervalSeconds?: number | null;
+ rotationIntervalSeconds: number;
}>();
const rotationEnabled = watch("rotationEnabled");
return (
<Tooltip content="The resource which owns this account does not have rotation credentials configured.">
- <div className="flex h-9 w-fit items-center gap-3">
+ <div
+ className={twMerge(
+ "flex h-9 w-fit items-center gap-3",
+ !rotationCredentialsConfigured && "opacity-50"
+ )}
+ >
<Controller
control={control}
name="rotationEnabled"
@@ -31,6 +41,7 @@ export const RotateAccountFields = () => {
thumbClassName="bg-mineshaft-800"
onCheckedChange={onChange}
isChecked={value}
+ isDisabled={!rotationCredentialsConfigured}
/>
</FormControl>
)}
@@ -48,13 +59,13 @@ export const RotateAccountFields = () => {
className="mb-0"
>
<Select
- value={(value || 2592000).toString()}
+ value={value.toString()}
onValueChange={(val) => onChange(parseInt(val, 10))}
className="w-full border border-mineshaft-500 capitalize"
position="popper"
placeholder="Select an interval..."
dropdownContainerClassName="max-w-none"
- isDisabled={!rotationEnabled}
+ isDisabled={!rotationEnabled || !rotationCredentialsConfigured}
dropdownContainerStyle={{
width: "130px"
}}