Reverting frontend change.

This commit is contained in:
mike12345567 2024-04-09 10:29:52 +01:00
parent 680b6af2d1
commit 5cd82597ec
1 changed files with 4 additions and 4 deletions

View File

@ -4,11 +4,11 @@ import { get } from "svelte/store"
export function getTableFields(linkField) { export function getTableFields(linkField) {
const table = get(tables).list.find(table => table._id === linkField.tableId) const table = get(tables).list.find(table => table._id === linkField.tableId)
if (!table) { if (!table || !table.sql) {
return [] return []
} }
const linkFields = getFields(Object.values(table.schema), { const linkFields = getFields(Object.values(table.schema), {
tableFields: true, allowLinks: false,
}) })
return linkFields.map(field => ({ return linkFields.map(field => ({
...field, ...field,
@ -16,11 +16,11 @@ export function getTableFields(linkField) {
})) }))
} }
export function getFields(fields, { tableFields }) { export function getFields(fields, { allowLinks } = { allowLinks: true }) {
let filteredFields = fields.filter( let filteredFields = fields.filter(
field => !BannedSearchTypes.includes(field.type) field => !BannedSearchTypes.includes(field.type)
) )
if (!tableFields) { if (!allowLinks) {
const linkFields = fields.filter(field => field.type === "link") const linkFields = fields.filter(field => field.type === "link")
for (let linkField of linkFields) { for (let linkField of linkFields) {
// only allow one depth of SQL relationship filtering // only allow one depth of SQL relationship filtering