Remove table ID from custom queries to fix 500 errors when trying to fetch a table definition and passing up a query ID, and fix issue with search fields when no table ID exists

This commit is contained in:
Andrew Kingston 2022-04-12 16:58:26 +01:00
parent d73105dbee
commit 69ec82856c
2 changed files with 1 additions and 2 deletions

View File

@ -52,7 +52,6 @@
.map(query => ({ .map(query => ({
label: query.name, label: query.name,
name: query.name, name: query.name,
tableId: query._id,
...query, ...query,
type: "query", type: "query",
})) }))

View File

@ -22,7 +22,7 @@
function getOptions(ds, dsSchema) { function getOptions(ds, dsSchema) {
let base = Object.values(dsSchema) let base = Object.values(dsSchema)
if (!ds?.tableId) { if (!ds?.tableId) {
return base return base.map(field => field.name)
} }
const currentTable = $tables.list.find(table => table._id === ds.tableId) const currentTable = $tables.list.find(table => table._id === ds.tableId)
return getFields(base, { allowLinks: currentTable?.sql }).map( return getFields(base, { allowLinks: currentTable?.sql }).map(