surface schema for user in json
This commit is contained in:
parent
e479ced4c8
commit
2d4bb78afc
|
@ -11,10 +11,22 @@
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
export let bindings
|
export let bindings
|
||||||
$: table = $tables.list.find(table => table._id === value?.tableId)
|
let table
|
||||||
$: schemaFields = Object.entries(table?.schema ?? {})
|
let schemaFields
|
||||||
|
|
||||||
|
$: {
|
||||||
|
table = $tables.list.find(table => table._id === value?.tableId)
|
||||||
|
schemaFields = Object.entries(table?.schema ?? {})
|
||||||
|
// surface the schema so the user can see it in the json
|
||||||
|
schemaFields.map(([, schema]) => {
|
||||||
|
if (!schema.autocolumn && !value[schema.name]) {
|
||||||
|
value[schema.name] = ""
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const onChangeTable = e => {
|
const onChangeTable = e => {
|
||||||
value = { tableId: e.detail }
|
value["tableId"] = e.detail
|
||||||
dispatch("change", value)
|
dispatch("change", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue