diff --git a/backend/src/ee/secretRotation/templates/mysql.ts b/backend/src/ee/secretRotation/templates/mysql.ts index b57666596..357de6919 100644 --- a/backend/src/ee/secretRotation/templates/mysql.ts +++ b/backend/src/ee/secretRotation/templates/mysql.ts @@ -1,4 +1,4 @@ -import { TProviderFunctionTypes, TDbProviderClients, TAssignOp } from "../types"; +import { TAssignOp, TDbProviderClients, TProviderFunctionTypes } from "../types"; export const MYSQL_TEMPLATE = { inputs: { @@ -9,9 +9,17 @@ export const MYSQL_TEMPLATE = { host: { type: "string" as const }, database: { type: "string" as const }, port: { type: "integer" as const, default: "3306" }, - username1: { type: "string", default: "infisical-sql-user1" }, - username2: { type: "string", default: "infisical-sql-user2" }, - ca: { type: "string" } + username1: { + type: "string", + default: "infisical-sql-user1", + desc: "This user must be created in your database" + }, + username2: { + type: "string", + default: "infisical-sql-user2", + desc: "This user must be created in your database" + }, + ca: { type: "string", desc: "SSL certificate for db auth(string)" } }, required: [ "admin_username", diff --git a/backend/src/ee/secretRotation/templates/postgres.ts b/backend/src/ee/secretRotation/templates/postgres.ts index c4981cf29..3b3153be1 100644 --- a/backend/src/ee/secretRotation/templates/postgres.ts +++ b/backend/src/ee/secretRotation/templates/postgres.ts @@ -1,4 +1,4 @@ -import { TProviderFunctionTypes, TDbProviderClients, TAssignOp } from "../types"; +import { TAssignOp, TDbProviderClients, TProviderFunctionTypes } from "../types"; export const POSTGRES_TEMPLATE = { inputs: { @@ -9,9 +9,17 @@ export const POSTGRES_TEMPLATE = { host: { type: "string" as const }, database: { type: "string" as const }, port: { type: "integer" as const, default: "5432" }, - username1: { type: "string", default: "infisical-pg-user1" }, - username2: { type: "string", default: "infisical-pg-user2" }, - ca: { type: "string" } + username1: { + type: "string", + default: "infisical-pg-user1", + desc: "This user must be created in your database" + }, + username2: { + type: "string", + default: "infisical-pg-user2", + desc: "This user must be created in your database" + }, + ca: { type: "string", desc: "SSL certificate for db auth(string)" } }, required: [ "admin_username", diff --git a/backend/src/ee/secretRotation/templates/sendgrid.ts b/backend/src/ee/secretRotation/templates/sendgrid.ts index 454c9a145..ada62a0e6 100644 --- a/backend/src/ee/secretRotation/templates/sendgrid.ts +++ b/backend/src/ee/secretRotation/templates/sendgrid.ts @@ -1,11 +1,15 @@ -import { TProviderFunctionTypes, TAssignOp } from "../types"; +import { TAssignOp, TProviderFunctionTypes } from "../types"; export const SENDGRID_TEMPLATE = { inputs: { type: "object" as const, properties: { - admin_api_key: { type: "string" as const }, - scopes: { type: "array", items: { type: "string" as const } } + admin_api_key: { type: "string" as const, desc: "Sendgrid admin api key to create new keys" }, + scopes: { + type: "array", + items: { type: "string" as const }, + desc: "Scopes for created tokens by rotation(Array)" + } }, required: ["admin_api_key", "scopes"], additionalProperties: false diff --git a/backend/src/ee/secretRotation/types.ts b/backend/src/ee/secretRotation/types.ts index 4aa5975de..36ad36798 100644 --- a/backend/src/ee/secretRotation/types.ts +++ b/backend/src/ee/secretRotation/types.ts @@ -103,7 +103,7 @@ export type TProviderFunction = THttpProviderFunction | TDbProviderFunction; export type TProviderTemplate = { inputs: { type: "object"; - properties: Record; + properties: Record; required?: string[]; }; outputs: Record; diff --git a/frontend/src/components/v2/FormControl/FormControl.tsx b/frontend/src/components/v2/FormControl/FormControl.tsx index 91dfd4139..8f2e57f48 100644 --- a/frontend/src/components/v2/FormControl/FormControl.tsx +++ b/frontend/src/components/v2/FormControl/FormControl.tsx @@ -9,16 +9,24 @@ export type FormLabelProps = { isRequired?: boolean; label?: ReactNode; icon?: ReactNode; + className?: string; }; -export const FormLabel = ({ id, label, isRequired, icon }: FormLabelProps) => ( +export const FormLabel = ({ id, label, isRequired, icon, className }: FormLabelProps) => ( {label} {isRequired && *} - {icon && {icon}} + {icon && ( + + {icon} + + )} ); diff --git a/frontend/src/views/SecretRotationPage/components/CreateRotationForm/steps/RotationInputForm.tsx b/frontend/src/views/SecretRotationPage/components/CreateRotationForm/steps/RotationInputForm.tsx index 8c50687d1..125515bf1 100644 --- a/frontend/src/views/SecretRotationPage/components/CreateRotationForm/steps/RotationInputForm.tsx +++ b/frontend/src/views/SecretRotationPage/components/CreateRotationForm/steps/RotationInputForm.tsx @@ -1,14 +1,16 @@ import { Controller, useForm } from "react-hook-form"; +import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; -import { Button, FormControl, SecretInput } from "@app/components/v2"; +import { Button, FormControl, FormLabel, SecretInput, Tooltip } from "@app/components/v2"; type Props = { onSubmit: (data: Record) => void; onCancel: () => void; inputSchema: { - properties: Record; + properties: Record; required: string[]; }; }; @@ -35,8 +37,24 @@ export const RotationInputForm = ({ onSubmit, onCancel, inputSchema }: Props) => render={({ field }) => ( + + {Boolean(inputSchema.properties[inputName]?.desc) && ( + + + + )} + + } > {!isSecretsLoading && - secrets?.map(({ key, _id }) => ( - - {key} - - ))} + secrets + ?.filter( + ({ _id }) => + value === _id || !Object.values(selectedSecrets || {}).includes(_id) + ) + ?.map(({ key, _id }) => ( + + {key} + + ))} {isSecretsLoading && (