diff --git a/ui/src/components/DiffContent/index.tsx b/ui/src/components/DiffContent/index.tsx index 2362e81c..2becb18d 100644 --- a/ui/src/components/DiffContent/index.tsx +++ b/ui/src/components/DiffContent/index.tsx @@ -24,7 +24,7 @@ const Index: FC = ({ showTagUrlSlug: true, }, }) => { - if (!newData?.original_text) return null; + if (!newData) return null; let tag = newData.tags; if (objectType === 'question' && oldData?.tags) { diff --git a/ui/src/components/SchemaForm/index.tsx b/ui/src/components/SchemaForm/index.tsx index 776d0b42..61c7d8c7 100644 --- a/ui/src/components/SchemaForm/index.tsx +++ b/ui/src/components/SchemaForm/index.tsx @@ -237,6 +237,24 @@ const SchemaForm: FC = ({ } }; + const handleCheckboxChange = ( + e: React.ChangeEvent, + index: number, + ) => { + const { name } = e.target; + const data = { + ...formData, + [name]: { + ...formData[name], + value: schema.properties[name]?.enum?.[index], + isInvalid: false, + }, + }; + if (onChange instanceof Function) { + onChange(data); + } + }; + return (
{keys.map((key) => { @@ -280,13 +298,14 @@ const SchemaForm: FC = ({ inline required type={widget} - name={title} + name={key} id={String(item)} label={properties[key].enumNames?.[index]} checked={formData[key]?.value === item} feedback={formData[key]?.errorMsg} feedbackType="invalid" isInvalid={formData[key].isInvalid} + onChange={(e) => handleCheckboxChange(e, index)} /> ); })} diff --git a/ui/src/pages/Admin/Smtp/index.tsx b/ui/src/pages/Admin/Smtp/index.tsx index 2af421a6..26cdd451 100644 --- a/ui/src/pages/Admin/Smtp/index.tsx +++ b/ui/src/pages/Admin/Smtp/index.tsx @@ -37,7 +37,7 @@ const Smtp: FC = () => { type: 'boolean', title: t('encryption.label'), description: t('encryption.text'), - enum: [true, false], + enum: ['SSL', ''], enumNames: ['SSL', ''], }, smtp_port: {