Fix for datasource resolution in validation editor drawer
This commit is contained in:
parent
cb63848245
commit
4343c43148
|
@ -12,7 +12,10 @@
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { currentAsset, selectedComponent } from "builderStore"
|
import { currentAsset, selectedComponent } from "builderStore"
|
||||||
import { findClosestMatchingComponent } from "builderStore/componentUtils"
|
import { findClosestMatchingComponent } from "builderStore/componentUtils"
|
||||||
import { getSchemaForDatasource } from "builderStore/dataBinding"
|
import {
|
||||||
|
getSchemaForDatasource,
|
||||||
|
getDatasourceForProvider,
|
||||||
|
} from "builderStore/dataBinding"
|
||||||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||||
import { generate } from "shortid"
|
import { generate } from "shortid"
|
||||||
|
|
||||||
|
@ -124,6 +127,12 @@
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resolveDatasource = (currentAsset, componentInstance, parent) => {
|
||||||
|
return (
|
||||||
|
getDatasourceForProvider(currentAsset, parent || componentInstance) || {}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
$: dataSourceSchema = getDataSourceSchema($currentAsset, $selectedComponent)
|
$: dataSourceSchema = getDataSourceSchema($currentAsset, $selectedComponent)
|
||||||
$: field = fieldName || $selectedComponent?.field
|
$: field = fieldName || $selectedComponent?.field
|
||||||
$: schemaRules = parseRulesFromSchema(field, dataSourceSchema || {})
|
$: schemaRules = parseRulesFromSchema(field, dataSourceSchema || {})
|
||||||
|
@ -146,8 +155,8 @@
|
||||||
component._component.endsWith("/formblock") ||
|
component._component.endsWith("/formblock") ||
|
||||||
component._component.endsWith("/tableblock")
|
component._component.endsWith("/tableblock")
|
||||||
)
|
)
|
||||||
|
const dataSource = resolveDatasource(asset, component, formParent)
|
||||||
return getSchemaForDatasource(asset, formParent?.dataSource)
|
return getSchemaForDatasource(asset, dataSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseRulesFromSchema = (field, dataSourceSchema) => {
|
const parseRulesFromSchema = (field, dataSourceSchema) => {
|
||||||
|
|
Loading…
Reference in New Issue