From eb04c89182884b260b3322106dd8829696bab391 Mon Sep 17 00:00:00 2001 From: Keith Ellis Date: Tue, 31 Oct 2023 16:34:02 -0400 Subject: [PATCH 001/150] Add check to fix startup if CLUSTER_MODE is enable --- packages/server/src/environment.ts | 1 + packages/server/src/startup.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/server/src/environment.ts b/packages/server/src/environment.ts index a1701535ce..b0a35eedf5 100644 --- a/packages/server/src/environment.ts +++ b/packages/server/src/environment.ts @@ -32,6 +32,7 @@ const environment = { REDIS_PASSWORD: process.env.REDIS_PASSWORD, REDIS_CLUSTERED: process.env.REDIS_CLUSTERED, HTTP_MIGRATIONS: process.env.HTTP_MIGRATIONS, + CLUSTER_MODE: process.env.CLUSTER_MODE, API_REQ_LIMIT_PER_SEC: process.env.API_REQ_LIMIT_PER_SEC, GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET, diff --git a/packages/server/src/startup.ts b/packages/server/src/startup.ts index b4a287d2d4..fd07c5f530 100644 --- a/packages/server/src/startup.ts +++ b/packages/server/src/startup.ts @@ -58,7 +58,7 @@ export async function startup(app?: any, server?: any) { return } STARTUP_RAN = true - if (server) { + if (server && env.CLUSTER_MODE?.toLowerCase() !== "true") { console.log(`Budibase running on ${JSON.stringify(server.address())}`) env._set("PORT", server.address().port) } From 0921bcf3334e6a77a67b8771005587e2f37a3af4 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 1 Nov 2023 11:40:27 +0000 Subject: [PATCH 002/150] Add button setting to grid and allow removing all buttons --- .../ButtonConfiguration/ButtonConfiguration.svelte | 13 ++++++++----- packages/client/manifest.json | 10 ++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/ButtonConfiguration/ButtonConfiguration.svelte b/packages/builder/src/components/design/settings/controls/ButtonConfiguration/ButtonConfiguration.svelte index 324418511b..6fed8abdba 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonConfiguration/ButtonConfiguration.svelte +++ b/packages/builder/src/components/design/settings/controls/ButtonConfiguration/ButtonConfiguration.svelte @@ -19,7 +19,7 @@ componentBindings: componentBindings || [], bindings, removeButton, - canRemove: buttonCount > 1, + canRemove: true, } const sanitizeValue = val => { @@ -86,11 +86,11 @@ focus={focusItem} draggable={buttonCount > 1} /> - - {/if} + + diff --git a/packages/frontend-core/src/components/grid/layout/Grid.svelte b/packages/frontend-core/src/components/grid/layout/Grid.svelte index e2ecd0f968..285282ddf7 100644 --- a/packages/frontend-core/src/components/grid/layout/Grid.svelte +++ b/packages/frontend-core/src/components/grid/layout/Grid.svelte @@ -48,6 +48,7 @@ export let fixedRowHeight = null export let notifySuccess = null export let notifyError = null + export let buttons = null // Unique identifier for DOM nodes inside this instance const rand = Math.random() @@ -99,6 +100,7 @@ fixedRowHeight, notifySuccess, notifyError, + buttons, }) // Set context for children to consume diff --git a/packages/frontend-core/src/components/grid/layout/GridBody.svelte b/packages/frontend-core/src/components/grid/layout/GridBody.svelte index 0bb2a51fb4..559c465b86 100644 --- a/packages/frontend-core/src/components/grid/layout/GridBody.svelte +++ b/packages/frontend-core/src/components/grid/layout/GridBody.svelte @@ -3,6 +3,7 @@ import GridScrollWrapper from "./GridScrollWrapper.svelte" import GridRow from "./GridRow.svelte" import { BlankRowID } from "../lib/constants" + import ButtonColumn from "./ButtonColumn.svelte" const { bounds, @@ -13,6 +14,7 @@ dispatch, isDragging, config, + props, } = getContext("grid") let body @@ -54,6 +56,9 @@ /> {/if} + {#if $props.buttons?.length} + + {/if} diff --git a/packages/client/manifest.json b/packages/client/manifest.json index d131cda8c3..378d8c3493 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -6348,6 +6348,7 @@ "type": "buttonConfiguration", "key": "buttons", "nested": true, + "max": 3, "context": [ { "label": "Clicked row", From 34693481b13c858b5f8e6e45831ed75d6ad322dc Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 7 Nov 2023 15:02:45 +0000 Subject: [PATCH 017/150] Fix bug in SectionSelect --- .../components/design/settings/controls/SectionSelect.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/design/settings/controls/SectionSelect.svelte b/packages/builder/src/components/design/settings/controls/SectionSelect.svelte index 4394f47cef..5b4eb8d2a9 100644 --- a/packages/builder/src/components/design/settings/controls/SectionSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/SectionSelect.svelte @@ -32,7 +32,9 @@ } -{layoutMap[value].name} + + {layoutMap[value || "mainSidebar"].name} + dispatch("change", selected)} From a39accdb42ce6921113506dda9dc0533b76da12f Mon Sep 17 00:00:00 2001 From: Dean Date: Tue, 7 Nov 2023 15:07:00 +0000 Subject: [PATCH 018/150] Test coverage added for the component. Minor refactor --- .../DataTable/modals/ExportModal.svelte | 53 ++-- .../DataTable/modals/ExportModal.test.js | 240 ++++++++++++++++++ packages/shared-core/src/utils.ts | 14 + 3 files changed, 281 insertions(+), 26 deletions(-) create mode 100644 packages/builder/src/components/backend/DataTable/modals/ExportModal.test.js diff --git a/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte b/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte index 61c81c86eb..c2a7ec33fe 100644 --- a/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte @@ -8,7 +8,8 @@ } from "@budibase/bbui" import download from "downloadjs" import { API } from "api" - import { Constants, LuceneUtils } from "@budibase/frontend-core" + import { LuceneUtils } from "@budibase/frontend-core" + import { utils } from "@budibase/shared-core" import { ROW_EXPORT_FORMATS } from "constants/backend" export let view @@ -17,8 +18,6 @@ export let selectedRows = [] export let formats - $: appliedFilters = filters?.filter(filter => !filter.onEmptyFilter) - const FORMATS = [ { name: "CSV", @@ -34,6 +33,8 @@ }, ] + $: appliedFilters = filters?.filter(filter => !filter.onEmptyFilter) + $: options = FORMATS.filter(format => { if (formats && !formats.includes(format.key)) { return false @@ -55,14 +56,7 @@ appliedFilters ) - const buildFilterLookup = () => { - return Object.keys(Constants.OperatorOptions).reduce((acc, key) => { - const op = Constants.OperatorOptions[key] - acc[op.value] = op.label - return acc - }, {}) - } - filterLookup = buildFilterLookup() + filterLookup = utils.filterValueToLabel() const filterDisplay = () => { if (!appliedFilters) { @@ -173,19 +167,23 @@ > {#if selectedRows?.length} - {selectedRows?.length} - {`row${selectedRows?.length > 1 ? "s" : ""} will be exported`} + + {selectedRows?.length} + {`row${selectedRows?.length > 1 ? "s" : ""} will be exported`} + {:else if appliedFilters?.length || (sorting?.sortOrder && sorting?.sortColumn)} {#if !appliedFilters} - Exporting all rows + + Exporting all rows + {:else} - Filters applied + Filters applied {/if} -
+
{:else} - Exporting all rows + + Exporting all rows + {/if} - - x.name} + getOptionValue={x => x.key} + /> + diff --git a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte index d89f09fc08..80f3f22497 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte @@ -4,6 +4,7 @@ import Panel from "components/design/Panel.svelte" import { isActive, redirect, goto, params } from "@roxi/routify" import { datasources } from "stores/backend" + import SearchBox from "components/common/SearchBox.svelte" $: { // If we ever don't have any data other than the users table, prompt the @@ -18,7 +19,10 @@
{#if !$isActive("./new")} - + + + + @@ -51,4 +55,8 @@ flex: 1 1 auto; z-index: 1; } + + .panel-title-content { + display: contents; + } From 04f67f3199a3511fac67b291fa63218bdd008dab Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 9 Nov 2023 12:53:47 +0100 Subject: [PATCH 078/150] Add close functionallity --- .../src/components/common/SearchBox.svelte | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/components/common/SearchBox.svelte b/packages/builder/src/components/common/SearchBox.svelte index d37bcab2a0..079ac7e37b 100644 --- a/packages/builder/src/components/common/SearchBox.svelte +++ b/packages/builder/src/components/common/SearchBox.svelte @@ -1,7 +1,6 @@ @@ -39,15 +47,16 @@ {placeholder} /> -
- -
{title}
+ +
+ +
From 24bef1ee9df868ed21bdc5c04ef295646281e7e3 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 9 Nov 2023 15:38:08 +0100 Subject: [PATCH 085/150] Rename --- .../components/common/{SearchBox.svelte => NavHeader.svelte} | 0 .../src/pages/builder/app/[application]/data/_layout.svelte | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/builder/src/components/common/{SearchBox.svelte => NavHeader.svelte} (100%) diff --git a/packages/builder/src/components/common/SearchBox.svelte b/packages/builder/src/components/common/NavHeader.svelte similarity index 100% rename from packages/builder/src/components/common/SearchBox.svelte rename to packages/builder/src/components/common/NavHeader.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte index 7d05b68ec8..268cce2930 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte @@ -4,7 +4,7 @@ import Panel from "components/design/Panel.svelte" import { isActive, redirect, goto, params } from "@roxi/routify" import { datasources } from "stores/backend" - import SearchBox from "components/common/SearchBox.svelte" + import NavHeader from "components/common/NavHeader.svelte" let searchValue @@ -23,7 +23,7 @@ {#if !$isActive("./new")} - Date: Thu, 9 Nov 2023 15:44:34 +0100 Subject: [PATCH 086/150] Handle enters --- .../src/components/common/NavHeader.svelte | 15 +++++++++++++-- packages/builder/src/helpers/keyUtils.js | 7 +++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 packages/builder/src/helpers/keyUtils.js diff --git a/packages/builder/src/components/common/NavHeader.svelte b/packages/builder/src/components/common/NavHeader.svelte index 3131f06ea6..5e401cf3c8 100644 --- a/packages/builder/src/components/common/NavHeader.svelte +++ b/packages/builder/src/components/common/NavHeader.svelte @@ -1,6 +1,7 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte index 268cce2930..90f9fb6be2 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte @@ -27,10 +27,10 @@ title="Sources" placeholder="Search for sources" bind:value={searchValue} + onAdd={() => $goto("./new")} /> - From b908287223d150d0e93f9cf0ea35678078a99da9 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 9 Nov 2023 16:09:45 +0100 Subject: [PATCH 090/150] Animate chevron --- packages/builder/src/components/common/NavItem.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/components/common/NavItem.svelte b/packages/builder/src/components/common/NavItem.svelte index 2c8a862535..1c9267ca18 100644 --- a/packages/builder/src/components/common/NavItem.svelte +++ b/packages/builder/src/components/common/NavItem.svelte @@ -189,6 +189,7 @@ flex: 0 0 20px; pointer-events: all; order: 0; + transition: transform 100ms linear; } .icon.arrow.absolute { position: absolute; From 72c415e72c61c18e01e76cbc53b92fbbf1e92a16 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 9 Nov 2023 16:31:10 +0100 Subject: [PATCH 091/150] Filter tables --- .../backend/DatasourceNavigator/DatasourceNavigator.svelte | 2 +- .../components/backend/TableNavigator/TableNavigator.svelte | 6 ++++++ .../src/pages/builder/app/[application]/data/_layout.svelte | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte index 5f914f545a..86cea3b3b9 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte @@ -206,7 +206,7 @@ {#if datasource.open} - + {#each $queries.list.filter(query => query.datasourceId === datasource._id && (!searchTerm || query.name ?.toLowerCase() ?.indexOf(searchTerm.toLowerCase()) > -1)) as query} diff --git a/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte b/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte index 712d74889c..3f0538ceb3 100644 --- a/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte +++ b/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte @@ -7,6 +7,7 @@ import { goto, isActive } from "@roxi/routify" import { userSelectedResourceMap } from "builderStore" + export let searchTerm export let sourceId export let selectTable @@ -14,6 +15,11 @@ .filter( table => table.sourceId === sourceId && table._id !== TableNames.USERS ) + .filter( + table => + !searchTerm || + table.name.toLowerCase()?.indexOf(searchTerm.toLowerCase()) > -1 + ) .sort(alphabetical) const alphabetical = (a, b) => { diff --git a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte index 90f9fb6be2..3fbf18eac5 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte @@ -1,5 +1,5 @@