mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 09:28:06 +00:00
feat(secret-rotation): updated helper text for options
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { TProviderFunctionTypes, TDbProviderClients, TAssignOp } from "../types";
|
import { TAssignOp, TDbProviderClients, TProviderFunctionTypes } from "../types";
|
||||||
|
|
||||||
export const MYSQL_TEMPLATE = {
|
export const MYSQL_TEMPLATE = {
|
||||||
inputs: {
|
inputs: {
|
||||||
@@ -9,9 +9,17 @@ export const MYSQL_TEMPLATE = {
|
|||||||
host: { type: "string" as const },
|
host: { type: "string" as const },
|
||||||
database: { type: "string" as const },
|
database: { type: "string" as const },
|
||||||
port: { type: "integer" as const, default: "3306" },
|
port: { type: "integer" as const, default: "3306" },
|
||||||
username1: { type: "string", default: "infisical-sql-user1" },
|
username1: {
|
||||||
username2: { type: "string", default: "infisical-sql-user2" },
|
type: "string",
|
||||||
ca: { 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: [
|
required: [
|
||||||
"admin_username",
|
"admin_username",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TProviderFunctionTypes, TDbProviderClients, TAssignOp } from "../types";
|
import { TAssignOp, TDbProviderClients, TProviderFunctionTypes } from "../types";
|
||||||
|
|
||||||
export const POSTGRES_TEMPLATE = {
|
export const POSTGRES_TEMPLATE = {
|
||||||
inputs: {
|
inputs: {
|
||||||
@@ -9,9 +9,17 @@ export const POSTGRES_TEMPLATE = {
|
|||||||
host: { type: "string" as const },
|
host: { type: "string" as const },
|
||||||
database: { type: "string" as const },
|
database: { type: "string" as const },
|
||||||
port: { type: "integer" as const, default: "5432" },
|
port: { type: "integer" as const, default: "5432" },
|
||||||
username1: { type: "string", default: "infisical-pg-user1" },
|
username1: {
|
||||||
username2: { type: "string", default: "infisical-pg-user2" },
|
type: "string",
|
||||||
ca: { 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: [
|
required: [
|
||||||
"admin_username",
|
"admin_username",
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import { TProviderFunctionTypes, TAssignOp } from "../types";
|
import { TAssignOp, TProviderFunctionTypes } from "../types";
|
||||||
|
|
||||||
export const SENDGRID_TEMPLATE = {
|
export const SENDGRID_TEMPLATE = {
|
||||||
inputs: {
|
inputs: {
|
||||||
type: "object" as const,
|
type: "object" as const,
|
||||||
properties: {
|
properties: {
|
||||||
admin_api_key: { 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 } }
|
scopes: {
|
||||||
|
type: "array",
|
||||||
|
items: { type: "string" as const },
|
||||||
|
desc: "Scopes for created tokens by rotation(Array)"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
required: ["admin_api_key", "scopes"],
|
required: ["admin_api_key", "scopes"],
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export type TProviderFunction = THttpProviderFunction | TDbProviderFunction;
|
|||||||
export type TProviderTemplate = {
|
export type TProviderTemplate = {
|
||||||
inputs: {
|
inputs: {
|
||||||
type: "object";
|
type: "object";
|
||||||
properties: Record<string, { type: string; [x: string]: unknown }>;
|
properties: Record<string, { type: string; [x: string]: unknown; desc?: string }>;
|
||||||
required?: string[];
|
required?: string[];
|
||||||
};
|
};
|
||||||
outputs: Record<string, unknown>;
|
outputs: Record<string, unknown>;
|
||||||
|
|||||||
@@ -9,16 +9,24 @@ export type FormLabelProps = {
|
|||||||
isRequired?: boolean;
|
isRequired?: boolean;
|
||||||
label?: ReactNode;
|
label?: ReactNode;
|
||||||
icon?: ReactNode;
|
icon?: ReactNode;
|
||||||
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FormLabel = ({ id, label, isRequired, icon }: FormLabelProps) => (
|
export const FormLabel = ({ id, label, isRequired, icon, className }: FormLabelProps) => (
|
||||||
<Label.Root
|
<Label.Root
|
||||||
className="mb-0.5 ml-1 block flex items-center text-sm font-normal text-mineshaft-400"
|
className={twMerge(
|
||||||
|
"mb-0.5 ml-1 block flex items-center text-sm font-normal text-mineshaft-400",
|
||||||
|
className
|
||||||
|
)}
|
||||||
htmlFor={id}
|
htmlFor={id}
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
{isRequired && <span className="ml-1 text-red">*</span>}
|
{isRequired && <span className="ml-1 text-red">*</span>}
|
||||||
{icon && <span className="ml-2 text-mineshaft-300 hover:text-mineshaft-200 cursor-default">{icon}</span>}
|
{icon && (
|
||||||
|
<span className="ml-2 text-mineshaft-300 hover:text-mineshaft-200 cursor-default">
|
||||||
|
{icon}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</Label.Root>
|
</Label.Root>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+22
-4
@@ -1,14 +1,16 @@
|
|||||||
import { Controller, useForm } from "react-hook-form";
|
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 { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { z } from "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 = {
|
type Props = {
|
||||||
onSubmit: (data: Record<string, string>) => void;
|
onSubmit: (data: Record<string, string>) => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
inputSchema: {
|
inputSchema: {
|
||||||
properties: Record<string, { type: string; helperText?: string; default?: string }>;
|
properties: Record<string, { type: string; desc?: string; default?: string }>;
|
||||||
required: string[];
|
required: string[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -35,8 +37,24 @@ export const RotationInputForm = ({ onSubmit, onCancel, inputSchema }: Props) =>
|
|||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
key={`provider-input-${inputName}`}
|
key={`provider-input-${inputName}`}
|
||||||
label={inputName.replaceAll("_", " ")}
|
label={
|
||||||
helperText={inputSchema.properties[inputName]?.helperText}
|
<div className="flex items-center space-x-2">
|
||||||
|
<FormLabel className="uppercase mb-0" label={inputName.replaceAll("_", " ")} />
|
||||||
|
{Boolean(inputSchema.properties[inputName]?.desc) && (
|
||||||
|
<Tooltip
|
||||||
|
className="max-w-xs"
|
||||||
|
content={inputSchema.properties[inputName]?.desc}
|
||||||
|
position="right"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={faQuestionCircle}
|
||||||
|
size="xs"
|
||||||
|
className="text-bunker-300"
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SecretInput
|
<SecretInput
|
||||||
{...field}
|
{...field}
|
||||||
|
|||||||
+11
-5
@@ -35,6 +35,7 @@ export const RotationOutputForm = ({ onSubmit, onCancel, outputSchema = {} }: Pr
|
|||||||
|
|
||||||
const environment = watch("environment", environments?.[0]?.slug);
|
const environment = watch("environment", environments?.[0]?.slug);
|
||||||
const secretPath = watch("secretPath");
|
const secretPath = watch("secretPath");
|
||||||
|
const selectedSecrets = watch("secrets");
|
||||||
|
|
||||||
const { data: userWsKey } = useGetUserWsKey(workspaceId);
|
const { data: userWsKey } = useGetUserWsKey(workspaceId);
|
||||||
const { data: secrets, isLoading: isSecretsLoading } = useGetProjectSecrets({
|
const { data: secrets, isLoading: isSecretsLoading } = useGetProjectSecrets({
|
||||||
@@ -114,11 +115,16 @@ export const RotationOutputForm = ({ onSubmit, onCancel, outputSchema = {} }: Pr
|
|||||||
position="popper"
|
position="popper"
|
||||||
>
|
>
|
||||||
{!isSecretsLoading &&
|
{!isSecretsLoading &&
|
||||||
secrets?.map(({ key, _id }) => (
|
secrets
|
||||||
<SelectItem value={_id} key={_id}>
|
?.filter(
|
||||||
{key}
|
({ _id }) =>
|
||||||
</SelectItem>
|
value === _id || !Object.values(selectedSecrets || {}).includes(_id)
|
||||||
))}
|
)
|
||||||
|
?.map(({ key, _id }) => (
|
||||||
|
<SelectItem value={_id} key={_id}>
|
||||||
|
{key}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
{isSecretsLoading && (
|
{isSecretsLoading && (
|
||||||
<SelectItem value="Loading" isDisabled>
|
<SelectItem value="Loading" isDisabled>
|
||||||
<Spinner size="xs" />
|
<Spinner size="xs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user