Skip to content

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

feat(dynamic-secrets): cut over to shared provider registry (#7839)

Andrew Huang4eb663904c0d
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/DynamicSecretProviderForm.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/DynamicSecretProviderForm.tsx
index 0d25e31027..960cd0ffee 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/DynamicSecretProviderForm.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/DynamicSecretProviderForm.tsx
@@ -12,11 +12,11 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { createNotification } from "@app/components/notifications";
import {
Button,
+ Combobox,
Field,
FieldDescription,
FieldError,
FieldLabel,
- FilterableSelect,
Input
} from "@app/components/v3";
import { cn } from "@app/components/v3/utils";
@@ -375,17 +375,20 @@ export const DynamicSecretProviderForm = <
<FieldLabel htmlFor="dynamic-secret-environment">
{commonFields?.environment?.label ?? "Environment"}
</FieldLabel>
- <FilterableSelect<TDynamicSecretFormEnvironment>
- inputId="dynamic-secret-environment"
+ <Combobox<TDynamicSecretFormEnvironment>
+ id="dynamic-secret-environment"
options={environments}
value={(field.value as TDynamicSecretFormEnvironment | undefined) ?? null}
onBlur={field.onBlur}
- onChange={field.onChange}
+ onValueChange={field.onChange}
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.slug}
placeholder="Select the environment to create the secret in..."
+ searchPlaceholder="Search environments..."
+ searchAriaLabel="Search environments"
isDisabled={commonFields?.environment?.isDisabled}
isError={Boolean(error)}
+ modal
aria-describedby={
[
commonFields?.environment?.description
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/index.ts b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/index.ts
index 0274623637..09e9e4e431 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/index.ts
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/index.ts
@@ -2,8 +2,16 @@ export { DynamicSecretProviderFields } from "./DynamicSecretProviderFields";
export { DynamicSecretProviderForm } from "./DynamicSecretProviderForm";
export { DynamicSecretProviderFormItems } from "./DynamicSecretProviderFormItems";
export { DynamicSecretProviderGroup } from "./DynamicSecretProviderGroup";
+export * from "./productionRegistry";
export * from "./providerDefinitions";
export * from "./registry";
+export type {
+ TDynamicSecretLeaseCapabilities,
+ TDynamicSecretLeaseOutput,
+ TDynamicSecretLeaseOutputField,
+ TDynamicSecretProviderPresentation,
+ TDynamicSecretProviderRuntimeMetadata
+} from "./runtimeMetadata";
export * from "./scalarValues";
export * from "./schemas";
export * from "./shared";
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/production-route-cutover.test.ts b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/production-route-cutover.test.ts
new file mode 100644
index 0000000000..58b8b1b6ad
--- /dev/null
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/production-route-cutover.test.ts
@@ -0,0 +1,103 @@
+import assert from "node:assert/strict";
+import { readFile } from "node:fs/promises";
+import { describe, it } from "node:test";
+
+const readSource = (relativePath: string) =>
+ readFile(new URL(relativePath, import.meta.url), "utf8");
+
+describe("dynamic-secret production route cutover", () => {
+ it("composes all provider families in the production registry", async () => {
+ const source = await readSource("./productionRegistry.ts");
+
+ [
+ "identityAccessDynamicSecretProviders",
+ "managedStoresDynamicSecretProviders",
+ "relationalWarehouseDynamicSecretProviders",
+ "dataProtocolDynamicSecretProviders"
+ ].forEach((moduleName) => assert.match(source, new RegExp(moduleName)));
+ });
+
+ it("routes create and edit through the shared registry and form", async () => {
+ const [createSource, editSource] = await Promise.all([
+ readSource(
+ "../../../pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx"
+ ),
+ readSource(
+ "../../../pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretForm.tsx"
+ )
+ ]);
+
+ [createSource, editSource].forEach((source) => {
+ assert.match(source, /dynamicSecretProviderRegistry/);
+ assert.match(source, /DynamicSecretProviderForm/);
+ });
+ assert.match(createSource, /SshDynamicSecretCreateForm/);
+ assert.match(createSource, /DynamicSecretProviderSelect/);
+ assert.match(createSource, /sm:max-w-\[1500px\]/);
+ assert.match(createSource, /onBack={requestBack}/);
+ assert.match(createSource, /onCancel={requestClose}/);
+ assert.match(editSource, /not available in the shared provider registry/);
+ });
+
+ it("keeps provider presentation and lease behavior behind the shared registry", async () => {
+ const [pickerSource, rowSource, provisionSource, leasesSource] = await Promise.all([
+ readSource(
+ "../../../pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/DynamicSecretProviderSelect.tsx"
+ ),
+ readSource(
+ "../../../pages/secret-manager/OverviewPage/components/DynamicSecretTableRow/DynamicSecretTableRow.tsx"
+ ),
+ readSource(
+ "../../../pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx"
+ ),
+ readSource(
+ "../../../pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/DynamicSecretLease.tsx"
+ )
+ ]);
+
+ assert.match(pickerSource, /requirePresentation/);
+ assert.doesNotMatch(pickerSource, /PROVIDER_PRESENTATION/);
+ assert.match(rowSource, /dynamicSecretProviderRegistry\.requireDefinition/);
+ assert.doesNotMatch(rowSource, /DYNAMIC_SECRET_PROVIDER_NAMES/);
+ assert.match(provisionSource, /requireLeaseCapabilities/);
+ assert.doesNotMatch(provisionSource, /provider === DynamicSecretProviders/);
+ assert.match(leasesSource, /requireLeaseCapabilities/);
+ assert.doesNotMatch(leasesSource, /DYNAMIC_SECRETS_WITHOUT_RENEWAL/);
+ });
+
+ it("only renders the lease provisioner while its dynamic-secret data is available", async () => {
+ const source = await readSource("../../../pages/secret-manager/OverviewPage/OverviewPage.tsx");
+
+ assert.match(source, /dynamicSecretLeaseCreateData &&/);
+ assert.match(source, /provider={dynamicSecretLeaseCreateData\.type}/);
+ });
+
+ it("uses Combobox for every searchable selector in the shared provider forms", async () => {
+ const sources = await Promise.all([
+ readSource("./DynamicSecretProviderForm.tsx"),
+ readSource("./providerDefinitions/azureEntraId.tsx"),
+ readSource("./providerDefinitions/ibmApiConnect.tsx")
+ ]);
+
+ sources.forEach((source) => {
+ assert.match(source, /Combobox/);
+ assert.doesNotMatch(source, /FilterableSelect/);
+ });
+ });
+
+ it("keeps shared provider dependencies on v3 components and semantic colors", async () => {
+ const [permissionSource, gatewaySource, secretInputSource] = await Promise.all([
+ readSource("../../permissions/OrgPermissionCan.tsx"),
+ readSource("../../v3/platform/GatewayPicker/GatewayPicker.tsx"),
+ readSource("../../v3/platform/SecretInput/SecretInput.tsx")
+ ]);
+
+ assert.doesNotMatch(permissionSource, /components\/v2|from "\.\.\/v2"/);
+ [gatewaySource, secretInputSource].forEach((source) => {
+ assert.doesNotMatch(
+ source,
+ /(?:bg|border|decoration|fill|ring|stroke|text)-(?:bunker|mineshaft|primary|yellow)/
+ );
+ });
+ });
+});
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/productionRegistry.test.ts b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/productionRegistry.test.ts
new file mode 100644
index 0000000000..438dbced8e
--- /dev/null
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/productionRegistry.test.ts
@@ -0,0 +1,31 @@
+import assert from "node:assert/strict";
+import { describe, it } from "node:test";
+
+import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
+
+import { dynamicSecretProviderRegistry } from "./productionRegistry";
+import { DYNAMIC_SECRET_PROVIDER_PICKER_ORDER } from "./registry";
+
+describe("dynamicSecretProviderRegistry", () => {
+ it("composes every provider exactly once in product picker order", () => {
+ assert.deepEqual(dynamicSecretProviderRegistry.providers, DYNAMIC_SECRET_PROVIDER_PICKER_ORDER);
+ assert.equal(dynamicSecretProviderRegistry.definitions.length, 27);
+ assert.equal(new Set(dynamicSecretProviderRegistry.providers).size, 27);
+ assert.equal(Object.values(DynamicSecretProviders).length, 27);
+ });
+
+ it("preserves provider labels and documentation slugs", () => {
+ dynamicSecretProviderRegistry.providers.forEach((provider) => {
+ assert.ok(dynamicSecretProviderRegistry.requireDefinition(provider).label);
+ assert.ok(dynamicSecretProviderRegistry.getDocsSlug(provider));
+ });
+ assert.equal(
+ dynamicSecretProviderRegistry.getDocsSlug(DynamicSecretProviders.SqlDatabase),
+ "postgresql"
+ );
+ assert.equal(
+ dynamicSecretProviderRegistry.getDocsSlug(DynamicSecretProviders.MongoAtlas),
+ "mongo-atlas"
+ );
+ });
+});
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/productionRegistry.ts b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/productionRegistry.ts
new file mode 100644
index 0000000000..663b9e9da0
--- /dev/null
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/productionRegistry.ts
@@ -0,0 +1,14 @@
+import {
+ dataProtocolDynamicSecretProviders,
+ identityAccessDynamicSecretProviders,
+ managedStoresDynamicSecretProviders,
+ relationalWarehouseDynamicSecretProviders
+} from "./providerDefinitions";
+import { createDynamicSecretProviderRegistry } from "./registry";
+
+export const dynamicSecretProviderRegistry = createDynamicSecretProviderRegistry(
+ relationalWarehouseDynamicSecretProviders,
+ dataProtocolDynamicSecretProviders,
+ managedStoresDynamicSecretProviders,
+ identityAccessDynamicSecretProviders
+);
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/awsIam.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/awsIam.tsx
index f019391406..01d288aac1 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/awsIam.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/awsIam.tsx
@@ -60,32 +60,61 @@ const AwsIamFields = () => {
},
...(method === DynamicSecretAwsIamAuth.AccessKey
? [
- { name: "inputs.accessKey", type: "text", label: "Access Key", layout: "half" } as const,
+ {
+ name: "inputs.accessKey",
+ type: "text",
+ label: "Access Key",
+ placeholder: "AKIA...",
+ layout: "half"
+ } as const,
{
name: "inputs.secretAccessKey",
type: "secret",
label: "Secret Access Key",
+ placeholder: "Enter secret access key",
layout: "half",
autoComplete: "new-password"
} as const
]
: []),
...(method === DynamicSecretAwsIamAuth.AssumeRole
- ? [{ name: "inputs.roleArn", type: "text", label: "Role ARN" } as const]
+ ? [
+ {
+ name: "inputs.roleArn",
+ type: "text",
+ label: "Role ARN",
+ placeholder: "arn:aws:iam::123456789012:role/example-role"
+ } as const
+ ]
: []),
...(!isIamUser
? []
- : [{ name: "inputs.awsPath", type: "text", label: "AWS Path", isOptional: true } as const]),
- { name: "inputs.region", type: "text", label: "Region" },
+ : [
+ {
+ name: "inputs.awsPath",
+ type: "text",
+ label: "AWS Path",
+ placeholder: "/service-accounts/",
+ isOptional: true
+ } as const
+ ]),
+ { name: "inputs.region", type: "text", label: "Region", placeholder: "us-east-1" },
{
name: "inputs.permissionBoundaryPolicyArn",
type: "text",
label: "Permission Boundary Policy ARN",
+ placeholder: "arn:aws:iam::123456789012:policy/example-policy",
isOptional: true
},
...(isIamUser
? ([
- { name: "inputs.userGroups", type: "text", label: "AWS IAM Groups", isOptional: true },
+ {
+ name: "inputs.userGroups",
+ type: "text",
+ label: "AWS IAM Groups",
+ placeholder: "developers,operators",
+ isOptional: true
+ },
{
name: "inputs.policyArns",
type: "textarea",
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/awsManagedStores.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/awsManagedStores.tsx
index 7d3a90f762..b8855a5a7a 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/awsManagedStores.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/awsManagedStores.tsx
@@ -20,26 +20,64 @@ import {
} from "./awsManagedStoresContract";
const elastiCacheConnectionFields = [
- { name: "inputs.clusterName", type: "text", label: "Cluster Name", layout: "half" },
- { name: "inputs.region", type: "text", label: "Region", layout: "half" },
- { name: "inputs.accessKeyId", type: "text", label: "Access Key ID", layout: "half" },
+ {
+ name: "inputs.clusterName",
+ type: "text",
+ label: "Cluster Name",
+ placeholder: "my-elasticache-cluster",
+ layout: "half"
+ },
+ {
+ name: "inputs.region",
+ type: "text",
+ label: "Region",
+ placeholder: "us-east-1",
+ layout: "half"
+ },
+ {
+ name: "inputs.accessKeyId",
+ type: "text",
+ label: "Access Key ID",
+ placeholder: "AKIA...",
+ layout: "half"
+ },
{
name: "inputs.secretAccessKey",
type: "secret",
label: "Secret Access Key",
+ placeholder: "Enter secret access key",
autoComplete: "new-password",
layout: "half"
}
] as const;
const memoryDbConnectionFields = [
- { name: "inputs.clusterName", type: "text", label: "Cluster Name", layout: "half" },
- { name: "inputs.region", type: "text", label: "Region", layout: "half" },
- { name: "inputs.auth.accessKeyId", type: "text", label: "Access Key ID", layout: "half" },
+ {
+ name: "inputs.clusterName",
+ type: "text",
+ label: "Cluster Name",
+ placeholder: "my-memorydb-cluster",
+ layout: "half"
+ },
+ {
+ name: "inputs.region",
+ type: "text",
+ label: "Region",
+ placeholder: "us-east-1",
+ layout: "half"
+ },
+ {
+ name: "inputs.auth.accessKeyId",
+ type: "text",
+ label: "Access Key ID",
+ placeholder: "AKIA...",
+ layout: "half"
+ },
{
name: "inputs.auth.secretAccessKey",
type: "secret",
label: "Secret Access Key",
+ placeholder: "Enter secret access key",
autoComplete: "new-password",
layout: "half"
}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/azureEntraId.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/azureEntraId.tsx
index 0065a2fdc2..b1c13004f6 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/azureEntraId.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/azureEntraId.tsx
@@ -1,14 +1,7 @@
import { useEffect } from "react";
import { Controller, useFormContext } from "react-hook-form";
-import {
- Field,
- FieldError,
- FieldFeedback,
- FieldLabel,
- FilterableSelect,
- Input
-} from "@app/components/v3";
+import { Combobox, Field, FieldError, FieldFeedback, FieldLabel, Input } from "@app/components/v3";
import { SecretInput } from "@app/components/v3/platform";
import { useGetDynamicSecretProviderData } from "@app/hooks/api/dynamicSecret/queries";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
@@ -34,6 +27,12 @@ const credentialLabels = {
clientSecret: "Client Secret"
} as const;
+const credentialPlaceholders = {
+ tenantId: "00000000-0000-0000-0000-000000000000",
+ applicationId: "00000000-0000-0000-0000-000000000000",
+ clientSecret: "Enter client secret"
+} as const;
+
const EMPTY_USERS: { id: string; name: string; email: string }[] = [];
const AzureEntraIdFields = ({
@@ -113,6 +112,7 @@ const AzureEntraIdFields = ({
{...field}
id={`azure-entra-${key}`}
type={key === "clientSecret" ? "password" : "text"}
+ placeholder={credentialPlaceholders[key]}
autoComplete={key === "clientSecret" ? "new-password" : "off"}
isError={Boolean(error)}
aria-describedby={error ? `azure-entra-${key}-error` : undefined}
@@ -128,19 +128,22 @@ const AzureEntraIdFields = ({
render={({ field, fieldState: { error } }) => (
<Field data-invalid={Boolean(error)}>
<FieldLabel htmlFor="azure-entra-users">Users</FieldLabel>
- <FilterableSelect
- inputId="azure-entra-users"
- isMulti
+ <Combobox
+ id="azure-entra-users"
+ multiple
isDisabled={!isConfigured || isLoading || isError}
isLoading={isLoading}
options={usersQuery.data ?? EMPTY_USERS}
value={field.value ?? EMPTY_USERS}
onBlur={field.onBlur}
- onChange={(next) => field.onChange(next ?? EMPTY_USERS)}
+ onValueChange={field.onChange}
getOptionLabel={(user) => `${user.name} (${user.email})`}
getOptionValue={(user) => user.id}
placeholder="Select users..."
+ searchPlaceholder="Search users..."
+ searchAriaLabel="Search Azure Entra ID users"
isError={Boolean(error)}
+ modal
aria-describedby="azure-entra-users-feedback"
/>
<FieldFeedback
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/azureSqlDatabase.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/azureSqlDatabase.tsx
index f6b65dde36..c5a60ca0fb 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/azureSqlDatabase.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/azureSqlDatabase.tsx
@@ -196,9 +196,26 @@ const AzureSqlFields = ({ mode }: TDynamicSecretProviderRendererProps) => {
const gatewayId = watch("inputs.gatewayId");
const gatewayPoolId = watch("inputs.gatewayPoolId");
const scalarFields = [
- { name: "inputs.host", type: "text", label: "Host" },
- { name: "inputs.username", type: "text", label: "User", layout: "half" },
- { name: "inputs.database", type: "text", label: "Database", layout: "half" }
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "server.database.windows.net"
+ },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "database-admin",
+ layout: "half"
+ },
+ {
+ name: "inputs.database",
+ type: "text",
+ label: "Database",
+ placeholder: "app-db",
+ layout: "half"
+ }
] satisfies readonly TDynamicSecretProviderField<TAzureSqlEditValues>[];
const statementFields = [
{
@@ -316,6 +333,7 @@ const AzureSqlFields = ({ mode }: TDynamicSecretProviderRendererProps) => {
{...field}
value={field.value ?? ""}
id="azure-sql-password"
+ placeholder="Enter database password"
aria-describedby={error ? "azure-sql-password-error" : undefined}
/>
<FieldError id="azure-sql-password-error">{error?.message}</FieldError>
@@ -346,7 +364,15 @@ const AzureSqlFields = ({ mode }: TDynamicSecretProviderRendererProps) => {
{sslEnabled && (
<>
<DynamicSecretProviderFields
- fields={[{ name: "inputs.ca", type: "secret", label: "CA (SSL)", isOptional: true }]}
+ fields={[
+ {
+ name: "inputs.ca",
+ type: "secret",
+ label: "CA (SSL)",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
+ isOptional: true
+ }
+ ]}
/>
<Controller
control={control}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/cassandra.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/cassandra.tsx
index 2b51878c96..0445c83643 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/cassandra.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/cassandra.tsx
@@ -3,7 +3,7 @@ import { useFormContext } from "react-hook-form";
import { InfoIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import { Button } from "@app/components/v3";
+import { Alert, AlertAction, AlertDescription, Button } from "@app/components/v3";
import { ProjectPermissionSub, useProject } from "@app/context";
import { useCanUseProjectAppConnectionImport } from "@app/hooks";
import { useListAvailableAppConnections } from "@app/hooks/api/appConnections";
@@ -33,19 +33,51 @@ import {
} from "./cassandraContract";
const cassandraFields = [
- { name: "inputs.host", type: "text", label: "Host", placeholder: "host1,host2", layout: "half" },
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "cassandra-1.example.com,cassandra-2.example.com",
+ layout: "half"
+ },
{ name: "inputs.port", type: "number", label: "Port", layout: "half" },
- { name: "inputs.localDataCenter", type: "text", label: "Local Data Center" },
- { name: "inputs.username", type: "text", label: "User", layout: "half", autoComplete: "off" },
+ {
+ name: "inputs.localDataCenter",
+ type: "text",
+ label: "Local Data Center",
+ placeholder: "datacenter1"
+ },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "cassandra",
+ layout: "half",
+ autoComplete: "off"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter database password",
layout: "half",
autoComplete: "new-password"
},
- { name: "inputs.keyspace", type: "text", label: "Keyspace", isOptional: true },
- { name: "inputs.ca", type: "textarea", label: "CA (SSL)", isOptional: true, rows: 3 }
+ {
+ name: "inputs.keyspace",
+ type: "text",
+ label: "Keyspace",
+ placeholder: "app_keyspace",
+ isOptional: true
+ },
+ {
+ name: "inputs.ca",
+ type: "textarea",
+ label: "CA (SSL)",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
+ isOptional: true,
+ rows: 3
+ }
] satisfies readonly TDynamicSecretProviderField<TCassandraFormValues>[];
const advancedFields = buildStatementFields<TCassandraFormValues>({
@@ -72,16 +104,18 @@ const CassandraVaultImport = ({ onImport }: { onImport: (role: VaultDatabaseRole
return (
<>
- <div className="flex flex-col gap-3 rounded-md border border-info/20 bg-info/10 p-3 sm:flex-row sm:items-center sm:justify-between">
- <div className="flex items-center gap-2 text-sm text-foreground">
- <InfoIcon className="size-4 text-info" />
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
<span>Load values from HashiCorp Vault.</span>
- </div>
- <Button type="button" size="sm" variant="info" onClick={() => setIsOpen(true)}>
- <img src="/images/integrations/Vault.png" alt="" className="size-4" />
- Load from Vault
- </Button>
- </div>
+ <AlertAction>
+ <Button type="button" size="sm" variant="info" onClick={() => setIsOpen(true)}>
+ <img src="/images/integrations/Vault.png" alt="" className="size-4" />
+ Load from Vault
+ </Button>
+ </AlertAction>
+ </AlertDescription>
+ </Alert>
<VaultCassandraImportModal
isOpen={isOpen}
onOpenChange={setIsOpen}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/clickHouse.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/clickHouse.tsx
index fee6c8f7c9..ffd7769ac9 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/clickHouse.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/clickHouse.tsx
@@ -37,21 +37,36 @@ import {
} from "./clickHouseContract";
const connectionFields = [
- { name: "inputs.host", type: "text", label: "Host", layout: "half" },
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "https://your-host.clickhouse.cloud",
+ layout: "half"
+ },
{ name: "inputs.port", type: "number", label: "Port", layout: "half" },
- { name: "inputs.username", type: "text", label: "User", autoComplete: "off", layout: "half" },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "default",
+ autoComplete: "off",
+ layout: "half"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter database password",
autoComplete: "new-password",
layout: "half"
},
- { name: "inputs.database", type: "text", label: "Database" },
+ { name: "inputs.database", type: "text", label: "Database", placeholder: "default" },
{
name: "inputs.ca",
type: "secret",
label: "CA (SSL)",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
description: "Optionally needed for self-signed certificates.",
isOptional: true
}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/couchbase.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/couchbase.tsx
index ff8a3efa2d..0baabee963 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/couchbase.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/couchbase.tsx
@@ -47,14 +47,37 @@ const COUCHBASE_ROLES = [
] as const;
const couchbaseConnectionFields = [
- { name: "inputs.url", type: "text", label: "URL" },
- { name: "inputs.orgId", type: "text", label: "Organization ID", layout: "half" },
- { name: "inputs.projectId", type: "text", label: "Project ID", layout: "half" },
- { name: "inputs.clusterId", type: "text", label: "Cluster ID" },
+ {
+ name: "inputs.url",
+ type: "text",
+ label: "URL",
+ placeholder: "https://cloudapi.cloud.couchbase.com"
+ },
+ {
+ name: "inputs.orgId",
+ type: "text",
+ label: "Organization ID",
+ placeholder: "00000000-0000-0000-0000-000000000000",
+ layout: "half"
+ },
+ {
+ name: "inputs.projectId",
+ type: "text",
+ label: "Project ID",
+ placeholder: "00000000-0000-0000-0000-000000000000",
+ layout: "half"
+ },
+ {
+ name: "inputs.clusterId",
+ type: "text",
+ label: "Cluster ID",
+ placeholder: "00000000-0000-0000-0000-000000000000"
+ },
{
name: "inputs.auth.apiKey",
type: "secret",
label: "API Key",
+ placeholder: "Enter API key",
autoComplete: "new-password"
}
] satisfies readonly TDynamicSecretProviderField<TCouchbaseValues>[];
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/elasticSearch.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/elasticSearch.tsx
index 57eb21c2a6..396678cd8c 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/elasticSearch.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/elasticSearch.tsx
@@ -33,12 +33,25 @@ import {
} from "./elasticSearchContract";
const hostPortFields = [
- { name: "inputs.host", type: "text", label: "Host", layout: "half" },
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "elasticsearch.example.com",
+ layout: "half"
+ },
{ name: "inputs.port", type: "number", label: "Port", layout: "half" }
] satisfies readonly TDynamicSecretProviderField<TElasticSearchFormValues>[];
const advancedFields = [
- { name: "inputs.ca", type: "textarea", label: "CA (SSL)", isOptional: true, rows: 3 },
+ {
+ name: "inputs.ca",
+ type: "textarea",
+ label: "CA (SSL)",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
+ isOptional: true,
+ rows: 3
+ },
{
name: "usernameTemplate",
type: "text",
@@ -102,6 +115,7 @@ const ElasticSearchFields = () => {
<Input
{...field}
id="elasticsearch-auth-identity"
+ placeholder={authType === "user" ? "elastic" : "Enter API key ID"}
autoComplete="off"
isError={Boolean(error)}
/>
@@ -121,6 +135,7 @@ const ElasticSearchFields = () => {
{...field}
id="elasticsearch-auth-secret"
type="password"
+ placeholder={authType === "user" ? "Enter password" : "Enter API key"}
autoComplete="new-password"
isError={Boolean(error)}
/>
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/github.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/github.tsx
index dd25dd70c7..0c425f91ee 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/github.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/github.tsx
@@ -59,6 +59,7 @@ const GithubFields = () => {
<SecretInput
{...field}
id="github-private-key"
+ placeholder="-----BEGIN PRIVATE KEY----- ..."
aria-describedby={error ? "github-private-key-error" : undefined}
/>
<FieldError id="github-private-key-error">{error?.message}</FieldError>
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/ibmApiConnect.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/ibmApiConnect.tsx
index f2405a29f1..16d17e59bc 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/ibmApiConnect.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/ibmApiConnect.tsx
@@ -1,13 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { OrgPermissionCan } from "@app/components/permissions";
-import {
- Field,
- FieldDescription,
- FieldFeedback,
- FieldLabel,
- FilterableSelect
-} from "@app/components/v3";
+import { Combobox, Field, FieldDescription, FieldFeedback, FieldLabel } from "@app/components/v3";
import { GatewayPicker } from "@app/components/v3/platform/GatewayPicker";
import {
OrgGatewayPermissionActions,
@@ -40,21 +34,36 @@ import {
} from "./ibmApiConnectContract";
const credentialFields = [
- { name: "inputs.instanceUrl", type: "text", label: "Instance URL" },
- { name: "inputs.apiKey", type: "secret", label: "API Key", autoComplete: "new-password" },
- { name: "inputs.clientId", type: "text", label: "Client ID", layout: "half" },
+ {
+ name: "inputs.instanceUrl",
+ type: "text",
+ label: "Instance URL",
+ placeholder: "https://api-manager.example.com"
+ },
+ {
+ name: "inputs.apiKey",
+ type: "secret",
+ label: "API Key",
+ placeholder: "Enter API key",
+ autoComplete: "new-password"
+ },
+ {
+ name: "inputs.clientId",
+ type: "text",
+ label: "Client ID",
+ placeholder: "Enter client ID",
+ layout: "half"
+ },
{
name: "inputs.clientSecret",
type: "secret",
label: "Client Secret",
+ placeholder: "Enter client secret",
autoComplete: "new-password",
layout: "half"
}
] satisfies readonly TDynamicSecretProviderField<TIbmApiConnectFormValues>[];
-const getSingleOption = <T,>(selection: T | readonly T[] | null): T | null =>
- Array.isArray(selection) ? null : (selection as T | null);
-
const IbmApiConnectFields = ({ context, mode }: TDynamicSecretProviderRendererProps) => {
const { control, setValue, watch } = useFormContext<TIbmApiConnectFormValues>();
const instanceUrl = watch("inputs.instanceUrl");
@@ -163,27 +172,38 @@ const IbmApiConnectFields = ({ context, mode }: TDynamicSecretProviderRendererPr
data-disabled={!credentialsComplete || orgsQuery.isError}
>
<FieldLabel htmlFor="ibm-api-connect-organization">Organization</FieldLabel>
- <FilterableSelect
- inputId="ibm-api-connect-organization"
+ <Combobox
+ id="ibm-api-connect-organization"
isDisabled={!credentialsComplete || orgsQuery.isFetching || orgsQuery.isError}
isLoading={orgsQuery.isFetching}
options={orgsQuery.data ?? []}
value={orgsQuery.data?.find((option) => option.id === field.value) ?? null}
onBlur={field.onBlur}
- onChange={(selection) => {
- const option = getSingleOption(selection);
+ onValueChange={(option) => {
field.onChange(option?.id ?? "");
setValue("inputs.catalogId", "");
setValue("inputs.consumerOrgId", "");
setValue("inputs.appId", "");
}}
placeholder="Select an organization..."
+ searchPlaceholder="Search organizations..."
+ searchAriaLabel="Search IBM API Connect organizations"
getOptionLabel={(option) => option.title || option.name}
getOptionValue={(option) => option.id}
isError={Boolean(error)}
+ modal
+ aria-describedby={
+ description || error?.message
+ ? "ibm-api-connect-organization-feedback"
+ : undefined
+ }
/>
{(description || error?.message) && (
- <FieldFeedback description={description} error={error?.message} />
+ <FieldFeedback
+ id="ibm-api-connect-organization-feedback"
+ description={description}
+ error={error?.message}
+ />
)}
</Field>
);
@@ -203,26 +223,35 @@ const IbmApiConnectFields = ({ context, mode }: TDynamicSecretProviderRendererPr
data-disabled={!orgSelected || catalogsQuery.isError}
>
<FieldLabel htmlFor="ibm-api-connect-catalog">Catalog</FieldLabel>
- <FilterableSelect
- inputId="ibm-api-connect-catalog"
+ <Combobox
+ id="ibm-api-connect-catalog"
isDisabled={!orgSelected || catalogsQuery.isFetching || catalogsQuery.isError}
isLoading={catalogsQuery.isFetching}
options={catalogsQuery.data ?? []}
value={catalogsQuery.data?.find((option) => option.id === field.value) ?? null}
onBlur={field.onBlur}
- onChange={(selection) => {
- const option = getSingleOption(selection);
+ onValueChange={(option) => {
field.onChange(option?.id ?? "");
setValue("inputs.consumerOrgId", "");
setValue("inputs.appId", "");
}}
placeholder="Select a catalog..."
+ searchPlaceholder="Search catalogs..."
+ searchAriaLabel="Search IBM API Connect catalogs"
getOptionLabel={(option) => option.title || option.name}
getOptionValue={(option) => option.id}
isError={Boolean(error)}
+ modal
+ aria-describedby={
+ description || error?.message ? "ibm-api-connect-catalog-feedback" : undefined
+ }
/>
{(description || error?.message) && (
- <FieldFeedback description={description} error={error?.message} />
+ <FieldFeedback
+ id="ibm-api-connect-catalog-feedback"
+ description={description}
+ error={error?.message}
+ />
)}
</Field>
);
@@ -242,25 +271,36 @@ const IbmApiConnectFields = ({ context, mode }: TDynamicSecretProviderRendererPr
data-disabled={!catalogSelected || appsQuery.isError}
>
<FieldLabel htmlFor="ibm-api-connect-application">Application</FieldLabel>
- <FilterableSelect
- inputId="ibm-api-connect-application"
+ <Combobox
+ id="ibm-api-connect-application"
isDisabled={!catalogSelected || appsQuery.isFetching || appsQuery.isError}
isLoading={appsQuery.isFetching}
options={appsQuery.data ?? []}
value={appsQuery.data?.find((option) => option.id === field.value) ?? null}
onBlur={field.onBlur}
- onChange={(selection) => {
- const option = getSingleOption(selection);
+ onValueChange={(option) => {
field.onChange(option?.id ?? "");
setValue("inputs.consumerOrgId", option?.consumerOrgId ?? "");
}}
placeholder="Select an application..."
+ searchPlaceholder="Search applications..."
+ searchAriaLabel="Search IBM API Connect applications"
getOptionLabel={(option) => option.title || option.name}
getOptionValue={(option) => option.id}
isError={Boolean(error)}
+ modal
+ aria-describedby={
+ description || error?.message
+ ? "ibm-api-connect-application-feedback"
+ : undefined
+ }
/>
{(description || error?.message) && (
- <FieldFeedback description={description} error={error?.message} />
+ <FieldFeedback
+ id="ibm-api-connect-application-feedback"
+ description={description}
+ error={error?.message}
+ />
)}
</Field>
);
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/index.ts b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/index.ts
index c7548a6677..e45636a1f4 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/index.ts
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/index.ts
@@ -1,10 +1,13 @@
export { awsIamDynamicSecretProvider } from "./awsIam";
export { azureEntraIdDynamicSecretProvider } from "./azureEntraId";
+export { dataProtocolDynamicSecretProviders } from "./dataProtocol";
export { gcpIamDynamicSecretProvider } from "./gcpIam";
export { githubDynamicSecretProvider } from "./github";
export { identityAccessDynamicSecretProviders } from "./identityAccess";
export { IDENTITY_ACCESS_DYNAMIC_SECRET_PROVIDERS } from "./identityAccessContract";
export { ldapDynamicSecretProvider } from "./ldap";
+export { managedStoresDynamicSecretProviders } from "./managedStores";
+export { relationalWarehouseDynamicSecretProviders } from "./relationalWarehouse";
export { sshDynamicSecretProvider } from "./ssh";
export { sshDynamicSecretCreateBoundary, SshDynamicSecretCreateForm } from "./sshCreateForm";
export { tailscaleDynamicSecretProvider } from "./tailscale";
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/kubernetes.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/kubernetes.tsx
index 86a892c229..444e019733 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/kubernetes.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/kubernetes.tsx
@@ -5,6 +5,9 @@ import { InfoIcon, PlusIcon, Trash2Icon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
+ Alert,
+ AlertAction,
+ AlertDescription,
Button,
Field,
FieldContent,
@@ -70,7 +73,12 @@ const authMethodField = [
] satisfies readonly TDynamicSecretProviderField<TKubernetesFormValues>[];
const clusterUrlField = [
- { name: "inputs.url", type: "text", label: "Cluster URL" }
+ {
+ name: "inputs.url",
+ type: "text",
+ label: "Cluster URL",
+ placeholder: "https://kubernetes.example.com:6443"
+ }
] satisfies readonly TDynamicSecretProviderField<TKubernetesFormValues>[];
const clusterTokenField = [
@@ -78,6 +86,7 @@ const clusterTokenField = [
name: "inputs.clusterToken",
type: "secret",
label: "Cluster Token",
+ placeholder: "Enter service account token",
autoComplete: "new-password"
}
] satisfies readonly TDynamicSecretProviderField<TKubernetesFormValues>[];
@@ -101,6 +110,7 @@ const serviceAccountField = [
name: "inputs.serviceAccountName",
type: "text",
label: "Service Account Name",
+ placeholder: "infisical-dynamic-secrets",
autoComplete: "new-password",
layout: "half"
}
@@ -122,6 +132,7 @@ const namespaceField = (isStatic: boolean) =>
name: "inputs.namespace",
type: "text",
label: isStatic ? "Namespace" : "Allowed Namespace(s)",
+ placeholder: isStatic ? "default" : "default,production",
layout: "half"
}
] satisfies readonly TDynamicSecretProviderField<TKubernetesFormValues>[];
@@ -137,7 +148,13 @@ const roleFields = [
{ label: "Role", value: KubernetesRoleType.Role }
]
},
- { name: "inputs.role", type: "text", label: "Role", layout: "half" }
+ {
+ name: "inputs.role",
+ type: "text",
+ label: "Role",
+ placeholder: "view",
+ layout: "half"
+ }
] satisfies readonly TDynamicSecretProviderField<TKubernetesFormValues>[];
const KubernetesVaultImport = ({ onImport }: { onImport: (role: VaultKubernetesRole) => void }) => {
@@ -156,16 +173,18 @@ const KubernetesVaultImport = ({ onImport }: { onImport: (role: VaultKubernetesR
return (
<>
- <div className="flex flex-col gap-3 rounded-md border border-info/20 bg-info/10 p-3 sm:flex-row sm:items-center sm:justify-between">
- <div className="flex items-center gap-2 text-sm text-foreground">
- <InfoIcon className="size-4 text-info" />
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
<span>Load values from HashiCorp Vault.</span>
- </div>
- <Button type="button" size="sm" variant="info" onClick={() => setIsOpen(true)}>
- <img src="/images/integrations/Vault.png" alt="" className="size-4" />
- Load from Vault
- </Button>
- </div>
+ <AlertAction>
+ <Button type="button" size="sm" variant="info" onClick={() => setIsOpen(true)}>
+ <img src="/images/integrations/Vault.png" alt="" className="size-4" />
+ Load from Vault
+ </Button>
+ </AlertAction>
+ </AlertDescription>
+ </Alert>
<VaultKubernetesImportModal
isOpen={isOpen}
onOpenChange={setIsOpen}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/ldap.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/ldap.tsx
index 8898c09f30..673f9b5681 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/ldap.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/ldap.tsx
@@ -4,6 +4,9 @@ import { InfoIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import {
+ Alert,
+ AlertAction,
+ AlertDescription,
Button,
Field,
FieldContent,
@@ -59,16 +62,34 @@ const LdapFields = ({ mode }: TDynamicSecretProviderRendererProps) => {
const { control, reset, setValue, watch } = useFormContext<TLdapFormValues>();
const credentialType = watch("inputs.credentialType");
const common = [
- { name: "inputs.url", type: "text", label: "URL" },
- { name: "inputs.binddn", type: "text", label: "Bind DN", layout: "half" },
+ {
+ name: "inputs.url",
+ type: "text",
+ label: "URL",
+ placeholder: "ldaps://ldap.example.com:636"
+ },
+ {
+ name: "inputs.binddn",
+ type: "text",
+ label: "Bind DN",
+ placeholder: "cn=admin,dc=example,dc=com",
+ layout: "half"
+ },
{
name: "inputs.bindpass",
type: "secret",
label: "Bind Password",
+ placeholder: "Enter bind password",
layout: "half",
autoComplete: "new-password"
},
- { name: "inputs.ca", type: "textarea", label: "CA", isOptional: true }
+ {
+ name: "inputs.ca",
+ type: "textarea",
+ label: "CA",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
+ isOptional: true
+ }
] satisfies readonly TDynamicSecretProviderField<TLdapFormValues>[];
const handleImport = (role: VaultLdapRole) => {
try {
@@ -97,15 +118,17 @@ const LdapFields = ({ mode }: TDynamicSecretProviderRendererProps) => {
return (
<>
{mode === "create" && canImport && connections.length > 0 && (
- <div className="flex items-center justify-between gap-3 rounded-md border border-info/20 bg-info/10 p-3">
- <div className="flex items-center gap-2 text-sm">
- <InfoIcon className="size-4 text-info" />
- Load values from HashiCorp Vault.
- </div>
- <Button type="button" size="sm" variant="info" onClick={() => setIsImportOpen(true)}>
- Load from Vault
- </Button>
- </div>
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
+ <span>Load values from HashiCorp Vault.</span>
+ <AlertAction>
+ <Button type="button" size="sm" variant="info" onClick={() => setIsImportOpen(true)}>
+ Load from Vault
+ </Button>
+ </AlertAction>
+ </AlertDescription>
+ </Alert>
)}
<DynamicSecretProviderGroup id="ldap-connection" presentation="panel">
<DynamicSecretProviderFields fields={common} />
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/milvus.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/milvus.tsx
index bfa4c50666..910196ce13 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/milvus.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/milvus.tsx
@@ -72,11 +72,18 @@ const connectionFields = [
layout: "half"
},
{ name: "inputs.port", type: "number", label: "Port", placeholder: "19530", layout: "half" },
- { name: "inputs.username", type: "text", label: "Username", layout: "half" },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "Username",
+ placeholder: "root",
+ layout: "half"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter database password",
autoComplete: "new-password",
layout: "half"
},
@@ -101,6 +108,7 @@ const trailingFields = [
name: "inputs.ca",
type: "textarea",
label: "CA Certificate",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
isOptional: true,
description: "PEM-encoded CA certificate used to verify the Milvus server.",
rows: 3
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/mongoAtlas.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/mongoAtlas.tsx
index 1368c42068..5df0f2ff79 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/mongoAtlas.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/mongoAtlas.tsx
@@ -52,12 +52,14 @@ const mongoAtlasCredentialFields = [
name: "inputs.adminPublicKey",
type: "text",
label: "Admin Public Key",
+ placeholder: "Enter Atlas public key",
layout: "half"
},
{
name: "inputs.adminPrivateKey",
type: "secret",
label: "Admin Private Key",
+ placeholder: "Enter Atlas private key",
autoComplete: "new-password",
layout: "half"
},
@@ -65,6 +67,7 @@ const mongoAtlasCredentialFields = [
name: "inputs.groupId",
type: "text",
label: "Group/Project ID",
+ placeholder: "507f1f77bcf86cd799439011",
description: "Unique 24-hexadecimal digit string that identifies your project."
}
] satisfies readonly TDynamicSecretProviderField<TMongoAtlasValues>[];
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/mongoDb.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/mongoDb.tsx
index 1399a26d43..fa9c815bbc 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/mongoDb.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/mongoDb.tsx
@@ -21,18 +21,44 @@ import {
} from "./mongoDbContract";
const mongoDbConnectionFields = [
- { name: "inputs.host", type: "text", label: "Host", layout: "half" },
- { name: "inputs.port", type: "number", label: "Port", isOptional: true, layout: "half" },
- { name: "inputs.username", type: "text", label: "User", layout: "half" },
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "mongodb.example.com",
+ layout: "half"
+ },
+ {
+ name: "inputs.port",
+ type: "number",
+ label: "Port",
+ placeholder: "27017",
+ isOptional: true,
+ layout: "half"
+ },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "admin",
+ layout: "half"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter database password",
autoComplete: "new-password",
layout: "half"
},
- { name: "inputs.database", type: "text", label: "Database" },
- { name: "inputs.ca", type: "secret", label: "CA (SSL)", isOptional: true }
+ { name: "inputs.database", type: "text", label: "Database", placeholder: "admin" },
+ {
+ name: "inputs.ca",
+ type: "secret",
+ label: "CA (SSL)",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
+ isOptional: true
+ }
] satisfies readonly TDynamicSecretProviderField<TMongoDbCreateValues | TMongoDbEditValues>[];
const usernameTemplateField = [
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/rabbitMq.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/rabbitMq.tsx
index d9697c2ef9..f8c9e74fa9 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/rabbitMq.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/rabbitMq.tsx
@@ -39,18 +39,32 @@ const rabbitMqConnectionFields = [
description: "The port on which the RabbitMQ management plugin is running. Default is 15672.",
layout: "half"
},
- { name: "inputs.username", type: "text", label: "Username", layout: "half" },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "Username",
+ placeholder: "admin",
+ layout: "half"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter management password",
autoComplete: "new-password",
layout: "half"
}
] satisfies readonly TDynamicSecretProviderField<TRabbitMqFormValues>[];
const advancedFields = [
- { name: "inputs.ca", type: "textarea", label: "CA (SSL)", isOptional: true, rows: 3 },
+ {
+ name: "inputs.ca",
+ type: "textarea",
+ label: "CA (SSL)",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
+ isOptional: true,
+ rows: 3
+ },
{
name: "usernameTemplate",
type: "text",
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/redis.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/redis.tsx
index da2ef417e5..c8be76ead1 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/redis.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/redis.tsx
@@ -14,19 +14,38 @@ import {
} from "./redisContract";
const redisConnectionFields = [
- { name: "inputs.host", type: "text", label: "Host", layout: "half" },
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "redis.example.com",
+ layout: "half"
+ },
{ name: "inputs.port", type: "number", label: "Port", layout: "half" },
- { name: "inputs.username", type: "text", label: "User", layout: "half" },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "default",
+ layout: "half"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter Redis password",
description: "Required if your Redis instance is password protected.",
autoComplete: "new-password",
isOptional: true,
layout: "half"
},
- { name: "inputs.ca", type: "secret", label: "CA (SSL)", isOptional: true }
+ {
+ name: "inputs.ca",
+ type: "secret",
+ label: "CA (SSL)",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
+ isOptional: true
+ }
] as const;
const redisStatementFields = buildStatementFields();
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sapAse.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sapAse.tsx
index 51f6b5de3f..f36a2a9c57 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sapAse.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sapAse.tsx
@@ -15,14 +15,27 @@ import {
} from "./sapAseContract";
const sapAseCreateConnectionFields = [
- { name: "inputs.host", type: "text", label: "Host", layout: "half" },
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "ase.example.com",
+ layout: "half"
+ },
{ name: "inputs.port", type: "number", label: "Port", layout: "half" },
- { name: "inputs.database", type: "text", label: "Database" },
- { name: "inputs.username", type: "text", label: "User", layout: "half" },
+ { name: "inputs.database", type: "text", label: "Database", placeholder: "app_db" },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "sa",
+ layout: "half"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter database password",
autoComplete: "new-password",
layout: "half"
}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sapHana.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sapHana.tsx
index c22eac506d..36eb1a1d35 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sapHana.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sapHana.tsx
@@ -15,17 +15,36 @@ import {
} from "./sapHanaContract";
const sapHanaConnectionFields = [
- { name: "inputs.host", type: "text", label: "Host", layout: "half" },
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "hana.example.com",
+ layout: "half"
+ },
{ name: "inputs.port", type: "number", label: "Port", layout: "half" },
- { name: "inputs.username", type: "text", label: "User", layout: "half" },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "SYSTEM",
+ layout: "half"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter database password",
autoComplete: "new-password",
layout: "half"
},
- { name: "inputs.ca", type: "secret", label: "CA (SSL)", isOptional: true }
+ {
+ name: "inputs.ca",
+ type: "secret",
+ label: "CA (SSL)",
+ placeholder: "-----BEGIN CERTIFICATE----- ...",
+ isOptional: true
+ }
] as const;
const sapHanaAdvancedFields = buildStatementFields();
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/snowflake.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/snowflake.tsx
index 6b8667911a..de9d7eb9cb 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/snowflake.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/snowflake.tsx
@@ -15,18 +15,32 @@ import {
} from "./snowflakeContract";
const snowflakeConnectionFields = [
- { name: "inputs.accountId", type: "text", label: "Account Identifier", layout: "half" },
+ {
+ name: "inputs.accountId",
+ type: "text",
+ label: "Account Identifier",
+ placeholder: "my-account",
+ layout: "half"
+ },
{
name: "inputs.orgId",
type: "text",
label: "Organization Identifier",
+ placeholder: "my-organization",
+ layout: "half"
+ },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "INFISICAL_USER",
layout: "half"
},
- { name: "inputs.username", type: "text", label: "User", layout: "half" },
{
name: "inputs.password",
type: "secret",
label: "Programmatic Access Token",
+ placeholder: "Enter programmatic access token",
description:
"The programmatic access token used to authenticate with Snowflake. A user password is still accepted, but Snowflake is phasing out password authentication.",
autoComplete: "new-password",
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sqlDatabase.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sqlDatabase.tsx
index daad78fed2..f34478bc5b 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sqlDatabase.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/sqlDatabase.tsx
@@ -7,6 +7,9 @@ import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { ValidationRuleOverrideNotice } from "@app/components/secret-validation/ValidationRuleOverrideNotice";
import {
+ Alert,
+ AlertAction,
+ AlertDescription,
Button,
Field,
FieldContent,
@@ -66,11 +69,12 @@ import {
} from "./sqlDatabaseContract";
const sqlConnectionFields = [
- { name: "inputs.host", type: "text", label: "Host" },
+ { name: "inputs.host", type: "text", label: "Host", placeholder: "db.example.com" },
{
name: "inputs.username",
type: "text",
label: "User",
+ placeholder: "postgres",
autoComplete: "off",
layout: "half"
},
@@ -78,10 +82,17 @@ const sqlConnectionFields = [
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter database password",
autoComplete: "new-password",
layout: "half"
},
- { name: "inputs.database", type: "text", label: "Database Name", layout: "half" }
+ {
+ name: "inputs.database",
+ type: "text",
+ label: "Database Name",
+ placeholder: "app_db",
+ layout: "half"
+ }
] satisfies readonly TDynamicSecretProviderField<TSqlDatabaseFormValues>[];
const usernameTemplateField = [
@@ -109,16 +120,18 @@ const SqlVaultImport = ({ onImport }: { onImport: (role: VaultDatabaseRole) => v
return (
<>
- <div className="flex flex-col gap-3 rounded-md border border-info/20 bg-info/10 p-3 sm:flex-row sm:items-center sm:justify-between">
- <div className="flex items-center gap-2 text-sm text-foreground">
- <InfoIcon className="size-4 text-info" />
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
<span>Load values from HashiCorp Vault.</span>
- </div>
- <Button type="button" size="sm" variant="info" onClick={() => setIsOpen(true)}>
- <img src="/images/integrations/Vault.png" alt="" className="size-4" />
- Load from Vault
- </Button>
- </div>
+ <AlertAction>
+ <Button type="button" size="sm" variant="info" onClick={() => setIsOpen(true)}>
+ <img src="/images/integrations/Vault.png" alt="" className="size-4" />
+ Load from Vault
+ </Button>
+ </AlertAction>
+ </AlertDescription>
+ </Alert>
<VaultSqlDatabaseImportModal
isOpen={isOpen}
onOpenChange={setIsOpen}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/tailscale.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/tailscale.tsx
index 18bcabbeec..e0ebb436c8 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/tailscale.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/tailscale.tsx
@@ -49,13 +49,21 @@ const TailscaleFields = () => {
name: "inputs.tailnet",
type: "text",
label: "Tailnet",
+ placeholder: "example.com or -",
description: "Use '-' for the token owner's default tailnet, or provide a tailnet name."
},
- { name: "inputs.description", type: "text", label: "Description", isOptional: true },
+ {
+ name: "inputs.description",
+ type: "text",
+ label: "Description",
+ placeholder: "Infisical dynamic access",
+ isOptional: true
+ },
{
name: "inputs.tags",
type: "text",
label: "Tags",
+ placeholder: "tag:ci,tag:prod",
isOptional: true,
description: "Comma-separated ACL tags (for example, tag:ci, tag:prod)."
}
@@ -67,15 +75,23 @@ const TailscaleFields = () => {
name: "inputs.auth.apiKey",
type: "secret",
label: "API Key",
+ placeholder: "tskey-api-...",
autoComplete: "new-password"
}
] as const)
: ([
- { name: "inputs.auth.clientId", type: "text", label: "Client ID", layout: "half" },
+ {
+ name: "inputs.auth.clientId",
+ type: "text",
+ label: "Client ID",
+ placeholder: "Enter OAuth client ID",
+ layout: "half"
+ },
{
name: "inputs.auth.clientSecret",
type: "secret",
label: "Client Secret",
+ placeholder: "Enter OAuth client secret",
autoComplete: "new-password",
layout: "half"
}
@@ -98,6 +114,7 @@ const TailscaleFields = () => {
name: "inputs.scopes",
type: "text",
label: "Scopes",
+ placeholder: "devices:core,users:read",
description: "Comma-separated OAuth scopes."
}
]}
@@ -110,10 +127,22 @@ const TailscaleFields = () => {
name: "inputs.issuer",
type: "text",
label: "Issuer",
+ placeholder: "https://issuer.example.com",
description: "HTTPS URL of the OIDC issuer trusted for token exchange."
},
- { name: "inputs.subject", type: "text", label: "Subject" },
- { name: "inputs.audience", type: "text", label: "Audience", isOptional: true }
+ {
+ name: "inputs.subject",
+ type: "text",
+ label: "Subject",
+ placeholder: "[email protected]"
+ },
+ {
+ name: "inputs.audience",
+ type: "text",
+ label: "Audience",
+ placeholder: "tailscale",
+ isOptional: true
+ }
]}
/>
)}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/totp.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/totp.tsx
index d5a02040fd..257133dc9e 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/totp.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/totp.tsx
@@ -103,6 +103,7 @@ const TotpFields = () => {
id="totp-secret"
type="password"
autoComplete="new-password"
+ placeholder="Enter Base32 secret key"
isError={Boolean(error)}
aria-describedby={error ? "totp-secret-error" : undefined}
/>
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/vertica.tsx b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/vertica.tsx
index e54c279cce..bc583518df 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/vertica.tsx
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/providerDefinitions/vertica.tsx
@@ -24,14 +24,34 @@ import {
} from "./verticaContract";
const connectionFields = [
- { name: "inputs.host", type: "text", label: "Host", placeholder: "Vertica Host", layout: "half" },
+ {
+ name: "inputs.host",
+ type: "text",
+ label: "Host",
+ placeholder: "vertica.example.com",
+ layout: "half"
+ },
{ name: "inputs.port", type: "number", label: "Port", layout: "half" },
- { name: "inputs.database", type: "text", label: "Database", layout: "half" },
- { name: "inputs.username", type: "text", label: "User", autoComplete: "off", layout: "half" },
+ {
+ name: "inputs.database",
+ type: "text",
+ label: "Database",
+ placeholder: "VMart",
+ layout: "half"
+ },
+ {
+ name: "inputs.username",
+ type: "text",
+ label: "User",
+ placeholder: "dbadmin",
+ autoComplete: "off",
+ layout: "half"
+ },
{
name: "inputs.password",
type: "secret",
label: "Password",
+ placeholder: "Enter database password",
autoComplete: "new-password",
layout: "half"
}
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/registry.ts b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/registry.ts
index 6e6033eba2..4883b6153c 100644
--- a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/registry.ts
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/registry.ts
@@ -1,5 +1,6 @@
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
+import { getDynamicSecretProviderRuntimeMetadata } from "./runtimeMetadata";
import type { TDynamicSecretProviderDefinition } from "./types";
export type TRegisteredDynamicSecretProviderDefinition = TDynamicSecretProviderDefinition<
@@ -106,6 +107,26 @@ export const createDynamicSecretProviderRegistry = (
return definition;
},
getLabel: (provider: DynamicSecretProviders) => definitions.get(provider)?.label,
+ getPresentation: (provider: DynamicSecretProviders) =>
+ definitions.has(provider)
+ ? getDynamicSecretProviderRuntimeMetadata(provider).presentation
+ : undefined,
+ requirePresentation: (provider: DynamicSecretProviders) => {
+ if (!definitions.has(provider)) {
+ throw new Error(`Dynamic-secret provider "${provider}" is not registered.`);
+ }
+ return getDynamicSecretProviderRuntimeMetadata(provider).presentation;
+ },
+ getLeaseCapabilities: (provider: DynamicSecretProviders) =>
+ definitions.has(provider)
+ ? getDynamicSecretProviderRuntimeMetadata(provider).leaseCapabilities
+ : undefined,
+ requireLeaseCapabilities: (provider: DynamicSecretProviders) => {
+ if (!definitions.has(provider)) {
+ throw new Error(`Dynamic-secret provider "${provider}" is not registered.`);
+ }
+ return getDynamicSecretProviderRuntimeMetadata(provider).leaseCapabilities;
+ },
getDocsSlug: (provider: DynamicSecretProviders) =>
DYNAMIC_SECRET_PROVIDER_DOCS_SLUG[provider] ?? provider
});
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/runtimeMetadata.test.ts b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/runtimeMetadata.test.ts
new file mode 100644
index 0000000000..8c5151e6dd
--- /dev/null
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/runtimeMetadata.test.ts
@@ -0,0 +1,60 @@
+import assert from "node:assert/strict";
+import { describe, it } from "node:test";
+
+import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
+
+import { getDynamicSecretProviderRuntimeMetadata } from "./runtimeMetadata";
+
+describe("dynamic-secret provider runtime metadata", () => {
+ it("defines presentation and lease behavior for every provider", () => {
+ Object.values(DynamicSecretProviders).forEach((provider) => {
+ const metadata = getDynamicSecretProviderRuntimeMetadata(provider);
+
+ assert.ok(metadata.presentation.providerFamily);
+ assert.ok(metadata.leaseCapabilities.provisioner);
+ assert.ok(metadata.leaseCapabilities.output.type);
+
+ if (metadata.leaseCapabilities.output.type === "fields") {
+ assert.ok(metadata.leaseCapabilities.output.fields.length > 0);
+ assert.equal(
+ new Set(metadata.leaseCapabilities.output.fields.map(({ key }) => key)).size,
+ metadata.leaseCapabilities.output.fields.length
+ );
+ }
+ });
+ });
+
+ it("keeps special provisioning and renewal capabilities explicit", () => {
+ assert.equal(
+ getDynamicSecretProviderRuntimeMetadata(DynamicSecretProviders.Kubernetes).leaseCapabilities
+ .provisioner,
+ "kubernetes"
+ );
+ assert.equal(
+ getDynamicSecretProviderRuntimeMetadata(DynamicSecretProviders.Ssh).leaseCapabilities
+ .provisioner,
+ "ssh"
+ );
+ assert.equal(
+ getDynamicSecretProviderRuntimeMetadata(DynamicSecretProviders.Totp).leaseCapabilities
+ .autoGenerate,
+ true
+ );
+ assert.equal(
+ getDynamicSecretProviderRuntimeMetadata(DynamicSecretProviders.Github).leaseCapabilities
+ .fixedTtl,
+ "1h"
+ );
+
+ [
+ DynamicSecretProviders.Github,
+ DynamicSecretProviders.Ssh,
+ DynamicSecretProviders.Tailscale
+ ].forEach((provider) => {
+ assert.equal(
+ getDynamicSecretProviderRuntimeMetadata(provider).leaseCapabilities.supportsRenewal,
+ false
+ );
+ });
+ });
+});
diff --git a/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/runtimeMetadata.ts b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/runtimeMetadata.ts
new file mode 100644
index 0000000000..dec32d3e11
--- /dev/null
+++ b/frontend/src/components/dynamic-secrets/DynamicSecretProviderForm/runtimeMetadata.ts
@@ -0,0 +1,253 @@
+import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
+
+export type TDynamicSecretProviderPresentation = {
+ providerFamily: string;
+ logoFileName?: string;
+};
+
+export type TDynamicSecretLeaseOutputField = {
+ key: string;
+ label: string;
+ isOptional?: boolean;
+ format?: "json";
+};
+
+export type TDynamicSecretLeaseOutput =
+ | {
+ type: "fields";
+ fields: readonly TDynamicSecretLeaseOutputField[];
+ notice?: "one-time" | "one-time-delayed";
+ }
+ | { type: "totp" }
+ | { type: "ssh" };
+
+export type TDynamicSecretLeaseCapabilities = {
+ provisioner: "default" | "kubernetes" | "ssh";
+ output: TDynamicSecretLeaseOutput;
+ supportsRenewal: boolean;
+ autoGenerate?: boolean;
+ fixedTtl?: string;
+};
+
+export type TDynamicSecretProviderRuntimeMetadata = {
+ presentation: TDynamicSecretProviderPresentation;
+ leaseCapabilities: TDynamicSecretLeaseCapabilities;
+};
+
+const oneTimeFields = (
+ fields: readonly TDynamicSecretLeaseOutputField[],
+ notice: "one-time" | "one-time-delayed" = "one-time"
+): TDynamicSecretLeaseOutput => ({ type: "fields", fields, notice });
+
+const databaseCredentials = oneTimeFields([
+ { key: "DB_USERNAME", label: "Database User" },
+ { key: "DB_PASSWORD", label: "Database Password" }
+]);
+
+const credentials = oneTimeFields([
+ { key: "DB_USERNAME", label: "Username" },
+ { key: "DB_PASSWORD", label: "Password" }
+]);
+
+const createDefaultLeaseCapabilities = (
+ output: TDynamicSecretLeaseOutput
+): TDynamicSecretLeaseCapabilities => ({
+ provisioner: "default",
+ output,
+ supportsRenewal: true
+});
+
+const DYNAMIC_SECRET_PROVIDER_RUNTIME_METADATA = {
+ [DynamicSecretProviders.SqlDatabase]: {
+ presentation: { providerFamily: "SQL", logoFileName: "Postgres.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.Cassandra]: {
+ presentation: { providerFamily: "Cassandra", logoFileName: "Cassandra.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.Redis]: {
+ presentation: { providerFamily: "Redis", logoFileName: "Redis.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields([
+ { key: "DB_USERNAME", label: "Redis Username" },
+ { key: "DB_PASSWORD", label: "Redis Password" }
+ ])
+ )
+ },
+ [DynamicSecretProviders.AwsElastiCache]: {
+ presentation: { providerFamily: "AWS", logoFileName: "Amazon Web Services.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields(
+ [
+ { key: "DB_USERNAME", label: "Cluster Username" },
+ { key: "DB_PASSWORD", label: "Cluster Password" }
+ ],
+ "one-time-delayed"
+ )
+ )
+ },
+ [DynamicSecretProviders.AwsMemoryDb]: {
+ presentation: { providerFamily: "AWS", logoFileName: "Amazon Web Services.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields(
+ [
+ { key: "DB_USERNAME", label: "Cluster Username" },
+ { key: "DB_PASSWORD", label: "Cluster Password" }
+ ],
+ "one-time-delayed"
+ )
+ )
+ },
+ [DynamicSecretProviders.AwsIam]: {
+ presentation: { providerFamily: "AWS", logoFileName: "Amazon Web Services.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields([
+ { key: "USERNAME", label: "AWS IAM Username", isOptional: true },
+ { key: "ACCESS_KEY", label: "AWS IAM Access Key" },
+ { key: "SECRET_ACCESS_KEY", label: "AWS IAM Secret Key" },
+ { key: "SESSION_TOKEN", label: "AWS IAM Session Token", isOptional: true }
+ ])
+ )
+ },
+ [DynamicSecretProviders.MongoAtlas]: {
+ presentation: { providerFamily: "MongoDB", logoFileName: "MongoDB.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.MongoDB]: {
+ presentation: { providerFamily: "MongoDB", logoFileName: "MongoDB.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.ElasticSearch]: {
+ presentation: { providerFamily: "Elastic", logoFileName: "Elastic.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(credentials)
+ },
+ [DynamicSecretProviders.RabbitMq]: {
+ presentation: { providerFamily: "RabbitMQ" },
+ leaseCapabilities: createDefaultLeaseCapabilities(credentials)
+ },
+ [DynamicSecretProviders.AzureEntraId]: {
+ presentation: { providerFamily: "Azure", logoFileName: "Microsoft Azure.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields([
+ { key: "email", label: "Email" },
+ { key: "password", label: "Password" }
+ ])
+ )
+ },
+ [DynamicSecretProviders.AzureSqlDatabase]: {
+ presentation: { providerFamily: "Azure", logoFileName: "Microsoft Azure.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.Ldap]: {
+ presentation: { providerFamily: "LDAP", logoFileName: "LDAP.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields([
+ { key: "USERNAME", label: "Username" },
+ { key: "PASSWORD", label: "Password" },
+ { key: "DN_ARRAY", label: "DNs", format: "json" }
+ ])
+ )
+ },
+ [DynamicSecretProviders.SapHana]: {
+ presentation: { providerFamily: "SAP" },
+ leaseCapabilities: createDefaultLeaseCapabilities(credentials)
+ },
+ [DynamicSecretProviders.SapAse]: {
+ presentation: { providerFamily: "SAP" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.Snowflake]: {
+ presentation: { providerFamily: "Snowflake", logoFileName: "Snowflake.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(credentials)
+ },
+ [DynamicSecretProviders.Totp]: {
+ presentation: { providerFamily: "TOTP" },
+ leaseCapabilities: {
+ ...createDefaultLeaseCapabilities({ type: "totp" }),
+ autoGenerate: true
+ }
+ },
+ [DynamicSecretProviders.Vertica]: {
+ presentation: { providerFamily: "Vertica" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.Kubernetes]: {
+ presentation: { providerFamily: "Kubernetes", logoFileName: "Kubernetes.png" },
+ leaseCapabilities: {
+ provisioner: "kubernetes",
+ output: oneTimeFields([{ key: "TOKEN", label: "Service Account JWT" }]),
+ supportsRenewal: true
+ }
+ },
+ [DynamicSecretProviders.GcpIam]: {
+ presentation: { providerFamily: "Google Cloud", logoFileName: "Google Cloud Platform.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields([
+ { key: "SERVICE_ACCOUNT_EMAIL", label: "Service Account Email" },
+ { key: "TOKEN", label: "Token" }
+ ])
+ )
+ },
+ [DynamicSecretProviders.Github]: {
+ presentation: { providerFamily: "GitHub", logoFileName: "GitHub.png" },
+ leaseCapabilities: {
+ ...createDefaultLeaseCapabilities(oneTimeFields([{ key: "TOKEN", label: "Token" }])),
+ fixedTtl: "1h",
+ supportsRenewal: false
+ }
+ },
+ [DynamicSecretProviders.Couchbase]: {
+ presentation: { providerFamily: "Couchbase" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields([
+ { key: "username", label: "Username" },
+ { key: "password", label: "Password" }
+ ])
+ )
+ },
+ [DynamicSecretProviders.Milvus]: {
+ presentation: { providerFamily: "Milvus" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.Clickhouse]: {
+ presentation: { providerFamily: "ClickHouse" },
+ leaseCapabilities: createDefaultLeaseCapabilities(databaseCredentials)
+ },
+ [DynamicSecretProviders.Ssh]: {
+ presentation: { providerFamily: "SSH", logoFileName: "SSH.png" },
+ leaseCapabilities: {
+ provisioner: "ssh",
+ output: { type: "ssh" },
+ supportsRenewal: false
+ }
+ },
+ [DynamicSecretProviders.IbmApiConnect]: {
+ presentation: { providerFamily: "IBM", logoFileName: "IBM.png" },
+ leaseCapabilities: createDefaultLeaseCapabilities(
+ oneTimeFields([
+ { key: "CLIENT_ID", label: "Client ID" },
+ { key: "CLIENT_SECRET", label: "Client Secret" }
+ ])
+ )
+ },
+ [DynamicSecretProviders.Tailscale]: {
+ presentation: { providerFamily: "Tailscale" },
+ leaseCapabilities: {
+ provisioner: "default",
+ output: oneTimeFields([
+ { key: "KEY_ID", label: "Key ID", isOptional: true },
+ { key: "AUTH_KEY", label: "Auth Key", isOptional: true },
+ { key: "CLIENT_ID", label: "Client ID", isOptional: true },
+ { key: "CLIENT_SECRET", label: "Client Secret", isOptional: true },
+ { key: "FEDERATED_CREDENTIAL_ID", label: "Federated Credential ID", isOptional: true },
+ { key: "AUDIENCE", label: "Audience", isOptional: true }
+ ]),
+ supportsRenewal: false
+ }
+ }
+} as const satisfies Record<DynamicSecretProviders, TDynamicSecretProviderRuntimeMetadata>;
+
+export const getDynamicSecretProviderRuntimeMetadata = (
+ provider: DynamicSecretProviders
+): TDynamicSecretProviderRuntimeMetadata => DYNAMIC_SECRET_PROVIDER_RUNTIME_METADATA[provider];
diff --git a/frontend/src/components/permissions/OrgPermissionCan.tsx b/frontend/src/components/permissions/OrgPermissionCan.tsx
index c398117bc6..054ae5c663 100644
--- a/frontend/src/components/permissions/OrgPermissionCan.tsx
+++ b/frontend/src/components/permissions/OrgPermissionCan.tsx
@@ -1,19 +1,19 @@
-import { FunctionComponent, ReactNode } from "react";
+import { ComponentProps, FunctionComponent, ReactNode } from "react";
import { AbilityTuple, MongoAbility } from "@casl/ability";
import { Can } from "@casl/react";
-import { TooltipProps } from "@app/components/v2/Tooltip/Tooltip";
import {
AccessRestrictedDialog,
AccessRestrictedNotice,
TAccessRestrictedRequirement,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
toPermissionRequirement
} from "@app/components/v3";
import { useOrgPermission } from "@app/context/OrgPermissionContext";
import { OrgPermissionSet } from "@app/context/OrgPermissionContext/types";
-import { Tooltip } from "../v2";
-
export const OrgPermissionGuardBanner = ({
requirement,
accessRestrictedMode = "notice"
@@ -36,7 +36,7 @@ type Props<T extends AbilityTuple> = {
allowedLabel?: string;
accessRestrictedMode?: "dialog" | "notice";
renderGuardBanner?: boolean;
- tooltipProps?: Omit<TooltipProps, "children">;
+ tooltipProps?: Omit<ComponentProps<typeof TooltipContent>, "children">;
I: T[0];
ability?: MongoAbility<T>;
children: ReactNode | ((isAllowed: boolean, ability: T) => ReactNode);
@@ -70,16 +70,18 @@ export const OrgPermissionCan: FunctionComponent<Props<OrgPermissionSet>> = ({
if (!isAllowed && passThrough) {
return (
- <Tooltip content={label} {...tooltipProps}>
- {finalChild}
+ <Tooltip>
+ <TooltipTrigger asChild>{finalChild}</TooltipTrigger>
+ <TooltipContent {...tooltipProps}>{label}</TooltipContent>
</Tooltip>
);
}
if (isAllowed && renderTooltip && allowedLabel) {
return (
- <Tooltip content={allowedLabel} {...tooltipProps}>
- {finalChild}
+ <Tooltip>
+ <TooltipTrigger asChild>{finalChild}</TooltipTrigger>
+ <TooltipContent {...tooltipProps}>{allowedLabel}</TooltipContent>
</Tooltip>
);
}
diff --git a/frontend/src/components/v3/generic/Alert/Alert.stories.tsx b/frontend/src/components/v3/generic/Alert/Alert.stories.tsx
index b5a17556ff..a4507fe7a0 100644
--- a/frontend/src/components/v3/generic/Alert/Alert.stories.tsx
+++ b/frontend/src/components/v3/generic/Alert/Alert.stories.tsx
@@ -9,11 +9,13 @@ import {
TriangleAlertIcon
} from "lucide-react";
-import { Alert, AlertDescription, AlertTitle } from "./Alert";
+import { Button } from "../Button";
+import { Alert, AlertAction, AlertDescription, AlertTitle } from "./Alert";
/**
* Alerts surface short, scannable messages that communicate state or call attention to contextual information.
- * Compose an alert from an optional leading icon, `AlertTitle`, and `AlertDescription`.
+ * Compose an alert from an optional leading icon, `AlertTitle`, `AlertDescription`, and
+ * `AlertAction` for a related action.
* The `variant` determines the semantic tone of the message.
*/
const meta = {
@@ -276,6 +278,34 @@ export const TitleOnly: Story = {
)
};
+export const WithAction: Story = {
+ name: "Example: With Action",
+ args: {
+ variant: "info"
+ },
+ parameters: {
+ docs: {
+ description: {
+ story:
+ "Place AlertAction inside AlertDescription when a persistent message has a related action. The action stacks below the message in narrow containers."
+ }
+ }
+ },
+ render: (args) => (
+ <Alert {...args}>
+ <InfoIcon />
+ <AlertDescription>
+ <span>Deploy a gateway to keep traffic inside the target network.</span>
+ <AlertAction>
+ <Button variant="info" size="sm">
+ Deploy Gateway
+ </Button>
+ </AlertAction>
+ </AlertDescription>
+ </Alert>
+ )
+};
+
export const WithoutIcon: Story = {
name: "Example: Without Icon",
args: {
diff --git a/frontend/src/components/v3/generic/Alert/Alert.tsx b/frontend/src/components/v3/generic/Alert/Alert.tsx
index 030c128f72..0589cc0a1e 100644
--- a/frontend/src/components/v3/generic/Alert/Alert.tsx
+++ b/frontend/src/components/v3/generic/Alert/Alert.tsx
@@ -6,7 +6,7 @@ import { cn } from "../../utils";
const alertVariants = cva(
// min-h-9 replaces a flex item's automatic minimum size, so without shrink-0 a multi-line alert
// in a height-constrained flex column collapses to 36px and its text paints over the next sibling.
- "relative grid min-h-9 w-full shrink-0 grid-cols-[0_1fr] items-center gap-y-1 rounded-md border px-3 py-2.5 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:text-current",
+ "@container/alert relative grid min-h-9 w-full shrink-0 grid-cols-[0_1fr] items-center gap-y-1 rounded-md border px-3 py-2.5 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:text-current",
{
variants: {
variant: {
@@ -67,10 +67,17 @@ function AlertDescription({ className, ...props }: React.ComponentProps<"div">)
return (
<div
data-slot="alert-description"
- className={cn("col-start-2 grid justify-items-start gap-1 text-sm", className)}
+ className={cn(
+ "col-start-2 grid justify-items-start gap-1 text-sm has-[>[data-slot=alert-action]]:flex has-[>[data-slot=alert-action]]:flex-col has-[>[data-slot=alert-action]]:gap-3 has-[>[data-slot=alert-action]]:@sm/alert:flex-row has-[>[data-slot=alert-action]]:@sm/alert:items-center has-[>[data-slot=alert-action]]:@sm/alert:justify-between",
+ className
+ )}
{...props}
/>
);
}
-export { Alert, AlertDescription, AlertTitle };
+function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
+ return <div data-slot="alert-action" className={cn("shrink-0", className)} {...props} />;
+}
+
+export { Alert, AlertAction, AlertDescription, AlertTitle };
diff --git a/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx b/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx
index a45251bc65..883ee7b0f6 100644
--- a/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx
+++ b/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx
@@ -125,7 +125,7 @@ export const GatewayPicker = ({
</div>
<Tooltip>
<TooltipTrigger asChild>
- <span className="cursor-default rounded bg-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary">
+ <span className="cursor-default rounded bg-info/10 px-1.5 py-0.5 text-[10px] font-semibold text-info">
HA
</span>
</TooltipTrigger>
@@ -181,7 +181,7 @@ export const GatewayPicker = ({
to="/organizations/$orgId/networking"
params={{ orgId: currentOrg.id }}
target="_blank"
- className="text-foreground underline underline-offset-2 hover:text-primary"
+ className="text-foreground underline underline-offset-2 hover:text-info"
>
Set one up
</Link>{" "}
diff --git a/frontend/src/components/v3/platform/SecretInput/SecretInput.tsx b/frontend/src/components/v3/platform/SecretInput/SecretInput.tsx
index 20f7fa0ccb..0f7bb6f57a 100644
--- a/frontend/src/components/v3/platform/SecretInput/SecretInput.tsx
+++ b/frontend/src/components/v3/platform/SecretInput/SecretInput.tsx
@@ -40,7 +40,7 @@ const syntaxHighlight = (
const isCrossProjectRef = parts[0]?.startsWith("@");
return (
- <span className="ph-no-capture relative z-10 text-yellow" key={`secret-value-${i + 1}`}>
+ <span className="ph-no-capture relative z-10 text-secret" key={`secret-value-${i + 1}`}>
&#36;&#123;
{parts.map((segment, segmentIndex) => {
const segmentKey = `${part}-segment-${segmentIndex}`;
@@ -54,9 +54,9 @@ const syntaxHighlight = (
role="button"
tabIndex={isInteractive ? 0 : -1}
className={cn(
- "ph-no-capture text-yellow-200/80",
+ "ph-no-capture text-secret/80",
isInteractive ? "pointer-events-auto" : "pointer-events-none",
- shouldShowHoverStyle && "cursor-pointer underline decoration-yellow-400"
+ shouldShowHoverStyle && "cursor-pointer underline decoration-secret"
)}
onMouseEnter={() => onHoverPart?.(segmentKey)}
onMouseLeave={() => onHoverPart?.("")}
@@ -84,7 +84,7 @@ const syntaxHighlight = (
{segment}
</span>
{segmentIndex < parts.length - 1 && (
- <span className="ph-no-capture pointer-events-none text-yellow-200/80">.</span>
+ <span className="ph-no-capture pointer-events-none text-secret/80">.</span>
)}
</span>
);
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
index 564e9016c8..516bd8c966 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
@@ -9,6 +9,9 @@ import { VaultKubernetesAuthImportModal } from "@app/components/external-migrati
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
+ Alert,
+ AlertAction,
+ AlertDescription,
Button,
Checkbox,
Field,
@@ -519,36 +522,24 @@ export const IdentityKubernetesAuthForm = ({
<TabsContent value={IdentityFormTab.Configuration}>
<FieldGroup>
{hasVaultConnection && canUseAppConnectionImport && !isUpdate && (
- <div className="flex items-center justify-between rounded-md border border-primary/30 bg-primary/10 p-3">
- <div className="flex items-start gap-2 text-sm">
- <InfoIcon className="mt-0.5 size-4 text-primary" />
- <span className="text-foreground">Load values from HashiCorp Vault</span>
- </div>
- <Tooltip>
- <TooltipTrigger asChild>
- <span>
- <Button
- variant="outline"
- size="xs"
- onClick={() => handleImportPopUpToggle("importFromVault", true)}
- isDisabled={!canUseAppConnectionImport}
- >
- <img
- src="/images/integrations/Vault.png"
- alt="HashiCorp Vault"
- className="h-4 w-4"
- />
- Load from Vault
- </Button>
- </span>
- </TooltipTrigger>
- {!canUseAppConnectionImport && (
- <TooltipContent className="max-w-md">
- You don&apos;t have permission to import configurations from HashiCorp Vault
- </TooltipContent>
- )}
- </Tooltip>
- </div>
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
+ <span>Load values from HashiCorp Vault</span>
+ <AlertAction>
+ <Button
+ type="button"
+ variant="info"
+ size="xs"
+ onClick={() => handleImportPopUpToggle("importFromVault", true)}
+ isDisabled={!canUseAppConnectionImport}
+ >
+ <img src="/images/integrations/Vault.png" alt="" className="size-4" />
+ Load from Vault
+ </Button>
+ </AlertAction>
+ </AlertDescription>
+ </Alert>
)}
{canAttachTemplates && (
<Controller
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index a001d8b695..eceac51578 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -49,18 +49,13 @@ import { ReconcileLocalAccountRotationModal } from "@app/components/secret-rotat
import { RotateSecretRotationV2Modal } from "@app/components/secret-rotations-v2/RotateSecretRotationV2Modal";
import { ViewSecretRotationV2GeneratedCredentialsModal } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials";
import { CommitHistorySheet } from "@app/components/secrets/CommitHistorySheet";
-import {
- Button as ButtonV2,
- DeleteActionModal,
- Modal,
- ModalContent,
- PageHeader
-} from "@app/components/v2";
+import { Button as ButtonV2, Modal, ModalContent, PageHeader } from "@app/components/v2";
import {
Alert,
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
+ AlertDialogConfirmationField,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
@@ -75,6 +70,7 @@ import {
CardHeader,
Checkbox,
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
DialogHeader,
@@ -1648,25 +1644,18 @@ const OverviewPageContent = () => {
environment: string;
isForced?: boolean;
};
- try {
- await deleteDynamicSecret.mutateAsync({
- environmentSlug: environment,
- projectSlug,
- path: secretPath,
- name,
- isForced
- });
- handlePopUpClose("deleteDynamicSecret");
- createNotification({
- type: "success",
- text: "Successfully deleted dynamic secret"
- });
- } catch {
- createNotification({
- type: "error",
- text: "Failed to delete dynamic secret"
- });
- }
+ await deleteDynamicSecret.mutateAsync({
+ environmentSlug: environment,
+ projectSlug,
+ path: secretPath,
+ name,
+ isForced
+ });
+ handlePopUpClose("deleteDynamicSecret");
+ createNotification({
+ type: "success",
+ text: "Dynamic secret deleted"
+ });
};
const handleSecretImportDelete = async () => {
@@ -2676,6 +2665,12 @@ const OverviewPageContent = () => {
const dynamicSecretLeaseData = popUp.dynamicSecretLeases?.data as
| (TDynamicSecret & { environment: string })
| undefined;
+ const dynamicSecretLeaseCreateData = popUp.createDynamicSecretLease?.data as
+ | (TDynamicSecret & { environment: string })
+ | undefined;
+ const dynamicSecretDeleteData = popUp.deleteDynamicSecret?.data as
+ | (TDynamicSecret & { environment: string; isForced?: boolean })
+ | undefined;
return (
<div className="">
@@ -3690,20 +3685,22 @@ const OverviewPageContent = () => {
environments={visibleDynamicSecretEnvs}
secretPath={secretPath}
/>
- <Modal
- isOpen={popUp.dynamicSecretLeases.isOpen}
- onOpenChange={(state) => handlePopUpToggle("dynamicSecretLeases", state)}
+ <Dialog
+ open={popUp.dynamicSecretLeases.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("dynamicSecretLeases", isOpen)}
>
- <ModalContent
- title={
- <div className="flex items-center space-x-2">
- <p>Dynamic secret leases</p>
- <Badge variant="neutral">{dynamicSecretLeaseData?.name}</Badge>
- </div>
- }
- subTitle="Revoke or renew your secret leases"
- className="max-w-3xl"
- >
+ <DialogContent className="max-w-3xl">
+ <DialogHeader>
+ <DialogTitle className="flex min-w-0 items-center gap-2 pr-6">
+ <span>Dynamic Secret Leases</span>
+ {dynamicSecretLeaseData?.name && (
+ <Badge variant="neutral" isTruncatable>
+ {dynamicSecretLeaseData.name}
+ </Badge>
+ )}
+ </DialogTitle>
+ <DialogDescription>Revoke or renew active leases.</DialogDescription>
+ </DialogHeader>
{dynamicSecretLeaseData && (
<DynamicSecretLease
dynamicSecret={dynamicSecretLeaseData}
@@ -3718,64 +3715,94 @@ const OverviewPageContent = () => {
environment={dynamicSecretLeaseData.environment}
/>
)}
- </ModalContent>
- </Modal>
- <Modal
+ </DialogContent>
+ </Dialog>
+ <EditDynamicSecretForm
isOpen={popUp.editDynamicSecret.isOpen}
- onOpenChange={(state) => handlePopUpToggle("editDynamicSecret", state)}
- >
- <ModalContent title="Edit dynamic secret" className="max-w-3xl">
- <EditDynamicSecretForm
- onClose={() => handlePopUpClose("editDynamicSecret")}
- projectSlug={projectSlug}
- dynamicSecretName={
- (popUp.editDynamicSecret?.data as TDynamicSecret & { environment: string })?.name
- }
- secretPath={secretPath}
- environment={
- (popUp.editDynamicSecret?.data as TDynamicSecret & { environment: string })
- ?.environment
- }
- />
- </ModalContent>
- </Modal>
- <Modal
- isOpen={popUp.createDynamicSecretLease.isOpen}
- onOpenChange={(state) => handlePopUpToggle("createDynamicSecretLease", state)}
- >
- <ModalContent title="Provision lease">
- <CreateDynamicSecretLease
- provider={
- (popUp.createDynamicSecretLease?.data as TDynamicSecret & { environment: string })
- ?.type
- }
- onClose={() => handlePopUpClose("createDynamicSecretLease")}
- projectSlug={projectSlug}
- dynamicSecretName={
- (popUp.createDynamicSecretLease?.data as TDynamicSecret & { environment: string })
- ?.name
- }
- secretPath={secretPath}
- environment={
- (popUp.createDynamicSecretLease?.data as TDynamicSecret & { environment: string })
- ?.environment
- }
- />
- </ModalContent>
- </Modal>
- <DeleteActionModal
- isOpen={popUp.deleteDynamicSecret.isOpen}
- deleteKey={
- (popUp.deleteDynamicSecret?.data as TDynamicSecret & { environment: string })?.name
+ onToggle={(state) => handlePopUpToggle("editDynamicSecret", state)}
+ projectSlug={projectSlug}
+ dynamicSecretName={
+ (popUp.editDynamicSecret?.data as TDynamicSecret & { environment: string })?.name
}
- title={
- (popUp.deleteDynamicSecret?.data as { isForced?: boolean })?.isForced
- ? "Do you want to force delete this dynamic secret?"
- : "Do you want to delete this dynamic secret?"
+ secretPath={secretPath}
+ environment={
+ (popUp.editDynamicSecret?.data as TDynamicSecret & { environment: string })?.environment
}
- onChange={(isOpen) => handlePopUpToggle("deleteDynamicSecret", isOpen)}
- onDeleteApproved={handleDynamicSecretDelete}
/>
+ <Dialog
+ open={popUp.createDynamicSecretLease.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("createDynamicSecretLease", isOpen)}
+ >
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Provision Lease</DialogTitle>
+ <DialogDescription>
+ Generate temporary credentials from this dynamic secret.
+ </DialogDescription>
+ </DialogHeader>
+ {dynamicSecretLeaseCreateData && (
+ <DialogBody className="flex flex-col overflow-visible">
+ <CreateDynamicSecretLease
+ provider={dynamicSecretLeaseCreateData.type}
+ onClose={() => handlePopUpClose("createDynamicSecretLease")}
+ projectSlug={projectSlug}
+ dynamicSecretName={dynamicSecretLeaseCreateData.name}
+ secretPath={secretPath}
+ environment={dynamicSecretLeaseCreateData.environment}
+ />
+ </DialogBody>
+ )}
+ </DialogContent>
+ </Dialog>
+ <AlertDialog
+ open={popUp.deleteDynamicSecret.isOpen}
+ confirmationValue={dynamicSecretDeleteData?.name}
+ onOpenChange={(isOpen) => {
+ if (!deleteDynamicSecret.isPending) handlePopUpToggle("deleteDynamicSecret", isOpen);
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <TrashIcon />
+ </AlertDialogMedia>
+ <AlertDialogTitle>
+ {dynamicSecretDeleteData?.isForced
+ ? `Force Delete ${dynamicSecretDeleteData.name}?`
+ : `Delete ${dynamicSecretDeleteData?.name ?? "Dynamic Secret"}?`}
+ </AlertDialogTitle>
+ <AlertDialogDescription>
+ {dynamicSecretDeleteData?.isForced
+ ? "This removes the dynamic secret and its leases from Infisical without revoking them in the external provider. This cannot be undone."
+ : "This deletes the dynamic secret configuration and revokes its active leases. This cannot be undone."}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogConfirmationField
+ inputProps={{
+ disabled: deleteDynamicSecret.isPending,
+ placeholder: `Type ${dynamicSecretDeleteData?.name ?? "the dynamic secret name"} here`
+ }}
+ onConfirm={() => {
+ if (!deleteDynamicSecret.isPending) {
+ handleDynamicSecretDelete().catch(() => undefined);
+ }
+ }}
+ />
+ <AlertDialogFooter>
+ <AlertDialogCancel isDisabled={deleteDynamicSecret.isPending}>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ variant="danger"
+ isPending={deleteDynamicSecret.isPending}
+ onClick={(event) => {
+ event.preventDefault();
+ handleDynamicSecretDelete().catch(() => undefined);
+ }}
+ >
+ {dynamicSecretDeleteData?.isForced ? "Force Delete" : "Delete"}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
<AlertDialog
open={popUp.deleteSecretImport.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("deleteSecretImport", isOpen)}
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/DynamicSecretTableRow/DynamicSecretTableRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/DynamicSecretTableRow/DynamicSecretTableRow.tsx
index bcde8864c4..97d7daeb08 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/DynamicSecretTableRow/DynamicSecretTableRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/DynamicSecretTableRow/DynamicSecretTableRow.tsx
@@ -2,6 +2,7 @@ import { subject } from "@casl/ability";
import {
AlertTriangleIcon,
ChevronDownIcon,
+ ChevronRightIcon,
EditIcon,
FileKeyIcon,
FingerprintIcon,
@@ -11,6 +12,7 @@ import {
} from "lucide-react";
import { twMerge } from "tailwind-merge";
+import { dynamicSecretProviderRegistry } from "@app/components/dynamic-secrets";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Badge,
@@ -27,44 +29,10 @@ import {
} from "@app/components/v3";
import { ProjectPermissionDynamicSecretActions, ProjectPermissionSub } from "@app/context";
import { useToggle } from "@app/hooks";
-import {
- DynamicSecretProviders,
- DynamicSecretStatus,
- TDynamicSecret
-} from "@app/hooks/api/dynamicSecret/types";
+import { DynamicSecretStatus, TDynamicSecret } from "@app/hooks/api/dynamicSecret/types";
import { ResourceEnvironmentStatusCell } from "../ResourceEnvironmentStatusCell";
-const DYNAMIC_SECRET_PROVIDER_NAMES: Record<DynamicSecretProviders, string> = {
- [DynamicSecretProviders.SqlDatabase]: "SQL Database",
- [DynamicSecretProviders.Cassandra]: "Cassandra",
- [DynamicSecretProviders.AwsIam]: "AWS IAM",
- [DynamicSecretProviders.Redis]: "Redis",
- [DynamicSecretProviders.AwsElastiCache]: "AWS ElastiCache",
- [DynamicSecretProviders.AwsMemoryDb]: "AWS MemoryDB",
- [DynamicSecretProviders.MongoAtlas]: "Mongo Atlas",
- [DynamicSecretProviders.ElasticSearch]: "Elastic Search",
- [DynamicSecretProviders.MongoDB]: "Mongo DB",
- [DynamicSecretProviders.RabbitMq]: "RabbitMQ",
- [DynamicSecretProviders.AzureEntraId]: "Azure Entra ID",
- [DynamicSecretProviders.AzureSqlDatabase]: "Azure SQL Database",
- [DynamicSecretProviders.Ldap]: "LDAP",
- [DynamicSecretProviders.SapHana]: "SAP HANA",
- [DynamicSecretProviders.Snowflake]: "Snowflake",
- [DynamicSecretProviders.Totp]: "TOTP",
- [DynamicSecretProviders.SapAse]: "SAP ASE",
- [DynamicSecretProviders.Kubernetes]: "Kubernetes",
- [DynamicSecretProviders.Vertica]: "Vertica",
- [DynamicSecretProviders.GcpIam]: "GCP IAM",
- [DynamicSecretProviders.Github]: "GitHub",
- [DynamicSecretProviders.Clickhouse]: "ClickHouse",
- [DynamicSecretProviders.Couchbase]: "Couchbase",
- [DynamicSecretProviders.Milvus]: "Milvus",
- [DynamicSecretProviders.Ssh]: "SSH",
- [DynamicSecretProviders.IbmApiConnect]: "IBM API Connect",
- [DynamicSecretProviders.Tailscale]: "Tailscale"
-};
-
type DynamicSecretWithEnv = TDynamicSecret & { environment: string };
type Props = {
@@ -112,20 +80,23 @@ export const DynamicSecretTableRow = ({
const renderStatusIndicator = (dynamicSecret: DynamicSecretWithEnv) => {
if (!dynamicSecret.status) return null;
+ const statusLabel = dynamicSecret.statusDetails || dynamicSecret.status;
+ const visibleStatusLabel =
+ dynamicSecret.status === DynamicSecretStatus.Deleting ? "Revoking" : "Deletion Failed";
return (
<Tooltip>
<TooltipTrigger asChild>
- <AlertTriangleIcon
- className={twMerge(
- "ml-2 size-4",
- dynamicSecret.status === DynamicSecretStatus.Deleting
- ? "text-yellow-600"
- : "text-red-600"
- )}
- />
+ <Badge
+ aria-label={`Dynamic secret status: ${statusLabel}`}
+ className="ml-2"
+ variant={dynamicSecret.status === DynamicSecretStatus.Deleting ? "warning" : "danger"}
+ >
+ <AlertTriangleIcon aria-hidden="true" />
+ {visibleStatusLabel}
+ </Badge>
</TooltipTrigger>
- <TooltipContent>{dynamicSecret.statusDetails || dynamicSecret.status}</TooltipContent>
+ <TooltipContent>{statusLabel}</TooltipContent>
</Tooltip>
);
};
@@ -134,13 +105,7 @@ export const DynamicSecretTableRow = ({
const isRevoking = dynamicSecret.status === DynamicSecretStatus.Deleting;
return (
- <div
- className={twMerge(
- "flex items-center rounded-md border border-border bg-container-hover px-0.5 py-0.5 shadow-md",
- "pointer-events-none opacity-0 transition-all duration-300",
- "group-hover:pointer-events-auto group-hover:gap-1 group-hover:opacity-100"
- )}
- >
+ <div className="flex items-center gap-1 rounded-md border border-border bg-container-hover p-0.5 shadow-md">
<ProjectPermissionCan
I={ProjectPermissionDynamicSecretActions.Lease}
a={subject(ProjectPermissionSub.DynamicSecrets, {
@@ -151,11 +116,12 @@ export const DynamicSecretTableRow = ({
>
{(isAllowed) => (
<Tooltip>
- <TooltipTrigger>
+ <TooltipTrigger asChild>
<IconButton
+ aria-label="View leases"
variant="ghost"
size="xs"
- className="w-0 overflow-hidden border-0 transition-all duration-300 group-hover:w-7"
+ className="border-0"
isDisabled={!isAllowed || isRevoking}
onClick={(e) => {
e.stopPropagation();
@@ -179,11 +145,12 @@ export const DynamicSecretTableRow = ({
>
{(isAllowed) => (
<Tooltip>
- <TooltipTrigger>
+ <TooltipTrigger asChild>
<IconButton
+ aria-label="Generate lease"
variant="ghost"
size="xs"
- className="w-0 overflow-hidden border-0 transition-all duration-300 group-hover:w-7"
+ className="border-0"
isDisabled={!isAllowed || isRevoking}
onClick={(e) => {
e.stopPropagation();
@@ -207,11 +174,12 @@ export const DynamicSecretTableRow = ({
>
{(isAllowed) => (
<Tooltip>
- <TooltipTrigger>
+ <TooltipTrigger asChild>
<IconButton
+ aria-label="Edit dynamic secret"
variant="ghost"
size="xs"
- className="w-0 overflow-hidden border-0 transition-all duration-300 group-hover:w-7"
+ className="border-0"
isDisabled={!isAllowed || isRevoking}
onClick={(e) => {
e.stopPropagation();
@@ -236,11 +204,12 @@ export const DynamicSecretTableRow = ({
>
{(isAllowed) => (
<Tooltip>
- <TooltipTrigger>
+ <TooltipTrigger asChild>
<IconButton
+ aria-label="Force delete dynamic secret"
variant="ghost"
size="xs"
- className="w-0 overflow-hidden border-0 transition-all duration-300 group-hover:w-7 hover:text-danger"
+ className="border-0 hover:text-danger"
isDisabled={!isAllowed}
onClick={(e) => {
e.stopPropagation();
@@ -265,11 +234,12 @@ export const DynamicSecretTableRow = ({
>
{(isAllowed) => (
<Tooltip>
- <TooltipTrigger>
+ <TooltipTrigger asChild>
<IconButton
+ aria-label="Delete dynamic secret"
variant="ghost"
size="xs"
- className="w-0 overflow-hidden border-0 transition-all duration-300 group-hover:w-7 hover:text-danger"
+ className="border-0 hover:text-danger"
isDisabled={!isAllowed || isRevoking}
onClick={(e) => {
e.stopPropagation();
@@ -300,8 +270,19 @@ export const DynamicSecretTableRow = ({
!isSingleEnvView && isExpanded && "border-b-0 bg-container-hover"
)}
>
- {!isSingleEnvView && isExpanded ? (
- <ChevronDownIcon />
+ {!isSingleEnvView ? (
+ <IconButton
+ aria-label={`${isExpanded ? "Collapse" : "Expand"} ${dynamicSecretName}`}
+ aria-expanded={isExpanded}
+ variant="ghost-muted"
+ size="2xs"
+ onClick={(event) => {
+ event.stopPropagation();
+ setIsExpanded.toggle();
+ }}
+ >
+ {isExpanded ? <ChevronDownIcon /> : <ChevronRightIcon />}
+ </IconButton>
) : (
<FingerprintIcon className="text-dynamic-secret" />
)}
@@ -316,10 +297,10 @@ export const DynamicSecretTableRow = ({
colSpan={isSingleEnvView ? 2 : undefined}
>
{isSingleEnvView && singleEnvDynamicSecret ? (
- <div className="relative flex w-full items-center">
+ <div className="relative flex w-full items-center pr-40">
<span className="truncate">{dynamicSecretName}</span>
<Badge variant="neutral" className="ml-2">
- {DYNAMIC_SECRET_PROVIDER_NAMES[singleEnvDynamicSecret.type]}
+ {dynamicSecretProviderRegistry.requireDefinition(singleEnvDynamicSecret.type).label}
</Badge>
{renderStatusIndicator(singleEnvDynamicSecret)}
<div className="absolute top-1/2 -right-2.5 z-20 -translate-y-1/2">
@@ -395,10 +376,14 @@ export const DynamicSecretTableRow = ({
return (
<TableRow key={slug} className="group relative hover:z-10">
<TableCell colSpan={2}>
- <div className="relative flex w-full flex-wrap items-center">
+ <div className="relative flex w-full flex-wrap items-center pr-40">
<span>{envName}</span>
<Badge variant="neutral" className="ml-2">
- {DYNAMIC_SECRET_PROVIDER_NAMES[dynamicSecret.type]}
+ {
+ dynamicSecretProviderRegistry.requireDefinition(
+ dynamicSecret.type
+ ).label
+ }
</Badge>
{renderStatusIndicator(dynamicSecret)}
<div className="absolute top-1/2 -right-1.5 z-20 -translate-y-1/2">
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx
index ee6271b0f2..632fa005e4 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx
@@ -1,57 +1,24 @@
-import { useState } from "react";
-import { DiRedis } from "react-icons/di";
-import {
- SiApachecassandra,
- SiClickhouse,
- SiCouchbase,
- SiElasticsearch,
- SiFiles,
- SiKubernetes,
- SiMilvus,
- SiMongodb,
- SiRabbitmq,
- SiSap,
- SiSnowflake,
- SiTailscale
-} from "react-icons/si";
-import { VscAzure } from "react-icons/vsc";
-import { faAws, faGithub, faGoogle } from "@fortawesome/free-brands-svg-icons";
-import { faClock, faDatabase, faGlobe, faTerminal } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { AnimatePresence, motion } from "framer-motion";
+import { useCallback, useRef, useState } from "react";
-import { Modal, ModalContent } from "@app/components/v2";
-import { DocumentationLinkBadge } from "@app/components/v3";
+import {
+ DynamicSecretProviderForm,
+ dynamicSecretProviderRegistry,
+ SshDynamicSecretCreateForm
+} from "@app/components/dynamic-secrets";
+import {
+ DiscardChangesAlertDialog,
+ DocumentationLinkBadge,
+ Sheet,
+ SheetContent,
+ SheetDescription,
+ SheetHeader,
+ SheetTitle
+} from "@app/components/v3";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
import { ProjectEnv } from "@app/hooks/api/types";
+import { useDiscardChangesGuard } from "@app/hooks/useDiscardChangesGuard";
-import { AwsElastiCacheInputForm } from "./AwsElastiCacheInputForm";
-import { AwsIamInputForm } from "./AwsIamInputForm";
-import { AwsMemoryDbInputForm } from "./AwsMemoryDbInputForm";
-import { AzureEntraIdInputForm } from "./AzureEntraIdInputForm";
-import { AzureSqlDatabaseInputForm } from "./AzureSqlDatabaseInputForm";
-import { CassandraInputForm } from "./CassandraInputForm";
-import { ClickHouseInputForm } from "./ClickHouseInputForm";
-import { CouchbaseInputForm } from "./CouchbaseInputForm";
-import { ElasticSearchInputForm } from "./ElasticSearchInputForm";
-import { GcpIamInputForm } from "./GcpIamInputForm";
-import { GithubInputForm } from "./GithubInputForm";
-import { IbmApiConnectInputForm } from "./IbmApiConnectInputForm";
-import { KubernetesInputForm } from "./KubernetesInputForm";
-import { LdapInputForm } from "./LdapInputForm";
-import { MilvusInputForm } from "./MilvusInputForm";
-import { MongoAtlasInputForm } from "./MongoAtlasInputForm";
-import { MongoDBDatabaseInputForm } from "./MongoDBInputForm";
-import { RabbitMqInputForm } from "./RabbitMqInputForm";
-import { RedisInputForm } from "./RedisInputForm";
-import { SapAseInputForm } from "./SapAseInputForm";
-import { SapHanaInputForm } from "./SapHanaInputForm";
-import { SnowflakeInputForm } from "./SnowflakeInputForm";
-import { SqlDatabaseInputForm } from "./SqlDatabaseInputForm";
-import { SshInputForm } from "./SshInputForm";
-import { TailscaleInputForm } from "./TailscaleInputForm";
-import { TotpInputForm } from "./TotpInputForm";
-import { VerticaInputForm } from "./VerticaInputForm";
+import { DynamicSecretProviderSelect } from "./DynamicSecretProviderSelect";
type Props = {
isOpen?: boolean;
@@ -62,158 +29,6 @@ type Props = {
isSingleEnvironmentMode?: boolean;
};
-enum WizardSteps {
- SelectProvider = "select-provider",
- ProviderInputs = "provider-inputs"
-}
-
-const DYNAMIC_SECRET_LIST = [
- {
- icon: <FontAwesomeIcon icon={faDatabase} size="lg" />,
- provider: DynamicSecretProviders.SqlDatabase,
- title: "SQL\nDatabase"
- },
- {
- icon: <SiApachecassandra size="2rem" />,
- provider: DynamicSecretProviders.Cassandra,
- title: "Cassandra"
- },
- {
- icon: <DiRedis size="2rem" />,
- provider: DynamicSecretProviders.Redis,
- title: "Redis"
- },
- {
- icon: <FontAwesomeIcon icon={faAws} size="lg" />,
- provider: DynamicSecretProviders.AwsElastiCache,
- title: "AWS ElastiCache"
- },
- {
- icon: <FontAwesomeIcon icon={faAws} size="lg" />,
- provider: DynamicSecretProviders.AwsMemoryDb,
- title: "AWS MemoryDB"
- },
- {
- icon: <FontAwesomeIcon icon={faAws} size="lg" />,
- provider: DynamicSecretProviders.AwsIam,
- title: "AWS IAM"
- },
- {
- icon: <SiMongodb size="2rem" />,
- provider: DynamicSecretProviders.MongoAtlas,
- title: "Mongo Atlas"
- },
- {
- icon: <SiMongodb size="2rem" />,
- provider: DynamicSecretProviders.MongoDB,
- title: "Mongo DB"
- },
- {
- icon: <SiElasticsearch size="2rem" />,
- provider: DynamicSecretProviders.ElasticSearch,
- title: "Elastic Search"
- },
- {
- icon: <SiRabbitmq size="1.5rem" />,
- provider: DynamicSecretProviders.RabbitMq,
- title: "RabbitMQ"
- },
- {
- icon: <VscAzure size="1.5rem" />,
- provider: DynamicSecretProviders.AzureEntraId,
- title: "Azure Entra ID"
- },
- {
- icon: <VscAzure size="1.5rem" />,
- provider: DynamicSecretProviders.AzureSqlDatabase,
- title: "Azure SQL Database"
- },
- {
- icon: <SiFiles size="1.5rem" />,
- provider: DynamicSecretProviders.Ldap,
- title: "LDAP"
- },
- {
- icon: <SiSap size="1.5rem" />,
- provider: DynamicSecretProviders.SapHana,
- title: "SAP HANA"
- },
- {
- icon: <SiSap size="1.5rem" />,
- provider: DynamicSecretProviders.SapAse,
- title: "SAP ASE"
- },
- {
- icon: <SiSnowflake size="1.5rem" />,
- provider: DynamicSecretProviders.Snowflake,
- title: "Snowflake"
- },
- {
- icon: <FontAwesomeIcon icon={faClock} size="lg" />,
- provider: DynamicSecretProviders.Totp,
- title: "TOTP"
- },
- {
- icon: <FontAwesomeIcon icon={faDatabase} size="lg" />,
- provider: DynamicSecretProviders.Vertica,
- title: "Vertica"
- },
- {
- icon: <SiKubernetes size="1.5rem" />,
- provider: DynamicSecretProviders.Kubernetes,
- title: "Kubernetes"
- },
- {
- icon: <FontAwesomeIcon icon={faGoogle} size="lg" />,
- provider: DynamicSecretProviders.GcpIam,
- title: "GCP IAM"
- },
- {
- icon: <FontAwesomeIcon icon={faGithub} size="lg" />,
- provider: DynamicSecretProviders.Github,
- title: "GitHub"
- },
- {
- icon: <SiCouchbase size="1.5rem" />,
- provider: DynamicSecretProviders.Couchbase,
- title: "Couchbase"
- },
- {
- icon: <SiMilvus size="1.5rem" />,
- provider: DynamicSecretProviders.Milvus,
- title: "Milvus"
- },
- {
- icon: <SiClickhouse size="1.5rem" />,
- provider: DynamicSecretProviders.Clickhouse,
- title: "ClickHouse"
- },
- {
- icon: <FontAwesomeIcon icon={faTerminal} size="lg" />,
- provider: DynamicSecretProviders.Ssh,
- title: "SSH"
- },
- {
- icon: <FontAwesomeIcon icon={faGlobe} size="lg" />,
- provider: DynamicSecretProviders.IbmApiConnect,
- title: "IBM API Connect"
- },
- {
- icon: <SiTailscale size="1.5rem" />,
- provider: DynamicSecretProviders.Tailscale,
- title: "Tailscale"
- }
-];
-
-const DynamicSecretDetails = Object.fromEntries(
- DYNAMIC_SECRET_LIST.map((ds) => [ds.provider, ds.title])
-);
-
-const UniqueLinks: Record<string, string> = {
- [DynamicSecretProviders.SqlDatabase]: "postgresql", // gotta pick one...
- [DynamicSecretProviders.MongoAtlas]: "mongo-atlas"
-};
-
export const CreateDynamicSecretForm = ({
isOpen,
onToggle,
@@ -222,582 +37,108 @@ export const CreateDynamicSecretForm = ({
secretPath,
isSingleEnvironmentMode
}: Props) => {
- const [wizardStep, setWizardStep] = useState(WizardSteps.SelectProvider);
- const [selectedProvider, setSelectedProvider] = useState<DynamicSecretProviders | null>(null);
+ const [selectedProvider, setSelectedProvider] = useState<DynamicSecretProviders>();
+ const [isDirty, setIsDirty] = useState(false);
+ const discardActionRef = useRef<"back" | "close">("close");
+ const definition = selectedProvider
+ ? dynamicSecretProviderRegistry.requireDefinition(selectedProvider)
+ : undefined;
- const handleFormReset = (state: boolean = false) => {
- onToggle(state);
- setWizardStep(WizardSteps.SelectProvider);
- setSelectedProvider(null);
+ const close = useCallback(() => {
+ setIsDirty(false);
+ setSelectedProvider(undefined);
+ onToggle(false);
+ }, [onToggle]);
+ const handleDiscard = useCallback(() => {
+ setIsDirty(false);
+ if (discardActionRef.current === "back") {
+ setSelectedProvider(undefined);
+ return;
+ }
+ close();
+ }, [close]);
+ const { confirmDiscard, isDiscardDialogOpen, requestDiscard, setIsDiscardDialogOpen } =
+ useDiscardChangesGuard({ isDirty, onDiscard: handleDiscard });
+ const requestClose = () => {
+ discardActionRef.current = "close";
+ requestDiscard();
+ };
+ const requestBack = () => {
+ discardActionRef.current = "back";
+ requestDiscard();
};
- const modalTitle = selectedProvider ? DynamicSecretDetails[selectedProvider] : null;
+ const header = definition ? (
+ <SheetHeader className="-mx-4 -mt-5">
+ <SheetTitle className="flex items-center gap-2">
+ Add {definition.label} Dynamic Secret
+ <DocumentationLinkBadge
+ href={`https://infisical.com/docs/documentation/platform/dynamic-secrets/${dynamicSecretProviderRegistry.getDocsSlug(definition.provider)}`}
+ />
+ </SheetTitle>
+ <SheetDescription>Configure dynamic secret parameters.</SheetDescription>
+ </SheetHeader>
+ ) : undefined;
- return (
- <Modal isOpen={isOpen} onOpenChange={(state) => handleFormReset(state)}>
- <ModalContent
- title={
- <div className="flex items-center gap-x-2">
- <span>{modalTitle ? `${modalTitle} Dynamic Secret` : "Dynamic Secrets"} </span>
- <DocumentationLinkBadge
- href={`https://infisical.com/docs/documentation/platform/dynamic-secrets/${selectedProvider ? (UniqueLinks[selectedProvider] ?? selectedProvider) : "overview"}`}
- />
- </div>
- }
- subTitle="Configure dynamic secret parameters"
- className="my-4 max-w-3xl"
- >
- <AnimatePresence mode="wait">
- {wizardStep === WizardSteps.SelectProvider && (
- <motion.div
- key="select-type-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <div className="mb-4 text-mineshaft-300">Select a service to connect to:</div>
- <div className="grid grid-cols-4 gap-2">
- {DYNAMIC_SECRET_LIST.map(({ icon, provider, title }) => (
- <div
- key={`dynamic-secret-provider-${provider}`}
- className="flex h-30 w-42 cursor-pointer flex-col items-center space-y-4 rounded-sm border border-mineshaft-500 bg-bunker-600 p-6 transition-all hover:border-primary/70 hover:bg-primary/10 hover:text-white"
- role="button"
- tabIndex={0}
- onClick={() => {
- setSelectedProvider(provider);
- setWizardStep(WizardSteps.ProviderInputs);
- }}
- onKeyDown={(evt) => {
- if (evt.key === "Enter") {
- setSelectedProvider(provider);
- setWizardStep(WizardSteps.ProviderInputs);
- }
- }}
- >
- {icon}
- <div className="text-center text-sm whitespace-pre-wrap">{title}</div>
- </div>
- ))}
- </div>
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.SqlDatabase && (
- <motion.div
- key="dynamic-sql-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <SqlDatabaseInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Redis && (
- <motion.div
- key="dynamic-redis-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <RedisInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.AwsElastiCache && (
- <motion.div
- key="dynamic-aws-elasticache-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <AwsElastiCacheInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.AwsMemoryDb && (
- <motion.div
- key="dynamic-aws-memorydb-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <AwsMemoryDbInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Cassandra && (
- <motion.div
- key="dynamic-cassandra-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <CassandraInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.AwsIam && (
- <motion.div
- key="dynamic-aws-iam-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <AwsIamInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.MongoAtlas && (
- <motion.div
- key="dynamic-atlas-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <MongoAtlasInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.ElasticSearch && (
- <motion.div
- key="dynamic-elastic-search-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <ElasticSearchInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.MongoDB && (
- <motion.div
- key="dynamic-mongodb-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <MongoDBDatabaseInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.RabbitMq && (
- <motion.div
- key="dynamic-rabbit-mq-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <RabbitMqInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.AzureEntraId && (
- <motion.div
- key="dynamic-azure-entra-id-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <AzureEntraIdInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.AzureSqlDatabase && (
- <motion.div
- key="dynamic-azure-sql-database-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <AzureSqlDatabaseInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Ldap && (
- <motion.div
- key="dynamic-ldap-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <LdapInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.SapHana && (
- <motion.div
- key="dynamic-sap-hana-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <SapHanaInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
+ let content = (
+ <>
+ <SheetHeader>
+ <SheetTitle className="flex items-center gap-2">
+ Choose a Dynamic Secret Provider
+ </SheetTitle>
+ <SheetDescription>
+ Select the provider whose credentials Infisical should generate.
+ </SheetDescription>
+ </SheetHeader>
+ <DynamicSecretProviderSelect onSelect={setSelectedProvider} />
+ </>
+ );
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.SapAse && (
- <motion.div
- key="dynamic-sap-ase-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- >
- <SapAseInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
+ if (definition) {
+ content =
+ selectedProvider === DynamicSecretProviders.Ssh ? (
+ <SshDynamicSecretCreateForm
+ header={header}
+ onCompleted={close}
+ onCancel={requestClose}
+ onBack={requestBack}
+ onDirtyChange={setIsDirty}
+ projectSlug={projectSlug}
+ secretPath={secretPath}
+ environments={environments}
+ isSingleEnvironmentMode={isSingleEnvironmentMode}
+ />
+ ) : (
+ <DynamicSecretProviderForm
+ mode="create"
+ definition={definition}
+ header={header}
+ onCompleted={close}
+ onCancel={requestClose}
+ onBack={requestBack}
+ onDirtyChange={setIsDirty}
+ projectSlug={projectSlug}
+ secretPath={secretPath}
+ environments={environments}
+ isSingleEnvironmentMode={isSingleEnvironmentMode}
+ />
+ );
+ }
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Snowflake && (
- <motion.div
- key="dynamic-snowflake-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <SnowflakeInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Totp && (
- <motion.div
- key="dynamic-totp-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <TotpInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Kubernetes && (
- <motion.div
- key="dynamic-kubernetes-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <KubernetesInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Vertica && (
- <motion.div
- key="dynamic-vertica-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <VerticaInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.GcpIam && (
- <motion.div
- key="dynamic-gcp-iam-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <GcpIamInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Github && (
- <motion.div
- key="dynamic-github-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <GithubInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Couchbase && (
- <motion.div
- key="dynamic-couchbase-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <CouchbaseInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Milvus && (
- <motion.div
- key="dynamic-milvus-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <MilvusInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Clickhouse && (
- <motion.div
- key="dynamic-clickhouse-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <ClickHouseInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Ssh && (
- <motion.div
- key="dynamic-ssh-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <SshInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.IbmApiConnect && (
- <motion.div
- key="dynamic-ibm-api-connect-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <IbmApiConnectInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- {wizardStep === WizardSteps.ProviderInputs &&
- selectedProvider === DynamicSecretProviders.Tailscale && (
- <motion.div
- key="dynamic-tailscale-step"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <TailscaleInputForm
- onCompleted={handleFormReset}
- onCancel={handleFormReset}
- projectSlug={projectSlug}
- secretPath={secretPath}
- environments={environments}
- isSingleEnvironmentMode={isSingleEnvironmentMode}
- />
- </motion.div>
- )}
- </AnimatePresence>
- </ModalContent>
- </Modal>
+ return (
+ <>
+ <Sheet open={isOpen} onOpenChange={(open) => !open && requestClose()}>
+ <SheetContent className="flex h-full max-h-full w-full flex-col gap-y-0 p-0 sm:w-3/4 sm:max-w-[1500px]">
+ {content}
+ </SheetContent>
+ </Sheet>
+ <DiscardChangesAlertDialog
+ open={isDiscardDialogOpen}
+ onOpenChange={setIsDiscardDialogOpen}
+ onDiscard={confirmDiscard}
+ title="Discard Dynamic Secret Setup?"
+ description="Your progress configuring this dynamic secret will be lost."
+ />
+ </>
);
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/DynamicSecretProviderSelect.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/DynamicSecretProviderSelect.tsx
new file mode 100644
index 0000000000..961c51c119
--- /dev/null
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/DynamicSecretProviderSelect.tsx
@@ -0,0 +1,117 @@
+import { useMemo, useState } from "react";
+import { KeyRoundIcon, SearchIcon } from "lucide-react";
+
+import { dynamicSecretProviderRegistry } from "@app/components/dynamic-secrets";
+import {
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput
+} from "@app/components/v3";
+import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
+
+const ProviderCard = ({
+ provider,
+ onSelect
+}: {
+ provider: DynamicSecretProviders;
+ onSelect: () => void;
+}) => {
+ const definition = dynamicSecretProviderRegistry.requireDefinition(provider);
+ const { providerFamily, logoFileName } =
+ dynamicSecretProviderRegistry.requirePresentation(provider);
+
+ return (
+ <button
+ type="button"
+ onClick={onSelect}
+ className="group flex cursor-pointer flex-col gap-3 rounded-md border border-border bg-card p-4 text-left transition-colors hover:border-foreground/15 hover:bg-container-hover focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"
+ >
+ <div className="flex items-start justify-between gap-2">
+ <div className="flex size-9 items-center justify-center rounded-md bg-container">
+ {logoFileName ? (
+ <img
+ src={`/images/integrations/${logoFileName}`}
+ alt={`${providerFamily} logo`}
+ className="size-6 object-contain"
+ />
+ ) : (
+ <KeyRoundIcon className="size-5 text-muted" aria-hidden="true" />
+ )}
+ </div>
+ <span className="text-xs font-medium text-muted">{providerFamily}</span>
+ </div>
+ <div className="flex flex-col gap-1">
+ <p className="text-sm font-semibold text-foreground">{definition.label}</p>
+ <p className="text-xs leading-relaxed text-muted">
+ Generate time-limited {definition.label} credentials on demand.
+ </p>
+ </div>
+ </button>
+ );
+};
+
+export const DynamicSecretProviderSelect = ({
+ onSelect
+}: {
+ onSelect: (provider: DynamicSecretProviders) => void;
+}) => {
+ const [search, setSearch] = useState("");
+ const filteredProviders = useMemo(() => {
+ const query = search.trim().toLowerCase();
+ if (!query) return dynamicSecretProviderRegistry.providers;
+
+ return dynamicSecretProviderRegistry.providers.filter((provider) => {
+ const definition = dynamicSecretProviderRegistry.requireDefinition(provider);
+ const { providerFamily } = dynamicSecretProviderRegistry.requirePresentation(provider);
+ return [definition.label, providerFamily, provider].some((value) =>
+ value.toLowerCase().includes(query)
+ );
+ });
+ }, [search]);
+
+ return (
+ <div className="@container flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4">
+ <InputGroup>
+ <InputGroupAddon align="inline-start">
+ <SearchIcon />
+ </InputGroupAddon>
+ <InputGroupInput
+ value={search}
+ onChange={(event) => setSearch(event.target.value)}
+ placeholder="Search providers — SQL, AWS, MongoDB..."
+ aria-label="Search dynamic secret providers"
+ />
+ </InputGroup>
+
+ <section>
+ <p className="mb-3 text-xs font-medium text-muted">All providers</p>
+ {filteredProviders.length ? (
+ <div className="grid grid-cols-1 gap-3 @xl:grid-cols-2 @4xl:grid-cols-3">
+ {filteredProviders.map((provider) => (
+ <ProviderCard
+ key={provider}
+ provider={provider}
+ onSelect={() => onSelect(provider)}
+ />
+ ))}
+ </div>
+ ) : (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <SearchIcon />
+ </EmptyMedia>
+ <EmptyTitle>No matching providers</EmptyTitle>
+ <EmptyDescription>Try a different search term.</EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ </section>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultCassandraImportModal.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultCassandraImportModal.tsx
index 7f201adea7..fb34e3752e 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultCassandraImportModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultCassandraImportModal.tsx
@@ -1,6 +1,5 @@
import { useEffect, useState } from "react";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import {
defaultVaultConnectionId,
@@ -15,6 +14,7 @@ import {
ModalClose,
ModalContent
} from "@app/components/v2";
+import { Alert, AlertDescription } from "@app/components/v3";
import { TAvailableAppConnection } from "@app/hooks/api/appConnections/types";
import { useGetVaultDatabaseRoles, useGetVaultMounts } from "@app/hooks/api/migration/queries";
import { VaultDatabaseRole } from "@app/hooks/api/migration/types";
@@ -125,18 +125,13 @@ const Content = ({ onClose, appConnections, onImport }: ContentProps) => {
return (
<>
- <div className="mb-4 rounded-md bg-primary/10 p-3 text-sm text-mineshaft-200">
- <div className="flex items-start gap-2">
- <FontAwesomeIcon icon={faInfoCircle} className="mt-0.5 text-primary" />
- <div className="space-y-1.5 text-xs leading-relaxed">
- <p>
- Select a Cassandra database role from Vault to pre-fill the form with its
- configuration including connection details, creation/revocation statements, TTL
- settings, etc.
- </p>
- </div>
- </div>
- </div>
+ <Alert variant="info" className="mb-4">
+ <InfoIcon />
+ <AlertDescription>
+ Select a Cassandra database role from Vault to pre-fill the form with its configuration
+ including connection details, creation/revocation statements, TTL settings, etc.
+ </AlertDescription>
+ </Alert>
<VaultConnectionAndNamespaceFields
appConnections={appConnections}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultKubernetesImportModal.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultKubernetesImportModal.tsx
index 8b6b1a6f79..7193d00cae 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultKubernetesImportModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultKubernetesImportModal.tsx
@@ -1,6 +1,5 @@
import { useEffect, useState } from "react";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import {
defaultVaultConnectionId,
@@ -15,6 +14,7 @@ import {
ModalClose,
ModalContent
} from "@app/components/v2";
+import { Alert, AlertDescription } from "@app/components/v3";
import { TAvailableAppConnection } from "@app/hooks/api/appConnections/types";
import { useGetVaultKubernetesRoles, useGetVaultMounts } from "@app/hooks/api/migration/queries";
import { VaultKubernetesRole } from "@app/hooks/api/migration/types";
@@ -121,17 +121,13 @@ const Content = ({ onClose, appConnections, onImport }: ContentProps) => {
return (
<>
- <div className="mb-4 rounded-md bg-primary/10 p-3 text-sm text-mineshaft-200">
- <div className="flex items-start gap-2">
- <FontAwesomeIcon icon={faInfoCircle} className="mt-0.5 text-primary" />
- <div className="space-y-1.5 text-xs leading-relaxed">
- <p>
- Select a Kubernetes secrets engine role from Vault to pre-fill the form with its
- configuration including cluster URL, CA certificate, TTL settings, etc.
- </p>
- </div>
- </div>
- </div>
+ <Alert variant="info" className="mb-4">
+ <InfoIcon />
+ <AlertDescription>
+ Select a Kubernetes secrets engine role from Vault to pre-fill the form with its
+ configuration including cluster URL, CA certificate, TTL settings, etc.
+ </AlertDescription>
+ </Alert>
<VaultConnectionAndNamespaceFields
appConnections={appConnections}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultLdapImportModal.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultLdapImportModal.tsx
index be3bbbde24..9ccff3875c 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultLdapImportModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultLdapImportModal.tsx
@@ -1,6 +1,5 @@
import { useEffect, useState } from "react";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import {
defaultVaultConnectionId,
@@ -15,6 +14,7 @@ import {
ModalClose,
ModalContent
} from "@app/components/v2";
+import { Alert, AlertDescription } from "@app/components/v3";
import { TAvailableAppConnection } from "@app/hooks/api/appConnections/types";
import { useGetVaultLdapRoles, useGetVaultMounts } from "@app/hooks/api/migration/queries";
import { VaultLdapRole } from "@app/hooks/api/migration/types";
@@ -121,17 +121,13 @@ const Content = ({ onClose, appConnections, onImport }: ContentProps) => {
return (
<>
- <div className="mb-4 rounded-md bg-primary/10 p-3 text-sm text-mineshaft-200">
- <div className="flex items-start gap-2">
- <FontAwesomeIcon icon={faInfoCircle} className="mt-0.5 text-primary" />
- <div className="space-y-1.5 text-xs leading-relaxed">
- <p>
- Select an LDAP secrets engine role from Vault to pre-fill the form with its
- configuration including connection details, LDIF statements, TTL settings, etc.
- </p>
- </div>
- </div>
- </div>
+ <Alert variant="info" className="mb-4">
+ <InfoIcon />
+ <AlertDescription>
+ Select an LDAP secrets engine role from Vault to pre-fill the form with its configuration
+ including connection details, LDIF statements, TTL settings, etc.
+ </AlertDescription>
+ </Alert>
<VaultConnectionAndNamespaceFields
appConnections={appConnections}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultSqlDatabaseImportModal.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultSqlDatabaseImportModal.tsx
index d9b1f48cea..d6bcb3d9e1 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultSqlDatabaseImportModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VaultSqlDatabaseImportModal.tsx
@@ -1,6 +1,5 @@
import { useEffect, useState } from "react";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import {
defaultVaultConnectionId,
@@ -15,6 +14,7 @@ import {
ModalClose,
ModalContent
} from "@app/components/v2";
+import { Alert, AlertDescription } from "@app/components/v3";
import { TAvailableAppConnection } from "@app/hooks/api/appConnections/types";
import { useGetVaultDatabaseRoles, useGetVaultMounts } from "@app/hooks/api/migration/queries";
import { VaultDatabaseRole } from "@app/hooks/api/migration/types";
@@ -121,18 +121,14 @@ const Content = ({ onClose, appConnections, onImport }: ContentProps) => {
return (
<>
- <div className="mb-4 rounded-md bg-primary/10 p-3 text-sm text-mineshaft-200">
- <div className="flex items-start gap-2">
- <FontAwesomeIcon icon={faInfoCircle} className="mt-0.5 text-primary" />
- <div className="space-y-1.5 text-xs leading-relaxed">
- <p>
- Select a database secrets engine role from Vault to pre-fill the form with its
- configuration including connection details, creation/revocation statements, TTL
- settings, etc.
- </p>
- </div>
- </div>
- </div>
+ <Alert variant="info" className="mb-4">
+ <InfoIcon />
+ <AlertDescription>
+ Select a database secrets engine role from Vault to pre-fill the form with its
+ configuration including connection details, creation/revocation statements, TTL settings,
+ etc.
+ </AlertDescription>
+ </Alert>
<VaultConnectionAndNamespaceFields
appConnections={appConnections}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/components/LoadFromVaultBanner.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/components/LoadFromVaultBanner.tsx
index 29bb96bdf4..37358d8c5d 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/components/LoadFromVaultBanner.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/components/LoadFromVaultBanner.tsx
@@ -1,7 +1,6 @@
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
-import { Button, Tooltip } from "@app/components/v2";
+import { Alert, AlertAction, AlertDescription, Button } from "@app/components/v3";
import { ProjectPermissionSub, useProject } from "@app/context";
import { useCanUseProjectAppConnectionImport } from "@app/hooks";
import { useListAvailableAppConnections } from "@app/hooks/api/appConnections";
@@ -25,32 +24,24 @@ export const LoadFromVaultBanner = ({ onClick }: Props) => {
if (hasVaultConnection && canUseAppConnectionImport) {
return (
- <div className="mb-4 flex items-center justify-between rounded-md border border-primary-400/30 bg-primary/10 px-3 py-2.5">
- <div className="flex items-center gap-2 text-sm">
- <FontAwesomeIcon icon={faInfoCircle} className="text-primary" />
- <span className="text-mineshaft-200">Load values from HashiCorp Vault</span>
- </div>
- <Tooltip
- content={
- !canUseAppConnectionImport
- ? "Only authorized users can import configurations from HashiCorp Vault"
- : undefined
- }
- >
- <Button
- variant="outline_bg"
- size="xs"
- type="button"
- onClick={onClick}
- isDisabled={!canUseAppConnectionImport}
- leftIcon={
- <img src="/images/integrations/Vault.png" alt="HashiCorp Vault" className="h-4 w-4" />
- }
- >
- Load from Vault
- </Button>
- </Tooltip>
- </div>
+ <Alert variant="info" className="mb-4">
+ <InfoIcon />
+ <AlertDescription>
+ <span>Load values from HashiCorp Vault</span>
+ <AlertAction>
+ <Button
+ variant="info"
+ size="xs"
+ type="button"
+ onClick={onClick}
+ isDisabled={!canUseAppConnectionImport}
+ >
+ <img src="/images/integrations/Vault.png" alt="" className="size-4" />
+ Load from Vault
+ </Button>
+ </AlertAction>
+ </AlertDescription>
+ </Alert>
);
}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx
index ab0c5ea681..df20ac2f87 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx
@@ -1,26 +1,31 @@
-import { ReactNode, useEffect, useState } from "react";
+import { ReactNode, useEffect, useId, useState } from "react";
import { Controller, useForm } from "react-hook-form";
-import { faCheck, faClock, faCopy, faDownload } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
import FileSaver from "file-saver";
-import { AnimatePresence, motion } from "framer-motion";
+import { CheckIcon, Clock3Icon, CopyIcon, DownloadIcon, PlusIcon, Trash2Icon } from "lucide-react";
import ms from "ms";
import { z } from "zod";
-import { TtlFormLabel } from "@app/components/features";
+import {
+ dynamicSecretProviderRegistry,
+ TDynamicSecretLeaseOutput
+} from "@app/components/dynamic-secrets";
import { createNotification } from "@app/components/notifications";
import {
Button,
- FormControl,
- FormLabel,
+ DialogFooter,
+ Field,
+ FieldDescription,
+ FieldFeedback,
+ FieldLabel,
IconButton,
Input,
SecretInput,
Spinner,
- Tag,
- Tooltip
-} from "@app/components/v2";
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useTimedReset, useToggle } from "@app/hooks";
import { useCreateDynamicSecretLease } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
@@ -28,40 +33,52 @@ import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
const OutputDisplay = ({
value,
label,
- helperText
+ helperText,
+ isVisible
}: {
value: string;
label: string;
helperText?: ReactNode;
+ isVisible?: boolean;
}) => {
+ const inputId = useId();
const [copyText, isCopying, setCopyText] = useTimedReset<string>({
initialState: "Copy to clipboard"
});
return (
- <div className="relative">
- <FormControl label={label} className="grow" helperText={helperText}>
+ <Field className="relative mb-4 last:mb-0">
+ <FieldLabel htmlFor={inputId}>{label}</FieldLabel>
+ <div className="relative">
<SecretInput
+ id={inputId}
isReadOnly
+ isVisible={isVisible}
value={value}
- containerClassName="text-bunker-300 hover:border-primary-400/50 border border-mineshaft-600 bg-mineshaft-900 px-2 py-1.5"
+ aria-describedby={helperText ? `${inputId}-description` : undefined}
/>
- </FormControl>
- <Tooltip content={copyText}>
- <IconButton
- ariaLabel="Copy to clipboard"
- variant="plain"
- size="md"
- className="absolute top-7 right-2"
- onClick={() => {
- navigator.clipboard.writeText(value as string);
- setCopyText("Copied");
- }}
- >
- <FontAwesomeIcon icon={isCopying ? faCheck : faCopy} />
- </IconButton>
- </Tooltip>
- </div>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label={`Copy ${label}`}
+ variant="ghost-muted"
+ size="xs"
+ className="absolute top-1 right-1"
+ onClick={() => {
+ navigator.clipboard.writeText(value).catch(() => undefined);
+ setCopyText("Copied");
+ }}
+ >
+ {isCopying ? <CheckIcon /> : <CopyIcon />}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>{copyText}</TooltipContent>
+ </Tooltip>
+ </div>
+ {helperText && (
+ <FieldDescription id={`${inputId}-description`}>{helperText}</FieldDescription>
+ )}
+ </Field>
);
};
@@ -102,27 +119,23 @@ const TotpOutputDisplay = ({
<OutputDisplay label="Time-based one-time password" value={totp} />
{remainingTime > 0 ? (
<div
- className={`ml-2 flex items-center text-sm ${
- remainingTime < 10 ? "text-red-500" : "text-yellow-500"
+ className={`flex items-center gap-1 text-sm ${
+ remainingTime < 10 ? "text-danger" : "text-warning"
} transition-colors duration-500`}
>
- <FontAwesomeIcon className="mr-1" icon={faClock} size="sm" />
+ <Clock3Icon className="size-4" />
<span>
Expires in {remainingTime} {remainingTime > 1 ? "seconds" : "second"}
</span>
</div>
) : (
- <div className="ml-2 flex items-center text-sm text-red-500">
- <FontAwesomeIcon className="mr-1" icon={faClock} size="sm" />
+ <div className="flex items-center gap-1 text-sm text-danger">
+ <Clock3Icon className="size-4" />
Expired
</div>
)}
{shouldShowRegenerate && (
- <Button
- colorSchema="secondary"
- className="mt-2"
- onClick={() => triggerLeaseRegeneration({})}
- >
+ <Button className="mt-2" onClick={() => triggerLeaseRegeneration({})}>
Regenerate
</Button>
)}
@@ -131,222 +144,11 @@ const TotpOutputDisplay = ({
};
const renderOutputForm = (
- provider: DynamicSecretProviders,
+ output: TDynamicSecretLeaseOutput,
data: unknown,
triggerLeaseRegeneration: (details: { ttl?: string }) => Promise<void>
) => {
- if (
- provider === DynamicSecretProviders.SqlDatabase ||
- provider === DynamicSecretProviders.Cassandra ||
- provider === DynamicSecretProviders.MongoAtlas ||
- provider === DynamicSecretProviders.MongoDB ||
- provider === DynamicSecretProviders.Vertica ||
- provider === DynamicSecretProviders.SapAse ||
- provider === DynamicSecretProviders.AzureSqlDatabase ||
- provider === DynamicSecretProviders.Clickhouse ||
- provider === DynamicSecretProviders.Milvus
- ) {
- const { DB_PASSWORD, DB_USERNAME } = data as { DB_USERNAME: string; DB_PASSWORD: string };
- return (
- <div>
- <OutputDisplay label="Database User" value={DB_USERNAME} />
- <OutputDisplay
- label="Database Password"
- value={DB_PASSWORD}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.AwsIam) {
- const { USERNAME, ACCESS_KEY, SECRET_ACCESS_KEY, SESSION_TOKEN } = data as {
- ACCESS_KEY: string;
- SECRET_ACCESS_KEY: string;
- USERNAME?: string;
- SESSION_TOKEN?: string;
- };
- return (
- <div>
- {USERNAME && <OutputDisplay label="AWS IAM Username" value={USERNAME} />}
- <OutputDisplay label="AWS IAM Access Key" value={ACCESS_KEY} />
- <OutputDisplay label="AWS IAM Secret Key" value={SECRET_ACCESS_KEY} />
- {SESSION_TOKEN && <OutputDisplay label="AWS IAM Session Token" value={SESSION_TOKEN} />}
- <div className="mt-2 text-xs text-mineshaft-300">
- Important: Copy these credentials now. You will not be able to see them again after you
- close the modal.
- </div>
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.Redis) {
- const { DB_USERNAME, DB_PASSWORD } = data as {
- DB_USERNAME: string;
- DB_PASSWORD: string;
- };
-
- return (
- <div>
- <OutputDisplay label="Redis Username" value={DB_USERNAME} />
- <OutputDisplay
- label="Redis Password"
- value={DB_PASSWORD}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (
- provider === DynamicSecretProviders.AwsElastiCache ||
- provider === DynamicSecretProviders.AwsMemoryDb
- ) {
- const { DB_USERNAME, DB_PASSWORD } = data as {
- DB_USERNAME: string;
- DB_PASSWORD: string;
- };
-
- return (
- <div>
- <OutputDisplay label="Cluster Username" value={DB_USERNAME} />
- <OutputDisplay
- label="Cluster Password"
- value={DB_PASSWORD}
- helperText={
- <div className="space-y-4">
- <p>
- Important: Copy these credentials now. You will not be able to see them again after
- you close the modal.
- </p>
- <p className="font-medium">
- Please note that it may take a few minutes before the credentials are available for
- use.
- </p>
- </div>
- }
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.RabbitMq) {
- const { DB_USERNAME, DB_PASSWORD } = data as {
- DB_USERNAME: string;
- DB_PASSWORD: string;
- };
-
- return (
- <div>
- <OutputDisplay label="Username" value={DB_USERNAME} />
- <OutputDisplay
- label="Password"
- value={DB_PASSWORD}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.ElasticSearch) {
- const { DB_USERNAME, DB_PASSWORD } = data as {
- DB_USERNAME: string;
- DB_PASSWORD: string;
- };
-
- return (
- <div>
- <OutputDisplay label="Username" value={DB_USERNAME} />
- <OutputDisplay
- label="Password"
- value={DB_PASSWORD}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.AzureEntraId) {
- const { email, password } = data as {
- email: string;
- password: string;
- };
-
- return (
- <div>
- <OutputDisplay label="Email" value={email} />
- <OutputDisplay
- label="Password"
- value={password}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.Ldap) {
- const { USERNAME, PASSWORD, DN_ARRAY } = data as {
- USERNAME: string;
- PASSWORD: string;
- DN_ARRAY: string[];
- };
-
- return (
- <div>
- <OutputDisplay label="Username" value={USERNAME} />
- <OutputDisplay
- label="Password"
- value={PASSWORD}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- <FormControl label="DNs" className="grow">
- <SecretInput
- isReadOnly
- isVisible
- value={JSON.stringify(DN_ARRAY)}
- containerClassName="text-bunker-300 hover:border-primary-400/50 border border-mineshaft-600 bg-mineshaft-900 px-2 py-1.5"
- />
- </FormControl>
- </div>
- );
- }
-
- if (
- provider === DynamicSecretProviders.SapHana ||
- provider === DynamicSecretProviders.Snowflake
- ) {
- const { DB_USERNAME, DB_PASSWORD } = data as {
- DB_USERNAME: string;
- DB_PASSWORD: string;
- };
-
- return (
- <div>
- <OutputDisplay label="Username" value={DB_USERNAME} />
- <OutputDisplay
- label="Password"
- value={DB_PASSWORD}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.Kubernetes) {
- const { TOKEN } = data as { TOKEN: string };
-
- return (
- <div>
- <OutputDisplay
- label="Service Account JWT"
- value={TOKEN}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.Totp) {
+ if (output.type === "totp") {
const { TOTP, TIME_REMAINING } = data as {
TOTP: string;
TIME_REMAINING: number;
@@ -361,106 +163,46 @@ const renderOutputForm = (
);
}
- if (provider === DynamicSecretProviders.GcpIam) {
- const { TOKEN, SERVICE_ACCOUNT_EMAIL } = data as {
- SERVICE_ACCOUNT_EMAIL: string;
- TOKEN: string;
- };
-
- return (
- <div>
- <OutputDisplay label="Service Account Email" value={SERVICE_ACCOUNT_EMAIL} />
- <OutputDisplay
- label="Token"
- value={TOKEN}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.Github) {
- const { TOKEN } = data as {
- TOKEN: string;
- };
-
- return (
- <div>
- <OutputDisplay
- label="Token"
- value={TOKEN}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
-
- if (provider === DynamicSecretProviders.Couchbase) {
- const { username, password } = data as {
- username: string;
- password: string;
- };
-
- return (
- <div>
- <OutputDisplay label="Username" value={username} />
- <OutputDisplay
- label="Password"
- value={password}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
+ if (output.type === "ssh") {
+ throw new Error("SSH lease output must be rendered by the SSH provisioner.");
}
- if (provider === DynamicSecretProviders.IbmApiConnect) {
- const { CLIENT_ID, CLIENT_SECRET } = data as {
- CLIENT_ID: string;
- CLIENT_SECRET: string;
- };
+ const values = data as Record<string, unknown>;
- return (
- <div>
- <OutputDisplay label="Client ID" value={CLIENT_ID} />
- <OutputDisplay
- label="Client Secret"
- value={CLIENT_SECRET}
- helperText="Important: Copy these credentials now. You will not be able to see them again after you close the modal."
- />
- </div>
- );
- }
+ return (
+ <div>
+ {output.fields.map((field) => {
+ const rawValue = values[field.key];
+ if (field.isOptional && (rawValue === undefined || rawValue === null || rawValue === "")) {
+ return null;
+ }
- if (provider === DynamicSecretProviders.Tailscale) {
- const { KEY_ID, AUTH_KEY, CLIENT_ID, CLIENT_SECRET, FEDERATED_CREDENTIAL_ID, AUDIENCE } =
- data as {
- KEY_ID?: string;
- AUTH_KEY?: string;
- CLIENT_ID?: string;
- CLIENT_SECRET?: string;
- FEDERATED_CREDENTIAL_ID?: string;
- AUDIENCE?: string;
- };
+ const value = field.format === "json" ? JSON.stringify(rawValue) : String(rawValue ?? "");
- return (
- <div>
- {KEY_ID && <OutputDisplay label="Key ID" value={KEY_ID} />}
- {AUTH_KEY && <OutputDisplay label="Auth Key" value={AUTH_KEY} />}
- {CLIENT_ID && <OutputDisplay label="Client ID" value={CLIENT_ID} />}
- {CLIENT_SECRET && <OutputDisplay label="Client Secret" value={CLIENT_SECRET} />}
- {FEDERATED_CREDENTIAL_ID && (
- <OutputDisplay label="Federated Credential ID" value={FEDERATED_CREDENTIAL_ID} />
- )}
- {AUDIENCE && <OutputDisplay label="Audience" value={AUDIENCE} />}
- <div className="mt-2 text-xs text-mineshaft-300">
- Important: Copy these credentials now. You will not be able to see them again after you
- close the modal.
+ return (
+ <OutputDisplay
+ key={field.key}
+ label={field.label}
+ value={value}
+ isVisible={field.format === "json"}
+ />
+ );
+ })}
+ {output.notice && (
+ <div className="mt-2 space-y-2 text-xs text-muted">
+ <p>
+ Important: Copy these credentials now. You will not be able to see them again after you
+ close this dialog.
+ </p>
+ {output.notice === "one-time-delayed" && (
+ <p className="font-medium">
+ It may take a few minutes before the credentials are available for use.
+ </p>
+ )}
</div>
- </div>
- );
- }
-
- return null;
+ )}
+ </div>
+ );
};
const kubernetesFormSchema = z.object({
@@ -520,74 +262,64 @@ export const CreateKubernetesDynamicSecretLease = ({
const isOutputMode = Boolean(createDynamicSecretLease?.data);
+ if (isOutputMode) {
+ return renderOutputForm(
+ dynamicSecretProviderRegistry.requireLeaseCapabilities(provider).output,
+ createDynamicSecretLease.data?.data,
+ handleLeaseRegeneration
+ );
+ }
+
return (
- <div>
- <AnimatePresence>
- {!isOutputMode && (
- <motion.div
- key="lease-input"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: 30 }}
- >
- <form onSubmit={handleSubmit(handleDynamicSecretLeaseCreate)}>
- <Controller
- control={control}
- name="namespace"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Namespace"
- isError={Boolean(error?.message)}
- errorText={error?.message}
- helperText="The Kubernetes namespace to lease the dynamic secret to. If not specified, the first namespace defined in the configuration will be used."
- >
- <Input {...field} />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="ttl"
- defaultValue="1h"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={<TtlFormLabel label="Default TTL" />}
- isError={Boolean(error?.message)}
- errorText={error?.message}
- >
- <Input {...field} />
- </FormControl>
- )}
- />
- <div className="mt-4 flex items-center space-x-4">
- <Button type="submit" isLoading={isSubmitting}>
- Submit
- </Button>
- <Button variant="outline_bg" onClick={onClose}>
- Cancel
- </Button>
- </div>
- </form>
- </motion.div>
+ <form className="flex flex-col gap-4" onSubmit={handleSubmit(handleDynamicSecretLeaseCreate)}>
+ <Controller
+ control={control}
+ name="namespace"
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="kubernetes-lease-namespace">Namespace</FieldLabel>
+ <Input
+ {...field}
+ id="kubernetes-lease-namespace"
+ isError={Boolean(error)}
+ aria-describedby="kubernetes-lease-namespace-feedback"
+ />
+ <FieldFeedback
+ id="kubernetes-lease-namespace-feedback"
+ description="The Kubernetes namespace to lease the dynamic secret to. If omitted, the first configured namespace is used."
+ error={error?.message}
+ />
+ </Field>
)}
- {isOutputMode && (
- <motion.div
- key="lease-output"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: 30 }}
- >
- {renderOutputForm(
- provider,
- createDynamicSecretLease.data?.data,
- handleLeaseRegeneration
+ />
+ <Controller
+ control={control}
+ name="ttl"
+ defaultValue="1h"
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="kubernetes-lease-ttl">Default TTL</FieldLabel>
+ <Input
+ {...field}
+ id="kubernetes-lease-ttl"
+ isError={Boolean(error)}
+ aria-describedby={error ? "kubernetes-lease-ttl-feedback" : undefined}
+ />
+ {error?.message && (
+ <FieldFeedback id="kubernetes-lease-ttl-feedback" error={error.message} />
)}
- </motion.div>
+ </Field>
)}
- </AnimatePresence>
- </div>
+ />
+ <DialogFooter>
+ <Button variant="ghost" size="sm" onClick={onClose}>
+ Cancel
+ </Button>
+ <Button type="submit" variant="project" size="sm" isPending={isSubmitting}>
+ Provision Lease
+ </Button>
+ </DialogFooter>
+ </form>
);
};
@@ -629,104 +361,115 @@ const SshLeaseOutput = ({
};
return (
- <div>
- <div className="mb-4 flex items-center justify-between">
- <h2 className="text-sm font-medium">Private Key</h2>
- <div className="flex">
- <Tooltip content={copyTextPrivateKey}>
- <IconButton
- ariaLabel="copy icon"
- colorSchema="secondary"
- className="group relative"
- onClick={() => {
- navigator.clipboard.writeText(data.PRIVATE_KEY);
- setCopyTextPrivateKey("Copied");
- }}
- >
- <FontAwesomeIcon icon={isCopyingPrivateKey ? faCheck : faCopy} />
- </IconButton>
- </Tooltip>
- <Tooltip content="Download key.pem">
- <IconButton
- ariaLabel="download icon"
- colorSchema="secondary"
- className="group relative ml-2"
- onClick={() => downloadTxtFile("key.pem", data.PRIVATE_KEY)}
- >
- <FontAwesomeIcon icon={faDownload} />
- </IconButton>
- </Tooltip>
- </div>
- </div>
- <div className="mb-6 max-h-32 thin-scrollbar overflow-auto rounded-md bg-foreground/10 p-2 text-base text-label">
- <p className="mr-4 break-all whitespace-pre-wrap">{data.PRIVATE_KEY}</p>
- </div>
- <div className="mb-4 flex items-center justify-between">
- <h2 className="text-sm font-medium">Signed Certificate</h2>
- <div className="flex">
- <Tooltip content={copyTextSignedKey}>
- <IconButton
- ariaLabel="copy icon"
- colorSchema="secondary"
- className="group relative"
- onClick={() => {
- navigator.clipboard.writeText(data.SIGNED_KEY);
- setCopyTextSignedKey("Copied");
- }}
- >
- <FontAwesomeIcon icon={isCopyingSignedKey ? faCheck : faCopy} />
- </IconButton>
- </Tooltip>
- <Tooltip content="Download cert.pub">
- <IconButton
- ariaLabel="download icon"
- colorSchema="secondary"
- className="group relative ml-2"
- onClick={() => downloadTxtFile("cert.pub", data.SIGNED_KEY)}
- >
- <FontAwesomeIcon icon={faDownload} />
- </IconButton>
- </Tooltip>
- </div>
- </div>
- <div className="mb-6 max-h-32 thin-scrollbar overflow-auto rounded-md bg-foreground/10 p-2 text-base text-label">
- <p className="mr-4 break-all whitespace-pre-wrap">{data.SIGNED_KEY}</p>
- </div>
- <div className="flex flex-col gap-4">
- <div>
- <FormLabel label="Set private key permissions" />
- <div className="flex gap-2">
- <Input value={chmodCommand} isDisabled />
- <IconButton
- ariaLabel="copy"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => copyCommand(chmodCommand)}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
+ <div className="flex flex-col gap-4">
+ <Field>
+ <div className="flex items-center justify-between gap-2">
+ <FieldLabel htmlFor="ssh-lease-private-key">Private Key</FieldLabel>
+ <div className="flex gap-1">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="Copy private key"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => {
+ navigator.clipboard.writeText(data.PRIVATE_KEY).catch(() => undefined);
+ setCopyTextPrivateKey("Copied");
+ }}
+ >
+ {isCopyingPrivateKey ? <CheckIcon /> : <CopyIcon />}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>{copyTextPrivateKey}</TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="Download private key"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => downloadTxtFile("key.pem", data.PRIVATE_KEY)}
+ >
+ <DownloadIcon />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>Download key.pem</TooltipContent>
+ </Tooltip>
</div>
</div>
- <div>
- <FormLabel label="Connect to the target host" />
- <div className="flex gap-2">
- <Input value={sshCommand} isDisabled />
- <IconButton
- ariaLabel="copy"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => copyCommand(sshCommand)}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
+ <SecretInput id="ssh-lease-private-key" isReadOnly value={data.PRIVATE_KEY} />
+ </Field>
+ <Field>
+ <div className="flex items-center justify-between gap-2">
+ <FieldLabel htmlFor="ssh-lease-signed-certificate">Signed Certificate</FieldLabel>
+ <div className="flex gap-1">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="Copy signed certificate"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => {
+ navigator.clipboard.writeText(data.SIGNED_KEY).catch(() => undefined);
+ setCopyTextSignedKey("Copied");
+ }}
+ >
+ {isCopyingSignedKey ? <CheckIcon /> : <CopyIcon />}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>{copyTextSignedKey}</TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="Download signed certificate"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => downloadTxtFile("cert.pub", data.SIGNED_KEY)}
+ >
+ <DownloadIcon />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>Download cert.pub</TooltipContent>
+ </Tooltip>
</div>
</div>
- </div>
- <p className="mt-4 text-xs text-muted">
+ <SecretInput
+ id="ssh-lease-signed-certificate"
+ isReadOnly
+ isVisible
+ value={data.SIGNED_KEY}
+ />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="ssh-lease-chmod-command">Set Private Key Permissions</FieldLabel>
+ <div className="flex gap-2">
+ <Input id="ssh-lease-chmod-command" value={chmodCommand} readOnly />
+ <IconButton
+ aria-label="Copy private key permissions command"
+ variant="outline"
+ onClick={() => copyCommand(chmodCommand)}
+ >
+ <CopyIcon />
+ </IconButton>
+ </div>
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="ssh-lease-connect-command">Connect to the Target Host</FieldLabel>
+ <div className="flex gap-2">
+ <Input id="ssh-lease-connect-command" value={sshCommand} readOnly />
+ <IconButton
+ aria-label="Copy SSH connection command"
+ variant="outline"
+ onClick={() => copyCommand(sshCommand)}
+ >
+ <CopyIcon />
+ </IconButton>
+ </div>
+ </Field>
+ <p className="text-xs text-muted">
Important: Copy or download these credentials now. You will not be able to see them again
- after you close the modal.
+ after you close this dialog.
</p>
</div>
);
@@ -796,113 +539,98 @@ export const CreateSshDynamicSecretLease = ({
const isOutputMode = Boolean(createDynamicSecretLease?.data);
+ if (isOutputMode) {
+ return (
+ <SshLeaseOutput
+ data={createDynamicSecretLease.data?.data as { PRIVATE_KEY: string; SIGNED_KEY: string }}
+ firstPrincipal={principals[0]}
+ />
+ );
+ }
+
return (
- <div>
- <AnimatePresence>
- {!isOutputMode && (
- <motion.div
- key="lease-input"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: 30 }}
- >
- <form onSubmit={handleSubmit(handleDynamicSecretLeaseCreate)}>
- <Controller
- control={control}
- name="principals"
- render={({ fieldState: { error } }) => (
- <FormControl
- label="Principals"
- isError={Boolean(error?.message)}
- errorText={error?.message}
- helperText="The usernames to embed in the certificate (must be from the allowed list)"
- >
- <div className="flex flex-col gap-2">
- <div className="flex items-center gap-2">
- <Input
- value={principalInput}
- onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
- setPrincipalInput(e.target.value)
- }
- placeholder="Enter principal name..."
- onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
- if (e.key === "Enter") {
- e.preventDefault();
- handleAddPrincipal();
- }
- }}
- />
- <Button
- type="button"
- variant="outline_bg"
- size="sm"
- onClick={handleAddPrincipal}
- isDisabled={!principalInput.trim()}
- >
- Add
- </Button>
- </div>
- {principals.length > 0 && (
- <div className="flex flex-wrap gap-1">
- {principals.map((principal: string, idx: number) => (
- <Tag
- className="bg-neutral/15 text-neutral"
- key={principal}
- onClose={() => handleRemovePrincipal(idx)}
- >
- {principal}
- </Tag>
- ))}
- </div>
- )}
- </div>
- </FormControl>
- )}
+ <form className="flex flex-col gap-4" onSubmit={handleSubmit(handleDynamicSecretLeaseCreate)}>
+ <Controller
+ control={control}
+ name="principals"
+ render={({ fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="ssh-lease-principal">Principals</FieldLabel>
+ <div className="flex gap-2">
+ <Input
+ id="ssh-lease-principal"
+ value={principalInput}
+ aria-describedby="ssh-lease-principals-feedback"
+ onChange={(event) => setPrincipalInput(event.target.value)}
+ placeholder="Enter principal name..."
+ onKeyDown={(event) => {
+ if (event.key === "Enter") {
+ event.preventDefault();
+ handleAddPrincipal();
+ }
+ }}
/>
- <Controller
- control={control}
- name="ttl"
- defaultValue="1h"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={<TtlFormLabel label="Default TTL" />}
- isError={Boolean(error?.message)}
- errorText={error?.message}
- >
- <Input {...field} />
- </FormControl>
- )}
- />
- <div className="mt-4 flex items-center space-x-4">
- <Button type="submit" isLoading={isSubmitting}>
- Submit
- </Button>
- <Button variant="outline_bg" onClick={onClose}>
- Cancel
- </Button>
+ <Button
+ type="button"
+ variant="outline"
+ size="md"
+ onClick={handleAddPrincipal}
+ isDisabled={!principalInput.trim()}
+ >
+ <PlusIcon /> Add
+ </Button>
+ </div>
+ <FieldFeedback
+ id="ssh-lease-principals-feedback"
+ description="The usernames to embed in the certificate. Each principal must be on the allowed list."
+ error={error?.message}
+ />
+ {principals.length > 0 && (
+ <div className="flex flex-col gap-2">
+ {principals.map((principal: string, idx: number) => (
+ <div key={principal} className="flex gap-2">
+ <Input value={principal} readOnly aria-label={`Principal ${principal}`} />
+ <IconButton
+ type="button"
+ variant="outline"
+ aria-label={`Remove principal ${principal}`}
+ onClick={() => handleRemovePrincipal(idx)}
+ >
+ <Trash2Icon />
+ </IconButton>
+ </div>
+ ))}
</div>
- </form>
- </motion.div>
+ )}
+ </Field>
)}
- {isOutputMode && (
- <motion.div
- key="lease-output"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: 30 }}
- >
- <SshLeaseOutput
- data={
- createDynamicSecretLease.data?.data as { PRIVATE_KEY: string; SIGNED_KEY: string }
- }
- firstPrincipal={principals[0]}
+ />
+ <Controller
+ control={control}
+ name="ttl"
+ defaultValue="1h"
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="ssh-lease-ttl">Default TTL</FieldLabel>
+ <Input
+ {...field}
+ id="ssh-lease-ttl"
+ isError={Boolean(error)}
+ aria-describedby={error ? "ssh-lease-ttl-error" : undefined}
/>
- </motion.div>
+ {error?.message && <FieldFeedback id="ssh-lease-ttl-error" error={error.message} />}
+ </Field>
)}
- </AnimatePresence>
- </div>
+ />
+ <DialogFooter>
+ <Button variant="ghost" size="sm" onClick={onClose}>
+ Cancel
+ </Button>
+ <Button type="submit" variant="project" size="sm" isPending={isSubmitting}>
+ Provision Lease
+ </Button>
+ </DialogFooter>
+ </form>
);
};
@@ -924,8 +652,6 @@ type Props = {
secretPath: string;
};
-const PROVIDERS_WITH_AUTOGENERATE_SUPPORT = [DynamicSecretProviders.Totp];
-
export const CreateDynamicSecretLease = ({
onClose,
projectSlug,
@@ -934,6 +660,7 @@ export const CreateDynamicSecretLease = ({
secretPath,
environment
}: Props) => {
+ const leaseCapabilities = dynamicSecretProviderRegistry.requireLeaseCapabilities(provider);
const {
control,
formState: { isSubmitting },
@@ -944,9 +671,7 @@ export const CreateDynamicSecretLease = ({
ttl: "1h"
}
});
- const [isPreloading, setIsPreloading] = useToggle(
- PROVIDERS_WITH_AUTOGENERATE_SUPPORT.includes(provider)
- );
+ const [isPreloading, setIsPreloading] = useToggle(Boolean(leaseCapabilities.autoGenerate));
const createDynamicSecretLease = useCreateDynamicSecretLease();
@@ -975,12 +700,12 @@ export const CreateDynamicSecretLease = ({
};
useEffect(() => {
- if (provider === DynamicSecretProviders.Totp) {
+ if (leaseCapabilities.autoGenerate) {
handleDynamicSecretLeaseCreate({});
}
}, [provider]);
- if (provider === DynamicSecretProviders.Kubernetes) {
+ if (leaseCapabilities.provisioner === "kubernetes") {
return (
<CreateKubernetesDynamicSecretLease
onClose={onClose}
@@ -993,7 +718,7 @@ export const CreateDynamicSecretLease = ({
);
}
- if (provider === DynamicSecretProviders.Ssh) {
+ if (leaseCapabilities.provisioner === "ssh") {
return (
<CreateSshDynamicSecretLease
onClose={onClose}
@@ -1009,68 +734,55 @@ export const CreateDynamicSecretLease = ({
const isOutputMode = Boolean(createDynamicSecretLease?.data);
if (isPreloading) {
- return <Spinner className="mx-auto h-40 text-mineshaft-700" />;
+ return <Spinner className="mx-auto my-12" label="Provisioning lease" />;
}
- // Github tokens are fixed to 1 hour
- const fixedTtl = provider === DynamicSecretProviders.Github;
+ const { fixedTtl } = leaseCapabilities;
+
+ if (isOutputMode) {
+ return renderOutputForm(
+ leaseCapabilities.output,
+ createDynamicSecretLease.data?.data,
+ handleLeaseRegeneration
+ );
+ }
return (
- <div>
- <AnimatePresence>
- {!isOutputMode && (
- <motion.div
- key="lease-input"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: 30 }}
- >
- <form onSubmit={handleSubmit(handleDynamicSecretLeaseCreate)}>
- <Controller
- control={control}
- name="ttl"
- defaultValue="1h"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={<TtlFormLabel label="Default TTL" />}
- isError={Boolean(error?.message)}
- errorText={error?.message}
- helperText={
- fixedTtl ? `This provider has a fixed TTL of ${field.value}` : undefined
- }
- >
- <Input {...field} isDisabled={fixedTtl} />
- </FormControl>
- )}
+ <form className="flex flex-col gap-4" onSubmit={handleSubmit(handleDynamicSecretLeaseCreate)}>
+ <Controller
+ control={control}
+ name="ttl"
+ defaultValue="1h"
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="dynamic-secret-lease-ttl">Default TTL</FieldLabel>
+ <Input
+ {...field}
+ id="dynamic-secret-lease-ttl"
+ disabled={Boolean(fixedTtl)}
+ isError={Boolean(error)}
+ aria-describedby={
+ fixedTtl || error?.message ? "dynamic-secret-lease-ttl-feedback" : undefined
+ }
+ />
+ {(fixedTtl || error?.message) && (
+ <FieldFeedback
+ id="dynamic-secret-lease-ttl-feedback"
+ description={fixedTtl ? `This provider has a fixed TTL of ${fixedTtl}.` : undefined}
+ error={error?.message}
/>
- <div className="mt-4 flex items-center space-x-4">
- <Button type="submit" isLoading={isSubmitting}>
- Submit
- </Button>
- <Button variant="outline_bg" onClick={onClose}>
- Cancel
- </Button>
- </div>
- </form>
- </motion.div>
- )}
- {isOutputMode && (
- <motion.div
- key="lease-output"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: 30 }}
- >
- {renderOutputForm(
- provider,
- createDynamicSecretLease.data?.data,
- handleLeaseRegeneration
)}
- </motion.div>
+ </Field>
)}
- </AnimatePresence>
- </div>
+ />
+ <DialogFooter>
+ <Button variant="ghost" size="sm" onClick={onClose}>
+ Cancel
+ </Button>
+ <Button type="submit" variant="project" size="sm" isPending={isSubmitting}>
+ Provision Lease
+ </Button>
+ </DialogFooter>
+ </form>
);
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/DynamicSecretLease.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/DynamicSecretLease.tsx
index 7d8d84e1cc..84fde73963 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/DynamicSecretLease.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/DynamicSecretLease.tsx
@@ -1,35 +1,54 @@
import { subject } from "@casl/ability";
-import {
- faClose,
- faFileContract,
- faRepeat,
- faTrash,
- faWarning
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format, formatDistance } from "date-fns";
+import { CircleXIcon, RefreshCwIcon, Trash2Icon, TriangleAlertIcon } from "lucide-react";
+import { dynamicSecretProviderRegistry } from "@app/components/dynamic-secrets";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
+ Alert,
+ AlertAction,
+ AlertDescription,
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogConfirmationField,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
+ AlertTitle,
Button,
- DeleteActionModal,
- EmptyState,
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Empty,
+ EmptyContent,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
IconButton,
- Modal,
- ModalContent,
+ Skeleton,
Table,
- TableContainer,
- TBody,
- Td,
- THead,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
Tooltip,
- Tr
-} from "@app/components/v2";
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { ProjectPermissionDynamicSecretActions, ProjectPermissionSub } from "@app/context";
import { usePopUp } from "@app/hooks";
import { useGetDynamicSecretLeases, useRevokeDynamicSecretLease } from "@app/hooks/api";
-import { DynamicSecretProviders, TDynamicSecret } from "@app/hooks/api/dynamicSecret/types";
+import { TDynamicSecret } from "@app/hooks/api/dynamicSecret/types";
import { DynamicSecretLeaseStatus } from "@app/hooks/api/dynamicSecretLease/types";
import { RenewDynamicSecretLease } from "./RenewDynamicSecretLease";
@@ -44,12 +63,6 @@ type Props = {
onClose: () => void;
};
-const DYNAMIC_SECRETS_WITHOUT_RENEWAL = [
- DynamicSecretProviders.Github,
- DynamicSecretProviders.Ssh,
- DynamicSecretProviders.Tailscale
-];
-
export const DynamicSecretLease = ({
projectSlug,
dynamicSecretName,
@@ -63,7 +76,12 @@ export const DynamicSecretLease = ({
"deleteSecret",
"renewSecret"
] as const);
- const { data: leases, isPending: isLeaseLoading } = useGetDynamicSecretLeases({
+ const {
+ data: leases,
+ isPending: isLeaseLoading,
+ isError: isLeaseError,
+ refetch: refetchLeases
+ } = useGetDynamicSecretLeases({
projectSlug,
environmentSlug: environment,
path: secretPath,
@@ -88,167 +106,235 @@ export const DynamicSecretLease = ({
handlePopUpClose("deleteSecret");
createNotification({
type: "success",
- text: "Successfully deleted lease"
+ text: isForced ? "Lease deleted" : "Lease revoked"
});
};
- const canRenew = !DYNAMIC_SECRETS_WITHOUT_RENEWAL.includes(dynamicSecret.type);
+ const canRenew = dynamicSecretProviderRegistry.requireLeaseCapabilities(
+ dynamicSecret.type
+ ).supportsRenewal;
+ const selectedLease = popUp.deleteSecret.data as
+ | { leaseId: string; isForced?: boolean }
+ | undefined;
+
+ const handleDeleteConfirmation = () => {
+ if (deleteDynamicSecretLease.isPending) return;
+ handleDynamicSecretDeleteLease().catch(() => undefined);
+ };
+
+ const permissionSubject = subject(ProjectPermissionSub.DynamicSecrets, {
+ environment,
+ secretPath,
+ metadata: dynamicSecret.metadata
+ });
return (
- <div>
- <TableContainer>
- <Table className="bg-mineshaft-600">
- <THead>
- <Tr>
- <Td>Lease ID</Td>
- <Td>Expire At</Td>
- <Td />
- </Tr>
- </THead>
- <TBody>
- {!isLeaseLoading && leases?.length === 0 && (
- <tr>
- <td colSpan={3}>
- <EmptyState title="No leases found" icon={faFileContract}>
- <Button
- onClick={onClickNewLease}
- className="mt-4"
- colorSchema="primary"
- size="sm"
- >
- New Lease
- </Button>
- </EmptyState>
- </td>
- </tr>
- )}
- {(leases || []).map(({ id, expireAt, status, statusDetails }) => (
- <Tr key={id}>
- <Td>
- {id}
- {Boolean(status) && (
- <Tooltip content={statusDetails || status || ""}>
- <FontAwesomeIcon className="ml-2 text-yellow-600" icon={faWarning} />
+ <>
+ <DialogBody className="flex flex-col gap-4">
+ {isLeaseError && (
+ <Alert variant="danger">
+ <CircleXIcon />
+ <AlertTitle>Could not load leases.</AlertTitle>
+ <AlertDescription>
+ Try loading the dynamic secret leases again.
+ <AlertAction>
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={() => refetchLeases().catch(() => undefined)}
+ >
+ Retry
+ </Button>
+ </AlertAction>
+ </AlertDescription>
+ </Alert>
+ )}
+
+ {!isLeaseError && !isLeaseLoading && leases?.length === 0 && (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No leases found</EmptyTitle>
+ <EmptyDescription>
+ Provision a lease to generate temporary credentials from this dynamic secret.
+ </EmptyDescription>
+ </EmptyHeader>
+ <EmptyContent>
+ <ProjectPermissionCan
+ I={ProjectPermissionDynamicSecretActions.Lease}
+ a={permissionSubject}
+ >
+ {(isAllowed) => (
+ <Button
+ variant="project"
+ size="sm"
+ onClick={onClickNewLease}
+ isDisabled={!isAllowed}
+ >
+ New Lease
+ </Button>
+ )}
+ </ProjectPermissionCan>
+ </EmptyContent>
+ </Empty>
+ )}
+
+ {!isLeaseError && (isLeaseLoading || Boolean(leases?.length)) && (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Lease ID</TableHead>
+ <TableHead>Expires At</TableHead>
+ <TableHead variant="action" aria-label="Actions" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isLeaseLoading &&
+ Array.from({ length: 3 }).map((_, index) => (
+ <TableRow key={`lease-loading-${index + 1}`}>
+ <TableCell>
+ <Skeleton className="h-4 w-48" />
+ </TableCell>
+ <TableCell>
+ <Skeleton className="h-4 w-24" />
+ </TableCell>
+ <TableCell variant="action">
+ <Skeleton className="ml-auto size-7" />
+ </TableCell>
+ </TableRow>
+ ))}
+ {(leases || []).map(({ id, expireAt, status, statusDetails }) => (
+ <TableRow key={id}>
+ <TableCell className="max-w-80 font-mono">
+ <div className="flex min-w-0 items-center">
+ <span className="truncate">{id}</span>
+ {Boolean(status) && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ className="ml-2 inline-flex shrink-0 rounded-xs text-warning outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ aria-label="Lease warning"
+ >
+ <TriangleAlertIcon className="size-4" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent>
+ {statusDetails || status || "Lease warning"}
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </div>
+ </TableCell>
+ <TableCell>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="capitalize">
+ {formatDistance(new Date(expireAt), new Date())}
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ {format(new Date(expireAt), "yyyy-MM-dd, hh:mm aaa")}
+ </TooltipContent>
</Tooltip>
- )}
- </Td>
- <Td>
- <Tooltip content={format(new Date(expireAt), "yyyy-MM-dd, hh:mm aaa")}>
- <span className="capitalize">
- {formatDistance(new Date(expireAt), new Date())}
- </span>
- </Tooltip>
- </Td>
- <Td>
- <div className="flex items-center space-x-4">
- {canRenew && (
- <ProjectPermissionCan
- I={ProjectPermissionDynamicSecretActions.Lease}
- a={subject(ProjectPermissionSub.DynamicSecrets, {
- environment,
- secretPath,
- metadata: dynamicSecret.metadata
- })}
- renderTooltip
- allowedLabel="Renew"
- >
- {(isAllowed) => (
- <IconButton
- ariaLabel="renew-lease"
- variant="plain"
- size="sm"
- className="p-0"
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("renewSecret", { leaseId: id })}
- >
- <FontAwesomeIcon icon={faRepeat} size="lg" />
- </IconButton>
- )}
- </ProjectPermissionCan>
- )}
- <ProjectPermissionCan
- I={ProjectPermissionDynamicSecretActions.Lease}
- a={subject(ProjectPermissionSub.DynamicSecrets, {
- environment,
- secretPath,
- metadata: dynamicSecret.metadata
- })}
- renderTooltip
- allowedLabel="Delete"
- >
- {(isAllowed) => (
- <IconButton
- ariaLabel="delete-folder"
- variant="plain"
- size="md"
- className="p-0"
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("deleteSecret", { leaseId: id })}
+ </TableCell>
+ <TableCell variant="action">
+ <div className="flex items-center justify-end gap-1">
+ {canRenew && (
+ <ProjectPermissionCan
+ I={ProjectPermissionDynamicSecretActions.Lease}
+ a={permissionSubject}
+ renderTooltip
+ allowedLabel="Renew lease"
>
- <FontAwesomeIcon icon={faClose} size="lg" />
- </IconButton>
+ {(isAllowed) => (
+ <IconButton
+ aria-label="Renew lease"
+ variant="ghost-muted"
+ size="xs"
+ isDisabled={!isAllowed}
+ onClick={() => handlePopUpOpen("renewSecret", { leaseId: id })}
+ >
+ <RefreshCwIcon />
+ </IconButton>
+ )}
+ </ProjectPermissionCan>
)}
- </ProjectPermissionCan>
- {status === DynamicSecretLeaseStatus.FailedDeletion && (
<ProjectPermissionCan
I={ProjectPermissionDynamicSecretActions.Lease}
- a={subject(ProjectPermissionSub.DynamicSecrets, {
- environment,
- secretPath,
- metadata: dynamicSecret.metadata
- })}
+ a={permissionSubject}
renderTooltip
- allowedLabel="Force Delete. This action will remove the secret from internal storage, but it will remain in external systems."
+ allowedLabel="Revoke lease"
>
{(isAllowed) => (
<IconButton
- ariaLabel="delete-folder"
- variant="plain"
- size="md"
- className="p-0 text-red-600"
+ aria-label="Revoke lease"
+ variant="ghost-muted"
+ size="xs"
isDisabled={!isAllowed}
- onClick={() =>
- handlePopUpOpen("deleteSecret", { leaseId: id, isForced: true })
- }
+ onClick={() => handlePopUpOpen("deleteSecret", { leaseId: id })}
>
- <FontAwesomeIcon icon={faTrash} />
+ <Trash2Icon />
</IconButton>
)}
</ProjectPermissionCan>
- )}
- </div>
- </Td>
- </Tr>
- ))}
- </TBody>
- </Table>
- </TableContainer>
- {!isLeaseLoading && Boolean(leases?.length) && (
- <div className="mt-6 flex items-center space-x-4">
+ {status === DynamicSecretLeaseStatus.FailedDeletion && (
+ <ProjectPermissionCan
+ I={ProjectPermissionDynamicSecretActions.Lease}
+ a={permissionSubject}
+ renderTooltip
+ allowedLabel="Force delete lease. This removes the lease from Infisical without revoking it in the external provider."
+ >
+ {(isAllowed) => (
+ <IconButton
+ aria-label="Force delete lease"
+ variant="danger"
+ size="xs"
+ isDisabled={!isAllowed}
+ onClick={() =>
+ handlePopUpOpen("deleteSecret", { leaseId: id, isForced: true })
+ }
+ >
+ <Trash2Icon />
+ </IconButton>
+ )}
+ </ProjectPermissionCan>
+ )}
+ </div>
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ )}
+ </DialogBody>
+
+ {!isLeaseLoading && !isLeaseError && Boolean(leases?.length) && (
+ <DialogFooter>
+ <Button onClick={onClose} variant="ghost" size="sm">
+ Close
+ </Button>
<ProjectPermissionCan
I={ProjectPermissionDynamicSecretActions.Lease}
- a={subject(ProjectPermissionSub.DynamicSecrets, {
- environment,
- secretPath,
- metadata: dynamicSecret.metadata
- })}
+ a={permissionSubject}
>
{(isAllowed) => (
- <Button onClick={onClickNewLease} size="xs" isDisabled={!isAllowed}>
+ <Button onClick={onClickNewLease} variant="project" size="sm" isDisabled={!isAllowed}>
New Lease
</Button>
)}
</ProjectPermissionCan>
- <Button onClick={onClose} variant="plain" colorSchema="secondary" size="xs">
- Close
- </Button>
- </div>
+ </DialogFooter>
)}
- <Modal
- isOpen={popUp.renewSecret.isOpen}
- onOpenChange={(state) => handlePopUpToggle("renewSecret", state)}
+
+ <Dialog
+ open={popUp.renewSecret.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("renewSecret", isOpen)}
>
- <ModalContent title="Renew Lease">
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Renew Lease</DialogTitle>
+ <DialogDescription>Extend this lease by a new TTL.</DialogDescription>
+ </DialogHeader>
<RenewDynamicSecretLease
onClose={() => handlePopUpClose("renewSecret")}
projectSlug={projectSlug}
@@ -258,15 +344,54 @@ export const DynamicSecretLease = ({
secretPath={secretPath}
environment={environment}
/>
- </ModalContent>
- </Modal>
- <DeleteActionModal
- isOpen={popUp.deleteSecret.isOpen}
- deleteKey="delete"
- title="Do you want to delete this lease?"
- onChange={(isOpen) => handlePopUpToggle("deleteSecret", isOpen)}
- onDeleteApproved={handleDynamicSecretDeleteLease}
- />
- </div>
+ </DialogContent>
+ </Dialog>
+
+ <AlertDialog
+ open={popUp.deleteSecret.isOpen}
+ confirmationValue="delete"
+ onOpenChange={(isOpen) => {
+ if (!deleteDynamicSecretLease.isPending) handlePopUpToggle("deleteSecret", isOpen);
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2Icon />
+ </AlertDialogMedia>
+ <AlertDialogTitle>
+ {selectedLease?.isForced ? "Force Delete Lease?" : "Revoke Lease?"}
+ </AlertDialogTitle>
+ <AlertDialogDescription>
+ {selectedLease?.isForced
+ ? "This removes the lease from Infisical without revoking it in the external provider. This cannot be undone."
+ : "This revokes the temporary credentials and deletes the lease. This cannot be undone."}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogConfirmationField
+ inputProps={{
+ disabled: deleteDynamicSecretLease.isPending,
+ placeholder: "Type delete here"
+ }}
+ onConfirm={handleDeleteConfirmation}
+ />
+ <AlertDialogFooter>
+ <AlertDialogCancel isDisabled={deleteDynamicSecretLease.isPending}>
+ Cancel
+ </AlertDialogCancel>
+ <AlertDialogAction
+ variant="danger"
+ isPending={deleteDynamicSecretLease.isPending}
+ onClick={(event) => {
+ event.preventDefault();
+ handleDeleteConfirmation();
+ }}
+ >
+ {selectedLease?.isForced ? "Force Delete" : "Revoke"}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </>
);
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretForm.tsx
index f85e04c540..5542e68724 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretForm.tsx
@@ -1,39 +1,26 @@
-import { AnimatePresence, motion } from "framer-motion";
+import { useState } from "react";
-import { Spinner } from "@app/components/v2";
+import {
+ DynamicSecretProviderForm,
+ dynamicSecretProviderRegistry
+} from "@app/components/dynamic-secrets";
+import {
+ Alert,
+ AlertDescription,
+ DiscardChangesAlertDialog,
+ PageLoader,
+ Sheet,
+ SheetContent,
+ SheetDescription,
+ SheetHeader,
+ SheetTitle
+} from "@app/components/v3";
import { useGetDynamicSecretDetails } from "@app/hooks/api";
-import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-
-import { EditDynamicSecretAwsElastiCacheProviderForm } from "./EditDynamicSecretAwsElastiCacheProviderForm";
-import { EditDynamicSecretAwsIamForm } from "./EditDynamicSecretAwsIamForm";
-import { EditDynamicSecretAwsMemoryDbProviderForm } from "./EditDynamicSecretAwsMemoryDbProviderForm";
-import { EditDynamicSecretAzureEntraIdForm } from "./EditDynamicSecretAzureEntraIdForm";
-import { EditDynamicSecretAzureSqlDatabaseForm } from "./EditDynamicSecretAzureSqlDatabaseForm";
-import { EditDynamicSecretCassandraForm } from "./EditDynamicSecretCassandraForm";
-import { EditDynamicSecretClickHouseForm } from "./EditDynamicSecretClickHouseForm";
-import { EditDynamicSecretCouchbaseForm } from "./EditDynamicSecretCouchbaseForm";
-import { EditDynamicSecretElasticSearchForm } from "./EditDynamicSecretElasticSearchForm";
-import { EditDynamicSecretGcpIamForm } from "./EditDynamicSecretGcpIamForm";
-import { EditDynamicSecretGithubForm } from "./EditDynamicSecretGithubForm";
-import { EditDynamicSecretIbmApiConnectForm } from "./EditDynamicSecretIbmApiConnectForm";
-import { EditDynamicSecretKubernetesForm } from "./EditDynamicSecretKubernetesForm";
-import { EditDynamicSecretLdapForm } from "./EditDynamicSecretLdapForm";
-import { EditDynamicSecretMilvusForm } from "./EditDynamicSecretMilvusForm";
-import { EditDynamicSecretMongoAtlasForm } from "./EditDynamicSecretMongoAtlasForm";
-import { EditDynamicSecretMongoDBForm } from "./EditDynamicSecretMongoDBForm";
-import { EditDynamicSecretRabbitMqForm } from "./EditDynamicSecretRabbitMqForm";
-import { EditDynamicSecretRedisProviderForm } from "./EditDynamicSecretRedisProviderForm";
-import { EditDynamicSecretSapAseForm } from "./EditDynamicSecretSapAseForm";
-import { EditDynamicSecretSapHanaForm } from "./EditDynamicSecretSapHanaForm";
-import { EditDynamicSecretSnowflakeForm } from "./EditDynamicSecretSnowflakeForm";
-import { EditDynamicSecretSqlProviderForm } from "./EditDynamicSecretSqlProviderForm";
-import { EditDynamicSecretSshForm } from "./EditDynamicSecretSshForm";
-import { EditDynamicSecretTailscaleForm } from "./EditDynamicSecretTailscaleForm";
-import { EditDynamicSecretTotpForm } from "./EditDynamicSecretTotpForm";
-import { EditDynamicSecretVerticaForm } from "./EditDynamicSecretVertica";
+import { useDiscardChangesGuard } from "@app/hooks/useDiscardChangesGuard";
type Props = {
- onClose: () => void;
+ isOpen: boolean;
+ onToggle: (isOpen: boolean) => void;
dynamicSecretName: string;
projectSlug: string;
environment: string;
@@ -41,494 +28,76 @@ type Props = {
};
export const EditDynamicSecretForm = ({
+ isOpen,
dynamicSecretName,
environment,
projectSlug,
- onClose,
+ onToggle,
secretPath
}: Props) => {
- const { data: dynamicSecretDetails, isPending: isDynamicSecretLoading } =
- useGetDynamicSecretDetails({
- projectSlug,
- environmentSlug: environment,
- name: dynamicSecretName,
- path: secretPath
- });
+ const [isDirty, setIsDirty] = useState(false);
+ const close = () => {
+ setIsDirty(false);
+ onToggle(false);
+ };
+ const { confirmDiscard, isDiscardDialogOpen, requestDiscard, setIsDiscardDialogOpen } =
+ useDiscardChangesGuard({ isDirty, onDiscard: close });
+ const { data: dynamicSecret, isPending } = useGetDynamicSecretDetails({
+ projectSlug,
+ environmentSlug: environment,
+ name: dynamicSecretName,
+ path: secretPath
+ });
- if (isDynamicSecretLoading) {
- return (
- <div className="flex w-full items-center justify-center p-8">
- <Spinner />
- </div>
+ let content = <PageLoader />;
+ if (!dynamicSecret) {
+ content = (
+ <Alert variant="danger">
+ <AlertDescription>Unable to load this dynamic secret.</AlertDescription>
+ </Alert>
+ );
+ } else {
+ const definition = dynamicSecretProviderRegistry.getDefinition(dynamicSecret.type);
+ content = definition ? (
+ <DynamicSecretProviderForm
+ mode="edit"
+ definition={definition}
+ dynamicSecret={dynamicSecret}
+ environment={environment}
+ projectSlug={projectSlug}
+ secretPath={secretPath}
+ onCompleted={close}
+ onCancel={requestDiscard}
+ onDirtyChange={setIsDirty}
+ />
+ ) : (
+ <Alert variant="danger">
+ <AlertDescription>
+ The {dynamicSecret.type} provider is not available in the shared provider registry.
+ </AlertDescription>
+ </Alert>
);
}
return (
- <AnimatePresence mode="wait">
- {dynamicSecretDetails?.type === DynamicSecretProviders.SqlDatabase && (
- <motion.div
- key="sqldatabase-provider-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretSqlProviderForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Cassandra && (
- <motion.div
- key="cassandra-provider-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretCassandraForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.AwsIam && (
- <motion.div
- key="aws-iam-provider-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretAwsIamForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Redis && (
- <motion.div
- key="redis-provider-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretRedisProviderForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.AwsElastiCache && (
- <motion.div
- key="redis-provider-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretAwsElastiCacheProviderForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.AwsMemoryDb && (
- <motion.div
- key="aws-memorydb-provider-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretAwsMemoryDbProviderForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.MongoAtlas && (
- <motion.div
- key="mongo-atlas-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretMongoAtlasForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
-
- {dynamicSecretDetails?.type === DynamicSecretProviders.ElasticSearch && (
- <motion.div
- key="elastic-search-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretElasticSearchForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.MongoDB && (
- <motion.div
- key="mongodb-search-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretMongoDBForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
-
- {dynamicSecretDetails?.type === DynamicSecretProviders.RabbitMq && (
- <motion.div
- key="rabbit-mq-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretRabbitMqForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
-
- {dynamicSecretDetails?.type === DynamicSecretProviders.AzureEntraId && (
- <motion.div
- key="azure-entra-id-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretAzureEntraIdForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
-
- {dynamicSecretDetails?.type === DynamicSecretProviders.AzureSqlDatabase && (
- <motion.div
- key="azure-sql-database-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretAzureSqlDatabaseForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
-
- {dynamicSecretDetails?.type === DynamicSecretProviders.Ldap && (
- <motion.div
- key="ldap-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretLdapForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.SapHana && (
- <motion.div
- key="sap-hana-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretSapHanaForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.SapAse && (
- <motion.div
- key="sap-ase-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretSapAseForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Snowflake && (
- <motion.div
- key="snowflake-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretSnowflakeForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Totp && (
- <motion.div
- key="totp-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretTotpForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Kubernetes && (
- <motion.div
- key="kubernetes-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretKubernetesForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Vertica && (
- <motion.div
- key="vertica-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretVerticaForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.GcpIam && (
- <motion.div
- key="gcp-iam-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretGcpIamForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Github && (
- <motion.div
- key="github-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretGithubForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Milvus && (
- <motion.div
- key="milvus-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretMilvusForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Couchbase && (
- <motion.div
- key="couchbase-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretCouchbaseForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Clickhouse && (
- <motion.div
- key="clickhouse-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretClickHouseForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Ssh && (
- <motion.div
- key="ssh-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretSshForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.IbmApiConnect && (
- <motion.div
- key="ibm-api-connect-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretIbmApiConnectForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- {dynamicSecretDetails?.type === DynamicSecretProviders.Tailscale && (
- <motion.div
- key="tailscale-edit"
- transition={{ duration: 0.1 }}
- initial={{ opacity: 0, translateX: 30 }}
- animate={{ opacity: 1, translateX: 0 }}
- exit={{ opacity: 0, translateX: -30 }}
- >
- <EditDynamicSecretTailscaleForm
- onClose={onClose}
- projectSlug={projectSlug}
- secretPath={secretPath}
- dynamicSecret={dynamicSecretDetails}
- environment={environment}
- />
- </motion.div>
- )}
- </AnimatePresence>
+ <>
+ <Sheet open={isOpen} onOpenChange={(open) => !open && requestDiscard()}>
+ <SheetContent className="w-full sm:max-w-3xl">
+ <SheetHeader>
+ <SheetTitle>Edit Dynamic Secret</SheetTitle>
+ <SheetDescription>Update dynamic secret parameters.</SheetDescription>
+ </SheetHeader>
+ {!isPending && content}
+ {isPending && <PageLoader />}
+ </SheetContent>
+ </Sheet>
+ <DiscardChangesAlertDialog
+ open={isDiscardDialogOpen}
+ onOpenChange={setIsDiscardDialogOpen}
+ onDiscard={confirmDiscard}
+ title="Discard Dynamic Secret Changes?"
+ description="Your unsaved changes to this dynamic secret will be lost."
+ />
+ </>
);
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/RenewDynamicSecretLease.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/RenewDynamicSecretLease.tsx
index bdb5f9add4..01d8fe7a06 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/RenewDynamicSecretLease.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/RenewDynamicSecretLease.tsx
@@ -3,9 +3,8 @@ import { zodResolver } from "@hookform/resolvers/zod";
import ms from "ms";
import { z } from "zod";
-import { TtlFormLabel } from "@app/components/features";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input } from "@app/components/v2";
+import { Button, DialogFooter, Field, FieldFeedback, FieldLabel, Input } from "@app/components/v3";
import { useRenewDynamicSecretLease } from "@app/hooks/api";
import { TDynamicSecret } from "@app/hooks/api/dynamicSecret/types";
@@ -86,24 +85,30 @@ export const RenewDynamicSecretLease = ({
name="ttl"
defaultValue={dynamicSecret.defaultTTL}
render={({ field, fieldState: { error } }) => (
- <FormControl
- label={<TtlFormLabel label="TTL" />}
- isError={Boolean(error?.message)}
- errorText={error?.message}
- helperText="The existing expiration time will be extended by the TTL"
- >
- <Input {...field} />
- </FormControl>
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="renew-lease-ttl">TTL</FieldLabel>
+ <Input
+ {...field}
+ id="renew-lease-ttl"
+ isError={Boolean(error)}
+ aria-describedby="renew-lease-ttl-feedback"
+ />
+ <FieldFeedback
+ id="renew-lease-ttl-feedback"
+ description="The existing expiration time will be extended by this TTL."
+ error={error?.message}
+ />
+ </Field>
)}
/>
- <div className="mt-4 flex items-center space-x-4">
- <Button type="submit" isLoading={isSubmitting}>
- Renew
- </Button>
- <Button variant="outline_bg" onClick={onClose}>
+ <DialogFooter>
+ <Button variant="ghost" size="sm" onClick={onClose}>
Cancel
</Button>
- </div>
+ <Button type="submit" variant="project" size="sm" isPending={isSubmitting}>
+ Renew Lease
+ </Button>
+ </DialogFooter>
</form>
);
};