Review updates

This commit is contained in:
Dean 2022-11-23 17:12:23 +00:00
parent de8d1daca2
commit 13616e5966
2 changed files with 14 additions and 10 deletions

View File

@ -20,6 +20,11 @@ import {
} from "../componentUtils" } from "../componentUtils"
import { Helpers } from "@budibase/bbui" import { Helpers } from "@budibase/bbui"
import { Utils } from "@budibase/frontend-core" import { Utils } from "@budibase/frontend-core"
import {
BUDIBASE_INTERNAL_DB_ID,
DB_TYPE_INTERNAL,
DB_TYPE_EXTERNAL,
} from "constants/backend"
const INITIAL_FRONTEND_STATE = { const INITIAL_FRONTEND_STATE = {
apps: [], apps: [],
@ -497,25 +502,22 @@ export const getFrontendStore = () => {
const internalTable = filteredTables.find( const internalTable = filteredTables.find(
table => table =>
table.sourceId === "bb_internal" && table.type == "internal" table.sourceId === BUDIBASE_INTERNAL_DB_ID &&
table.type == DB_TYPE_INTERNAL
) )
const defaultSourceTable = filteredTables.find( const defaultSourceTable = filteredTables.find(
table => table =>
table.sourceId !== "bb_internal" && table.type == "internal" table.sourceId !== BUDIBASE_INTERNAL_DB_ID &&
table.type == DB_TYPE_INTERNAL
) )
const defaultExternalTable = filteredTables.find( const defaultExternalTable = filteredTables.find(
table => table.type == "external" table => table.type == DB_TYPE_EXTERNAL
) )
if (defaultSourceTable) { defaultDatasource =
defaultDatasource = defaultSourceTable defaultSourceTable || internalTable || defaultExternalTable
} else if (internalTable) {
defaultDatasource = internalTable
} else if (defaultExternalTable) {
defaultDatasource = defaultExternalTable
}
} }
// Generate default props // Generate default props

View File

@ -175,6 +175,8 @@ export const SWITCHABLE_TYPES = [
export const BUDIBASE_INTERNAL_DB_ID = "bb_internal" export const BUDIBASE_INTERNAL_DB_ID = "bb_internal"
export const BUDIBASE_DATASOURCE_TYPE = "budibase" export const BUDIBASE_DATASOURCE_TYPE = "budibase"
export const DB_TYPE_INTERNAL = "internal"
export const DB_TYPE_EXTERNAL = "external"
export const IntegrationTypes = { export const IntegrationTypes = {
POSTGRES: "POSTGRES", POSTGRES: "POSTGRES",