Skip to content

Commit

Permalink
[INLONG-11379][Dashboard] Redis sink Properties saving problem
Browse files Browse the repository at this point in the history
  • Loading branch information
wohainilaodou committed Oct 21, 2024
1 parent 8c7d31d commit 0f9054b
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ const Comp: React.FC<DetailModalProps> = ({
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);
},
},
Expand Down Expand Up @@ -158,6 +164,19 @@ const Comp: React.FC<DetailModalProps> = ({
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',
Expand Down

0 comments on commit 0f9054b

Please sign in to comment.