Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
"required": "This field is required!",
"properFormatting": "Use A-Z, a-z, 0-9, hyphen (-), and period (.), but note that whitespace (spaces, tabs, etc.) is not allowed for proper compatibility.",
"properFormattingLowercase": "Use lowercase a-z, 0-9, hyphen (-), and period (.), but note that whitespace (spaces, tabs, etc.) is not allowed for proper compatibility.",
"max25chars": "Max length is 25 characters.",
"maxChars": "Max length is {{maxLength}} characters.",
"userExists": "User with this email already exists!",
"atLeastOneUser": "You need to have at least one member assigned."
},
Expand Down
14 changes: 4 additions & 10 deletions src/lib/api/validations/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { z } from 'zod';
import { Member } from '../types/shared/members.ts';
import i18n from '../../../../i18n.ts';
import {
managedControlPlaneNameRegex,
projectWorkspaceNameRegex,
} from './regex.ts';
import { managedControlPlaneNameRegex, projectWorkspaceNameRegex } from './regex.ts';

const { t } = i18n;

Expand All @@ -15,7 +12,7 @@ export const validationSchemaProjectWorkspace = z.object({
.string()
.min(1, t('validationErrors.required'))
.regex(projectWorkspaceNameRegex, t('validationErrors.properFormatting'))
.max(25, t('validationErrors.max25chars')),
.max(25, t('validationErrors.maxChars', { maxLength: 25 })),
displayName: z.string().optional(),
chargingTarget: z.string().optional(),
chargingTargetType: z.string().optional(),
Expand All @@ -25,11 +22,8 @@ export const validationSchemaCreateManagedControlPlane = z.object({
name: z
.string()
.min(1, t('validationErrors.required'))
.regex(
managedControlPlaneNameRegex,
t('validationErrors.properFormattingLowercase'),
)
.max(25, t('validationErrors.max25chars')),
.regex(managedControlPlaneNameRegex, t('validationErrors.properFormattingLowercase'))
.max(36, t('validationErrors.maxChars', { maxLength: 36 })),
displayName: z.string().optional(),
chargingTarget: z.string().optional(),
chargingTargetType: z.string().optional(),
Expand Down
Loading