diff --git a/lerna.json b/lerna.json
index 3ab56dc0b1..6663aebfe6 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "2.15.2",
+ "version": "2.15.3",
"npmClient": "yarn",
"packages": [
"packages/*",
diff --git a/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte b/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte
index 161757c570..09553c1bcd 100644
--- a/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte
+++ b/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte
@@ -13,6 +13,7 @@
Icon,
} from "@budibase/bbui"
import { capitalise } from "helpers"
+ import { getFormattedPlanName } from "helpers/planTitle"
import { get } from "svelte/store"
export let resourceId
@@ -99,7 +100,9 @@
{#if requiresPlanToModify}
- {capitalise(requiresPlanToModify)}
+ {getFormattedPlanName(requiresPlanToModify)}
{/if}
diff --git a/packages/builder/src/helpers/planTitle.js b/packages/builder/src/helpers/planTitle.js
new file mode 100644
index 0000000000..dc07e8be2f
--- /dev/null
+++ b/packages/builder/src/helpers/planTitle.js
@@ -0,0 +1,11 @@
+import { PlanType } from "@budibase/types"
+
+export function getFormattedPlanName(userPlanType) {
+ let planName = "Free"
+ if (userPlanType === PlanType.PREMIUM_PLUS) {
+ planName = "Premium"
+ } else if (userPlanType === PlanType.ENTERPRISE_BASIC) {
+ planName = "Enterprise"
+ }
+ return `${planName} Plan`
+}
diff --git a/packages/builder/src/pages/builder/portal/account/usage.svelte b/packages/builder/src/pages/builder/portal/account/usage.svelte
index 9e7c402e91..8eb26c20d6 100644
--- a/packages/builder/src/pages/builder/portal/account/usage.svelte
+++ b/packages/builder/src/pages/builder/portal/account/usage.svelte
@@ -15,7 +15,7 @@
import { DashCard, Usage } from "components/usage"
import { PlanModel } from "constants"
import { sdk } from "@budibase/shared-core"
- import { PlanType } from "@budibase/types"
+ import { getFormattedPlanName } from "helpers/planTitle"
let staticUsage = []
let monthlyUsage = []
@@ -100,23 +100,6 @@
cancelAt = license?.billing?.subscription?.cancelAt
}
- const capitalise = string => {
- if (string) {
- return string.charAt(0).toUpperCase() + string.slice(1)
- }
- }
-
- const planTitle = () => {
- const planType = license?.plan.type
- let planName = license?.plan.type
- if (planType === PlanType.PREMIUM_PLUS) {
- planName = "Premium"
- } else if (planType === PlanType.ENTERPRISE_BASIC) {
- planName = "Enterprise"
- }
- return `${capitalise(planName)} Plan`
- }
-
const getDaysRemaining = timestamp => {
if (!timestamp) {
return
@@ -227,7 +210,7 @@
{/each}
diff --git a/packages/client/src/components/app/forms/RelationshipField.svelte b/packages/client/src/components/app/forms/RelationshipField.svelte
index fcdc93020e..af48183c20 100644
--- a/packages/client/src/components/app/forms/RelationshipField.svelte
+++ b/packages/client/src/components/app/forms/RelationshipField.svelte
@@ -108,8 +108,16 @@
}
}
+ $: forceFetchRows(filter)
$: debouncedFetchRows(searchTerm, primaryDisplay, defaultValue)
+ const forceFetchRows = async () => {
+ // if the filter has changed, then we need to reset the options, clear the selection, and re-fetch
+ optionsObj = {}
+ fieldApi.setValue([])
+ selectedValue = []
+ debouncedFetchRows(searchTerm, primaryDisplay, defaultValue)
+ }
const fetchRows = async (searchTerm, primaryDisplay, defaultVal) => {
const allRowsFetched =
$fetch.loaded &&
diff --git a/packages/server/src/api/controllers/datasource.ts b/packages/server/src/api/controllers/datasource.ts
index a702a8cd84..d70c13f800 100644
--- a/packages/server/src/api/controllers/datasource.ts
+++ b/packages/server/src/api/controllers/datasource.ts
@@ -9,8 +9,11 @@ import {
CreateDatasourceResponse,
Datasource,
DatasourcePlus,
+ Document,
FetchDatasourceInfoRequest,
FetchDatasourceInfoResponse,
+ FieldType,
+ RelationshipFieldMetadata,
SourceName,
UpdateDatasourceResponse,
UserCtx,
@@ -218,9 +221,26 @@ async function destroyInternalTablesBySourceId(datasourceId: string) {
[]
)
+ function updateRevisions(deletedLinks: RelationshipFieldMetadata[]) {
+ for (const link of deletedLinks) {
+ datasourceTableDocs.forEach((doc: Document) => {
+ if (doc._id === link.tableId) {
+ doc._rev = link.tableRev
+ }
+ })
+ }
+ }
+
// Destroy the tables.
for (const table of datasourceTableDocs) {
- await sdk.tables.internal.destroy(table)
+ const deleted = await sdk.tables.internal.destroy(table)
+ // Update the revisions of any tables that remain to be deleted
+ const deletedLinks: RelationshipFieldMetadata[] = Object.values(
+ deleted.table.schema
+ )
+ .filter(field => field.type === FieldType.LINK)
+ .map(field => field as RelationshipFieldMetadata)
+ updateRevisions(deletedLinks)
}
}
diff --git a/packages/server/src/db/defaultData/employeeImport.ts b/packages/server/src/db/defaultData/employeeImport.ts
index d2bab601a0..c3c2082285 100644
--- a/packages/server/src/db/defaultData/employeeImport.ts
+++ b/packages/server/src/db/defaultData/employeeImport.ts
@@ -13,6 +13,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Senior"],
"Start Date": "2015-02-12T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Mandy",
@@ -28,6 +29,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Senior"],
"Start Date": "2017-09-10T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Holly",
@@ -43,6 +45,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Senior"],
"Start Date": "2022-02-12T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Francis",
@@ -58,6 +61,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Apprentice"],
"Start Date": "2021-03-10T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Richard",
@@ -73,6 +77,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Apprentice"],
"Start Date": "2020-07-09T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Donald",
@@ -88,6 +93,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Junior"],
"Start Date": "2018-04-13T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Maria",
@@ -103,6 +109,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Manager"],
"Start Date": "2016-05-22T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Suzy",
@@ -118,6 +125,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Senior", "Manager"],
"Start Date": "2019-05-01T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Patrick",
@@ -133,6 +141,7 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Apprentice"],
"Start Date": "2014-08-30T12:00:00.000",
+ "Badge Photo": [],
},
{
"First Name": "Brayden",
@@ -148,5 +157,6 @@ export const employeeImport = [
type: "row",
"Employee Level": ["Contractor"],
"Start Date": "2022-11-09T12:00:00.000",
+ "Badge Photo": [],
},
]
diff --git a/packages/server/src/db/linkedRows/LinkController.ts b/packages/server/src/db/linkedRows/LinkController.ts
index f52694465f..a7de3ff8d8 100644
--- a/packages/server/src/db/linkedRows/LinkController.ts
+++ b/packages/server/src/db/linkedRows/LinkController.ts
@@ -440,7 +440,7 @@ class LinkController {
if (field.type === FieldTypes.LINK && field.fieldName) {
const linkedTable = await this._db.get
(field.tableId)
delete linkedTable.schema[field.fieldName]
- await this._db.put(linkedTable)
+ field.tableRev = (await this._db.put(linkedTable)).rev
}
} catch (err: any) {
logging.logWarn(err?.message, err)
diff --git a/packages/server/src/sdk/app/permissions/index.ts b/packages/server/src/sdk/app/permissions/index.ts
index b62a7fb459..a6d8f338a1 100644
--- a/packages/server/src/sdk/app/permissions/index.ts
+++ b/packages/server/src/sdk/app/permissions/index.ts
@@ -61,7 +61,7 @@ export async function getInheritablePermissions(
export async function allowsExplicitPermissions(resourceId: string) {
if (isViewID(resourceId)) {
const allowed = await features.isViewPermissionEnabled()
- const minPlan = !allowed ? PlanType.BUSINESS : undefined
+ const minPlan = !allowed ? PlanType.PREMIUM_PLUS : undefined
return {
allowed,
diff --git a/packages/types/src/documents/app/table/schema.ts b/packages/types/src/documents/app/table/schema.ts
index 19a7303072..e9eb139ebc 100644
--- a/packages/types/src/documents/app/table/schema.ts
+++ b/packages/types/src/documents/app/table/schema.ts
@@ -21,6 +21,7 @@ interface BaseRelationshipFieldMetadata
main?: boolean
fieldName: string
tableId: string
+ tableRev?: string
subtype?: AutoFieldSubTypes.CREATED_BY | AutoFieldSubTypes.UPDATED_BY
}