|
|
@ -1,6 +1,7 @@ |
|
|
import { cloneDeep } from "lodash/fp" |
|
|
import { cloneDeep } from "lodash/fp" |
|
|
import { get } from "svelte/store" |
|
|
import { get } from "svelte/store" |
|
|
import { backendUiStore, store } from "builderStore" |
|
|
import { store } from "builderStore" |
|
|
|
|
|
import { tables as tablesStore, queries as queriesStores } from 'builderStore/store/backend/' |
|
|
import { findComponentPath } from "./storeUtils" |
|
|
import { findComponentPath } from "./storeUtils" |
|
|
import { makePropSafe } from "@budibase/string-templates" |
|
|
import { makePropSafe } from "@budibase/string-templates" |
|
|
import { TableNames } from "../constants" |
|
|
import { TableNames } from "../constants" |
|
|
@ -164,7 +165,7 @@ const getContextBindings = (asset, componentId) => { |
|
|
*/ |
|
|
*/ |
|
|
const getUserBindings = () => { |
|
|
const getUserBindings = () => { |
|
|
let bindings = [] |
|
|
let bindings = [] |
|
|
const tables = get(backendUiStore).tables |
|
|
const tables = get(tablesStore).list |
|
|
const userTable = tables.find(table => table._id === TableNames.USERS) |
|
|
const userTable = tables.find(table => table._id === TableNames.USERS) |
|
|
const schema = { |
|
|
const schema = { |
|
|
...userTable.schema, |
|
|
...userTable.schema, |
|
|
@ -223,10 +224,10 @@ export const getSchemaForDatasource = (datasource, isForm = false) => { |
|
|
if (datasource) { |
|
|
if (datasource) { |
|
|
const { type } = datasource |
|
|
const { type } = datasource |
|
|
if (type === "query") { |
|
|
if (type === "query") { |
|
|
const queries = get(backendUiStore).queries |
|
|
const queries = get(queriesStores).queries |
|
|
table = queries.find(query => query._id === datasource._id) |
|
|
table = queries.find(query => query._id === datasource._id) |
|
|
} else { |
|
|
} else { |
|
|
const tables = get(backendUiStore).tables |
|
|
const tables = get(tablesStore).tables |
|
|
table = tables.find(table => table._id === datasource.tableId) |
|
|
table = tables.find(table => table._id === datasource.tableId) |
|
|
} |
|
|
} |
|
|
if (table) { |
|
|
if (table) { |
|
|
|