mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 09:34:31 +08:00
Fix "Validation failed" when editing env variables with null labels (#3026)
* Initial plan * Fix env variable edit validation error when labels is null --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -49,7 +49,7 @@ export default (app: Router) => {
|
|||||||
.required()
|
.required()
|
||||||
.pattern(/^[a-zA-Z_][0-9a-zA-Z_]*$/),
|
.pattern(/^[a-zA-Z_][0-9a-zA-Z_]*$/),
|
||||||
remarks: Joi.string().optional().allow(''),
|
remarks: Joi.string().optional().allow(''),
|
||||||
labels: Joi.array().items(Joi.string().trim()).optional(),
|
labels: Joi.array().items(Joi.string().trim()).optional().allow(null),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
@@ -76,7 +76,7 @@ export default (app: Router) => {
|
|||||||
name: Joi.string().required(),
|
name: Joi.string().required(),
|
||||||
remarks: Joi.string().optional().allow('').allow(null),
|
remarks: Joi.string().optional().allow('').allow(null),
|
||||||
id: Joi.number().required(),
|
id: Joi.number().required(),
|
||||||
labels: Joi.array().items(Joi.string().trim()).optional(),
|
labels: Joi.array().items(Joi.string().trim()).optional().allow(null),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
async (req: Request, res: Response, next: NextFunction) => {
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -35,7 +35,7 @@ const EnvModal = ({
|
|||||||
payload = [{ value, name, remarks, labels: labels || [] }];
|
payload = [{ value, name, remarks, labels: labels || [] }];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
payload = { ...values, id: env.id };
|
payload = { ...values, labels: values.labels || [], id: env.id };
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const { code, data } = await request[method](
|
const { code, data } = await request[method](
|
||||||
|
|||||||
Reference in New Issue
Block a user