feat: Enhance EditChannelModal with JSONEditor key updates and input reset
Some checks failed
Publish Docker image (Multi Registries) / Push Docker image to multiple registries (push) Has been cancelled
Linux Release / release (push) Has been cancelled
macOS Release / release (push) Has been cancelled
Windows Release / release (push) Has been cancelled

- Added unique keys for JSONEditor components to ensure proper re-rendering based on channelId.
- Implemented input reset to clear previous JSON field values when the modal is opened.
This commit is contained in:
CaIon 2025-08-10 12:22:18 +08:00
parent 1ea54eb2ed
commit 54f470bc46

View File

@ -587,6 +587,8 @@ const EditChannelModal = (props) => {
if (formApiRef.current) {
formApiRef.current.setValue('key_mode', undefined);
}
// JSON
setInputs(getInitValues());
}
}, [props.visible, channelId]);
@ -1257,6 +1259,7 @@ const EditChannelModal = (props) => {
{inputs.type === 41 && (
<JSONEditor
key={`region-${isEdit ? channelId : 'new'}`}
field='other'
label={t('部署地区')}
placeholder={t(
@ -1552,6 +1555,7 @@ const EditChannelModal = (props) => {
/>
<JSONEditor
key={`model_mapping-${isEdit ? channelId : 'new'}`}
field='model_mapping'
label={t('模型重定向')}
placeholder={
@ -1655,6 +1659,7 @@ const EditChannelModal = (props) => {
/>
<JSONEditor
key={`status_code_mapping-${isEdit ? channelId : 'new'}`}
field='status_code_mapping'
label={t('状态码复写')}
placeholder={