Skip to content

Commit

Permalink
fix(connector & action): issue when saving as copy; simple oneof
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon committed Dec 19, 2024
1 parent d1e1d47 commit d1daa8a
Showing 1 changed file with 2 additions and 33 deletions.
35 changes: 2 additions & 33 deletions src/hooks/Rule/useDataHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const useCommonDataHandler = () => {
'secret_access_key',
'token',
'security_token',
'access_key_id',
'access_key_secret',
].reduce((arr: Array<string>, key) => [...arr, key, `parameters.${key}`], [])
const handleDataForCopy = (data: any): any => {
const ret = omit(data, keysNeedDel.saveAsCopy)
Expand Down Expand Up @@ -257,37 +259,6 @@ export const useActionDataHandler = (): {
} => {
const { handleDataBeforeSubmit } = useCommonDataHandler()

const handleOpenTSDBDataBeforeSubmit = (data: any): any => {
const dataArr = data.parameters?.data
if (Array.isArray(dataArr)) {
data.parameters.data = dataArr.map((item) =>
NUM_REG.test(item.value) ? { ...item, value: Number(item.value) } : item,
)
}
return data
}

const handleTablestoreActionData = (data: any) => {
const fieldArr = data.parameters?.fields
if (Array.isArray(fieldArr)) {
data.parameters.fields = fieldArr.map((item) => {
const ret = item
;['value', 'isint', 'isbinary'].forEach((key) => {
if (/^(true|false)$/i.test(item[key])) {
ret[key] = /^true/i.test(item[key])
} else if (!item[key]) {
Reflect.deleteProperty(ret, key)
}
})
if (NUM_REG.test(item.value)) {
ret.value = Number(item.value)
}
return ret
})
}
return data
}

const { splitBySpace, transCommandArrToStr } = useRedisCommandCheck()
const handleRedisBridgeData = async (bridgeData: any) => {
try {
Expand Down Expand Up @@ -324,12 +295,10 @@ export const useActionDataHandler = (): {
}

const specialDataHandlerBeforeSubmit = new Map([
[BridgeType.OpenTSDB, handleOpenTSDBDataBeforeSubmit],
[BridgeType.Redis, handleRedisBridgeData],
[BridgeType.S3, handleS3ActionData],
[BridgeType.AzureBlobStorage, handleS3ActionData],
[BridgeType.IoTDB, handleIoTDBActionData],
[BridgeType.Tablestore, handleTablestoreActionData],
])

/**
Expand Down

0 comments on commit d1daa8a

Please sign in to comment.