diff --git a/packages/server/src/api/controllers/auth.js b/packages/server/src/api/controllers/auth.js
index 0fed3337f8..a859bc43e3 100644
--- a/packages/server/src/api/controllers/auth.js
+++ b/packages/server/src/api/controllers/auth.js
@@ -70,6 +70,7 @@ exports.authenticate = async ctx => {
expires,
path: "/",
httpOnly: false,
+ overwrite: true,
})
ctx.body = {
diff --git a/packages/server/src/api/controllers/deploy/aws.js b/packages/server/src/api/controllers/deploy/aws.js
index 1337f23d1c..28bedb8893 100644
--- a/packages/server/src/api/controllers/deploy/aws.js
+++ b/packages/server/src/api/controllers/deploy/aws.js
@@ -2,6 +2,7 @@ const fs = require("fs")
const { join } = require("../../../utilities/centralPath")
const AWS = require("aws-sdk")
const fetch = require("node-fetch")
+const uuid = require("uuid")
const { budibaseAppsDir } = require("../../../utilities/budibaseDir")
const PouchDB = require("../../../db")
const environment = require("../../../environment")
@@ -13,7 +14,7 @@ async function invalidateCDN(cfDistribution, appId) {
.createInvalidation({
DistributionId: cfDistribution,
InvalidationBatch: {
- CallerReference: appId,
+ CallerReference: `${appId}-${uuid.v4()}`,
Paths: {
Quantity: 1,
Items: [`/assets/${appId}/*`],
diff --git a/packages/server/src/middleware/authenticated.js b/packages/server/src/middleware/authenticated.js
index 33cafca17a..aebe6c6bd7 100644
--- a/packages/server/src/middleware/authenticated.js
+++ b/packages/server/src/middleware/authenticated.js
@@ -51,6 +51,7 @@ module.exports = async (ctx, next) => {
ctx.auth.apiKey = jwtPayload.apiKey
ctx.user = {
...jwtPayload,
+ instanceId: jwtPayload.instanceId,
accessLevel: await getAccessLevel(
jwtPayload.instanceId,
jwtPayload.accessLevelId
diff --git a/packages/server/src/utilities/builder/setBuilderToken.js b/packages/server/src/utilities/builder/setBuilderToken.js
index d43a9543e7..6674e69d66 100644
--- a/packages/server/src/utilities/builder/setBuilderToken.js
+++ b/packages/server/src/utilities/builder/setBuilderToken.js
@@ -15,7 +15,16 @@ module.exports = (ctx, appId, instanceId) => {
expiresIn: "30 days",
})
- var expiry = new Date()
+ const expiry = new Date()
expiry.setDate(expiry.getDate() + 30)
- ctx.cookies.set("builder:token", token, { expires: expiry, httpOnly: false })
+ // remove the app token
+ ctx.cookies.set("budibase:token", "", {
+ overwrite: true,
+ })
+ // set the builder token
+ ctx.cookies.set("builder:token", token, {
+ expires: expiry,
+ httpOnly: false,
+ overwrite: true,
+ })
}
diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json
index dca4611923..7d64f49c84 100644
--- a/packages/standard-components/components.json
+++ b/packages/standard-components/components.json
@@ -242,7 +242,10 @@
"type": "number",
"default": "500"
},
- "pagination": "bool"
+ "pagination": {
+ "type": "bool",
+ "default": true
+ }
}
},
"dataform": {
diff --git a/packages/standard-components/rollup.config.js b/packages/standard-components/rollup.config.js
index 2b5aa7ce3d..202adde702 100644
--- a/packages/standard-components/rollup.config.js
+++ b/packages/standard-components/rollup.config.js
@@ -4,6 +4,7 @@ import commonjs from "@rollup/plugin-commonjs"
import postcss from "rollup-plugin-postcss"
import { terser } from "rollup-plugin-terser"
+const production = !process.env.ROLLUP_WATCH
const lodash_fp_exports = ["isEmpty"]
export default {
@@ -17,7 +18,8 @@ export default {
},
],
plugins: [
- terser(),
+ // Only run terser in production environments
+ production && terser(),
postcss({
plugins: [],
}),
diff --git a/packages/standard-components/src/DataGrid/AttachmentCell/Button.svelte b/packages/standard-components/src/DataGrid/AttachmentCell/Button.svelte
index 1c7a24ea4f..139ffe02aa 100644
--- a/packages/standard-components/src/DataGrid/AttachmentCell/Button.svelte
+++ b/packages/standard-components/src/DataGrid/AttachmentCell/Button.svelte
@@ -1,30 +1,6 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/packages/standard-components/src/DataGrid/Component.svelte b/packages/standard-components/src/DataGrid/Component.svelte
index 471d02cc68..0d86808961 100644
--- a/packages/standard-components/src/DataGrid/Component.svelte
+++ b/packages/standard-components/src/DataGrid/Component.svelte
@@ -12,7 +12,7 @@
import AgGrid from "@budibase/svelte-ag-grid"
import CreateRowButton from "./CreateRow/Button.svelte"
- import { TextButton as DeleteButton, Icon } from "@budibase/bbui"
+ import { TextButton as DeleteButton, Icon, Modal, ModalContent } from "@budibase/bbui"
export let _bb
export let datasource = {}
@@ -25,6 +25,8 @@
let canEdit = editable && datasource && datasource.type !== "view"
let canAddDelete = editable && datasource && datasource.type === "table"
+ let modal;
+
let store = _bb.store
let dataLoaded = false
let data
@@ -68,7 +70,7 @@
field: key,
hide: shouldHideField(key),
sortable: true,
- editable: canEdit,
+ editable: canEdit && schema[key].type !== "link",
cellRenderer: getRenderer(schema[key], canEdit),
autoHeight: true,
}
@@ -133,7 +135,7 @@
{#if selectedRows.length > 0}
-
+
Delete
{selectedRows.length}
@@ -150,13 +152,14 @@
on:update={handleUpdate}
on:select={({ detail }) => (selectedRows = detail)} />
{/if}
+
+
+ Are you sure you want to delete {selectedRows.length} row(s)?
+
+
diff --git a/packages/standard-components/src/DataGrid/Relationship/tableCache.js b/packages/standard-components/src/DataGrid/Relationship/tableCache.js
new file mode 100644
index 0000000000..850bdd212a
--- /dev/null
+++ b/packages/standard-components/src/DataGrid/Relationship/tableCache.js
@@ -0,0 +1,20 @@
+import api from "../../api"
+
+let cache = {}
+
+async function fetchTable(id) {
+ const FETCH_TABLE_URL = `/api/tables/${id}`
+ const response = await api.get(FETCH_TABLE_URL)
+ return await response.json()
+}
+
+export async function getTable(tableId) {
+ if (!tableId) {
+ return null
+ }
+ if (!cache[tableId]) {
+ cache[tableId] = fetchTable(tableId)
+ cache[tableId] = await cache[tableId]
+ }
+ return await cache[tableId]
+}
diff --git a/packages/standard-components/src/DataGrid/customRenderer.js b/packages/standard-components/src/DataGrid/customRenderer.js
index e3f07eda47..607a4f8432 100644
--- a/packages/standard-components/src/DataGrid/customRenderer.js
+++ b/packages/standard-components/src/DataGrid/customRenderer.js
@@ -4,6 +4,7 @@
import AttachmentCell from "./AttachmentCell/Button.svelte"
import Select from "./Select/Wrapper.svelte"
import DatePicker from "./DateTime/Wrapper.svelte"
+import RelationshipDisplay from "./Relationship/RelationshipDisplay.svelte"
const renderers = new Map([
["boolean", booleanRenderer],
@@ -54,6 +55,13 @@ function attachmentRenderer(constraints, editable) {
},
})
+ const deleteFile = event => {
+ const newFilesArray = params.value.filter(file => file !== event.detail)
+ params.setValue(newFilesArray)
+ }
+
+ attachmentInstance.$on("delete", deleteFile)
+
return container
}
}
@@ -110,7 +118,13 @@ function linkedRowRenderer(constraints, editable) {
container.style.placeItems = "center"
container.style.height = "100%"
- container.innerText = params.value ? params.value.length : 0
+ new RelationshipDisplay({
+ target: container,
+ props: {
+ row: params.data,
+ columnName: params.column.colId,
+ },
+ })
return container
}
diff --git a/packages/standard-components/src/attachments/AttachmentList.svelte b/packages/standard-components/src/attachments/AttachmentList.svelte
index 52f61e2d8e..e52eeef5a7 100644
--- a/packages/standard-components/src/attachments/AttachmentList.svelte
+++ b/packages/standard-components/src/attachments/AttachmentList.svelte
@@ -1,30 +1,53 @@
+
+
+ Are you sure you want to delete this attachment?
+
+