Update form setting datasource type
This commit is contained in:
parent
951491006b
commit
aef82e29a6
|
@ -440,36 +440,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"rowdetail": {
|
|
||||||
"name": "Row Detail",
|
|
||||||
"description": "Loads a row, using an id from the URL, which can be used with {{ context }}, in children",
|
|
||||||
"icon": "ri-profile-line",
|
|
||||||
"styleable": true,
|
|
||||||
"hasChildren": true,
|
|
||||||
"dataProvider": true,
|
|
||||||
"settings": [
|
|
||||||
{
|
|
||||||
"type": "table",
|
|
||||||
"label": "Table",
|
|
||||||
"key": "table"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"newrow": {
|
|
||||||
"name": "New Row",
|
|
||||||
"description": "Sets up a new row for creation, which can be used with {{ context }}, in children",
|
|
||||||
"icon": "ri-profile-line",
|
|
||||||
"hasChildren": true,
|
|
||||||
"styleable": true,
|
|
||||||
"dataProvider": true,
|
|
||||||
"settings": [
|
|
||||||
{
|
|
||||||
"type": "table",
|
|
||||||
"label": "Table",
|
|
||||||
"key": "table"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"cardhorizontal": {
|
"cardhorizontal": {
|
||||||
"name": "Horizontal Card",
|
"name": "Horizontal Card",
|
||||||
"description": "A basic card component that can contain content and actions.",
|
"description": "A basic card component that can contain content and actions.",
|
||||||
|
@ -1144,7 +1114,7 @@
|
||||||
{
|
{
|
||||||
"type": "schema",
|
"type": "schema",
|
||||||
"label": "Schema",
|
"label": "Schema",
|
||||||
"key": "datasource"
|
"key": "dataSource"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "select",
|
"type": "select",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import { createValidatorFromConstraints } from "./validation"
|
import { createValidatorFromConstraints } from "./validation"
|
||||||
import { generateID } from "../helpers"
|
import { generateID } from "../helpers"
|
||||||
|
|
||||||
export let datasource
|
export let dataSource
|
||||||
export let theme
|
export let theme
|
||||||
export let size
|
export let size
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
|
@ -143,15 +143,15 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetches the form schema from this form's datasource, if one exists
|
// Fetches the form schema from this form's dataSource, if one exists
|
||||||
const fetchSchema = async () => {
|
const fetchSchema = async () => {
|
||||||
if (!datasource?.tableId) {
|
if (!dataSource?.tableId) {
|
||||||
schema = {}
|
schema = {}
|
||||||
table = null
|
table = null
|
||||||
} else {
|
} else {
|
||||||
table = await API.fetchTableDefinition(datasource?.tableId)
|
table = await API.fetchTableDefinition(dataSource?.tableId)
|
||||||
if (table) {
|
if (table) {
|
||||||
if (datasource?.type === "query") {
|
if (dataSource?.type === "query") {
|
||||||
schema = {}
|
schema = {}
|
||||||
const params = table.parameters || []
|
const params = table.parameters || []
|
||||||
params.forEach(param => {
|
params.forEach(param => {
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
|
|
||||||
<Provider
|
<Provider
|
||||||
{actions}
|
{actions}
|
||||||
data={{ ...$formState.values, tableId: datasource?.tableId }}>
|
data={{ ...$formState.values, tableId: dataSource?.tableId }}>
|
||||||
<div
|
<div
|
||||||
lang="en"
|
lang="en"
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
|
|
Loading…
Reference in New Issue