Review updates
This commit is contained in:
parent
847245f275
commit
f082e4596c
|
@ -2,7 +2,7 @@
|
|||
import { onMount } from "svelte"
|
||||
import { get } from "svelte/store"
|
||||
import { goto, params } from "@roxi/routify"
|
||||
import { BUDIBASE_INTERNAL_DB } from "constants"
|
||||
import { BUDIBASE_INTERNAL_DB_ID } from "constants/backend"
|
||||
import { database, datasources, queries, tables, views } from "stores/backend"
|
||||
import EditDatasourcePopover from "./popovers/EditDatasourcePopover.svelte"
|
||||
import EditQueryPopover from "./popovers/EditQueryPopover.svelte"
|
||||
|
@ -129,7 +129,7 @@
|
|||
size="18"
|
||||
/>
|
||||
</div>
|
||||
{#if datasource._id !== BUDIBASE_INTERNAL_DB}
|
||||
{#if datasource._id !== BUDIBASE_INTERNAL_DB_ID}
|
||||
<EditDatasourcePopover {datasource} />
|
||||
{/if}
|
||||
</NavItem>
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
} from "@budibase/bbui"
|
||||
import { datasources } from "stores/backend"
|
||||
import TableDataImport from "../TableDataImport.svelte"
|
||||
import {
|
||||
BUDIBASE_INTERNAL_DB_ID,
|
||||
BUDIBASE_DATASOURCE_TYPE,
|
||||
} from "constants/backend"
|
||||
import { buildAutoColumn, getAutoColumnInformation } from "builderStore/utils"
|
||||
|
||||
$: tableNames = $tables.list.map(table => table.name)
|
||||
|
@ -19,10 +23,10 @@
|
|||
source => source._id === $datasources.selected
|
||||
)
|
||||
|
||||
$: isSelectedInternal = selectedSource?.type === "budibase"
|
||||
$: isSelectedInternal = selectedSource?.type === BUDIBASE_DATASOURCE_TYPE
|
||||
$: targetDatasourceId = isSelectedInternal
|
||||
? selectedSource._id
|
||||
: "bb_internal"
|
||||
: BUDIBASE_INTERNAL_DB_ID
|
||||
|
||||
export let name
|
||||
let dataImport
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
import { datasources, integrations, queries } from "stores/backend"
|
||||
import BindingBuilder from "components/integration/QueryBindingBuilder.svelte"
|
||||
import IntegrationQueryEditor from "components/integration/index.svelte"
|
||||
import { BUDIBASE_DATASOURCE_ID } from "constants/backend"
|
||||
import {
|
||||
BUDIBASE_INTERNAL_DB_ID,
|
||||
BUDIBASE_DATASOURCE_TYPE,
|
||||
} from "constants/backend"
|
||||
|
||||
export let parameters
|
||||
export let bindings = []
|
||||
|
@ -14,7 +17,8 @@
|
|||
)
|
||||
// Executequery must exclude budibase datasource
|
||||
$: executeQueryDatasources = $datasources.list.filter(
|
||||
x => x._id !== BUDIBASE_DATASOURCE_ID && x.type !== "budibase"
|
||||
x =>
|
||||
x._id !== BUDIBASE_INTERNAL_DB_ID && x.type !== BUDIBASE_DATASOURCE_TYPE
|
||||
)
|
||||
|
||||
function fetchQueryDefinition(query) {
|
||||
|
|
|
@ -173,7 +173,8 @@ export const SWITCHABLE_TYPES = [
|
|||
...ALLOWABLE_NUMBER_TYPES,
|
||||
]
|
||||
|
||||
export const BUDIBASE_DATASOURCE_ID = "bb_internal"
|
||||
export const BUDIBASE_INTERNAL_DB_ID = "bb_internal"
|
||||
export const BUDIBASE_DATASOURCE_TYPE = "budibase"
|
||||
|
||||
export const IntegrationTypes = {
|
||||
POSTGRES: "POSTGRES",
|
||||
|
|
|
@ -43,8 +43,6 @@ export const LAYOUT_NAMES = {
|
|||
},
|
||||
}
|
||||
|
||||
export const BUDIBASE_INTERNAL_DB = "bb_internal"
|
||||
|
||||
// one or more word characters and whitespace
|
||||
export const APP_NAME_REGEX = /^[\w\s]+$/
|
||||
// zero or more non-whitespace characters
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import { redirect, params } from "@roxi/routify"
|
||||
import { Icon, Tabs, Tab } from "@budibase/bbui"
|
||||
import { BUDIBASE_INTERNAL_DB } from "constants"
|
||||
import { BUDIBASE_INTERNAL_DB_ID } from "constants/backend"
|
||||
import DatasourceNavigator from "components/backend/DatasourceNavigator/DatasourceNavigator.svelte"
|
||||
import CreateDatasourceModal from "components/backend/DatasourceNavigator/modals/CreateDatasourceModal.svelte"
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
$: isExternal =
|
||||
$params.selectedDatasource &&
|
||||
$params.selectedDatasource !== BUDIBASE_INTERNAL_DB
|
||||
$params.selectedDatasource !== BUDIBASE_INTERNAL_DB_ID
|
||||
|
||||
function selectFirstDatasource() {
|
||||
$redirect("./table")
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<Layout gap="XS" noPadding>
|
||||
<header>
|
||||
<svelte:component this={ICONS.BUDIBASE} height="26" width="26" />
|
||||
<Heading size="M">Budibase Default</Heading>
|
||||
<Heading size="M">Test DB</Heading>
|
||||
</header>
|
||||
<Body size="M">A little something to get you up and running!</Body>
|
||||
<Body size="M"
|
||||
|
|
|
@ -175,17 +175,6 @@ const addDefaultTables = async (db: any) => {
|
|||
|
||||
// add in the default db data docs - tables, datasource, rows and links
|
||||
await db.bulkDocs([...defaultDbDocs])
|
||||
|
||||
// Sync Quotas with the imported row count.
|
||||
const metrics = defaultDbDocs.reduce((acc, doc) => {
|
||||
acc[doc.type] = acc[doc.type] ? acc[doc.type] + 1 : 1
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
// Record the row quotas
|
||||
if (metrics.row) {
|
||||
await quotas.addRows(metrics.row)
|
||||
}
|
||||
}
|
||||
|
||||
export const fetch = async (ctx: any) => {
|
||||
|
|
|
@ -7,7 +7,11 @@ const {
|
|||
getTableParams,
|
||||
} = require("../../db/utils")
|
||||
const { destroy: tableDestroy } = require("./table/internal")
|
||||
const { BuildSchemaErrors, InvalidColumns } = require("../../constants")
|
||||
const {
|
||||
BuildSchemaErrors,
|
||||
InvalidColumns,
|
||||
BUDIBASE_DATASOURCE_TYPE,
|
||||
} = require("../../constants")
|
||||
const { getIntegration } = require("../../integrations")
|
||||
const { getDatasourceAndQuery } = require("./row/utils")
|
||||
const { invalidateDynamicVariables } = require("../../threads/utils")
|
||||
|
@ -51,7 +55,7 @@ exports.fetch = async function (ctx) {
|
|||
delete datasource.config.auth
|
||||
}
|
||||
|
||||
if (datasource.type === "budibase") {
|
||||
if (datasource.type === BUDIBASE_DATASOURCE_TYPE) {
|
||||
datasource.entities = internal[datasource._id]
|
||||
}
|
||||
}
|
||||
|
@ -243,7 +247,7 @@ exports.destroy = async function (ctx) {
|
|||
const datasource = await db.get(datasourceId)
|
||||
// Delete all queries for the datasource
|
||||
|
||||
if (datasource.type === "budibase") {
|
||||
if (datasource.type === BUDIBASE_DATASOURCE_TYPE) {
|
||||
await destroyInternalTablesBySourceId(datasourceId)
|
||||
} else {
|
||||
const queries = await db.allDocs(getQueryParams(datasourceId, null))
|
||||
|
|
|
@ -89,6 +89,8 @@ exports.DatasourceAuthTypes = {
|
|||
GOOGLE: "google",
|
||||
}
|
||||
|
||||
exports.BUDIBASE_DATASOURCE_TYPE = "budibase"
|
||||
|
||||
exports.SortDirection = {
|
||||
ASCENDING: "ASCENDING",
|
||||
DESCENDING: "DESCENDING",
|
||||
|
|
|
@ -10,6 +10,7 @@ const { inventoryImport } = require("./inventoryImport")
|
|||
const { employeeImport } = require("./employeeImport")
|
||||
const { jobsImport } = require("./jobsImport")
|
||||
const { expensesImport } = require("./expensesImport")
|
||||
const { BUDIBASE_DATASOURCE_TYPE } = require("../../constants")
|
||||
|
||||
exports.DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs"
|
||||
exports.DEFAULT_INVENTORY_TABLE_ID = "ta_bb_inventory"
|
||||
|
@ -18,8 +19,8 @@ exports.DEFAULT_EMPLOYEE_TABLE_ID = "ta_bb_employee"
|
|||
exports.DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default"
|
||||
exports.DEFAULT_BB_DATASOURCE = {
|
||||
_id: this.DEFAULT_BB_DATASOURCE_ID,
|
||||
type: "budibase",
|
||||
name: "BB Default",
|
||||
type: BUDIBASE_DATASOURCE_TYPE,
|
||||
name: "Test DB",
|
||||
source: "BUDIBASE",
|
||||
config: {},
|
||||
}
|
||||
|
@ -290,14 +291,6 @@ exports.DEFAULT_EMPLOYEE_TABLE_SCHEMA = {
|
|||
name: "Badge Photo",
|
||||
sortable: false,
|
||||
},
|
||||
// Jobs: {
|
||||
// name: "Jobs",
|
||||
// type: FieldTypes.LINK,
|
||||
// tableId: this.DEFAULT_EMPLOYEE_TABLE_ID,
|
||||
// fieldName: "Assigned",
|
||||
// relationshipType: RelationshipTypes.MANY_TO_MANY,
|
||||
// sortable: false,
|
||||
// },
|
||||
Jobs: {
|
||||
type: FieldTypes.LINK,
|
||||
constraints: {
|
||||
|
|
|
@ -22,6 +22,8 @@ const {
|
|||
getGlobalIDFromUserMetadataID,
|
||||
} = require("@budibase/backend-core/db")
|
||||
|
||||
const { BUDIBASE_DATASOURCE_TYPE } = require("../constants")
|
||||
|
||||
const UNICODE_MAX = "\ufff0"
|
||||
|
||||
const AppStatus = {
|
||||
|
@ -40,7 +42,7 @@ exports.StaticDatabases = StaticDatabases
|
|||
|
||||
const BudibaseInternalDB = {
|
||||
_id: "bb_internal",
|
||||
type: "budibase",
|
||||
type: BUDIBASE_DATASOURCE_TYPE,
|
||||
name: "Budibase DB",
|
||||
source: "BUDIBASE",
|
||||
config: {},
|
||||
|
|
Loading…
Reference in New Issue