mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-19 10:25:20 +00:00
Merge pull request #3348 from Bima42/feat/3345-allow-services-to-end-with-numbers
fix: update regex to allow number at the end of app name
This commit is contained in:
@@ -43,6 +43,7 @@ import {
|
|||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import { slugify } from "@/lib/slug";
|
import { slugify } from "@/lib/slug";
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
|
import { APP_NAME_MESSAGE, APP_NAME_REGEX } from "@/utils/schema";
|
||||||
|
|
||||||
const AddTemplateSchema = z.object({
|
const AddTemplateSchema = z.object({
|
||||||
name: z.string().min(1, {
|
name: z.string().min(1, {
|
||||||
@@ -53,9 +54,8 @@ const AddTemplateSchema = z.object({
|
|||||||
.min(1, {
|
.min(1, {
|
||||||
message: "App name is required",
|
message: "App name is required",
|
||||||
})
|
})
|
||||||
.regex(/^[a-z](?!.*--)([a-z0-9-]*[a-z])?$/, {
|
.regex(APP_NAME_REGEX, {
|
||||||
message:
|
message: APP_NAME_MESSAGE,
|
||||||
"App name supports lowercase letters, numbers, '-' and can only start and end letters, and does not support continuous '-'",
|
|
||||||
}),
|
}),
|
||||||
description: z.string().optional(),
|
description: z.string().optional(),
|
||||||
serverId: z.string().optional(),
|
serverId: z.string().optional(),
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import {
|
|||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import { slugify } from "@/lib/slug";
|
import { slugify } from "@/lib/slug";
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
|
import { APP_NAME_MESSAGE, APP_NAME_REGEX } from "@/utils/schema";
|
||||||
|
|
||||||
const AddComposeSchema = z.object({
|
const AddComposeSchema = z.object({
|
||||||
composeType: z.enum(["docker-compose", "stack"]).optional(),
|
composeType: z.enum(["docker-compose", "stack"]).optional(),
|
||||||
@@ -54,9 +55,8 @@ const AddComposeSchema = z.object({
|
|||||||
.min(1, {
|
.min(1, {
|
||||||
message: "App name is required",
|
message: "App name is required",
|
||||||
})
|
})
|
||||||
.regex(/^[a-z](?!.*--)([a-z0-9-]*[a-z])?$/, {
|
.regex(APP_NAME_REGEX, {
|
||||||
message:
|
message: APP_NAME_MESSAGE,
|
||||||
"App name supports lowercase letters, numbers, '-' and can only start and end letters, and does not support continuous '-'",
|
|
||||||
}),
|
}),
|
||||||
description: z.string().optional(),
|
description: z.string().optional(),
|
||||||
serverId: z.string().optional(),
|
serverId: z.string().optional(),
|
||||||
@@ -78,9 +78,6 @@ export const AddCompose = ({ environmentId, projectName }: Props) => {
|
|||||||
const { mutateAsync, isPending, error, isError } =
|
const { mutateAsync, isPending, error, isError } =
|
||||||
api.compose.create.useMutation();
|
api.compose.create.useMutation();
|
||||||
|
|
||||||
// Get environment data to extract projectId
|
|
||||||
// const { data: environment } = api.environment.one.useQuery({ environmentId });
|
|
||||||
|
|
||||||
const hasServers = servers && servers.length > 0;
|
const hasServers = servers && servers.length > 0;
|
||||||
// Show dropdown logic based on cloud environment
|
// Show dropdown logic based on cloud environment
|
||||||
// Cloud: show only if there are remote servers (no Dokploy option)
|
// Cloud: show only if there are remote servers (no Dokploy option)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import {
|
|||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import { slugify } from "@/lib/slug";
|
import { slugify } from "@/lib/slug";
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
|
import { APP_NAME_MESSAGE, APP_NAME_REGEX } from "@/utils/schema";
|
||||||
|
|
||||||
type DbType = z.infer<typeof mySchema>["type"];
|
type DbType = z.infer<typeof mySchema>["type"];
|
||||||
|
|
||||||
@@ -82,9 +83,8 @@ const baseDatabaseSchema = z.object({
|
|||||||
.min(1, {
|
.min(1, {
|
||||||
message: "App name is required",
|
message: "App name is required",
|
||||||
})
|
})
|
||||||
.regex(/^[a-z](?!.*--)([a-z0-9-]*[a-z])?$/, {
|
.regex(APP_NAME_REGEX, {
|
||||||
message:
|
message: APP_NAME_MESSAGE,
|
||||||
"App name supports lowercase letters, numbers, '-' and can only start and end letters, and does not support continuous '-'",
|
|
||||||
}),
|
}),
|
||||||
databasePassword: z
|
databasePassword: z
|
||||||
.string()
|
.string()
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ if (typeof window === "undefined") {
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const APP_NAME_REGEX = /^[a-z](?!.*--)([a-z0-9-]*[a-z0-9])?$/;
|
||||||
|
export const APP_NAME_MESSAGE =
|
||||||
|
"App name supports lowercase letters, numbers, '-' and must start with a letter, end with a letter or number, and cannot contain consecutive '-'";
|
||||||
|
|
||||||
export const uploadFileSchema = zfd.formData({
|
export const uploadFileSchema = zfd.formData({
|
||||||
applicationId: z.string().optional(),
|
applicationId: z.string().optional(),
|
||||||
zip: zfd.file(),
|
zip: zfd.file(),
|
||||||
|
|||||||
Reference in New Issue
Block a user