fix: built-in backend versions endwith -custom

This commit is contained in:
jialin
2025-10-27 16:09:09 +08:00
parent 61065ee0b7
commit 697f1f9c25
15 changed files with 96 additions and 48 deletions
+26 -3
View File
@@ -12,11 +12,14 @@ import styled from 'styled-components';
import { frameworks } from '../config';
import { ListItem } from '../config/types';
// version must be endwith '-custom'
const pattern = /-custom$/;
const Box = styled.div`
display: grid;
grid-template-columns: 150px 1fr;
grid-template-columns: 180px 1fr;
gap: 16px;
align-items: center;
`;
const Label = styled.span`
@@ -152,6 +155,10 @@ const VersionsForm: React.FC<AddModalProps> = ({
}
}, [currentData?.default_version]);
const handleVersionChange = (e: React.ChangeEvent<HTMLInputElement>) => {
console.log('Version changed:', e.target.value);
};
return (
<>
<Title>
@@ -273,11 +280,27 @@ const VersionsForm: React.FC<AddModalProps> = ({
{
required: true,
message: getRuleMessage(`input`, 'backend.version')
}
},
currentData?.is_built_in
? {
pattern: pattern,
message: intl.formatMessage({
id: 'backend.version.rules.builtin'
})
}
: {}
]}
>
<SealInput.Input
trim
description={
currentData?.is_built_in
? intl.formatMessage({
id: 'backend.version.no.tips'
})
: ''
}
onChange={handleVersionChange}
label={intl.formatMessage({ id: 'backend.version' })}
required
></SealInput.Input>