Browse Source
Merge pull request #737 from Budibase/bug/relationship-bugs
Minor - Some relationship bugs
gh-pages
Michael Drury
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
21 additions and
7 deletions
-
packages/builder/src/builderStore/store/index.js
-
packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte
-
packages/server/src/db/linkedRows/LinkController.js
-
packages/standard-components/src/DataGrid/Component.svelte
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
import { values, cloneDeep } from "lodash/fp" |
|
|
|
import { cloneDeep } from "lodash/fp" |
|
|
|
import getNewComponentName from "../getNewComponentName" |
|
|
|
import { backendUiStore } from "builderStore" |
|
|
|
import { writable, get } from "svelte/store" |
|
|
|
@ -129,7 +129,10 @@ const setPackage = (store, initial) => async pkg => { |
|
|
|
initial.appId = pkg.application._id |
|
|
|
initial.pages = pkg.pages |
|
|
|
initial.hasAppPackage = true |
|
|
|
initial.screens = values(pkg.screens) |
|
|
|
initial.screens = [ |
|
|
|
...Object.values(main_screens), |
|
|
|
...Object.values(unauth_screens), |
|
|
|
] |
|
|
|
initial.builtins = [getBuiltin("##builtin/screenslot")] |
|
|
|
initial.appInstances = pkg.application.instances |
|
|
|
initial.appId = pkg.application._id |
|
|
|
|
|
|
|
@ -42,6 +42,7 @@ |
|
|
|
async function deleteTable() { |
|
|
|
await backendUiStore.actions.tables.delete(table) |
|
|
|
store.deleteScreens(templateScreens) |
|
|
|
await backendUiStore.actions.tables.fetch() |
|
|
|
notifier.success("Table deleted") |
|
|
|
hideEditor() |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
const CouchDB = require("../index") |
|
|
|
const { IncludeDocs, getLinkDocuments } = require("./linkUtils") |
|
|
|
const { generateLinkID } = require("../utils") |
|
|
|
const Sentry = require("@sentry/node") |
|
|
|
|
|
|
|
/** |
|
|
|
* Creates a new link document structure which can be put to the database. It is important to |
|
|
|
@ -289,10 +290,14 @@ class LinkController { |
|
|
|
const schema = table.schema |
|
|
|
for (let fieldName of Object.keys(schema)) { |
|
|
|
const field = schema[fieldName] |
|
|
|
if (field.type === "link") { |
|
|
|
const linkedTable = await this._db.get(field.tableId) |
|
|
|
delete linkedTable.schema[table.name] |
|
|
|
await this._db.put(linkedTable) |
|
|
|
try { |
|
|
|
if (field.type === "link") { |
|
|
|
const linkedTable = await this._db.get(field.tableId) |
|
|
|
delete linkedTable.schema[field.fieldName] |
|
|
|
await this._db.put(linkedTable) |
|
|
|
} |
|
|
|
} catch (err) { |
|
|
|
Sentry.captureException(err) |
|
|
|
} |
|
|
|
} |
|
|
|
// need to get the full link docs to delete them
|
|
|
|
|
|
|
|
@ -11,7 +11,12 @@ |
|
|
|
import { onMount } from "svelte" |
|
|
|
|
|
|
|
import AgGrid from "@budibase/svelte-ag-grid" |
|
|
|
import { TextButton as DeleteButton, Icon, Modal, ModalContent } from "@budibase/bbui" |
|
|
|
import { |
|
|
|
TextButton as DeleteButton, |
|
|
|
Icon, |
|
|
|
Modal, |
|
|
|
ModalContent, |
|
|
|
} from "@budibase/bbui" |
|
|
|
|
|
|
|
export let _bb |
|
|
|
export let datasource = {} |
|
|
|
|