mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 10:28:21 +00:00
Change overview dynamic secret creation modal to set only one env
This commit is contained in:
+9
-17
@@ -53,7 +53,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ export const AwsElastiCacheInputForm = ({
|
|||||||
"UserId": "{{username}}"
|
"UserId": "{{username}}"
|
||||||
}`
|
}`
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -102,12 +102,10 @@ export const AwsElastiCacheInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.AwsElastiCache, inputs: provider },
|
provider: { type: DynamicSecretProviders.AwsElastiCache, inputs: provider },
|
||||||
@@ -116,20 +114,15 @@ export const AwsElastiCacheInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
hasErrors = true;
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -319,19 +312,18 @@ export const AwsElastiCacheInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
/>
|
/>
|
||||||
|
|||||||
+10
-17
@@ -42,7 +42,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ export const AwsIamInputForm = ({
|
|||||||
} = useForm<TForm>({
|
} = useForm<TForm>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -79,12 +79,11 @@ export const AwsIamInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.AwsIam, inputs: provider },
|
provider: { type: DynamicSecretProviders.AwsIam, inputs: provider },
|
||||||
@@ -93,20 +92,15 @@ export const AwsIamInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
hasErrors = true;
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -307,19 +301,18 @@ export const AwsIamInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -62,7 +62,7 @@ const formSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
.refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ export const AzureEntraIdInputForm = ({
|
|||||||
} = useForm<TForm>({
|
} = useForm<TForm>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const tenantId = watch("provider.tenantId");
|
const tenantId = watch("provider.tenantId");
|
||||||
@@ -113,12 +113,10 @@ export const AzureEntraIdInputForm = ({
|
|||||||
provider,
|
provider,
|
||||||
maxTTL,
|
maxTTL,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
selectedUsers.map(async (user: { id: string; name: string; email: string }) => {
|
selectedUsers.map(async (user: { id: string; name: string; email: string }) => {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
@@ -137,20 +135,15 @@ export const AzureEntraIdInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -389,19 +382,18 @@ export const AzureEntraIdInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+10
-17
@@ -55,7 +55,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ export const CassandraInputForm = ({
|
|||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
provider: getSqlStatements(),
|
provider: getSqlStatements(),
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -102,12 +102,11 @@ export const CassandraInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.Cassandra, inputs: provider },
|
provider: { type: DynamicSecretProviders.Cassandra, inputs: provider },
|
||||||
@@ -116,19 +115,14 @@ export const CassandraInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -365,19 +359,18 @@ export const CassandraInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -76,7 +76,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ export const ElasticSearchInputForm = ({
|
|||||||
roles: ["superuser"],
|
roles: ["superuser"],
|
||||||
port: 443
|
port: 443
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -122,12 +122,10 @@ export const ElasticSearchInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.ElasticSearch, inputs: provider },
|
provider: { type: DynamicSecretProviders.ElasticSearch, inputs: provider },
|
||||||
@@ -136,19 +134,14 @@ export const ElasticSearchInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -426,19 +419,18 @@ export const ElasticSearchInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -79,7 +79,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
|
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
@@ -118,7 +118,7 @@ export const LdapInputForm = ({
|
|||||||
rollbackLdif: "",
|
rollbackLdif: "",
|
||||||
credentialType: CredentialType.Dynamic
|
credentialType: CredentialType.Dynamic
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -131,12 +131,10 @@ export const LdapInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.Ldap, inputs: provider },
|
provider: { type: DynamicSecretProviders.Ldap, inputs: provider },
|
||||||
@@ -145,19 +143,14 @@ export const LdapInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -396,19 +389,18 @@ export const LdapInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -66,7 +66,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ export const MongoAtlasInputForm = ({
|
|||||||
provider: {
|
provider: {
|
||||||
roles: [{ databaseName: "", roleName: "" }]
|
roles: [{ databaseName: "", roleName: "" }]
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -133,12 +133,10 @@ export const MongoAtlasInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.MongoAtlas, inputs: provider },
|
provider: { type: DynamicSecretProviders.MongoAtlas, inputs: provider },
|
||||||
@@ -147,19 +145,14 @@ export const MongoAtlasInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -458,19 +451,18 @@ export const MongoAtlasInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -56,7 +56,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ export const MongoDBDatabaseInputForm = ({
|
|||||||
provider: {
|
provider: {
|
||||||
roles: [{ roleName: "readWrite" }]
|
roles: [{ roleName: "readWrite" }]
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -103,12 +103,10 @@ export const MongoDBDatabaseInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: {
|
provider: {
|
||||||
@@ -124,19 +122,14 @@ export const MongoDBDatabaseInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -348,19 +341,18 @@ export const MongoDBDatabaseInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -60,7 +60,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ export const RabbitMqInputForm = ({
|
|||||||
},
|
},
|
||||||
tags: []
|
tags: []
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -111,12 +111,10 @@ export const RabbitMqInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.RabbitMq, inputs: provider },
|
provider: { type: DynamicSecretProviders.RabbitMq, inputs: provider },
|
||||||
@@ -125,19 +123,14 @@ export const RabbitMqInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -432,19 +425,18 @@ export const RabbitMqInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -53,7 +53,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ export const RedisInputForm = ({
|
|||||||
creationStatement: "ACL SETUSER {{username}} on >{{password}} ~* &* +@all",
|
creationStatement: "ACL SETUSER {{username}} on >{{password}} ~* &* +@all",
|
||||||
revocationStatement: "ACL DELUSER {{username}}"
|
revocationStatement: "ACL DELUSER {{username}}"
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -96,12 +96,10 @@ export const RedisInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.Redis, inputs: provider },
|
provider: { type: DynamicSecretProviders.Redis, inputs: provider },
|
||||||
@@ -110,19 +108,14 @@ export const RedisInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -333,19 +326,18 @@ export const RedisInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -51,7 +51,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ sp_role 'grant', 'mon_role', '{{username}}';`,
|
|||||||
revocationStatement: `sp_dropuser '{{username}}';
|
revocationStatement: `sp_dropuser '{{username}}';
|
||||||
sp_droplogin '{{username}}';`
|
sp_droplogin '{{username}}';`
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -97,12 +97,10 @@ sp_droplogin '{{username}}';`
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.SapAse, inputs: provider },
|
provider: { type: DynamicSecretProviders.SapAse, inputs: provider },
|
||||||
@@ -111,19 +109,14 @@ sp_droplogin '{{username}}';`
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -311,19 +304,18 @@ sp_droplogin '{{username}}';`
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+9
-17
@@ -53,7 +53,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ GRANT "MONITORING" TO {{username}};`,
|
|||||||
DROP USER {{username}};`,
|
DROP USER {{username}};`,
|
||||||
renewStatement: "ALTER USER {{username}} VALID UNTIL '{{expiration}}';"
|
renewStatement: "ALTER USER {{username}} VALID UNTIL '{{expiration}}';"
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -97,12 +97,10 @@ DROP USER {{username}};`,
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.SapHana, inputs: provider },
|
provider: { type: DynamicSecretProviders.SapHana, inputs: provider },
|
||||||
@@ -111,19 +109,14 @@ DROP USER {{username}};`,
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret in environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -331,19 +324,18 @@ DROP USER {{username}};`,
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+8
-16
@@ -57,7 +57,7 @@ const formSchema = z.object({
|
|||||||
.trim()
|
.trim()
|
||||||
.min(1)
|
.min(1)
|
||||||
.refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
.refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ export const SnowflakeInputForm = ({
|
|||||||
revocationStatement: "DROP USER {{username}};",
|
revocationStatement: "DROP USER {{username}};",
|
||||||
renewStatement: "ALTER USER {{username}} SET DAYS_TO_EXPIRY = {{expiration}};"
|
renewStatement: "ALTER USER {{username}} SET DAYS_TO_EXPIRY = {{expiration}};"
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -100,12 +100,10 @@ export const SnowflakeInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.Snowflake, inputs: provider },
|
provider: { type: DynamicSecretProviders.Snowflake, inputs: provider },
|
||||||
@@ -114,19 +112,14 @@ export const SnowflakeInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: err instanceof Error ? err.message : "Failed to create dynamic secret"
|
text: err instanceof Error ? err.message : "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -334,19 +327,18 @@ export const SnowflakeInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+10
-17
@@ -82,7 +82,7 @@ const formSchema = z.object({
|
|||||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "TTL must be less than a day" });
|
||||||
}),
|
}),
|
||||||
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
name: z.string().refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ export const SqlDatabaseInputForm = ({
|
|||||||
allowedSymbols: "-_.~!*"
|
allowedSymbols: "-_.~!*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -190,12 +190,11 @@ export const SqlDatabaseInputForm = ({
|
|||||||
maxTTL,
|
maxTTL,
|
||||||
provider,
|
provider,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
environments: selectedEnvs
|
environment
|
||||||
}: TForm) => {
|
}: TForm) => {
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.SqlDatabase, inputs: provider },
|
provider: { type: DynamicSecretProviders.SqlDatabase, inputs: provider },
|
||||||
@@ -204,19 +203,14 @@ export const SqlDatabaseInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL,
|
defaultTTL,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch {
|
} catch {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: `Failed to create dynamic secret for environment ${env.name}`
|
text: "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -669,19 +663,18 @@ export const SqlDatabaseInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
+8
-20
@@ -61,7 +61,7 @@ const formSchema = z.object({
|
|||||||
.trim()
|
.trim()
|
||||||
.min(1)
|
.min(1)
|
||||||
.refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
.refine((val) => val.toLowerCase() === val, "Must be lowercase"),
|
||||||
environments: z.object({ name: z.string(), slug: z.string() }).array()
|
environment: z.object({ name: z.string(), slug: z.string() })
|
||||||
});
|
});
|
||||||
|
|
||||||
type TForm = z.infer<typeof formSchema>;
|
type TForm = z.infer<typeof formSchema>;
|
||||||
@@ -92,7 +92,7 @@ export const TotpInputForm = ({
|
|||||||
provider: {
|
provider: {
|
||||||
configType: ConfigType.URL
|
configType: ConfigType.URL
|
||||||
},
|
},
|
||||||
environments: environments.length === 1 ? environments : []
|
environment: environments.length === 1 ? environments[0] : environments[0]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -100,15 +100,9 @@ export const TotpInputForm = ({
|
|||||||
|
|
||||||
const createDynamicSecret = useCreateDynamicSecret();
|
const createDynamicSecret = useCreateDynamicSecret();
|
||||||
|
|
||||||
const handleCreateDynamicSecret = async ({
|
const handleCreateDynamicSecret = async ({ name, provider, environment }: TForm) => {
|
||||||
name,
|
|
||||||
provider,
|
|
||||||
environments: selectedEnvs
|
|
||||||
}: TForm) => {
|
|
||||||
// wait till previous request is finished
|
// wait till previous request is finished
|
||||||
if (createDynamicSecret.isPending) return;
|
if (createDynamicSecret.isPending) return;
|
||||||
let hasErrors = false;
|
|
||||||
const promises = selectedEnvs.map(async (env) => {
|
|
||||||
try {
|
try {
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.Totp, inputs: provider },
|
provider: { type: DynamicSecretProviders.Totp, inputs: provider },
|
||||||
@@ -117,19 +111,14 @@ export const TotpInputForm = ({
|
|||||||
path: secretPath,
|
path: secretPath,
|
||||||
defaultTTL: "1m",
|
defaultTTL: "1m",
|
||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: env.slug
|
environmentSlug: environment.slug
|
||||||
});
|
});
|
||||||
|
onCompleted();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: err instanceof Error ? err.message : "Failed to create dynamic secret"
|
text: err instanceof Error ? err.message : "Failed to create dynamic secret"
|
||||||
});
|
});
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
if (!hasErrors) {
|
|
||||||
onCompleted();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -319,19 +308,18 @@ export const TotpInputForm = ({
|
|||||||
{environments.length > 1 && (
|
{environments.length > 1 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="environments"
|
name="environment"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Environments"
|
label="Environment"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
isMulti
|
|
||||||
options={environments}
|
options={environments}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Select environments to create secret in..."
|
placeholder="Select the environment to create secret in..."
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option.slug}
|
getOptionValue={(option) => option.slug}
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
|
|||||||
Reference in New Issue
Block a user