Remove last usage of legacy context util and update data providers to be able to use any data providers on the screen
This commit is contained in:
parent
b36b061bb2
commit
0d0d96f5da
|
@ -97,7 +97,7 @@ export const findAllComponents = rootComponent => {
|
|||
}
|
||||
|
||||
/**
|
||||
* Finds the closes parent component which matches certain criteria
|
||||
* Finds the closest parent component which matches certain criteria
|
||||
*/
|
||||
export const findClosestMatchingComponent = (
|
||||
rootComponent,
|
||||
|
|
|
@ -258,20 +258,6 @@ export const getComponentContexts = (
|
|||
return Object.values(map)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all data provider components above a component.
|
||||
*/
|
||||
export const getContextProviderComponents = (
|
||||
asset,
|
||||
componentId,
|
||||
type,
|
||||
options = { includeSelf: false }
|
||||
) => {
|
||||
return getComponentContexts(asset, componentId, type, options).map(
|
||||
entry => entry.component
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all data provider components above a component.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { getContextProviderComponents } from "builderStore/dataBinding"
|
||||
import { getComponentContexts } from "builderStore/dataBinding"
|
||||
import {
|
||||
Button,
|
||||
Popover,
|
||||
|
@ -22,6 +22,7 @@
|
|||
import BindingBuilder from "components/integration/QueryBindingBuilder.svelte"
|
||||
import IntegrationQueryEditor from "components/integration/index.svelte"
|
||||
import { makePropSafe as safe } from "@budibase/string-templates"
|
||||
import { findAllComponents } from "builderStore/componentUtils"
|
||||
|
||||
export let value = {}
|
||||
export let otherSources
|
||||
|
@ -60,12 +61,13 @@
|
|||
...query,
|
||||
type: "query",
|
||||
}))
|
||||
$: contextProviders = getContextProviderComponents(
|
||||
$currentAsset,
|
||||
$store.selectedComponentId
|
||||
)
|
||||
$: dataProviders = contextProviders
|
||||
.filter(component => component._component?.endsWith("/dataprovider"))
|
||||
$: dataProviders = findAllComponents($currentAsset.props)
|
||||
.filter(component => {
|
||||
return (
|
||||
component._component?.endsWith("/dataprovider") &&
|
||||
component._id !== $store.selectedComponentId
|
||||
)
|
||||
})
|
||||
.map(provider => ({
|
||||
label: provider._instanceName,
|
||||
name: provider._instanceName,
|
||||
|
|
Loading…
Reference in New Issue