wip: cleanup of components

This commit is contained in:
Keviin Åberg Kultalahti 2021-03-23 12:27:10 +01:00
parent c924e03519
commit 8a2ccbc1a9
7 changed files with 12 additions and 13 deletions

View File

@ -22,7 +22,7 @@
$: schema = $tables.selected.schema $: schema = $tables.selected.schema
$: tableView = { $: tableView = {
schema, schema,
name: $views.selected.name, name: $views.selected?.name,
} }
// Fetch rows for specified table // Fetch rows for specified table

View File

@ -1,7 +1,7 @@
<script> <script>
import { Button, Input } from "@budibase/bbui" import { Button, Input } from "@budibase/bbui"
import { goto } from "@sveltech/routify" import { goto } from "@sveltech/routify"
import { backendUiStore } from "builderStore" import { views as viewsStore } from 'builderStore/store/backend/'
import { tables } from 'builderStore/store/backend/' import { tables } from 'builderStore/store/backend/'
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import analytics from "analytics" import analytics from "analytics"
@ -20,7 +20,7 @@
notifier.danger(`View exists with name ${name}.`) notifier.danger(`View exists with name ${name}.`)
return return
} }
backendUiStore.actions.views.save({ viewsStore.save({
name, name,
tableId: $tables.selected._id, tableId: $tables.selected._id,
field, field,

View File

@ -1,5 +1,4 @@
<script> <script>
import { backendUiStore } from "builderStore"
import { roles, permissions as permissionsStore } from 'builderStore/store/backend/' import { roles, permissions as permissionsStore } from 'builderStore/store/backend/'
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import { Button, Label, Input, Select, Spacer } from "@budibase/bbui" import { Button, Label, Input, Select, Spacer } from "@budibase/bbui"

View File

@ -1,5 +1,6 @@
<script> <script>
import { backendUiStore, store, allScreens } from "builderStore" import { backendUiStore, store, allScreens } from "builderStore"
import { tables } from 'builderStore/store/backend/'
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import { DropdownMenu, Button, Input } from "@budibase/bbui" import { DropdownMenu, Button, Input } from "@budibase/bbui"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
@ -36,15 +37,15 @@
} }
async function deleteTable() { async function deleteTable() {
await backendUiStore.actions.tables.delete(table) await tables.delete(table)
store.actions.screens.delete(templateScreens) store.actions.screens.delete(templateScreens)
await backendUiStore.actions.tables.fetch() await tables.fetch()
notifier.success("Table deleted") notifier.success("Table deleted")
hideEditor() hideEditor()
} }
async function save() { async function save() {
await backendUiStore.actions.tables.save(table) await tables.save(table)
notifier.success("Table renamed successfully") notifier.success("Table renamed successfully")
hideEditor() hideEditor()
} }

View File

@ -1,6 +1,6 @@
<script> <script>
import { goto } from "@sveltech/routify" import { goto } from "@sveltech/routify"
import { backendUiStore } from "builderStore" import { views } from 'builderStore/store/backend/'
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import { DropdownMenu, Button, Input } from "@budibase/bbui" import { DropdownMenu, Button, Input } from "@budibase/bbui"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
@ -29,7 +29,7 @@
} }
async function save() { async function save() {
await backendUiStore.actions.views.save({ await views.save({
originalName, originalName,
...view, ...view,
}) })
@ -40,7 +40,7 @@
async function deleteView() { async function deleteView() {
const name = view.name const name = view.name
const id = view.tableId const id = view.tableId
await backendUiStore.actions.views.delete(name) await views.delete(name)
notifier.success("View deleted") notifier.success("View deleted")
$goto(`./table/${id}`) $goto(`./table/${id}`)
} }

View File

@ -15,7 +15,6 @@
import IntegrationQueryEditor from "components/integration/index.svelte" import IntegrationQueryEditor from "components/integration/index.svelte"
import ExternalDataSourceTable from "components/backend/DataTable/ExternalDataSourceTable.svelte" import ExternalDataSourceTable from "components/backend/DataTable/ExternalDataSourceTable.svelte"
import ParameterBuilder from "components/integration/QueryParameterBuilder.svelte" import ParameterBuilder from "components/integration/QueryParameterBuilder.svelte"
import { backendUiStore } from "builderStore"
import { datasources, integrations } from 'builderStore/store/backend/' import { datasources, integrations } from 'builderStore/store/backend/'
const PREVIEW_HEADINGS = [ const PREVIEW_HEADINGS = [

View File

@ -1,6 +1,6 @@
<script> <script>
import { params } from "@sveltech/routify" import { params } from "@sveltech/routify"
import { tables } from 'builderStore/store/backend/' import { tables, views } from 'builderStore/store/backend/'
if ($params.selectedView) { if ($params.selectedView) {
let view let view
@ -11,7 +11,7 @@
} }
} }
if (view) { if (view) {
backendUiStore.actions.views.select({ views.select({
name: viewName, name: viewName,
...view, ...view,
}) })