Remove legacy concept of database store

This commit is contained in:
Andrew Kingston 2024-02-06 15:40:51 +00:00
parent 1efd5725c7
commit 94544c4008
9 changed files with 100 additions and 130 deletions

View File

@ -9,7 +9,6 @@
views,
viewsV2,
userSelectedResourceMap,
database,
} from "stores/builder"
import EditDatasourcePopover from "./popovers/EditDatasourcePopover.svelte"
import EditQueryPopover from "./popovers/EditQueryPopover.svelte"
@ -75,7 +74,6 @@
searchTerm && !showAppUsersTable && !enrichedDataSources.find(ds => ds.show)
</script>
{#if $database?._id}
<div class="hierarchy-items-container">
{#if showAppUsersTable}
<NavItem
@ -137,7 +135,6 @@
</Layout>
{/if}
</div>
{/if}
<style>
.hierarchy-items-container {

View File

@ -4,7 +4,6 @@
views,
viewsV2,
userSelectedResourceMap,
database,
} from "stores/builder"
import { TableNames } from "constants"
import EditTablePopover from "./popovers/EditTablePopover.svelte"
@ -29,7 +28,6 @@
}
</script>
{#if $database?._id}
<div class="hierarchy-items-container">
{#each sortedTables as table, idx}
<NavItem
@ -67,4 +65,3 @@
{/each}
{/each}
</div>
{/if}

View File

@ -1,5 +1,5 @@
<script>
import { queries, datasources, database } from "stores/builder"
import { queries, datasources } from "stores/builder"
import QueryViewer from "components/integration/QueryViewer.svelte"
import RestQueryViewer from "components/integration/RestQueryViewer.svelte"
import { IntegrationTypes } from "constants/backend"
@ -11,7 +11,7 @@
$: isRestQuery = datasource?.source === IntegrationTypes.REST
</script>
{#if $database._id && query}
{#if query}
{#if isRestQuery}
<RestQueryViewer queryId={$queries.selectedQueryId} />
{:else}

View File

@ -3,7 +3,7 @@
import QueryViewer from "components/integration/QueryViewer.svelte"
import RestQueryViewer from "components/integration/RestQueryViewer.svelte"
import { IntegrationTypes } from "constants/backend"
import { database, datasources } from "stores/builder"
import { datasources } from "stores/builder"
$: datasource = $datasources.list.find(ds => ds._id === $params.datasourceId)
$: {
@ -32,7 +32,7 @@
}
</script>
{#if $database._id && datasource && query}
{#if datasource && query}
{#if isRestQuery}
<RestQueryViewer />
{:else}

View File

@ -1,6 +1,6 @@
<script>
import TableDataTable from "components/backend/DataTable/TableDataTable.svelte"
import { tables, database } from "stores/builder"
import { tables } from "stores/builder"
import { Banner } from "@budibase/bbui"
const verifyAutocolumns = table => {
@ -30,7 +30,7 @@
})
</script>
{#if $database?._id && $tables?.selected?.name}
{#if $tables?.selected?.name}
{#if duplicates?.length}
<div class="alert-wrap">
<Banner type="warning" showCloseButton={false}>

View File

@ -1,11 +1,11 @@
<script>
import ViewDataTable from "components/backend/DataTable/ViewDataTable.svelte"
import { views, database } from "stores/builder"
import { views } from "stores/builder"
$: selectedView = $views.selected
</script>
{#if $database._id && selectedView}
{#if selectedView}
<ViewDataTable view={selectedView} />
{:else}<i>Create your first table to start building</i>{/if}

View File

@ -5,7 +5,6 @@
import { notifications } from "@budibase/bbui"
import { SplitPage } from "@budibase/frontend-core"
import { API } from "api"
import { database } from "stores/builder"
import { auth, admin } from "stores/portal"
let name = "My first app"
@ -26,9 +25,6 @@
const createdApp = await API.createApp(data)
// Select Correct Application/DB in prep for creating user
database.syncAppDatabase(createdApp)
// Update checklist - in case first app
await admin.init()

View File

@ -1,16 +0,0 @@
import { writable } from "svelte/store"
export const createDatabaseStore = () => {
const store = writable({})
const syncAppDatabase = application => {
store.set({ ...application.instance })
}
return {
subscribe: store.subscribe,
syncAppDatabase,
}
}
export const database = createDatabaseStore()

View File

@ -18,7 +18,6 @@ import {
} from "./automations.js"
import { userStore, userSelectedResourceMap, isOnlyUser } from "./users.js"
import { deploymentStore } from "./deployments.js"
import { database } from "./database.js"
// Backend
import { tables } from "./tables"
@ -34,7 +33,6 @@ import { flags } from "./flags"
export {
layoutStore,
database,
appStore,
componentStore,
navigationStore,
@ -104,8 +102,6 @@ export const initialise = async pkg => {
themeStore.syncAppTheme(application)
screenStore.syncAppScreens(pkg)
layoutStore.syncAppLayouts(pkg)
// required for api comms
database.syncAppDatabase(application)
resetBuilderHistory()
await refreshBuilderData()
}