refactor(ui): clean code

This commit is contained in:
Fu Diwei
2024-12-25 23:20:09 +08:00
parent adbf40914e
commit 1184e52ba9
30 changed files with 267 additions and 233 deletions

View File

@@ -32,7 +32,7 @@ const NotifyChannel = ({ className, style, channel }: NotifyChannelProps) => {
await channelFormRef.current!.validateFields();
try {
setChannel(channel, channelFormRef.current!.getFieldsValue());
setChannel(channel, channelFormRef.current!.getFieldsValue(true));
setChannelFormChanged(false);
messageApi.success(t("common.text.operation_succeeded"));
@@ -46,7 +46,13 @@ const NotifyChannel = ({ className, style, channel }: NotifyChannelProps) => {
{MessageContextHolder}
{NotificationContextHolder}
<NotifyChannelEditForm ref={channelFormRef} className="mt-2" channel={channel} model={channelConfig} onModelChange={() => setChannelFormChanged(true)} />
<NotifyChannelEditForm
ref={channelFormRef}
className="mt-2"
channel={channel}
initialValues={channelConfig}
onValuesChange={() => setChannelFormChanged(true)}
/>
<Space className="mb-2">
<Button type="primary" disabled={!channelFormChanged} onClick={handleSubmit}>