Review updates

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

View File

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

View File

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