Update search component to work with new data bindings. Simplify manifest context entries for data bindings
This commit is contained in:
parent
88ae09a553
commit
d26c20df31
|
@ -35,7 +35,7 @@ export const getDataProviderComponents = (asset, componentId) => {
|
||||||
// Filter by only data provider components
|
// Filter by only data provider components
|
||||||
return path.filter(component => {
|
return path.filter(component => {
|
||||||
const def = store.actions.components.getDefinition(component._component)
|
const def = store.actions.components.getDefinition(component._component)
|
||||||
return def?.dataContext != null
|
return def?.context != null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,32 +113,28 @@ const getContextBindings = (asset, componentId) => {
|
||||||
// Create bindings for each data provider
|
// Create bindings for each data provider
|
||||||
dataProviders.forEach(component => {
|
dataProviders.forEach(component => {
|
||||||
const def = store.actions.components.getDefinition(component._component)
|
const def = store.actions.components.getDefinition(component._component)
|
||||||
const contextDefinition = def.dataContext
|
const contextDefinition = def.context
|
||||||
let schema
|
let schema
|
||||||
let readablePrefix
|
let readablePrefix
|
||||||
|
|
||||||
// Forms are an edge case which do not need table schemas
|
|
||||||
if (contextDefinition.type === "form") {
|
if (contextDefinition.type === "form") {
|
||||||
|
// Forms do not need table schemas
|
||||||
|
// Their schemas are built from their component field names
|
||||||
schema = buildFormSchema(component)
|
schema = buildFormSchema(component)
|
||||||
readablePrefix = "Fields"
|
readablePrefix = "Fields"
|
||||||
} else if (contextDefinition.type === "static") {
|
} else if (contextDefinition.type === "static") {
|
||||||
|
// Static contexts are fully defined by the components
|
||||||
schema = {}
|
schema = {}
|
||||||
const values = contextDefinition.values || []
|
const values = contextDefinition.values || []
|
||||||
values.forEach(value => {
|
values.forEach(value => {
|
||||||
schema[value.key] = { name: value.label, type: "string" }
|
schema[value.key] = { name: value.label, type: "string" }
|
||||||
})
|
})
|
||||||
} else if (contextDefinition.type === "schema") {
|
} else if (contextDefinition.type === "schema") {
|
||||||
let datasource
|
// Schema contexts are generated dynamically depending on their data
|
||||||
const setting = contextDefinition.dataProviderSetting
|
const datasource = getDatasourceForProvider(asset, component)
|
||||||
const settingValue = component[setting]
|
|
||||||
const providerId = extractLiteralHandlebarsID(settingValue)
|
|
||||||
const provider = findComponent(asset.props, providerId)
|
|
||||||
datasource = getDatasourceForProvider(asset, provider)
|
|
||||||
if (!datasource) {
|
if (!datasource) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get schema and table for the datasource
|
|
||||||
const info = getSchemaForDatasource(datasource)
|
const info = getSchemaForDatasource(datasource)
|
||||||
schema = info.schema
|
schema = info.schema
|
||||||
readablePrefix = info.table?.name
|
readablePrefix = info.table?.name
|
||||||
|
|
|
@ -61,9 +61,8 @@
|
||||||
"key": "filter"
|
"key": "filter"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dataContext": {
|
"context": {
|
||||||
"type": "schema",
|
"type": "schema"
|
||||||
"dataProviderSetting": "dataProvider"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
|
@ -96,7 +95,10 @@
|
||||||
"key": "noRowsMessage",
|
"key": "noRowsMessage",
|
||||||
"defaultValue": "No rows found."
|
"defaultValue": "No rows found."
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"context": {
|
||||||
|
"type": "schema"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"stackedlist": {
|
"stackedlist": {
|
||||||
"name": "Stacked List",
|
"name": "Stacked List",
|
||||||
|
@ -1125,7 +1127,7 @@
|
||||||
"defaultValue": false
|
"defaultValue": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dataContext": {
|
"context": {
|
||||||
"type": "form"
|
"type": "form"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1446,7 +1448,7 @@
|
||||||
"key": "limit"
|
"key": "limit"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dataContext": {
|
"context": {
|
||||||
"type": "static",
|
"type": "static",
|
||||||
"values": [
|
"values": [
|
||||||
{
|
{
|
||||||
|
@ -1548,9 +1550,8 @@
|
||||||
"defaultValue": false
|
"defaultValue": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dataContext": {
|
"context": {
|
||||||
"type": "schema",
|
"type": "schema"
|
||||||
"dataProviderSetting": "dataProvider"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue