diff --git a/lerna.json b/lerna.json
index 39e368fc2f..8808d0369a 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "0.1.23",
+ "version": "0.1.25",
"npmClient": "yarn",
"packages": [
"packages/*"
diff --git a/package.json b/package.json
index d99718ca02..dbbe008b42 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,6 @@
"test:e2e:ci": "lerna run cy:ci"
},
"dependencies": {
- "@fortawesome/fontawesome": "^1.1.8",
- "pouchdb-replication-stream": "^1.2.9"
+ "@fortawesome/fontawesome": "^1.1.8"
}
-}
+}
\ No newline at end of file
diff --git a/packages/builder/cypress/integration/createAutomation.spec.js b/packages/builder/cypress/integration/createAutomation.spec.js
index ca17e3b7f3..26af4fac71 100644
--- a/packages/builder/cypress/integration/createAutomation.spec.js
+++ b/packages/builder/cypress/integration/createAutomation.spec.js
@@ -50,7 +50,6 @@ context("Create a automation", () => {
// Activate Automation
cy.get("[data-cy=activate-automation]").click()
- cy.contains("Add Record").should("be.visible")
cy.get(".stop-button.highlighted").should("be.visible")
})
diff --git a/packages/builder/cypress/integration/createTable.spec.js b/packages/builder/cypress/integration/createTable.spec.js
index a30ecb5ad8..d7ae805b27 100644
--- a/packages/builder/cypress/integration/createTable.spec.js
+++ b/packages/builder/cypress/integration/createTable.spec.js
@@ -8,7 +8,7 @@ context("Create a Table", () => {
cy.createTable("dog")
// Check if Table exists
- cy.get(".title").should("have.text", "dog")
+ cy.get(".title span").should("have.text", "dog")
})
it("adds a new column to the table", () => {
diff --git a/packages/builder/cypress/integration/createView.spec.js b/packages/builder/cypress/integration/createView.spec.js
index 95cabc887f..8f0c9565c8 100644
--- a/packages/builder/cypress/integration/createView.spec.js
+++ b/packages/builder/cypress/integration/createView.spec.js
@@ -50,13 +50,11 @@ context("Create a View", () => {
it("creates a stats calculation view based on age", () => {
cy.contains("Calculate").click()
+ // we may reinstate this - have commented this dropdown for now as there is only one option
+ //cy.get(".menu-container").find("select").first().select("Statistics")
cy.get(".menu-container")
.find("select")
- .first()
- .select("Statistics")
- cy.get(".menu-container")
- .find("select")
- .eq(1)
+ .eq(0)
.select("age")
cy.contains("Save").click()
cy.get("thead th div").should($headers => {
diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js
index 302a39a367..05b30da98f 100644
--- a/packages/builder/cypress/support/commands.js
+++ b/packages/builder/cypress/support/commands.js
@@ -68,6 +68,7 @@ Cypress.Commands.add("createTable", tableName => {
cy.contains("Create New Table").click()
cy.get(".menu-container")
.get("input")
+ .first()
.type(tableName)
cy.contains("Save").click()
diff --git a/packages/builder/package.json b/packages/builder/package.json
index 0ad83945b1..74bff1b6a8 100644
--- a/packages/builder/package.json
+++ b/packages/builder/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
- "version": "0.1.23",
+ "version": "0.1.25",
"license": "AGPL-3.0",
"private": true,
"scripts": {
@@ -63,8 +63,8 @@
}
},
"dependencies": {
- "@budibase/bbui": "^1.39.0",
- "@budibase/client": "^0.1.23",
+ "@budibase/bbui": "^1.40.1",
+ "@budibase/client": "^0.1.25",
"@budibase/colorpicker": "^1.0.1",
"@fortawesome/fontawesome-free": "^5.14.0",
"@sentry/browser": "5.19.1",
diff --git a/packages/builder/src/builderStore/fetchBindableProperties.js b/packages/builder/src/builderStore/fetchBindableProperties.js
index 65cc861c50..c71c498a32 100644
--- a/packages/builder/src/builderStore/fetchBindableProperties.js
+++ b/packages/builder/src/builderStore/fetchBindableProperties.js
@@ -37,9 +37,9 @@ export default function({ componentInstanceId, screen, components, models }) {
.filter(isInstanceInSharedContext(walkResult))
.map(componentInstanceToBindable(walkResult)),
- ...walkResult.target._contexts
+ ...(walkResult.target?._contexts
.map(contextToBindables(models, walkResult))
- .flat(),
+ .flat() ?? []),
]
}
@@ -73,6 +73,10 @@ const componentInstanceToBindable = walkResult => i => {
const contextToBindables = (models, walkResult) => context => {
const contextParentPath = getParentPath(walkResult, context)
+ const isModel = context.model?.isModel || typeof context.model === "string"
+ const modelId =
+ typeof context.model === "string" ? context.model : context.model.modelId
+ const model = models.find(model => model._id === modelId)
const newBindable = key => ({
type: "context",
@@ -80,15 +84,12 @@ const contextToBindables = (models, walkResult) => context => {
// how the binding expression persists, and is used in the app at runtime
runtimeBinding: `${contextParentPath}data.${key}`,
// how the binding exressions looks to the user of the builder
- readableBinding: `${context.instance._instanceName}.${context.model.label}.${key}`,
+ readableBinding: `${context.instance._instanceName}.${model.name}.${key}`,
})
// see ModelViewSelect.svelte for the format of context.model
- // ... this allows us to bind to Model scheams, or View schemas
- const model = models.find(m => m._id === context.model.modelId)
- const schema = context.model.isModel
- ? model.schema
- : model.views[context.model.name].schema
+ // ... this allows us to bind to Model schemas, or View schemas
+ const schema = isModel ? model.schema : model.views[context.model.name].schema
return (
Object.keys(schema)
diff --git a/packages/builder/src/components/backend/DataTable/ModelDataTable.svelte b/packages/builder/src/components/backend/DataTable/ModelDataTable.svelte
index 49659ff8d0..63d94aeab4 100644
--- a/packages/builder/src/components/backend/DataTable/ModelDataTable.svelte
+++ b/packages/builder/src/components/backend/DataTable/ModelDataTable.svelte
@@ -8,6 +8,7 @@
import Table from "./Table.svelte"
let data = []
+ let loading = false
$: title = $backendUiStore.selectedModel.name
$: schema = $backendUiStore.selectedModel.schema
@@ -19,14 +20,16 @@
// Fetch records for specified model
$: {
if ($backendUiStore.selectedView?.name?.startsWith("all_")) {
+ loading = true
api.fetchDataForView($backendUiStore.selectedView).then(records => {
data = records || []
+ loading = false
})
}
}
-
+
{#if Object.keys(schema).length > 0}
diff --git a/packages/builder/src/components/backend/DataTable/RecordFieldControl.svelte b/packages/builder/src/components/backend/DataTable/RecordFieldControl.svelte
index 55129b47e3..50d13557fd 100644
--- a/packages/builder/src/components/backend/DataTable/RecordFieldControl.svelte
+++ b/packages/builder/src/components/backend/DataTable/RecordFieldControl.svelte
@@ -2,39 +2,33 @@
import { Input, Select, Label, DatePicker, Toggle } from "@budibase/bbui"
import Dropzone from "components/common/Dropzone.svelte"
import { capitalise } from "../../../helpers"
+ import LinkedRecordSelector from "components/common/LinkedRecordSelector.svelte"
export let meta
export let value = meta.type === "boolean" ? false : ""
- const type = determineInputType(meta)
- const label = capitalise(meta.name)
-
- function determineInputType(meta) {
- if (meta.type === "datetime") return "date"
- if (meta.type === "number") return "number"
- if (meta.type === "boolean") return "checkbox"
- if (meta.type === "attachment") return "file"
- if (meta.type === "options") return "select"
- return "text"
- }
+ $: type = meta.type
+ $: label = capitalise(meta.name)
-{#if type === 'select'}
+{#if type === 'options'}
-{:else if type === 'date'}
+{:else if type === 'datetime'}
-{:else if type === 'file'}
+{:else if type === 'attachment'}
-{:else if type === 'checkbox'}
+{:else if type === 'boolean'}
+{:else if type === 'link'}
+
{:else}
{/if}
diff --git a/packages/builder/src/components/backend/DataTable/Table.svelte b/packages/builder/src/components/backend/DataTable/Table.svelte
index 2e28577c60..c1e34074e6 100644
--- a/packages/builder/src/components/backend/DataTable/Table.svelte
+++ b/packages/builder/src/components/backend/DataTable/Table.svelte
@@ -1,6 +1,7 @@