From 0f9054bc9a3d534fd8a006636446edc280ca7b7f Mon Sep 17 00:00:00 2001 From: wohainilaodou Date: Mon, 21 Oct 2024 16:01:15 +0800 Subject: [PATCH] [INLONG-11379][Dashboard] Redis sink Properties saving problem --- .../GroupDetail/DataStorage/DetailModal.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/inlong-dashboard/src/ui/pages/GroupDetail/DataStorage/DetailModal.tsx b/inlong-dashboard/src/ui/pages/GroupDetail/DataStorage/DetailModal.tsx index e2d4e2d69ef..5819494b3a3 100644 --- a/inlong-dashboard/src/ui/pages/GroupDetail/DataStorage/DetailModal.tsx +++ b/inlong-dashboard/src/ui/pages/GroupDetail/DataStorage/DetailModal.tsx @@ -73,6 +73,12 @@ const Comp: React.FC = ({ formatResult: result => new Entity()?.parse(result) || result, onSuccess: result => { setSinkType(result.sinkType); + if (result.sinkType === 'REDIS') { + result.properties = Object.entries(result.properties).map(([key, value]) => ({ + keyName: key, + keyValue: value, + })); + } form.setFieldsValue(result); }, }, @@ -158,6 +164,19 @@ const Comp: React.FC = ({ if (startProcess) { submitData.startProcess = true; } + if (sinkType === 'REDIS') { + if (Array.isArray(submitData.properties) && submitData.properties.length > 0) { + const propertiesObject = submitData.properties.reduce((acc, item) => { + if (item.keyName && item.keyValue !== undefined) { + acc[item.keyName] = item.keyValue; + } + return acc; + }, {}); + submitData.properties = propertiesObject; + } else { + submitData.properties = {}; + } + } await request({ url: isUpdate ? '/sink/update' : '/sink/save', method: 'POST',