mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-22 00:01:34 +00:00
fix (#1453)
This commit is contained in:
@@ -142,17 +142,12 @@
|
||||
return
|
||||
}
|
||||
|
||||
const { path } = connection
|
||||
|
||||
const hasSubPath = ['.', '['].some((x) => path.includes(x))
|
||||
|
||||
if (hasSubPath) {
|
||||
const realPath = path
|
||||
.replace(/\[(\w+)\]/g, '.$1')
|
||||
.split('.')
|
||||
.slice(1)
|
||||
.join('.')
|
||||
let { path }: { path: string } = connection
|
||||
|
||||
path = path.replace(/\[(\d+)\]/g, '.$1').replace(/\[\"(.*)\"\]/g, '.$1')
|
||||
let splitPoint = path.indexOf('.')
|
||||
if (splitPoint != -1) {
|
||||
const realPath = path.substring(splitPoint + 1)
|
||||
value = accessPropertyByPath<T>(newValue, realPath)
|
||||
} else {
|
||||
value = newValue
|
||||
|
||||
@@ -81,12 +81,7 @@ export function schemaToInputsSpec(
|
||||
}, {})
|
||||
}
|
||||
|
||||
export function accessPropertyByPath<T>(object: T, path: string): T | undefined {
|
||||
// convert indexes to properties
|
||||
path = path.replace(/\[(\w+)\]/g, '.$1')
|
||||
// strip a leading dot
|
||||
path = path.replace(/^\./, '')
|
||||
|
||||
export function accessPropertyByPath<T>(object: T, path: string): any {
|
||||
let a = path.split('.')
|
||||
|
||||
for (let i = 0, depth = a.length; i < depth; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user