From e69a328eb442e1d769ca9023fdeb0a45fc54fafd Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Mon, 11 Jul 2022 15:59:32 +0200 Subject: [PATCH 001/112] Pass a title property with untruncated text to the RadioGroup --- packages/bbui/src/Form/Core/RadioGroup.svelte | 3 ++- packages/bbui/src/Form/RadioGroup.svelte | 2 ++ .../backend/DataTable/modals/CreateEditColumn.svelte | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/bbui/src/Form/Core/RadioGroup.svelte b/packages/bbui/src/Form/Core/RadioGroup.svelte index 18a1e82ee8..a3952a9759 100644 --- a/packages/bbui/src/Form/Core/RadioGroup.svelte +++ b/packages/bbui/src/Form/Core/RadioGroup.svelte @@ -10,6 +10,7 @@ export let disabled = false export let getOptionLabel = option => option export let getOptionValue = option => option + export let getOptionTitle = option => option const dispatch = createEventDispatcher() const onChange = e => dispatch("change", e.target.value) @@ -19,7 +20,7 @@ {#if options && Array.isArray(options)} {#each options as option}
diff --git a/packages/bbui/src/Form/RadioGroup.svelte b/packages/bbui/src/Form/RadioGroup.svelte index 528f9f5eba..843a3657b4 100644 --- a/packages/bbui/src/Form/RadioGroup.svelte +++ b/packages/bbui/src/Form/RadioGroup.svelte @@ -12,6 +12,7 @@ export let direction = "vertical" export let getOptionLabel = option => extractProperty(option, "label") export let getOptionValue = option => extractProperty(option, "value") + export let getOptionTitle = option => extractProperty(option, "label") const dispatch = createEventDispatcher() const onChange = e => { @@ -35,6 +36,7 @@ {direction} {getOptionLabel} {getOptionValue} + {getOptionTitle} on:change={onChange} /> diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 77ab75827f..a6cef23467 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -474,6 +474,7 @@ options={relationshipOptions} getOptionLabel={option => option.name} getOptionValue={option => option.value} + getOptionTitle={option => option.alt} /> {/if} Date: Mon, 25 Jul 2022 09:49:37 +0200 Subject: [PATCH 002/112] add missing props --- packages/client/src/components/app/forms/OptionsField.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/components/app/forms/OptionsField.svelte b/packages/client/src/components/app/forms/OptionsField.svelte index 1df0216f56..dd90591569 100644 --- a/packages/client/src/components/app/forms/OptionsField.svelte +++ b/packages/client/src/components/app/forms/OptionsField.svelte @@ -77,6 +77,7 @@ {direction} on:change={handleChange} getOptionLabel={flatOptions ? x => x : x => x.label} + getOptionTitle={flatOptions ? x => x : x => x.label} getOptionValue={flatOptions ? x => x : x => x.value} /> {/if} From 62e01a299e1f05227bc6fee4dfc79f9c0f675ad5 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sat, 13 Aug 2022 15:22:54 +0100 Subject: [PATCH 003/112] Fix add component not working on first click when no component is selected --- .../design/[screenId]/_components/AppPreview.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte index 3c99c90d49..814930d636 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte @@ -186,7 +186,7 @@ $goto("./navigation") } } else if (type === "request-add-component") { - $goto(`./components/${$selectedComponent?._id}/new`) + toggleAddComponent() } else if (type === "highlight-setting") { store.actions.settings.highlight(data.setting) @@ -230,9 +230,8 @@ if (isAddingComponent) { $goto(`../${$selectedScreen._id}/components/${$selectedComponent?._id}`) } else { - $goto( - `../${$selectedScreen._id}/components/${$selectedComponent?._id}/new` - ) + const id = $selectedComponent?._id || $selectedScreen?.props?._id + $goto(`../${$selectedScreen._id}/components/${id}/new`) } } From 3a7c92e20248d6837f259a87a8e5a3b8ea60ac48 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sat, 13 Aug 2022 15:38:21 +0100 Subject: [PATCH 004/112] Support filtering data exports to only certain columns with internal tables --- .../server/src/api/controllers/row/internal.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/internal.js b/packages/server/src/api/controllers/row/internal.js index 086e1d9ce4..0c92959db8 100644 --- a/packages/server/src/api/controllers/row/internal.js +++ b/packages/server/src/api/controllers/row/internal.js @@ -375,6 +375,7 @@ exports.exportRows = async ctx => { const table = await db.get(ctx.params.tableId) const rowIds = ctx.request.body.rows let format = ctx.query.format + const { columns } = ctx.request.body let response = ( await db.allDocs({ include_docs: true, @@ -382,7 +383,20 @@ exports.exportRows = async ctx => { }) ).rows.map(row => row.doc) - let rows = await outputProcessing(table, response) + let result = await outputProcessing(table, response) + let rows = [] + + // Filter data to only specified columns if required + if (columns && columns.length) { + for (let i = 0; i < result.length; i++) { + rows[i] = {} + for (let column of columns) { + rows[i][column] = result[i][column] + } + } + } else { + rows = result + } let headers = Object.keys(rows[0]) const exporter = exporters[format] From ee5085f57fd3e929be9982ca6606918bbb67a3a1 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sat, 13 Aug 2022 16:25:01 +0100 Subject: [PATCH 005/112] Fix flatpickr offsetting date by one hour on initial selection of time-only fields --- packages/bbui/src/Form/Core/DatePicker.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/bbui/src/Form/Core/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker.svelte index 39a7d9d626..c3eee7505f 100644 --- a/packages/bbui/src/Form/Core/DatePicker.svelte +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -59,6 +59,13 @@ // If time only set date component to 2000-01-01 if (timeOnly) { + // Classic flackpickr causing issues. + // When selecting a time first the first time for a "time only" field, + // the time is always offset by 1 hour for some reason (regardless of time + // zone) so we need to correct it. + if (!value && newValue) { + newValue = new Date(dates[0].getTime() + 60 * 60 * 1000).toISOString() + } newValue = `2000-01-01T${newValue.split("T")[1]}` } From 03e379bafef8d0eea80347ed0d9f4d26059f0cf3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 15 Aug 2022 11:24:25 +0100 Subject: [PATCH 006/112] Fix typo --- packages/bbui/src/Form/Core/DatePicker.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bbui/src/Form/Core/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker.svelte index c3eee7505f..c6230c5212 100644 --- a/packages/bbui/src/Form/Core/DatePicker.svelte +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -60,7 +60,7 @@ // If time only set date component to 2000-01-01 if (timeOnly) { // Classic flackpickr causing issues. - // When selecting a time first the first time for a "time only" field, + // When selecting a value for the first time for a "time only" field, // the time is always offset by 1 hour for some reason (regardless of time // zone) so we need to correct it. if (!value && newValue) { From 4045337bb7034862d7d91c51c5e3725caedefcf3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 15 Aug 2022 11:37:04 +0100 Subject: [PATCH 007/112] Add download setting to links --- packages/bbui/src/Link/Link.svelte | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/bbui/src/Link/Link.svelte b/packages/bbui/src/Link/Link.svelte index f66554bd75..3bbfdd8282 100644 --- a/packages/bbui/src/Link/Link.svelte +++ b/packages/bbui/src/Link/Link.svelte @@ -8,12 +8,14 @@ export let secondary = false export let overBackground = false export let target + export let download Date: Mon, 15 Aug 2022 11:37:30 +0100 Subject: [PATCH 008/112] Use real file names when download files from dropzones --- packages/bbui/src/Form/Core/Dropzone.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte index 36515acbc5..e98b2ad964 100644 --- a/packages/bbui/src/Form/Core/Dropzone.svelte +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -133,7 +133,13 @@
{#if selectedUrl} - {selectedImage.name} + + {selectedImage.name} + {:else} {selectedImage.name} {/if} From 35528ee17e563c5c84c90b95f2bf67a7a9b69d0f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 15 Aug 2022 11:37:40 +0100 Subject: [PATCH 009/112] Use real file names when download files from tables --- packages/bbui/src/Table/AttachmentRenderer.svelte | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/bbui/src/Table/AttachmentRenderer.svelte b/packages/bbui/src/Table/AttachmentRenderer.svelte index 4dff22aef8..3017aac9b7 100644 --- a/packages/bbui/src/Table/AttachmentRenderer.svelte +++ b/packages/bbui/src/Table/AttachmentRenderer.svelte @@ -15,14 +15,24 @@ {#each attachments as attachment} {#if isImage(attachment.extension)} - +
{attachment.extension}
{:else}
- + {attachment.extension}
From abd732fa52537453100242530db7f200067e2fc3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 19 Aug 2022 13:54:08 +0100 Subject: [PATCH 010/112] Add tests for exporting data --- .../server/src/api/routes/tests/row.spec.js | 216 ++++++++++++------ 1 file changed, 149 insertions(+), 67 deletions(-) diff --git a/packages/server/src/api/routes/tests/row.spec.js b/packages/server/src/api/routes/tests/row.spec.js index 86e47924d8..5cd282bb34 100644 --- a/packages/server/src/api/routes/tests/row.spec.js +++ b/packages/server/src/api/routes/tests/row.spec.js @@ -3,7 +3,12 @@ const setup = require("./utilities") const { basicRow } = setup.structures const { doInAppContext } = require("@budibase/backend-core/context") const { doInTenant } = require("@budibase/backend-core/tenancy") -const { quotas, QuotaUsageType, StaticQuotaName, MonthlyQuotaName } = require("@budibase/pro") +const { + quotas, + QuotaUsageType, + StaticQuotaName, + MonthlyQuotaName, +} = require("@budibase/pro") describe("/rows", () => { let request = setup.getRequest() @@ -23,23 +28,30 @@ describe("/rows", () => { await request .get(`/api/${table._id}/rows/${id}`) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(status) const getRowUsage = async () => { - return config.doInContext(null, () => quotas.getCurrentUsageValue(QuotaUsageType.STATIC, StaticQuotaName.ROWS)) + return config.doInContext(null, () => + quotas.getCurrentUsageValue(QuotaUsageType.STATIC, StaticQuotaName.ROWS) + ) } const getQueryUsage = async () => { - return config.doInContext(null, () => quotas.getCurrentUsageValue(QuotaUsageType.MONTHLY, MonthlyQuotaName.QUERIES)) + return config.doInContext(null, () => + quotas.getCurrentUsageValue( + QuotaUsageType.MONTHLY, + MonthlyQuotaName.QUERIES + ) + ) } - const assertRowUsage = async (expected) => { + const assertRowUsage = async expected => { const usage = await getRowUsage() expect(usage).toBe(expected) } - const assertQueryUsage = async (expected) => { + const assertQueryUsage = async expected => { const usage = await getQueryUsage() expect(usage).toBe(expected) } @@ -76,10 +88,12 @@ describe("/rows", () => { name: "Updated Name", }) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) - expect(res.res.statusMessage).toEqual(`${table.name} updated successfully.`) + expect(res.res.statusMessage).toEqual( + `${table.name} updated successfully.` + ) expect(res.body.name).toEqual("Updated Name") // await assertRowUsage(rowUsage) // await assertQueryUsage(queryUsage + 1) @@ -92,7 +106,7 @@ describe("/rows", () => { const res = await request .get(`/api/${table._id}/rows/${existing._id}`) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) expect(res.body).toEqual({ @@ -110,7 +124,7 @@ describe("/rows", () => { const newRow = { tableId: table._id, name: "Second Contact", - status: "new" + status: "new", } await config.createRow() await config.createRow(newRow) @@ -119,7 +133,7 @@ describe("/rows", () => { const res = await request .get(`/api/${table._id}/rows`) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) expect(res.body.length).toBe(2) @@ -135,17 +149,36 @@ describe("/rows", () => { await request .get(`/api/${table._id}/rows/not-a-valid-id`) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(404) await assertQueryUsage(queryUsage) // no change }) it("row values are coerced", async () => { - const str = {type:"string", constraints: { type: "string", presence: false }} - const attachment = {type:"attachment", constraints: { type: "array", presence: false }} - const bool = {type:"boolean", constraints: { type: "boolean", presence: false }} - const number = {type:"number", constraints: { type: "number", presence: false }} - const datetime = {type:"datetime", constraints: { type: "string", presence: false, datetime: {earliest:"", latest: ""} }} + const str = { + type: "string", + constraints: { type: "string", presence: false }, + } + const attachment = { + type: "attachment", + constraints: { type: "array", presence: false }, + } + const bool = { + type: "boolean", + constraints: { type: "boolean", presence: false }, + } + const number = { + type: "number", + constraints: { type: "number", presence: false }, + } + const datetime = { + type: "datetime", + constraints: { + type: "string", + presence: false, + datetime: { earliest: "", latest: "" }, + }, + } table = await config.createTable({ name: "TestTable2", @@ -171,9 +204,9 @@ describe("/rows", () => { boolUndefined: bool, boolString: bool, boolBool: bool, - attachmentNull : attachment, - attachmentUndefined : attachment, - attachmentEmpty : attachment, + attachmentNull: attachment, + attachmentUndefined: attachment, + attachmentEmpty: attachment, }, }) @@ -198,9 +231,9 @@ describe("/rows", () => { boolString: "true", boolBool: true, tableId: table._id, - attachmentNull : null, - attachmentUndefined : undefined, - attachmentEmpty : "", + attachmentNull: null, + attachmentUndefined: undefined, + attachmentEmpty: "", } const id = (await config.createRow(row))._id @@ -218,7 +251,9 @@ describe("/rows", () => { expect(saved.datetimeEmptyString).toBe(null) expect(saved.datetimeNull).toBe(null) expect(saved.datetimeUndefined).toBe(undefined) - expect(saved.datetimeString).toBe(new Date(row.datetimeString).toISOString()) + expect(saved.datetimeString).toBe( + new Date(row.datetimeString).toISOString() + ) expect(saved.datetimeDate).toBe(row.datetimeDate.toISOString()) expect(saved.boolNull).toBe(null) expect(saved.boolEmpty).toBe(null) @@ -247,10 +282,12 @@ describe("/rows", () => { name: "Updated Name", }) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) - - expect(res.res.statusMessage).toEqual(`${table.name} updated successfully.`) + + expect(res.res.statusMessage).toEqual( + `${table.name} updated successfully.` + ) expect(res.body.name).toEqual("Updated Name") expect(res.body.description).toEqual(existing.description) @@ -292,16 +329,14 @@ describe("/rows", () => { const res = await request .delete(`/api/${table._id}/rows`) .send({ - rows: [ - createdRow - ] + rows: [createdRow], }) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) expect(res.body[0]._id).toEqual(createdRow._id) - await assertRowUsage(rowUsage -1) - await assertQueryUsage(queryUsage +1) + await assertRowUsage(rowUsage - 1) + await assertQueryUsage(queryUsage + 1) }) }) @@ -314,9 +349,9 @@ describe("/rows", () => { .post(`/api/${table._id}/rows/validate`) .send({ name: "ivan" }) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) - + expect(res.body.valid).toBe(true) expect(Object.keys(res.body.errors)).toEqual([]) await assertRowUsage(rowUsage) @@ -331,9 +366,9 @@ describe("/rows", () => { .post(`/api/${table._id}/rows/validate`) .send({ name: 1 }) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) - + expect(res.body.valid).toBe(false) expect(Object.keys(res.body.errors)).toEqual(["name"]) await assertRowUsage(rowUsage) @@ -351,19 +386,16 @@ describe("/rows", () => { const res = await request .delete(`/api/${table._id}/rows`) .send({ - rows: [ - row1, - row2, - ] + rows: [row1, row2], }) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) expect(res.body.length).toEqual(2) await loadRow(row1._id, 404) await assertRowUsage(rowUsage - 2) - await assertQueryUsage(queryUsage +1) + await assertQueryUsage(queryUsage + 1) }) }) @@ -376,12 +408,12 @@ describe("/rows", () => { const res = await request .get(`/api/views/${table._id}`) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) expect(res.body.length).toEqual(1) expect(res.body[0]._id).toEqual(row._id) await assertRowUsage(rowUsage) - await assertQueryUsage(queryUsage +1) + await assertQueryUsage(queryUsage + 1) }) it("should throw an error if view doesn't exist", async () => { @@ -406,7 +438,7 @@ describe("/rows", () => { const res = await request .get(`/api/views/${view.name}`) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) expect(res.body.length).toEqual(1) expect(res.body[0]._id).toEqual(row._id) @@ -418,21 +450,24 @@ describe("/rows", () => { describe("fetchEnrichedRows", () => { it("should allow enriching some linked rows", async () => { - const { table, firstRow, secondRow } = await doInTenant(setup.structures.TENANT_ID, async () => { - const table = await config.createLinkedTable() - const firstRow = await config.createRow({ - name: "Test Contact", - description: "original description", - tableId: table._id - }) - const secondRow = await config.createRow({ - name: "Test 2", - description: "og desc", - link: [{_id: firstRow._id}], - tableId: table._id, - }) - return { table, firstRow, secondRow } - }) + const { table, firstRow, secondRow } = await doInTenant( + setup.structures.TENANT_ID, + async () => { + const table = await config.createLinkedTable() + const firstRow = await config.createRow({ + name: "Test Contact", + description: "original description", + tableId: table._id, + }) + const secondRow = await config.createRow({ + name: "Test 2", + description: "og desc", + link: [{ _id: firstRow._id }], + tableId: table._id, + }) + return { table, firstRow, secondRow } + } + ) const rowUsage = await getRowUsage() const queryUsage = await getQueryUsage() @@ -440,7 +475,7 @@ describe("/rows", () => { const resBasic = await request .get(`/api/${table._id}/rows/${secondRow._id}`) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) expect(resBasic.body.link[0]._id).toBe(firstRow._id) expect(resBasic.body.link[0].primaryDisplay).toBe("Test Contact") @@ -449,14 +484,14 @@ describe("/rows", () => { const resEnriched = await request .get(`/api/${table._id}/${secondRow._id}/enrich`) .set(config.defaultHeaders()) - .expect('Content-Type', /json/) + .expect("Content-Type", /json/) .expect(200) expect(resEnriched.body.link.length).toBe(1) expect(resEnriched.body.link[0]._id).toBe(firstRow._id) expect(resEnriched.body.link[0].name).toBe("Test Contact") expect(resEnriched.body.link[0].description).toBe("original description") await assertRowUsage(rowUsage) - await assertQueryUsage(queryUsage +2) + await assertQueryUsage(queryUsage + 2) }) }) @@ -466,9 +501,11 @@ describe("/rows", () => { const row = await config.createRow({ name: "test", description: "test", - attachment: [{ - key: `${config.getAppId()}/attachments/test/thing.csv`, - }], + attachment: [ + { + key: `${config.getAppId()}/attachments/test/thing.csv`, + }, + ], tableId: table._id, }) // the environment needs configured for this @@ -482,4 +519,49 @@ describe("/rows", () => { }) }) }) + + describe("exportData", () => { + it("should allow exporting all columns", async () => { + const existing = await config.createRow() + const res = await request + .post(`/api/${table._id}/rows/exportRows?format=json`) + .set(config.defaultHeaders()) + .send({ + rows: [existing._id], + }) + .expect("Content-Type", /json/) + .expect(200) + const results = JSON.parse(res.text) + expect(results.length).toEqual(1) + const row = results[0] + + // Ensure all original columns were exported + expect(Object.keys(row).length).toBeGreaterThanOrEqual( + Object.keys(existing).length + ) + Object.keys(existing).forEach(key => { + expect(row[key]).toEqual(existing[key]) + }) + }) + + it("should allow exporting only certain columns", async () => { + const existing = await config.createRow() + const res = await request + .post(`/api/${table._id}/rows/exportRows?format=json`) + .set(config.defaultHeaders()) + .send({ + rows: [existing._id], + columns: ["_id"], + }) + .expect("Content-Type", /json/) + .expect(200) + const results = JSON.parse(res.text) + expect(results.length).toEqual(1) + const row = results[0] + + // Ensure only the _id column was exported + expect(Object.keys(row).length).toEqual(1) + expect(row._id).toEqual(existing._id) + }) + }) }) From 5c5e4bcccbb6363da08edd36ad9bc3fcbbce341b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 19 Aug 2022 14:11:58 +0100 Subject: [PATCH 011/112] Fix issue with falsey lucene values being ignored --- packages/frontend-core/src/utils/lucene.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/frontend-core/src/utils/lucene.js b/packages/frontend-core/src/utils/lucene.js index b9f673668e..243b7ba646 100644 --- a/packages/frontend-core/src/utils/lucene.js +++ b/packages/frontend-core/src/utils/lucene.js @@ -72,7 +72,7 @@ const cleanupQuery = query => { continue } for (let [key, value] of Object.entries(query[filterField])) { - if (!value || value === "") { + if (value == null || value === "") { delete query[filterField][key] } } @@ -174,7 +174,7 @@ export const runLuceneQuery = (docs, query) => { return docs } - // make query consistent first + // Make query consistent first query = cleanupQuery(query) // Iterates over a set of filters and evaluates a fail function against a doc @@ -206,7 +206,12 @@ export const runLuceneQuery = (docs, query) => { // Process a range match const rangeMatch = match("range", (docValue, testValue) => { - return !docValue || docValue < testValue.low || docValue > testValue.high + return ( + docValue == null || + docValue === "" || + docValue < testValue.low || + docValue > testValue.high + ) }) // Process an equal match (fails if the value is different) From bfaf1e61e4b1bee75ea5f80365e2dee87535bbcb Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 19 Aug 2022 14:52:50 +0100 Subject: [PATCH 012/112] Null safety --- .../src/components/automation/SetupPanel/FieldSelector.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/SetupPanel/FieldSelector.svelte b/packages/builder/src/components/automation/SetupPanel/FieldSelector.svelte index f510d961fb..3920885a2e 100644 --- a/packages/builder/src/components/automation/SetupPanel/FieldSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/FieldSelector.svelte @@ -14,7 +14,7 @@ $: { let fields = {} - for (const [key, type] of Object.entries(block?.inputs?.fields)) { + for (const [key, type] of Object.entries(block?.inputs?.fields ?? {})) { fields = { ...fields, [key]: { From ef7b7079b00bb920462ac87e3db6997eb9c36d5f Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 19 Aug 2022 14:57:15 +0100 Subject: [PATCH 013/112] tableId null safety --- packages/server/src/automations/steps/queryRows.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/server/src/automations/steps/queryRows.js b/packages/server/src/automations/steps/queryRows.js index b02f31b1ec..cfff039221 100644 --- a/packages/server/src/automations/steps/queryRows.js +++ b/packages/server/src/automations/steps/queryRows.js @@ -125,6 +125,14 @@ const hasNullFilters = filters => exports.run = async function ({ inputs, appId }) { const { tableId, filters, sortColumn, sortOrder, limit } = inputs + if (!tableId) { + return { + success: false, + response: { + message: "You must select a table to query.", + }, + } + } const table = await getTable(appId, tableId) let sortType = FieldTypes.STRING if (table && table.schema && table.schema[sortColumn] && sortColumn) { From ec6f0ec3d1a82155990fbb5938d57cb45e053d3a Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 19 Aug 2022 14:17:38 +0000 Subject: [PATCH 014/112] v1.2.44 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lerna.json b/lerna.json index 72d1757935..b04f956dc6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.43", + "version": "1.2.44", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 767af444a4..47f1717043 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.2.43", + "version": "1.2.44", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^1.2.43", + "@budibase/types": "^1.2.44", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 4e8a5d15eb..5a26b689c2 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.2.43", + "version": "1.2.44", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.2.43", + "@budibase/string-templates": "^1.2.44", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index d51e75335f..a51f3a853c 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.2.43", + "version": "1.2.44", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.2.43", - "@budibase/client": "^1.2.43", - "@budibase/frontend-core": "^1.2.43", - "@budibase/string-templates": "^1.2.43", + "@budibase/bbui": "^1.2.44", + "@budibase/client": "^1.2.44", + "@budibase/frontend-core": "^1.2.44", + "@budibase/string-templates": "^1.2.44", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 6a22dd3f45..677e2f47e4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.2.43", + "version": "1.2.44", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 79c7f3114f..4b8cb69d60 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.2.43", + "version": "1.2.44", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.2.43", - "@budibase/frontend-core": "^1.2.43", - "@budibase/string-templates": "^1.2.43", + "@budibase/bbui": "^1.2.44", + "@budibase/frontend-core": "^1.2.44", + "@budibase/string-templates": "^1.2.44", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 5320c2e1be..86039ba828 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.2.43", + "version": "1.2.44", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.2.43", + "@budibase/bbui": "^1.2.44", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 3f8c2fb032..cfcc4e9e8b 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.2.43", + "version": "1.2.44", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^1.2.43", - "@budibase/client": "^1.2.43", + "@budibase/backend-core": "^1.2.44", + "@budibase/client": "^1.2.44", "@budibase/pro": "1.2.43", - "@budibase/string-templates": "^1.2.43", - "@budibase/types": "^1.2.43", + "@budibase/string-templates": "^1.2.44", + "@budibase/types": "^1.2.44", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 71fea6428c..fba5f3bbf3 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.2.43", + "version": "1.2.44", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 6ea462d1e5..5c73db9d21 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.2.43", + "version": "1.2.44", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 468135d4e2..9edd2f1e76 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.2.43", + "version": "1.2.44", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.2.43", + "@budibase/backend-core": "^1.2.44", "@budibase/pro": "1.2.43", - "@budibase/string-templates": "^1.2.43", - "@budibase/types": "^1.2.43", + "@budibase/string-templates": "^1.2.44", + "@budibase/types": "^1.2.44", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 77e2f632990d2497d936f74dfdcd8b352b7400a0 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 19 Aug 2022 14:20:39 +0000 Subject: [PATCH 015/112] Update pro version to 1.2.44 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index cfcc4e9e8b..a6d3286b2f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.2.44", "@budibase/client": "^1.2.44", - "@budibase/pro": "1.2.43", + "@budibase/pro": "1.2.44", "@budibase/string-templates": "^1.2.44", "@budibase/types": "^1.2.44", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index bf1f4c0dfd..27cf0ed857 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.43": - version "1.2.43" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.43.tgz#3d27c216016dc98056cb60b8f4159256b897950b" - integrity sha512-00tPob6rVCbWQpvRHwqSxymwalCAh+5lrwnwOWfcOI+8ZM6aMaUqEsLZJIR97jX2JBlZ82qjdFTFQ30AzB618w== +"@budibase/backend-core@1.2.44": + version "1.2.44" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44.tgz#33cc9bf70292a6d3ab22d504d7135d1c05594e90" + integrity sha512-F9naEAaasP47RB3+BMzqS0mNNWcFVW8QqAVnpLb6mcYQ9fC64nqAIQ56OiRypRz0nx3iLHSPulknEsCCJ4Dnjg== dependencies: - "@budibase/types" "^1.2.43" + "@budibase/types" "^1.2.44" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1177,13 +1177,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.2.43": - version "1.2.43" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.43.tgz#a7abf200ad8d3535dc0dd8cadaaf475283f2aa5f" - integrity sha512-vkkCImIMpUb8CCrbpHsEMNzGWaNYLCcjHGDhkmNdzlyJu7GwK9LFj2p9JfamQWeBqSMFVaEcRQv/QxHLStu6TA== +"@budibase/pro@1.2.44": + version "1.2.44" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44.tgz#d51f57d30fdf7a1436b5cc6c3e0ec1eb562b3828" + integrity sha512-LJr94UmUfd3LX2S1W/JVG2NPuvR1kfdCe0jXjt05vWOwDXTZtNglGPhUEpT6uonbjgbhWrVYgY11IB+ezkvsSg== dependencies: - "@budibase/backend-core" "1.2.43" - "@budibase/types" "1.2.43" + "@budibase/backend-core" "1.2.44" + "@budibase/types" "1.2.44" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1206,10 +1206,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.2.43", "@budibase/types@^1.2.43": - version "1.2.43" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.43.tgz#19de137066dc2720d6c175bfe8bdf6cdadef825e" - integrity sha512-0CqcL9iYSa7fVsk0M7KerVYTr6IAH5PuEr8BfxcZgcrYgElVVmpnNI9Ehz25ldV0izquVACvk+8Q2H7GsWUvfw== +"@budibase/types@1.2.44", "@budibase/types@^1.2.44": + version "1.2.44" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44.tgz#0f11a37909cc57536a9bb61b79aeb5f3022c4c8c" + integrity sha512-/VQStgeJHpqwmioYoFl3IgBRHRPHot/90xJdNxjH4gAZEoxQMfpbJdLzNm8ydXjR/XI/shYbtYljVEIaMKTflA== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 9edd2f1e76..885d090f16 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.2.44", - "@budibase/pro": "1.2.43", + "@budibase/pro": "1.2.44", "@budibase/string-templates": "^1.2.44", "@budibase/types": "^1.2.44", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index dd2f81e4a9..6e667b8ccf 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.43": - version "1.2.43" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.43.tgz#3d27c216016dc98056cb60b8f4159256b897950b" - integrity sha512-00tPob6rVCbWQpvRHwqSxymwalCAh+5lrwnwOWfcOI+8ZM6aMaUqEsLZJIR97jX2JBlZ82qjdFTFQ30AzB618w== +"@budibase/backend-core@1.2.44": + version "1.2.44" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44.tgz#33cc9bf70292a6d3ab22d504d7135d1c05594e90" + integrity sha512-F9naEAaasP47RB3+BMzqS0mNNWcFVW8QqAVnpLb6mcYQ9fC64nqAIQ56OiRypRz0nx3iLHSPulknEsCCJ4Dnjg== dependencies: - "@budibase/types" "^1.2.43" + "@budibase/types" "^1.2.44" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -324,21 +324,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.2.43": - version "1.2.43" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.43.tgz#a7abf200ad8d3535dc0dd8cadaaf475283f2aa5f" - integrity sha512-vkkCImIMpUb8CCrbpHsEMNzGWaNYLCcjHGDhkmNdzlyJu7GwK9LFj2p9JfamQWeBqSMFVaEcRQv/QxHLStu6TA== +"@budibase/pro@1.2.44": + version "1.2.44" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44.tgz#d51f57d30fdf7a1436b5cc6c3e0ec1eb562b3828" + integrity sha512-LJr94UmUfd3LX2S1W/JVG2NPuvR1kfdCe0jXjt05vWOwDXTZtNglGPhUEpT6uonbjgbhWrVYgY11IB+ezkvsSg== dependencies: - "@budibase/backend-core" "1.2.43" - "@budibase/types" "1.2.43" + "@budibase/backend-core" "1.2.44" + "@budibase/types" "1.2.44" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.2.43", "@budibase/types@^1.2.43": - version "1.2.43" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.43.tgz#19de137066dc2720d6c175bfe8bdf6cdadef825e" - integrity sha512-0CqcL9iYSa7fVsk0M7KerVYTr6IAH5PuEr8BfxcZgcrYgElVVmpnNI9Ehz25ldV0izquVACvk+8Q2H7GsWUvfw== +"@budibase/types@1.2.44", "@budibase/types@^1.2.44": + version "1.2.44" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44.tgz#0f11a37909cc57536a9bb61b79aeb5f3022c4c8c" + integrity sha512-/VQStgeJHpqwmioYoFl3IgBRHRPHot/90xJdNxjH4gAZEoxQMfpbJdLzNm8ydXjR/XI/shYbtYljVEIaMKTflA== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 97cafac46c4b576f43cc896956e0b4360e1f4848 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 19 Aug 2022 15:21:53 +0100 Subject: [PATCH 016/112] Add support for NODE_DEBUG to app-service in kubernetes --- charts/budibase/templates/app-service-deployment.yaml | 4 ++++ charts/budibase/values.yaml | 1 + packages/server/src/automations/utils.ts | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index fd46e77647..0f8e2a08ce 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -130,6 +130,10 @@ spec: - name: BB_ADMIN_USER_PASSWORD value: { { .Values.globals.bbAdminUserPassword | quote } } {{ end }} + {{ if .Values.services.apps.nodeDebug }} + - name: NODE_DEBUG + value: {{ .Values.services.apps.nodeDebug | quote }} + {{ end }} image: budibase/apps:{{ .Values.globals.appVersion }} imagePullPolicy: Always diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index 404e92c70f..26f8cd24ed 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -126,6 +126,7 @@ services: port: 4002 replicaCount: 1 logLevel: info +# nodeDebug: "" # set the value of NODE_DEBUG worker: port: 4003 diff --git a/packages/server/src/automations/utils.ts b/packages/server/src/automations/utils.ts index 1799b4d74d..6e392d23de 100644 --- a/packages/server/src/automations/utils.ts +++ b/packages/server/src/automations/utils.ts @@ -24,7 +24,7 @@ const Runner = new Thread(ThreadType.AUTOMATION) export async function processEvent(job: any) { try { console.log( - `${job.data.automation.appId} automation ${job.data.automation._id} running` + `${job.data.automation.appId} automation ${job.data.automation._id} running. jobId=${job.id}` ) // need to actually await these so that an error can be captured properly const tenantId = tenancy.getTenantIDFromAppID(job.data.event.appId) From cd1b7c75c5a357964c5852c572a197bd4ba73594 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 19 Aug 2022 14:43:12 +0000 Subject: [PATCH 017/112] v1.2.45 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lerna.json b/lerna.json index b04f956dc6..9874e1030d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.44", + "version": "1.2.45", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 47f1717043..7e9c3e2e2f 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.2.44", + "version": "1.2.45", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^1.2.44", + "@budibase/types": "^1.2.45", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 5a26b689c2..b42842fc94 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.2.44", + "version": "1.2.45", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.2.44", + "@budibase/string-templates": "^1.2.45", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index a51f3a853c..73760a7a13 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.2.44", + "version": "1.2.45", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.2.44", - "@budibase/client": "^1.2.44", - "@budibase/frontend-core": "^1.2.44", - "@budibase/string-templates": "^1.2.44", + "@budibase/bbui": "^1.2.45", + "@budibase/client": "^1.2.45", + "@budibase/frontend-core": "^1.2.45", + "@budibase/string-templates": "^1.2.45", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 677e2f47e4..38ec0078b1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.2.44", + "version": "1.2.45", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 4b8cb69d60..100a6ced79 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.2.44", + "version": "1.2.45", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.2.44", - "@budibase/frontend-core": "^1.2.44", - "@budibase/string-templates": "^1.2.44", + "@budibase/bbui": "^1.2.45", + "@budibase/frontend-core": "^1.2.45", + "@budibase/string-templates": "^1.2.45", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 86039ba828..a80a5e8002 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.2.44", + "version": "1.2.45", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.2.44", + "@budibase/bbui": "^1.2.45", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index a6d3286b2f..b2b2ad761d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.2.44", + "version": "1.2.45", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^1.2.44", - "@budibase/client": "^1.2.44", + "@budibase/backend-core": "^1.2.45", + "@budibase/client": "^1.2.45", "@budibase/pro": "1.2.44", - "@budibase/string-templates": "^1.2.44", - "@budibase/types": "^1.2.44", + "@budibase/string-templates": "^1.2.45", + "@budibase/types": "^1.2.45", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index fba5f3bbf3..09e044e3f2 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.2.44", + "version": "1.2.45", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 5c73db9d21..c516a34594 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.2.44", + "version": "1.2.45", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 885d090f16..2a8428b8d2 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.2.44", + "version": "1.2.45", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.2.44", + "@budibase/backend-core": "^1.2.45", "@budibase/pro": "1.2.44", - "@budibase/string-templates": "^1.2.44", - "@budibase/types": "^1.2.44", + "@budibase/string-templates": "^1.2.45", + "@budibase/types": "^1.2.45", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From cfc28756ad35680ff09f4313cc4a22929d1d54da Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 19 Aug 2022 14:47:05 +0000 Subject: [PATCH 018/112] Update pro version to 1.2.45 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index b2b2ad761d..e163fab382 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.2.45", "@budibase/client": "^1.2.45", - "@budibase/pro": "1.2.44", + "@budibase/pro": "1.2.45", "@budibase/string-templates": "^1.2.45", "@budibase/types": "^1.2.45", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 27cf0ed857..ce910e7aa8 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.44": - version "1.2.44" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44.tgz#33cc9bf70292a6d3ab22d504d7135d1c05594e90" - integrity sha512-F9naEAaasP47RB3+BMzqS0mNNWcFVW8QqAVnpLb6mcYQ9fC64nqAIQ56OiRypRz0nx3iLHSPulknEsCCJ4Dnjg== +"@budibase/backend-core@1.2.45": + version "1.2.45" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.45.tgz#6d4c7106b014a9e3990706dcc5178a6567729959" + integrity sha512-28pBGZ2uQZAoo5TILhJJLJJOJkNcZUnJ+Lw5EG5wg/ltnVhGrw3/DlV9A45QeUrQZfC4MED9PxStk+Yh8z+kXw== dependencies: - "@budibase/types" "^1.2.44" + "@budibase/types" "^1.2.45" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1177,13 +1177,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.2.44": - version "1.2.44" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44.tgz#d51f57d30fdf7a1436b5cc6c3e0ec1eb562b3828" - integrity sha512-LJr94UmUfd3LX2S1W/JVG2NPuvR1kfdCe0jXjt05vWOwDXTZtNglGPhUEpT6uonbjgbhWrVYgY11IB+ezkvsSg== +"@budibase/pro@1.2.45": + version "1.2.45" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.45.tgz#ee270b0151f6ac680aadf92c9ca372560e31c0e7" + integrity sha512-r1bNg9YU3KCXnLD7xAm3rGd+tD2iQJ++zcVD6+7IE52Xbe5anmTdxp5oZIF0v8sqDwnVlmT7/XjsTKYjFoID9w== dependencies: - "@budibase/backend-core" "1.2.44" - "@budibase/types" "1.2.44" + "@budibase/backend-core" "1.2.45" + "@budibase/types" "1.2.45" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1206,10 +1206,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.2.44", "@budibase/types@^1.2.44": - version "1.2.44" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44.tgz#0f11a37909cc57536a9bb61b79aeb5f3022c4c8c" - integrity sha512-/VQStgeJHpqwmioYoFl3IgBRHRPHot/90xJdNxjH4gAZEoxQMfpbJdLzNm8ydXjR/XI/shYbtYljVEIaMKTflA== +"@budibase/types@1.2.45", "@budibase/types@^1.2.45": + version "1.2.45" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.45.tgz#07bca82830ccd08e5c19c6e3fbe7d06e1ab28838" + integrity sha512-y2RcK/5B7PfyRByK0atXYc51rfsO0fFy2QPec79vCXczlhVswuKgiLy6rQ612Cn03wZ4DQSgvLbCGrv9sot9EQ== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 2a8428b8d2..789be3b92f 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.2.45", - "@budibase/pro": "1.2.44", + "@budibase/pro": "1.2.45", "@budibase/string-templates": "^1.2.45", "@budibase/types": "^1.2.45", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 6e667b8ccf..bdc260c824 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.44": - version "1.2.44" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44.tgz#33cc9bf70292a6d3ab22d504d7135d1c05594e90" - integrity sha512-F9naEAaasP47RB3+BMzqS0mNNWcFVW8QqAVnpLb6mcYQ9fC64nqAIQ56OiRypRz0nx3iLHSPulknEsCCJ4Dnjg== +"@budibase/backend-core@1.2.45": + version "1.2.45" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.45.tgz#6d4c7106b014a9e3990706dcc5178a6567729959" + integrity sha512-28pBGZ2uQZAoo5TILhJJLJJOJkNcZUnJ+Lw5EG5wg/ltnVhGrw3/DlV9A45QeUrQZfC4MED9PxStk+Yh8z+kXw== dependencies: - "@budibase/types" "^1.2.44" + "@budibase/types" "^1.2.45" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -324,21 +324,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.2.44": - version "1.2.44" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44.tgz#d51f57d30fdf7a1436b5cc6c3e0ec1eb562b3828" - integrity sha512-LJr94UmUfd3LX2S1W/JVG2NPuvR1kfdCe0jXjt05vWOwDXTZtNglGPhUEpT6uonbjgbhWrVYgY11IB+ezkvsSg== +"@budibase/pro@1.2.45": + version "1.2.45" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.45.tgz#ee270b0151f6ac680aadf92c9ca372560e31c0e7" + integrity sha512-r1bNg9YU3KCXnLD7xAm3rGd+tD2iQJ++zcVD6+7IE52Xbe5anmTdxp5oZIF0v8sqDwnVlmT7/XjsTKYjFoID9w== dependencies: - "@budibase/backend-core" "1.2.44" - "@budibase/types" "1.2.44" + "@budibase/backend-core" "1.2.45" + "@budibase/types" "1.2.45" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.2.44", "@budibase/types@^1.2.44": - version "1.2.44" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44.tgz#0f11a37909cc57536a9bb61b79aeb5f3022c4c8c" - integrity sha512-/VQStgeJHpqwmioYoFl3IgBRHRPHot/90xJdNxjH4gAZEoxQMfpbJdLzNm8ydXjR/XI/shYbtYljVEIaMKTflA== +"@budibase/types@1.2.45", "@budibase/types@^1.2.45": + version "1.2.45" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.45.tgz#07bca82830ccd08e5c19c6e3fbe7d06e1ab28838" + integrity sha512-y2RcK/5B7PfyRByK0atXYc51rfsO0fFy2QPec79vCXczlhVswuKgiLy6rQ612Cn03wZ4DQSgvLbCGrv9sot9EQ== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From f273a6f779b7b3b78f1158b191c686a1653d384f Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 19 Aug 2022 23:14:19 +0100 Subject: [PATCH 019/112] Add logging to all event listeners for automations + stalled handling stub --- packages/server/src/automations/bullboard.js | 2 + packages/server/src/automations/listeners.ts | 78 ++++++++++++++++++++ packages/server/src/automations/utils.ts | 13 ++-- packages/server/src/threads/automation.ts | 51 +++++++++---- 4 files changed, 122 insertions(+), 22 deletions(-) create mode 100644 packages/server/src/automations/listeners.ts diff --git a/packages/server/src/automations/bullboard.js b/packages/server/src/automations/bullboard.js index cba6594ae7..af091843f2 100644 --- a/packages/server/src/automations/bullboard.js +++ b/packages/server/src/automations/bullboard.js @@ -8,12 +8,14 @@ const Queue = env.isTest() const { JobQueues } = require("../constants") const { utils } = require("@budibase/backend-core/redis") const { opts, redisProtocolUrl } = utils.getRedisOptions() +const listeners = require("./listeners") const CLEANUP_PERIOD_MS = 60 * 1000 const queueConfig = redisProtocolUrl || { redis: opts } let cleanupInternal = null let automationQueue = new Queue(JobQueues.AUTOMATIONS, queueConfig) +listeners.addListeners(automationQueue) async function cleanup() { await automationQueue.clean(CLEANUP_PERIOD_MS, "completed") diff --git a/packages/server/src/automations/listeners.ts b/packages/server/src/automations/listeners.ts new file mode 100644 index 0000000000..d53d0dddee --- /dev/null +++ b/packages/server/src/automations/listeners.ts @@ -0,0 +1,78 @@ +import { Queue, Job, JobId } from "bull" +import { AutomationEvent } from "../definitions/automations" +import * as automation from "../threads/automation" + +export const addListeners = (queue: Queue) => { + logging(queue) + // handleStalled(queue) +} + +const handleStalled = (queue: Queue) => { + queue.on("active", async (job: Job) => { + await automation.removeStalled(job as AutomationEvent) + }) +} + +const logging = (queue: Queue) => { + if (process.env.NODE_DEBUG?.includes("bull")) { + queue + .on("error", (error: any) => { + // An error occurred. + console.error(`automation-event=error error=${JSON.stringify(error)}`) + }) + .on("waiting", (jobId: JobId) => { + // A Job is waiting to be processed as soon as a worker is idling. + console.log(`automation-event=waiting jobId=${jobId}`) + }) + .on("active", (job: Job, jobPromise: any) => { + // A job has started. You can use `jobPromise.cancel()`` to abort it. + console.log(`automation-event=active jobId=${job.id}`) + }) + .on("stalled", (job: Job) => { + // A job has been marked as stalled. This is useful for debugging job + // workers that crash or pause the event loop. + console.error( + `automation-event=stalled jobId=${job.id} job=${JSON.stringify(job)}` + ) + }) + .on("progress", (job: Job, progress: any) => { + // A job's progress was updated! + console.log( + `automation-event=progress jobId=${job.id} progress=${progress}` + ) + }) + .on("completed", (job: Job, result) => { + // A job successfully completed with a `result`. + console.log( + `automation-event=completed jobId=${job.id} result=${result}` + ) + }) + .on("failed", (job, err: any) => { + // A job failed with reason `err`! + console.log(`automation-event=failed jobId=${job.id} error=${err}`) + }) + .on("paused", () => { + // The queue has been paused. + console.log(`automation-event=paused`) + }) + .on("resumed", (job: Job) => { + // The queue has been resumed. + console.log(`automation-event=paused jobId=${job.id}`) + }) + .on("cleaned", (jobs: Job[], type: string) => { + // Old jobs have been cleaned from the queue. `jobs` is an array of cleaned + // jobs, and `type` is the type of jobs cleaned. + console.log( + `automation-event=cleaned length=${jobs.length} type=${type}` + ) + }) + .on("drained", () => { + // Emitted every time the queue has processed all the waiting jobs (even if there can be some delayed jobs not yet processed) + console.log(`automation-event=drained`) + }) + .on("removed", (job: Job) => { + // A job successfully removed. + console.log(`automation-event=removed jobId=${job.id}`) + }) + } +} diff --git a/packages/server/src/automations/utils.ts b/packages/server/src/automations/utils.ts index 6e392d23de..e0979ac0d9 100644 --- a/packages/server/src/automations/utils.ts +++ b/packages/server/src/automations/utils.ts @@ -21,11 +21,13 @@ const WH_STEP_ID = definitions.WEBHOOK.stepId const CRON_STEP_ID = definitions.CRON.stepId const Runner = new Thread(ThreadType.AUTOMATION) +const jobMessage = (job: any, message: string) => { + return `app=${job.data.event.appId} automation=${job.data.automation._id} jobId=${job.id} trigger=${job.data.automation.definition.trigger.event} : ${message}` +} + export async function processEvent(job: any) { try { - console.log( - `${job.data.automation.appId} automation ${job.data.automation._id} running. jobId=${job.id}` - ) + console.log(jobMessage(job, "running")) // need to actually await these so that an error can be captured properly const tenantId = tenancy.getTenantIDFromAppID(job.data.event.appId) return await tenancy.doInTenant(tenantId, async () => { @@ -34,9 +36,7 @@ export async function processEvent(job: any) { }) } catch (err) { const errJson = JSON.stringify(err) - console.error( - `${job.data.automation.appId} automation ${job.data.automation._id} was unable to run - ${errJson}` - ) + console.error(jobMessage(job, `was unable to run - ${errJson}`)) console.trace(err) return { err } } @@ -91,6 +91,7 @@ export async function disableAllCrons(appId: any) { export async function disableCron(jobId: string, jobKey: string) { await queue.removeRepeatableByKey(jobKey) await queue.removeJobs(jobId) + console.log(`jobId=${jobId} disabled`) } export async function clearMetadata() { diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index d04c49ce79..04b6ae413c 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -133,27 +133,34 @@ class Orchestrator { return metadata } + async stopCron(reason: string) { + if (!this._repeat) { + return + } + logWarn( + `CRON disabled reason=${reason} - ${this._appId}/${this._automation._id}` + ) + const automation = this._automation + const trigger = automation.definition.trigger + await disableCron(this._repeat?.jobId, this._repeat?.jobKey) + this.updateExecutionOutput( + trigger.id, + trigger.stepId, + {}, + { + status: AutomationStatus.STOPPED_ERROR, + success: false, + } + ) + await storeLog(automation, this.executionOutput) + } + async checkIfShouldStop(metadata: AutomationMetadata): Promise { if (!metadata.errorCount || !this._repeat) { return false } - const automation = this._automation - const trigger = automation.definition.trigger if (metadata.errorCount >= MAX_AUTOMATION_RECURRING_ERRORS) { - logWarn( - `CRON disabled due to errors - ${this._appId}/${this._automation._id}` - ) - await disableCron(this._repeat?.jobId, this._repeat?.jobKey) - this.updateExecutionOutput( - trigger.id, - trigger.stepId, - {}, - { - status: AutomationStatus.STOPPED_ERROR, - success: false, - } - ) - await storeLog(automation, this.executionOutput) + await this.stopCron("errors") return true } return false @@ -465,3 +472,15 @@ export function execute(input: AutomationEvent, callback: WorkerCallback) { } }) } + +export const removeStalled = (input: AutomationEvent) => { + const appId = input.data.event.appId + doInAppContext(appId, async () => { + const automationOrchestrator = new Orchestrator( + input.data.automation, + input.data.event, + input.opts + ) + await automationOrchestrator.stopCron("stalled") + }) +} From 60c8dc10d287d5adf6380509e7e40e6f0e653eb8 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Sat, 20 Aug 2022 08:35:52 +0000 Subject: [PATCH 020/112] v1.2.46 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lerna.json b/lerna.json index 9874e1030d..d3e79fc5cb 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.45", + "version": "1.2.46", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 7e9c3e2e2f..799696358a 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.2.45", + "version": "1.2.46", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^1.2.45", + "@budibase/types": "^1.2.46", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index b42842fc94..1cf70e11b1 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.2.45", + "version": "1.2.46", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.2.45", + "@budibase/string-templates": "^1.2.46", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 73760a7a13..61f63064b5 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.2.45", + "version": "1.2.46", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.2.45", - "@budibase/client": "^1.2.45", - "@budibase/frontend-core": "^1.2.45", - "@budibase/string-templates": "^1.2.45", + "@budibase/bbui": "^1.2.46", + "@budibase/client": "^1.2.46", + "@budibase/frontend-core": "^1.2.46", + "@budibase/string-templates": "^1.2.46", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 38ec0078b1..8f5d8ff791 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.2.45", + "version": "1.2.46", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 100a6ced79..9261e214f3 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.2.45", + "version": "1.2.46", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.2.45", - "@budibase/frontend-core": "^1.2.45", - "@budibase/string-templates": "^1.2.45", + "@budibase/bbui": "^1.2.46", + "@budibase/frontend-core": "^1.2.46", + "@budibase/string-templates": "^1.2.46", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index a80a5e8002..ffda0ba07e 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.2.45", + "version": "1.2.46", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.2.45", + "@budibase/bbui": "^1.2.46", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index e163fab382..dfd59f47db 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.2.45", + "version": "1.2.46", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^1.2.45", - "@budibase/client": "^1.2.45", + "@budibase/backend-core": "^1.2.46", + "@budibase/client": "^1.2.46", "@budibase/pro": "1.2.45", - "@budibase/string-templates": "^1.2.45", - "@budibase/types": "^1.2.45", + "@budibase/string-templates": "^1.2.46", + "@budibase/types": "^1.2.46", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 09e044e3f2..6217a9ee91 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.2.45", + "version": "1.2.46", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index c516a34594..17ca3af63f 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.2.45", + "version": "1.2.46", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 789be3b92f..b61672fbf2 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.2.45", + "version": "1.2.46", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.2.45", + "@budibase/backend-core": "^1.2.46", "@budibase/pro": "1.2.45", - "@budibase/string-templates": "^1.2.45", - "@budibase/types": "^1.2.45", + "@budibase/string-templates": "^1.2.46", + "@budibase/types": "^1.2.46", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 66848e31ed9d2f92931007ad96b50930d212682c Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Sat, 20 Aug 2022 08:38:46 +0000 Subject: [PATCH 021/112] Update pro version to 1.2.46 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index dfd59f47db..8c76fea148 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.2.46", "@budibase/client": "^1.2.46", - "@budibase/pro": "1.2.45", + "@budibase/pro": "1.2.46", "@budibase/string-templates": "^1.2.46", "@budibase/types": "^1.2.46", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index ce910e7aa8..e3b5a55ffb 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.45": - version "1.2.45" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.45.tgz#6d4c7106b014a9e3990706dcc5178a6567729959" - integrity sha512-28pBGZ2uQZAoo5TILhJJLJJOJkNcZUnJ+Lw5EG5wg/ltnVhGrw3/DlV9A45QeUrQZfC4MED9PxStk+Yh8z+kXw== +"@budibase/backend-core@1.2.46": + version "1.2.46" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.46.tgz#681a987ea1f4a3d2aabf09713bc9a5f8215951f4" + integrity sha512-kAN3W9mdLsXGUrcDVyhot79mTUJDRyehMA3EhHiTq2eiezNL1plKFZAr1tLmD7J86j0X+yXNi2q1Cp/BKK8DuQ== dependencies: - "@budibase/types" "^1.2.45" + "@budibase/types" "^1.2.46" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1177,13 +1177,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.2.45": - version "1.2.45" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.45.tgz#ee270b0151f6ac680aadf92c9ca372560e31c0e7" - integrity sha512-r1bNg9YU3KCXnLD7xAm3rGd+tD2iQJ++zcVD6+7IE52Xbe5anmTdxp5oZIF0v8sqDwnVlmT7/XjsTKYjFoID9w== +"@budibase/pro@1.2.46": + version "1.2.46" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.46.tgz#9b7add93dc197c19766af44beed5c077cb397775" + integrity sha512-qUro7+08DBJP3/Avl8dCJzSuMWwm04crcCNJ20/A5TSFC35q0j7lspPylUokFmdyzd5oDrG1ZbyT8X8IXaVpkQ== dependencies: - "@budibase/backend-core" "1.2.45" - "@budibase/types" "1.2.45" + "@budibase/backend-core" "1.2.46" + "@budibase/types" "1.2.46" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1206,10 +1206,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.2.45", "@budibase/types@^1.2.45": - version "1.2.45" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.45.tgz#07bca82830ccd08e5c19c6e3fbe7d06e1ab28838" - integrity sha512-y2RcK/5B7PfyRByK0atXYc51rfsO0fFy2QPec79vCXczlhVswuKgiLy6rQ612Cn03wZ4DQSgvLbCGrv9sot9EQ== +"@budibase/types@1.2.46", "@budibase/types@^1.2.46": + version "1.2.46" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.46.tgz#de5d722edac539c12e7e8b834e1661fa962eed3d" + integrity sha512-Fwmj6rvrUEJ1B3pvrN6crcVKY47/1U5/lOxTe7zOGBq4Nl4XuwHqWj/RuKqRCWmA66IdzORBBYWCQW1STH7IBA== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index b61672fbf2..10a06bb180 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.2.46", - "@budibase/pro": "1.2.45", + "@budibase/pro": "1.2.46", "@budibase/string-templates": "^1.2.46", "@budibase/types": "^1.2.46", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index bdc260c824..b89f1b250c 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.45": - version "1.2.45" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.45.tgz#6d4c7106b014a9e3990706dcc5178a6567729959" - integrity sha512-28pBGZ2uQZAoo5TILhJJLJJOJkNcZUnJ+Lw5EG5wg/ltnVhGrw3/DlV9A45QeUrQZfC4MED9PxStk+Yh8z+kXw== +"@budibase/backend-core@1.2.46": + version "1.2.46" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.46.tgz#681a987ea1f4a3d2aabf09713bc9a5f8215951f4" + integrity sha512-kAN3W9mdLsXGUrcDVyhot79mTUJDRyehMA3EhHiTq2eiezNL1plKFZAr1tLmD7J86j0X+yXNi2q1Cp/BKK8DuQ== dependencies: - "@budibase/types" "^1.2.45" + "@budibase/types" "^1.2.46" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -324,21 +324,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.2.45": - version "1.2.45" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.45.tgz#ee270b0151f6ac680aadf92c9ca372560e31c0e7" - integrity sha512-r1bNg9YU3KCXnLD7xAm3rGd+tD2iQJ++zcVD6+7IE52Xbe5anmTdxp5oZIF0v8sqDwnVlmT7/XjsTKYjFoID9w== +"@budibase/pro@1.2.46": + version "1.2.46" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.46.tgz#9b7add93dc197c19766af44beed5c077cb397775" + integrity sha512-qUro7+08DBJP3/Avl8dCJzSuMWwm04crcCNJ20/A5TSFC35q0j7lspPylUokFmdyzd5oDrG1ZbyT8X8IXaVpkQ== dependencies: - "@budibase/backend-core" "1.2.45" - "@budibase/types" "1.2.45" + "@budibase/backend-core" "1.2.46" + "@budibase/types" "1.2.46" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.2.45", "@budibase/types@^1.2.45": - version "1.2.45" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.45.tgz#07bca82830ccd08e5c19c6e3fbe7d06e1ab28838" - integrity sha512-y2RcK/5B7PfyRByK0atXYc51rfsO0fFy2QPec79vCXczlhVswuKgiLy6rQ612Cn03wZ4DQSgvLbCGrv9sot9EQ== +"@budibase/types@1.2.46", "@budibase/types@^1.2.46": + version "1.2.46" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.46.tgz#de5d722edac539c12e7e8b834e1661fa962eed3d" + integrity sha512-Fwmj6rvrUEJ1B3pvrN6crcVKY47/1U5/lOxTe7zOGBq4Nl4XuwHqWj/RuKqRCWmA66IdzORBBYWCQW1STH7IBA== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 28cdb16e085831d7c2e7c3e0594a9e9d45d2d0e1 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Sat, 20 Aug 2022 11:02:22 +0100 Subject: [PATCH 022/112] enable stalled job disabling --- packages/server/src/automations/listeners.ts | 4 ++-- packages/server/src/threads/automation.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/automations/listeners.ts b/packages/server/src/automations/listeners.ts index d53d0dddee..9f8667bd29 100644 --- a/packages/server/src/automations/listeners.ts +++ b/packages/server/src/automations/listeners.ts @@ -4,11 +4,11 @@ import * as automation from "../threads/automation" export const addListeners = (queue: Queue) => { logging(queue) - // handleStalled(queue) + handleStalled(queue) } const handleStalled = (queue: Queue) => { - queue.on("active", async (job: Job) => { + queue.on("stalled", async (job: Job) => { await automation.removeStalled(job as AutomationEvent) }) } diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index 04b6ae413c..3136155869 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -473,9 +473,9 @@ export function execute(input: AutomationEvent, callback: WorkerCallback) { }) } -export const removeStalled = (input: AutomationEvent) => { +export const removeStalled = async (input: AutomationEvent) => { const appId = input.data.event.appId - doInAppContext(appId, async () => { + await doInAppContext(appId, async () => { const automationOrchestrator = new Orchestrator( input.data.automation, input.data.event, From 917bb96ae651e481c054a287099333c6785011a4 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Sat, 20 Aug 2022 11:42:51 +0100 Subject: [PATCH 023/112] add on() to mock queue --- packages/server/src/utilities/queue/inMemoryQueue.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/server/src/utilities/queue/inMemoryQueue.js b/packages/server/src/utilities/queue/inMemoryQueue.js index 620b65cf38..79781f9283 100644 --- a/packages/server/src/utilities/queue/inMemoryQueue.js +++ b/packages/server/src/utilities/queue/inMemoryQueue.js @@ -113,6 +113,10 @@ class InMemoryQueue { async getJob() { return {} } + + on() { + // do nothing + } } module.exports = InMemoryQueue From 46beea5ec0d775c432809e23572b6d811c771776 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Sat, 20 Aug 2022 11:45:07 +0000 Subject: [PATCH 024/112] v1.2.47 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lerna.json b/lerna.json index d3e79fc5cb..88627b68e4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.46", + "version": "1.2.47", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 799696358a..d999483139 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.2.46", + "version": "1.2.47", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^1.2.46", + "@budibase/types": "^1.2.47", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 1cf70e11b1..072dd0784a 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.2.46", + "version": "1.2.47", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.2.46", + "@budibase/string-templates": "^1.2.47", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 61f63064b5..2d5166c978 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.2.46", + "version": "1.2.47", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.2.46", - "@budibase/client": "^1.2.46", - "@budibase/frontend-core": "^1.2.46", - "@budibase/string-templates": "^1.2.46", + "@budibase/bbui": "^1.2.47", + "@budibase/client": "^1.2.47", + "@budibase/frontend-core": "^1.2.47", + "@budibase/string-templates": "^1.2.47", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 8f5d8ff791..22fac6dbf7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.2.46", + "version": "1.2.47", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 9261e214f3..352a250956 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.2.46", + "version": "1.2.47", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.2.46", - "@budibase/frontend-core": "^1.2.46", - "@budibase/string-templates": "^1.2.46", + "@budibase/bbui": "^1.2.47", + "@budibase/frontend-core": "^1.2.47", + "@budibase/string-templates": "^1.2.47", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index ffda0ba07e..2a5e2c970b 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.2.46", + "version": "1.2.47", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.2.46", + "@budibase/bbui": "^1.2.47", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 8c76fea148..b0ec92edab 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.2.46", + "version": "1.2.47", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^1.2.46", - "@budibase/client": "^1.2.46", + "@budibase/backend-core": "^1.2.47", + "@budibase/client": "^1.2.47", "@budibase/pro": "1.2.46", - "@budibase/string-templates": "^1.2.46", - "@budibase/types": "^1.2.46", + "@budibase/string-templates": "^1.2.47", + "@budibase/types": "^1.2.47", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 6217a9ee91..055ca8ee3c 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.2.46", + "version": "1.2.47", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 17ca3af63f..733287df92 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.2.46", + "version": "1.2.47", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 10a06bb180..725d8f5143 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.2.46", + "version": "1.2.47", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.2.46", + "@budibase/backend-core": "^1.2.47", "@budibase/pro": "1.2.46", - "@budibase/string-templates": "^1.2.46", - "@budibase/types": "^1.2.46", + "@budibase/string-templates": "^1.2.47", + "@budibase/types": "^1.2.47", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From e5129eca951044dd43a8daffa6c11c4c3fb1532c Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Sat, 20 Aug 2022 11:48:48 +0000 Subject: [PATCH 025/112] Update pro version to 1.2.47 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index b0ec92edab..8cc7eca3bc 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.2.47", "@budibase/client": "^1.2.47", - "@budibase/pro": "1.2.46", + "@budibase/pro": "1.2.47", "@budibase/string-templates": "^1.2.47", "@budibase/types": "^1.2.47", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index e3b5a55ffb..6f65ef63bb 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.46": - version "1.2.46" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.46.tgz#681a987ea1f4a3d2aabf09713bc9a5f8215951f4" - integrity sha512-kAN3W9mdLsXGUrcDVyhot79mTUJDRyehMA3EhHiTq2eiezNL1plKFZAr1tLmD7J86j0X+yXNi2q1Cp/BKK8DuQ== +"@budibase/backend-core@1.2.47": + version "1.2.47" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.47.tgz#d75e03d23342b0d53bb9b2005b60a07e98c9e89b" + integrity sha512-3ix9APbyYWyzPd5e8RpZ2+GQeCW9jMInTONx9C5i2HOIkggmuduBOUx00RqufQmEeQk2yYN0ih54/LF0fOGleg== dependencies: - "@budibase/types" "^1.2.46" + "@budibase/types" "^1.2.47" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1177,13 +1177,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.2.46": - version "1.2.46" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.46.tgz#9b7add93dc197c19766af44beed5c077cb397775" - integrity sha512-qUro7+08DBJP3/Avl8dCJzSuMWwm04crcCNJ20/A5TSFC35q0j7lspPylUokFmdyzd5oDrG1ZbyT8X8IXaVpkQ== +"@budibase/pro@1.2.47": + version "1.2.47" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.47.tgz#1e09b35765bce8d2933f5665cd92ffed64efdccd" + integrity sha512-bW4ntmHphySX+xRvtHEYUu1HOQiEvsl22MFq1u+rUJJ816WSnc2lRWOEX6nQ8wVCmKxLUva2WrrpU3R+zkVfEg== dependencies: - "@budibase/backend-core" "1.2.46" - "@budibase/types" "1.2.46" + "@budibase/backend-core" "1.2.47" + "@budibase/types" "1.2.47" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1206,10 +1206,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.2.46", "@budibase/types@^1.2.46": - version "1.2.46" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.46.tgz#de5d722edac539c12e7e8b834e1661fa962eed3d" - integrity sha512-Fwmj6rvrUEJ1B3pvrN6crcVKY47/1U5/lOxTe7zOGBq4Nl4XuwHqWj/RuKqRCWmA66IdzORBBYWCQW1STH7IBA== +"@budibase/types@1.2.47", "@budibase/types@^1.2.47": + version "1.2.47" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.47.tgz#c1a23864b2b806d63f74e6af528bba3d7a9665c7" + integrity sha512-QtI+rDmHI/CimYntivj88oMQ37oe9dGmhi8pjXlehSYfaqm2rmOzwMdqm/yULYJYA8qsEfvMqnSDYg3IQrspwQ== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 725d8f5143..60885179ac 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.2.47", - "@budibase/pro": "1.2.46", + "@budibase/pro": "1.2.47", "@budibase/string-templates": "^1.2.47", "@budibase/types": "^1.2.47", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index b89f1b250c..ada95a1087 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.46": - version "1.2.46" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.46.tgz#681a987ea1f4a3d2aabf09713bc9a5f8215951f4" - integrity sha512-kAN3W9mdLsXGUrcDVyhot79mTUJDRyehMA3EhHiTq2eiezNL1plKFZAr1tLmD7J86j0X+yXNi2q1Cp/BKK8DuQ== +"@budibase/backend-core@1.2.47": + version "1.2.47" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.47.tgz#d75e03d23342b0d53bb9b2005b60a07e98c9e89b" + integrity sha512-3ix9APbyYWyzPd5e8RpZ2+GQeCW9jMInTONx9C5i2HOIkggmuduBOUx00RqufQmEeQk2yYN0ih54/LF0fOGleg== dependencies: - "@budibase/types" "^1.2.46" + "@budibase/types" "^1.2.47" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -324,21 +324,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.2.46": - version "1.2.46" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.46.tgz#9b7add93dc197c19766af44beed5c077cb397775" - integrity sha512-qUro7+08DBJP3/Avl8dCJzSuMWwm04crcCNJ20/A5TSFC35q0j7lspPylUokFmdyzd5oDrG1ZbyT8X8IXaVpkQ== +"@budibase/pro@1.2.47": + version "1.2.47" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.47.tgz#1e09b35765bce8d2933f5665cd92ffed64efdccd" + integrity sha512-bW4ntmHphySX+xRvtHEYUu1HOQiEvsl22MFq1u+rUJJ816WSnc2lRWOEX6nQ8wVCmKxLUva2WrrpU3R+zkVfEg== dependencies: - "@budibase/backend-core" "1.2.46" - "@budibase/types" "1.2.46" + "@budibase/backend-core" "1.2.47" + "@budibase/types" "1.2.47" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.2.46", "@budibase/types@^1.2.46": - version "1.2.46" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.46.tgz#de5d722edac539c12e7e8b834e1661fa962eed3d" - integrity sha512-Fwmj6rvrUEJ1B3pvrN6crcVKY47/1U5/lOxTe7zOGBq4Nl4XuwHqWj/RuKqRCWmA66IdzORBBYWCQW1STH7IBA== +"@budibase/types@1.2.47", "@budibase/types@^1.2.47": + version "1.2.47" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.47.tgz#c1a23864b2b806d63f74e6af528bba3d7a9665c7" + integrity sha512-QtI+rDmHI/CimYntivj88oMQ37oe9dGmhi8pjXlehSYfaqm2rmOzwMdqm/yULYJYA8qsEfvMqnSDYg3IQrspwQ== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 098c67ce5de5632ce252b6a0879ab37780e3f088 Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 22 Aug 2022 12:49:05 +0100 Subject: [PATCH 026/112] Initial commit of UX refactor --- .../bbui/src/Actions/position_dropdown.js | 21 +- packages/bbui/src/Popover/Popover.svelte | 3 +- .../builder/src/builderStore/dataBinding.js | 8 + .../common/bindings/BindingPanel.svelte | 234 ++++++++++++++---- .../common/bindings/ClientBindingPanel.svelte | 1 - 5 files changed, 210 insertions(+), 57 deletions(-) diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js index a25cc1bbd5..7570a39c8c 100644 --- a/packages/bbui/src/Actions/position_dropdown.js +++ b/packages/bbui/src/Actions/position_dropdown.js @@ -1,4 +1,4 @@ -export default function positionDropdown(element, { anchor, align }) { +export default function positionDropdown(element, { anchor, align, maxWidth }) { let positionSide = "top" let maxHeight = 0 let dimensions = getDimensions(anchor) @@ -34,13 +34,24 @@ export default function positionDropdown(element, { anchor, align }) { } function calcLeftPosition() { - return align === "right" - ? dimensions.left + dimensions.width - dimensions.containerWidth - : dimensions.left + let left + + if (align == "right") { + left = dimensions.left + dimensions.width - dimensions.containerWidth + } else if (align == "right-side") { + left = dimensions.left + dimensions.width + } else { + left = dimensions.left + } + + return left } element.style.position = "absolute" element.style.zIndex = "9999" + if (maxWidth) { + element.style.maxWidth = `${maxWidth}px` + } element.style.minWidth = `${dimensions.width}px` element.style.maxHeight = `${maxHeight.toFixed(0)}px` element.style.transformOrigin = `center ${positionSide}` @@ -54,10 +65,8 @@ export default function positionDropdown(element, { anchor, align }) { element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px` }) }) - resizeObserver.observe(anchor) resizeObserver.observe(element) - return { destroy() { resizeObserver.disconnect() diff --git a/packages/bbui/src/Popover/Popover.svelte b/packages/bbui/src/Popover/Popover.svelte index 756e5e6a09..91581724d5 100644 --- a/packages/bbui/src/Popover/Popover.svelte +++ b/packages/bbui/src/Popover/Popover.svelte @@ -11,6 +11,7 @@ export let align = "right" export let portalTarget export let dataCy + export let maxWidth export let direction = "bottom" export let showTip = false @@ -45,7 +46,7 @@
{ providerId, // Table ID is used by JSON fields to know what table the field is in tableId: table?._id, + category: "Data", }) }) }) @@ -385,6 +386,7 @@ const getUserBindings = () => { // datasource options, based on bindable properties fieldSchema, providerId: "user", + category: "Current User", }) }) return bindings @@ -401,11 +403,13 @@ const getDeviceBindings = () => { type: "context", runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`, readableBinding: `Device.Mobile`, + category: "Device", }) bindings.push({ type: "context", runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`, readableBinding: `Device.Tablet`, + category: "Device", }) } return bindings @@ -460,6 +464,7 @@ const getStateBindings = () => { type: "context", runtimeBinding: `${safeState}.${makePropSafe(key)}`, readableBinding: `State.${key}`, + category: "State", })) } return bindings @@ -482,11 +487,13 @@ const getUrlBindings = asset => { type: "context", runtimeBinding: `${safeURL}.${makePropSafe(param)}`, readableBinding: `URL.${param}`, + category: "URL", })) const queryParamsBinding = { type: "context", runtimeBinding: makePropSafe("query"), readableBinding: "Query params", + category: "URL", } return urlParamBindings.concat([queryParamsBinding]) } @@ -497,6 +504,7 @@ const getRoleBindings = () => { type: "context", runtimeBinding: `trim "${role._id}"`, readableBinding: `Role.${role.name}`, + category: "Role", } }) } diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 49cbd434cf..40a4ed8061 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -9,6 +9,9 @@ Body, Layout, Button, + ActionButton, + Icon, + Popover, } from "@budibase/bbui" import { createEventDispatcher, onMount } from "svelte" import { @@ -45,6 +48,21 @@ let jsValue = initialValueJS ? value : null let hbsValue = initialValueJS ? null : value + let selectedCategory = null + let categoryIcons = { + Device: "DevicePhone", + "Current User": "User", + Helpers: "MagicWand", + Data: "Data", + State: "AutomatedSegment", + URL: "RailTop", + Role: "UsersLock", + } + + let popover + let popoverAnchor + let hoverHelper + $: usingJS = mode === "JavaScript" $: searchRgx = new RegExp(search, "ig") $: categories = Object.entries(groupBy("category", bindings)) @@ -55,10 +73,25 @@ return binding.readableBinding.match(searchRgx) }), })) - .filter(category => category.bindings?.length > 0) + .filter(category => { + return ( + category.bindings?.length > 0 && + (!selectedCategory ? true : selectedCategory === category.name) + ) + }) + $: filteredHelpers = helpers?.filter(helper => { return helper.label.match(searchRgx) || helper.description.match(searchRgx) }) + + $: categoryNames = [ + ...categories.reduce((acc, cat) => { + acc.push(cat[0]) + return acc + }, []), + "Helpers", + ] + $: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`) const updateValue = val => { @@ -140,23 +173,91 @@ }) + + + + {#if selectedCategory === "Helpers" || search} +
+
{hoverHelper.displayText}
+
+ {@html hoverHelper.description} +
+
{getHelperExample(
+              hoverHelper,
+              usingJS
+            )}
+
+ {/if} +
+
+
+ -
-
+ + {#if selectedCategory} +
+ { + selectedCategory = null + }} + > + Back + +
+ {/if} + + {#if !selectedCategory}
Search
-
- {#each filteredCategories as category} - {#if category.bindings?.length} -
-
{category.name}
+ {/if} + + {#if !selectedCategory && !search} +
    + {#each categoryNames as categoryName} +
  • { + selectedCategory = categoryName + }} + > + + {categoryName} + +
  • + {/each} +
+ {/if} + + {#if selectedCategory || search} + {#each filteredCategories as category} + {#if category.bindings?.length} +
+ {category.name} +
    {#each category.bindings as binding} -
  • addBinding(binding)}> + +
  • addBinding(binding)}> {binding.readableBinding} - {#if binding.type} - {binding.type} + + {#if binding.fieldSchema?.type} + + + {binding.fieldSchema.type} + + {/if} {#if binding.description}
    @@ -167,31 +268,44 @@
  • {/each}
-
+ {/if} + {/each} + + {#if selectedCategory === "Helpers" || search} + {#if filteredHelpers?.length} +
Helpers
+
    + {#each filteredHelpers as helper} +
  • addHelper(helper, usingJS)} + on:mouseenter={e => { + // if (e.target !== this) return + popoverAnchor = e.target + hoverHelper = helper + popover.show() + e.stopPropagation() + }} + on:mouseleave={() => { + popover.hide() + popoverAnchor = null + hoverHelper = null + }} + on:focus={() => {}} + on:blur={() => {}} + > + {helper.displayText} + {#if helper.type} + + {helper.type} + + {/if} +
  • + {/each} +
+ {/if} {/if} - {/each} - {#if filteredHelpers?.length} -
-
Helpers
-
    - {#each filteredHelpers as helper} -
  • addHelper(helper, usingJS)}> -
    -
    {helper.displayText}
    -
    - {@html helper.description} -
    -
    {getHelperExample(
    -                      helper,
    -                      usingJS
    -                    )}
    -
    -
  • - {/each} -
-
{/if} -
+
@@ -241,6 +355,35 @@ diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte index 8f22371372..990a54610c 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte @@ -96,7 +96,7 @@ + + + + diff --git a/packages/builder/src/stores/portal/users.js b/packages/builder/src/stores/portal/users.js index 1dbc878dd1..e9bdf790f2 100644 --- a/packages/builder/src/stores/portal/users.js +++ b/packages/builder/src/stores/portal/users.js @@ -83,7 +83,7 @@ export function createUsersStore() { } async function bulkDelete(userIds) { - await API.deleteUsers(userIds) + return API.deleteUsers(userIds) } async function save(user) { From ea6de7c428460f4b02926dde5db65a0cb783afd1 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 26 Aug 2022 13:12:33 +0100 Subject: [PATCH 078/112] update deletion failure modal --- .../manage/users/_components/DeletionFailureModal.svelte | 4 ++-- .../src/pages/builder/portal/manage/users/index.svelte | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/DeletionFailureModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/DeletionFailureModal.svelte index cfc753f1ca..370ee153f2 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/DeletionFailureModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/DeletionFailureModal.svelte @@ -52,7 +52,7 @@ Date: Fri, 26 Aug 2022 13:18:38 +0100 Subject: [PATCH 079/112] Update NGINX access log to show upstream_response_time, proxy_host and upstream_addr --- hosting/nginx.dev.conf.hbs | 5 ++++- hosting/nginx.prod.conf.hbs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hosting/nginx.dev.conf.hbs b/hosting/nginx.dev.conf.hbs index 9398b7e719..148007d958 100644 --- a/hosting/nginx.dev.conf.hbs +++ b/hosting/nginx.dev.conf.hbs @@ -15,7 +15,10 @@ http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; + '"$http_user_agent" "$http_x_forwarded_for" ' + 'response_time=$upstream_response_time proxy_host=$proxy_host upstream_addr=$upstream_addr'; + + access_log /var/log/nginx/access.log main; map $http_upgrade $connection_upgrade { default "upgrade"; diff --git a/hosting/nginx.prod.conf.hbs b/hosting/nginx.prod.conf.hbs index 4213626309..3c0e34387d 100644 --- a/hosting/nginx.prod.conf.hbs +++ b/hosting/nginx.prod.conf.hbs @@ -33,7 +33,10 @@ http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; + '"$http_user_agent" "$http_x_forwarded_for" ' + 'response_time=$upstream_response_time proxy_host=$proxy_host upstream_addr=$upstream_addr'; + + access_log /var/log/nginx/access.log main; map $http_upgrade $connection_upgrade { default "upgrade"; From 0dd1286d72bcf382f2d22f021c10c3d1a84ce362 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 26 Aug 2022 13:27:00 +0000 Subject: [PATCH 080/112] v1.2.44-alpha.10 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lerna.json b/lerna.json index a4a92345c0..99c092ebd4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index ca8e4bcfb1..a444e420b7 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "1.2.44-alpha.9", + "@budibase/types": "1.2.44-alpha.10", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 2717e0d437..6ed50eee9d 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "1.2.44-alpha.9", + "@budibase/string-templates": "1.2.44-alpha.10", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 2560bde9d6..322c2c1bfb 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "1.2.44-alpha.9", - "@budibase/client": "1.2.44-alpha.9", - "@budibase/frontend-core": "1.2.44-alpha.9", - "@budibase/string-templates": "1.2.44-alpha.9", + "@budibase/bbui": "1.2.44-alpha.10", + "@budibase/client": "1.2.44-alpha.10", + "@budibase/frontend-core": "1.2.44-alpha.10", + "@budibase/string-templates": "1.2.44-alpha.10", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index d1f662c212..458ef2569c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 6409b15bf7..15ce6f1fd6 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "1.2.44-alpha.9", - "@budibase/frontend-core": "1.2.44-alpha.9", - "@budibase/string-templates": "1.2.44-alpha.9", + "@budibase/bbui": "1.2.44-alpha.10", + "@budibase/frontend-core": "1.2.44-alpha.10", + "@budibase/string-templates": "1.2.44-alpha.10", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 3f8cb0239c..5f8984dea9 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "1.2.44-alpha.9", + "@budibase/bbui": "1.2.44-alpha.10", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 1df369cee4..8d0a76167e 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "1.2.44-alpha.9", - "@budibase/client": "1.2.44-alpha.9", + "@budibase/backend-core": "1.2.44-alpha.10", + "@budibase/client": "1.2.44-alpha.10", "@budibase/pro": "1.2.44-alpha.9", - "@budibase/string-templates": "1.2.44-alpha.9", - "@budibase/types": "1.2.44-alpha.9", + "@budibase/string-templates": "1.2.44-alpha.10", + "@budibase/types": "1.2.44-alpha.10", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 36b510223d..fa94e8e1bf 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 59c37abeb8..48fd7c063a 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index ca7b613a99..0732f9e6d8 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.2.44-alpha.9", + "version": "1.2.44-alpha.10", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "1.2.44-alpha.9", + "@budibase/backend-core": "1.2.44-alpha.10", "@budibase/pro": "1.2.44-alpha.9", - "@budibase/string-templates": "1.2.44-alpha.9", - "@budibase/types": "1.2.44-alpha.9", + "@budibase/string-templates": "1.2.44-alpha.10", + "@budibase/types": "1.2.44-alpha.10", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 9673cf5d1bb39d23273af18b352a83a870ada66b Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 26 Aug 2022 13:30:03 +0000 Subject: [PATCH 081/112] Update pro version to 1.2.44-alpha.10 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 8d0a76167e..4ef6a5bd18 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "1.2.44-alpha.10", "@budibase/client": "1.2.44-alpha.10", - "@budibase/pro": "1.2.44-alpha.9", + "@budibase/pro": "1.2.44-alpha.10", "@budibase/string-templates": "1.2.44-alpha.10", "@budibase/types": "1.2.44-alpha.10", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 6ec623f3ce..0e6b40cc30 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.44-alpha.9": - version "1.2.44-alpha.9" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.9.tgz#d0c00365a31e3a4c42994d6bc5cf70e03fe84682" - integrity sha512-SaO/8tKFXU98QJF8ztpU9CBP/G7572FUrjk2hm2wBi9aV/r/J/l6R3snRtVTC2Pmf2UY4DneYklP/SUwjaIAqw== +"@budibase/backend-core@1.2.44-alpha.10": + version "1.2.44-alpha.10" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.10.tgz#e34a98cef3cd48943f2fe60f196d0d2504386710" + integrity sha512-Ge8YJo7JbWtaBo9ucSFOCffFBplECi0c+BEP//tCUZTGYly/JnoVySS3mt/F7hSCD2XP8HFHgUD/suTSWCuOig== dependencies: - "@budibase/types" "1.2.44-alpha.9" + "@budibase/types" "1.2.44-alpha.10" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1178,13 +1178,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.2.44-alpha.9": - version "1.2.44-alpha.9" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.9.tgz#da801f96723dcf641bdbb4f40a3dc04c29d92732" - integrity sha512-cQdaAZfpCt3Z9+CKcAk6zC5YTqmQh30tdADXJwhXbGePnKjuZ4LN7Ykkeu+ClFXbR98Wip+ln1UqDmtLCKKwOw== +"@budibase/pro@1.2.44-alpha.10": + version "1.2.44-alpha.10" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.10.tgz#0d592d2eea71e2bcf30ae1fa2786605fce1af573" + integrity sha512-r85jqeYevOJ0k20F6aKDOt3CV68mbo8S7IioNNxVb7aXRwsVnEySDN21XcP27r1ZMOJFz2Yz+WcUfntVfLJKmA== dependencies: - "@budibase/backend-core" "1.2.44-alpha.9" - "@budibase/types" "1.2.44-alpha.9" + "@budibase/backend-core" "1.2.44-alpha.10" + "@budibase/types" "1.2.44-alpha.10" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1207,10 +1207,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.2.44-alpha.9": - version "1.2.44-alpha.9" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.9.tgz#292417adc3718f6b20ff0128214ca6a2b6877c8d" - integrity sha512-am9MOvmxPrhqeXrqZlojuHMbo9O39t3OAo5In9rtDx8LcJZdajo4xEad5UnMKgbxp1xHkpjLt+QjOohAT7Ct1A== +"@budibase/types@1.2.44-alpha.10": + version "1.2.44-alpha.10" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.10.tgz#e43d83d4754432fc492ff97f6edba475ea896e50" + integrity sha512-4LcI+13ewTqlwEcFvrvqkwUbXhc/vfkfyfBhHmfJFzhpwtXMXSLT+bdVlRAagAW7P/f4HY24vt3PJzrByyN4pQ== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 0732f9e6d8..5dcd799f1a 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "1.2.44-alpha.10", - "@budibase/pro": "1.2.44-alpha.9", + "@budibase/pro": "1.2.44-alpha.10", "@budibase/string-templates": "1.2.44-alpha.10", "@budibase/types": "1.2.44-alpha.10", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 6d15fa97a0..dccc6ee4ea 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.44-alpha.9": - version "1.2.44-alpha.9" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.9.tgz#d0c00365a31e3a4c42994d6bc5cf70e03fe84682" - integrity sha512-SaO/8tKFXU98QJF8ztpU9CBP/G7572FUrjk2hm2wBi9aV/r/J/l6R3snRtVTC2Pmf2UY4DneYklP/SUwjaIAqw== +"@budibase/backend-core@1.2.44-alpha.10": + version "1.2.44-alpha.10" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.10.tgz#e34a98cef3cd48943f2fe60f196d0d2504386710" + integrity sha512-Ge8YJo7JbWtaBo9ucSFOCffFBplECi0c+BEP//tCUZTGYly/JnoVySS3mt/F7hSCD2XP8HFHgUD/suTSWCuOig== dependencies: - "@budibase/types" "1.2.44-alpha.9" + "@budibase/types" "1.2.44-alpha.10" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -325,21 +325,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.2.44-alpha.9": - version "1.2.44-alpha.9" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.9.tgz#da801f96723dcf641bdbb4f40a3dc04c29d92732" - integrity sha512-cQdaAZfpCt3Z9+CKcAk6zC5YTqmQh30tdADXJwhXbGePnKjuZ4LN7Ykkeu+ClFXbR98Wip+ln1UqDmtLCKKwOw== +"@budibase/pro@1.2.44-alpha.10": + version "1.2.44-alpha.10" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.10.tgz#0d592d2eea71e2bcf30ae1fa2786605fce1af573" + integrity sha512-r85jqeYevOJ0k20F6aKDOt3CV68mbo8S7IioNNxVb7aXRwsVnEySDN21XcP27r1ZMOJFz2Yz+WcUfntVfLJKmA== dependencies: - "@budibase/backend-core" "1.2.44-alpha.9" - "@budibase/types" "1.2.44-alpha.9" + "@budibase/backend-core" "1.2.44-alpha.10" + "@budibase/types" "1.2.44-alpha.10" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.2.44-alpha.9": - version "1.2.44-alpha.9" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.9.tgz#292417adc3718f6b20ff0128214ca6a2b6877c8d" - integrity sha512-am9MOvmxPrhqeXrqZlojuHMbo9O39t3OAo5In9rtDx8LcJZdajo4xEad5UnMKgbxp1xHkpjLt+QjOohAT7Ct1A== +"@budibase/types@1.2.44-alpha.10": + version "1.2.44-alpha.10" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.10.tgz#e43d83d4754432fc492ff97f6edba475ea896e50" + integrity sha512-4LcI+13ewTqlwEcFvrvqkwUbXhc/vfkfyfBhHmfJFzhpwtXMXSLT+bdVlRAagAW7P/f4HY24vt3PJzrByyN4pQ== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 9355a55ca40c8d4245fa955eed134004849a3f01 Mon Sep 17 00:00:00 2001 From: marcussorealheis Date: Sun, 28 Aug 2022 22:48:02 -0700 Subject: [PATCH 082/112] removing a basic warning so it doesn't add to the others that will surely come. --- .prettierrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.prettierrc.json b/.prettierrc.json index 39654fd9f9..dae5906124 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -4,7 +4,7 @@ "singleQuote": false, "trailingComma": "es5", "arrowParens": "avoid", - "jsxBracketSameLine": false, + "bracketSameLine": false, "plugins": ["prettier-plugin-svelte"], "svelteSortOrder": "options-scripts-markup-styles" } From 65bf17b87cc9ee8b07e11c554611876b3276ff63 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 30 Aug 2022 10:16:01 +0100 Subject: [PATCH 083/112] Revert "Feature/binding ux update" --- .../bbui/src/Actions/position_dropdown.js | 21 +- packages/bbui/src/Popover/Popover.svelte | 3 +- .../cypress/integration/createBinding.spec.js | 10 +- .../builder/src/builderStore/dataBinding.js | 39 +-- .../common/bindings/BindingPanel.svelte | 273 ++++-------------- .../common/bindings/ClientBindingPanel.svelte | 1 + packages/client/manifest.json | 48 +-- 7 files changed, 90 insertions(+), 305 deletions(-) diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js index 7570a39c8c..a25cc1bbd5 100644 --- a/packages/bbui/src/Actions/position_dropdown.js +++ b/packages/bbui/src/Actions/position_dropdown.js @@ -1,4 +1,4 @@ -export default function positionDropdown(element, { anchor, align, maxWidth }) { +export default function positionDropdown(element, { anchor, align }) { let positionSide = "top" let maxHeight = 0 let dimensions = getDimensions(anchor) @@ -34,24 +34,13 @@ export default function positionDropdown(element, { anchor, align, maxWidth }) { } function calcLeftPosition() { - let left - - if (align == "right") { - left = dimensions.left + dimensions.width - dimensions.containerWidth - } else if (align == "right-side") { - left = dimensions.left + dimensions.width - } else { - left = dimensions.left - } - - return left + return align === "right" + ? dimensions.left + dimensions.width - dimensions.containerWidth + : dimensions.left } element.style.position = "absolute" element.style.zIndex = "9999" - if (maxWidth) { - element.style.maxWidth = `${maxWidth}px` - } element.style.minWidth = `${dimensions.width}px` element.style.maxHeight = `${maxHeight.toFixed(0)}px` element.style.transformOrigin = `center ${positionSide}` @@ -65,8 +54,10 @@ export default function positionDropdown(element, { anchor, align, maxWidth }) { element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px` }) }) + resizeObserver.observe(anchor) resizeObserver.observe(element) + return { destroy() { resizeObserver.disconnect() diff --git a/packages/bbui/src/Popover/Popover.svelte b/packages/bbui/src/Popover/Popover.svelte index 91581724d5..756e5e6a09 100644 --- a/packages/bbui/src/Popover/Popover.svelte +++ b/packages/bbui/src/Popover/Popover.svelte @@ -11,7 +11,6 @@ export let align = "right" export let portalTarget export let dataCy - export let maxWidth export let direction = "bottom" export let showTip = false @@ -46,7 +45,7 @@
{ it("should add a current user binding", () => { cy.searchAndAddComponent("Paragraph").then(() => { - addSettingBinding("text", ["Current User", "_id"], "Current User._id") + addSettingBinding("text", "Current User._id") }) }) @@ -28,7 +28,7 @@ filterTests(['smoke', 'all'], () => { const paramName = "foo" cy.createScreen(`/test/:${paramName}`) cy.searchAndAddComponent("Paragraph").then(componentId => { - addSettingBinding("text", ["URL", paramName], `URL.${paramName}`) + addSettingBinding("text", `URL.${paramName}`) // The builder preview pages don't have a real URL, so all we can do // is check that we were able to bind to the property, and that the // component exists on the page @@ -47,13 +47,11 @@ filterTests(['smoke', 'all'], () => { }) }) - const addSettingBinding = (setting, bindingCategories, bindingText, clickOption = true) => { + const addSettingBinding = (setting, bindingText, clickOption = true) => { cy.get(`[data-cy="setting-${setting}"] [data-cy=text-binding-button]`).click() - cy.get(".category-list li").contains(bindingCategories[0]) cy.get(".drawer").within(() => { if (clickOption) { - cy.get(".category-list li").contains(bindingCategories[0]).click() - cy.get("li.binding").contains(bindingCategories[1]).click() + cy.contains(bindingText).click() cy.get("textarea").should("have.value", `{{ ${bindingText} }}`) } else { cy.get("textarea").type(bindingText) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index d961a3a1cd..13b749e19f 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -299,10 +299,7 @@ const getProviderContextBindings = (asset, dataProviders) => { schema = {} const values = context.values || [] values.forEach(value => { - schema[value.key] = { - name: value.label, - type: value.type || "string", - } + schema[value.key] = { name: value.label, type: "string" } }) } else if (context.type === "schema") { // Schema contexts are generated dynamically depending on their data @@ -362,12 +359,6 @@ const getProviderContextBindings = (asset, dataProviders) => { providerId, // Table ID is used by JSON fields to know what table the field is in tableId: table?._id, - category: component._instanceName, - icon: def.icon, - display: { - name: fieldSchema.name || key, - type: fieldSchema.type, - }, }) }) }) @@ -394,9 +385,6 @@ const getUserBindings = () => { // datasource options, based on bindable properties fieldSchema, providerId: "user", - category: "Current User", - icon: "User", - display: fieldSchema, }) }) return bindings @@ -413,17 +401,11 @@ const getDeviceBindings = () => { type: "context", runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`, readableBinding: `Device.Mobile`, - category: "Device", - icon: "DevicePhone", - display: { type: "boolean", name: "mobile" }, }) bindings.push({ type: "context", runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`, readableBinding: `Device.Tablet`, - category: "Device", - icon: "DevicePhone", - display: { type: "boolean", name: "tablet" }, }) } return bindings @@ -447,8 +429,6 @@ const getSelectedRowsBindings = asset => { "selectedRows" )}`, readableBinding: `${table._instanceName}.Selected rows`, - category: "Selected rows", - icon: "ViewRow", })) ) @@ -480,9 +460,6 @@ const getStateBindings = () => { type: "context", runtimeBinding: `${safeState}.${makePropSafe(key)}`, readableBinding: `State.${key}`, - category: "State", - icon: "AutomatedSegment", - display: { name: key }, })) } return bindings @@ -505,17 +482,11 @@ const getUrlBindings = asset => { type: "context", runtimeBinding: `${safeURL}.${makePropSafe(param)}`, readableBinding: `URL.${param}`, - category: "URL", - icon: "RailTop", - display: { type: "string" }, })) const queryParamsBinding = { type: "context", runtimeBinding: makePropSafe("query"), readableBinding: "Query params", - category: "URL", - icon: "RailTop", - display: { type: "object" }, } return urlParamBindings.concat([queryParamsBinding]) } @@ -526,9 +497,6 @@ const getRoleBindings = () => { type: "context", runtimeBinding: `trim "${role._id}"`, readableBinding: `Role.${role.name}`, - category: "Role", - icon: "UserGroup", - display: { type: "string", name: role.name }, } }) } @@ -550,7 +518,6 @@ export const getEventContextBindings = ( // Check if any context bindings are provided by the component for this // setting const component = findComponent(asset.props, componentId) - const def = store.actions.components.getDefinition(component?._component) const settings = getComponentSettings(component?._component) const eventSetting = settings.find(setting => setting.key === settingKey) if (eventSetting?.context?.length) { @@ -560,8 +527,6 @@ export const getEventContextBindings = ( runtimeBinding: `${makePropSafe("eventContext")}.${makePropSafe( contextEntry.key )}`, - category: component._instanceName, - icon: def.icon, }) }) } @@ -583,8 +548,6 @@ export const getEventContextBindings = ( bindings.push({ readableBinding: `Action ${idx + 1}.${contextValue.label}`, runtimeBinding: `actions.${idx}.${contextValue.value}`, - category: "Actions", - icon: "JourneyAction", }) }) } diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index ffa0e98819..49cbd434cf 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -9,9 +9,6 @@ Body, Layout, Button, - ActionButton, - Icon, - Popover, } from "@budibase/bbui" import { createEventDispatcher, onMount } from "svelte" import { @@ -48,25 +45,9 @@ let jsValue = initialValueJS ? value : null let hbsValue = initialValueJS ? null : value - let selectedCategory = null - - let popover - let popoverAnchor - let hoverTarget - $: usingJS = mode === "JavaScript" $: searchRgx = new RegExp(search, "ig") $: categories = Object.entries(groupBy("category", bindings)) - - $: bindingIcons = bindings?.reduce((acc, ele) => { - if (ele.icon) { - acc[ele.category] = acc[ele.category] || ele.icon - } - return acc - }, {}) - - $: categoryIcons = { ...bindingIcons, Helpers: "MagicWand" } - $: filteredCategories = categories .map(([name, categoryBindings]) => ({ name, @@ -74,19 +55,10 @@ return binding.readableBinding.match(searchRgx) }), })) - .filter(category => { - return ( - category.bindings?.length > 0 && - (!selectedCategory ? true : selectedCategory === category.name) - ) - }) - + .filter(category => category.bindings?.length > 0) $: filteredHelpers = helpers?.filter(helper => { return helper.label.match(searchRgx) || helper.description.match(searchRgx) }) - - $: categoryNames = [...categories.map(cat => cat[0]), "Helpers"] - $: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`) const updateValue = val => { @@ -168,163 +140,58 @@ }) - - - -
- {#if hoverTarget.title} -
{hoverTarget.title}
- {/if} - {#if hoverTarget.description} -
- {@html hoverTarget.description} -
- {/if} - {#if hoverTarget.example} -
{hoverTarget.example}
- {/if} -
-
-
-
- - - {#if selectedCategory} -
- { - selectedCategory = null - }} - > - Back - -
- {/if} - - {#if !selectedCategory} +
+
Search
- {/if} - - {#if !selectedCategory && !search} -
    - {#each categoryNames as categoryName} -
  • { - selectedCategory = categoryName - }} - > - - {categoryName} - -
  • - {/each} -
- {/if} - - {#if selectedCategory || search} - {#each filteredCategories as category} - {#if category.bindings?.length} -
- {category.name} -
+
+ {#each filteredCategories as category} + {#if category.bindings?.length} +
+
{category.name}
    {#each category.bindings as binding} -
  • { - popoverAnchor = e.target - if (!binding.description) { - return - } - hoverTarget = { - title: binding.display.name || binding.fieldSchema.name, - description: binding.description, - } - popover.show() - e.stopPropagation() - }} - on:mouseleave={() => { - popover.hide() - popoverAnchor = null - hoverTarget = null - }} - on:focus={() => {}} - on:blur={() => {}} - on:click={() => addBinding(binding)} - > - - {#if binding.display?.name} - {binding.display.name} - {:else if binding.fieldSchema?.name} - {binding.fieldSchema?.name} - {:else} - {binding.readableBinding} - {/if} - - - {#if binding.display?.type || binding.fieldSchema?.type} - - - {binding.display?.type || binding.fieldSchema?.type} - - +
  • addBinding(binding)}> + {binding.readableBinding} + {#if binding.type} + {binding.type} + {/if} + {#if binding.description} +
    +
    + {binding.description || ""} +
    {/if}
  • {/each}
- {/if} - {/each} - - {#if selectedCategory === "Helpers" || search} - {#if filteredHelpers?.length} -
Helpers
-
    - {#each filteredHelpers as helper} -
  • addHelper(helper, usingJS)} - on:mouseenter={e => { - popoverAnchor = e.target - if (!helper.displayText && helper.description) { - return - } - hoverTarget = { - title: helper.displayText, - description: helper.description, - example: getHelperExample(helper, usingJS), - } - popover.show() - e.stopPropagation() - }} - on:mouseleave={() => { - popover.hide() - popoverAnchor = null - hoverTarget = null - }} - on:focus={() => {}} - on:blur={() => {}} - > - {helper.displayText} - - function - -
  • - {/each} -
- {/if} +
{/if} + {/each} + {#if filteredHelpers?.length} +
+
Helpers
+
    + {#each filteredHelpers as helper} +
  • addHelper(helper, usingJS)}> +
    +
    {helper.displayText}
    +
    + {@html helper.description} +
    +
    {getHelperExample(
    +                      helper,
    +                      usingJS
    +                    )}
    +
    +
  • + {/each} +
+
{/if} - +
@@ -374,35 +241,6 @@