From 757ca6a166d2dc8727db7382b178b90c7930fd0e Mon Sep 17 00:00:00 2001 From: Jonny McCullagh Date: Wed, 14 Jun 2023 16:18:09 +0100 Subject: [PATCH] Merge master develop (#10897) * Binding drawer fixes * Added missing headless flag for the bindable combobox * Fix for QueryEditor width * Fix svelte transitions in grid new row component breaking routify * Bump version to 2.7.7 * fix REST connector failure to save * Bump version to 2.7.8 * Bump version to 2.7.9 * Unexpected token when export data (#10721) * Tidy ID string for JSON parse * Display error for composite keys * Unit test WIP * directly assign the mock function on the datasource * Unit tests for exportRows ID handling --------- Co-authored-by: Martin McKeaveney * Return all rows if oneOf value is falsey (#10638) * Bump version to 2.7.10 * Make sure divider fields are left-most (#10627) * Make sure divider fields are left most * Refactor * Bump version to 2.7.11 * Temporarily remove the focus store update as it triggers a full redraw of the component settings * Linting * Removed commented out code * Bump version to 2.7.12 * Bump version to 2.7.13 * Do not show Business tag for Email action (#10867) * Bump version to 2.7.14 * new deploy trigger (#10892) * point the deploys at the new env * Bump version to 2.7.15 --------- Co-authored-by: Dean Co-authored-by: Andrew Kingston Co-authored-by: Budibase Staging Release Bot <> Co-authored-by: Martin McKeaveney Co-authored-by: Martin McKeaveney Co-authored-by: melohagan <101575380+melohagan@users.noreply.github.com> Co-authored-by: Adria Navarro --- .github/workflows/deploy-cloud.yaml | 70 +++------- .github/workflows/deploy-preprod.yml | 45 +------ lerna.json | 2 +- packages/backend-core/src/db/lucene.ts | 3 + .../backend-core/src/db/tests/lucene.spec.ts | 19 +++ packages/bbui/src/Table/Table.svelte | 6 + .../FlowChart/ActionModal.svelte | 4 +- .../components/backend/DataTable/formula.js | 4 + .../modals/DatasourceConfigModal.svelte | 6 + .../common/bindings/BindingPanel.svelte | 43 ++++--- .../common/bindings/BindingPicker.svelte | 11 +- .../bindings/DrawerBindableCombobox.svelte | 2 +- .../bindings/DrawerBindableInput.svelte | 4 - .../settings/controls/PropertyControl.svelte | 4 - .../components/integration/QueryEditor.svelte | 1 - .../datasource/[datasourceId]/index.svelte | 2 +- .../src/components/grid/layout/NewRow.svelte | 10 +- .../src/api/controllers/row/external.ts | 12 +- .../src/api/controllers/tests/row.spec.ts | 120 ++++++++++++++++++ .../src/sdk/app/datasources/datasources.ts | 2 +- 20 files changed, 234 insertions(+), 136 deletions(-) create mode 100644 packages/server/src/api/controllers/tests/row.spec.ts diff --git a/.github/workflows/deploy-cloud.yaml b/.github/workflows/deploy-cloud.yaml index 9f933746d6..389b10f7d3 100644 --- a/.github/workflows/deploy-cloud.yaml +++ b/.github/workflows/deploy-cloud.yaml @@ -12,31 +12,22 @@ jobs: runs-on: ubuntu-latest steps: - # - name: Fail if not a tag - # run: | - # if [[ $GITHUB_REF != refs/tags/* ]]; then - # echo "Workflow Dispatch can only be run on tags" - # exit 1 - # fi - - - uses: actions/checkout@v2 - # with: - # fetch-depth: 0 - - # - name: Fail if tag is not in master - # run: | - # if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then - # echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch" - # exit 1 - # fi - - - name: Pull values.yaml from budibase-infra + - name: Fail if not a tag run: | - curl -H "Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}" \ - -H 'Accept: application/vnd.github.v3.raw' \ - -o values.production.yaml \ - -L https://api.github.com/repos/budibase/budibase-infra/contents/kubernetes/values.yaml - wc -l values.production.yaml + if [[ $GITHUB_REF != refs/tags/* ]]; then + echo "Workflow Dispatch can only be run on tags" + exit 1 + fi + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Fail if tag is not in master + run: | + if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then + echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch" + exit 1 + fi - name: Get the latest budibase release version id: version @@ -48,29 +39,10 @@ jobs: fi echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + - uses: passeidireto/trigger-external-workflow-action@main + env: + PAYLOAD_VERSION: ${{ env.RELEASE_VERSION }} with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: eu-west-1 - - - name: Deploy to EKS - uses: craftech-io/eks-helm-deploy-action@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS__KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: eu-west-1 - cluster-name: budibase-eks-production - config-files: values.production.yaml - chart-path: charts/budibase - namespace: budibase - values: globals.appVersion=v${{ env.RELEASE_VERSION }},services.couchdb.url=${{ secrets.PRODUCTION_COUCHDB_URL }},services.couchdb.password=${{ secrets.PRODUCTION_COUCHDB_PASSWORD }} - name: budibase-prod - - - name: Discord Webhook Action - uses: tsickert/discord-webhook@v4.0.0 - with: - webhook-url: ${{ secrets.PROD_DEPLOY_WEBHOOK_URL }} - content: "Production Deployment Complete: ${{ env.RELEASE_VERSION }} deployed to Budibase Cloud." - embed-title: ${{ env.RELEASE_VERSION }} + repository: budibase/budibase-deploys + event: budicloud-prod-deploy + github_pat: ${{ secrets.GH_ACCESS_TOKEN }} diff --git a/.github/workflows/deploy-preprod.yml b/.github/workflows/deploy-preprod.yml index 81395bc7e3..9b7bca4770 100644 --- a/.github/workflows/deploy-preprod.yml +++ b/.github/workflows/deploy-preprod.yml @@ -24,51 +24,18 @@ jobs: echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch" exit 1 fi - - name: Get the latest budibase release version id: version run: | release_version=$(cat lerna.json | jq -r '.version') echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: eu-west-1 - - name: Pull values.yaml from budibase-infra - run: | - curl -H "Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}" \ - -H 'Accept: application/vnd.github.v3.raw' \ - -o values.preprod.yaml \ - -L https://api.github.com/repos/budibase/budibase-infra/contents/kubernetes/budibase-preprod/values.yaml - wc -l values.preprod.yaml - - name: Deploy to Preprod Environment - uses: budibase/helm@v1.8.0 - with: - release: budibase-preprod - namespace: budibase - chart: charts/budibase - token: ${{ github.token }} - helm: helm3 - values: | - globals: - appVersion: v${{ env.RELEASE_VERSION }} - ingress: - enabled: true - nginx: true - value-files: >- - [ - "values.preprod.yaml" - ] + - uses: passeidireto/trigger-external-workflow-action@main env: - KUBECONFIG_FILE: '${{ secrets.PREPROD_KUBECONFIG }}' - - - name: Discord Webhook Action - uses: tsickert/discord-webhook@v4.0.0 + PAYLOAD_VERSION: ${{ env.RELEASE_VERSION }} with: - webhook-url: ${{ secrets.PROD_DEPLOY_WEBHOOK_URL }} - content: "Preprod Deployment Complete: ${{ env.RELEASE_VERSION }} deployed to Budibase Pre-prod." - embed-title: ${{ env.RELEASE_VERSION }} + repository: budibase/budibase-deploys + event: budicloud-preprod-deploy + github_pat: ${{ secrets.GH_ACCESS_TOKEN }} + diff --git a/lerna.json b/lerna.json index 852e2686ce..6eadee202c 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.7.7-alpha.9", + "version": "2.7.15", "npmClient": "yarn", "packages": [ "packages/backend-core", diff --git a/packages/backend-core/src/db/lucene.ts b/packages/backend-core/src/db/lucene.ts index 4660be81aa..d501bb2166 100644 --- a/packages/backend-core/src/db/lucene.ts +++ b/packages/backend-core/src/db/lucene.ts @@ -343,6 +343,9 @@ export class QueryBuilder { } const oneOf = (key: string, value: any) => { + if (!value) { + return `*:*` + } if (!Array.isArray(value)) { if (typeof value === "string") { value = value.split(",") diff --git a/packages/backend-core/src/db/tests/lucene.spec.ts b/packages/backend-core/src/db/tests/lucene.spec.ts index b4791a86e0..a82828d8f2 100644 --- a/packages/backend-core/src/db/tests/lucene.spec.ts +++ b/packages/backend-core/src/db/tests/lucene.spec.ts @@ -114,6 +114,25 @@ describe("lucene", () => { expect(resp.rows.length).toBe(2) }) + it("should return all rows when doing a one of search against falsey value", async () => { + const builder = new QueryBuilder(dbName, INDEX_NAME) + builder.addOneOf("property", null) + let resp = await builder.run() + expect(resp.rows.length).toBe(3) + + builder.addOneOf("property", undefined) + resp = await builder.run() + expect(resp.rows.length).toBe(3) + + builder.addOneOf("property", "") + resp = await builder.run() + expect(resp.rows.length).toBe(3) + + builder.addOneOf("property", []) + resp = await builder.run() + expect(resp.rows.length).toBe(0) + }) + it("should be able to perform a contains search", async () => { const builder = new QueryBuilder(dbName, INDEX_NAME) builder.addContains("property", ["word"]) diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index 5bb4ed4523..f8528aac36 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -204,6 +204,12 @@ }) return columns .sort((a, b) => { + if (a.divider) { + return a + } + if (b.divider) { + return b + } const orderA = a.order || Number.MAX_SAFE_INTEGER const orderB = b.order || Number.MAX_SAFE_INTEGER const nameA = getDisplayName(a) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte index c5e4eaf61f..96dc8f4686 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte @@ -12,7 +12,7 @@ import { automationStore, selectedAutomation } from "builderStore" import { admin, licensing } from "stores/portal" import { externalActions } from "./ExternalActions" - import { TriggerStepID } from "constants/backend/automations" + import { TriggerStepID, ActionStepID } from "constants/backend/automations" import { checkForCollectStep } from "builderStore/utils" export let blockIdx @@ -149,7 +149,7 @@
{action.name} - {#if isDisabled && !syncAutomationsEnabled} + {#if isDisabled && !syncAutomationsEnabled && action.stepId === ActionStepID.COLLECT}
Business diff --git a/packages/builder/src/components/backend/DataTable/formula.js b/packages/builder/src/components/backend/DataTable/formula.js index 9fd5949178..43e8dc721e 100644 --- a/packages/builder/src/components/backend/DataTable/formula.js +++ b/packages/builder/src/components/backend/DataTable/formula.js @@ -76,6 +76,10 @@ export function getBindings({ // will be replaced by the main array binding readableBinding: label, runtimeBinding: binding, + display: { + name: label, + type: field.name === FIELDS.LINK.name ? "Array" : field.name, + }, }) } return bindings diff --git a/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte index fbc38e2daa..1d84dbbe39 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte @@ -57,6 +57,12 @@ } async function saveDatasource() { + if (integration.features?.[DatasourceFeature.CONNECTION_CHECKING]) { + const valid = await validateConfig() + if (!valid) { + return false + } + } try { if (!datasource.name) { datasource.name = name diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 3843eabf45..c95988e90c 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -19,7 +19,7 @@ readableToRuntimeBinding, runtimeToReadableBinding, } from "builderStore/dataBinding" - import { store } from "builderStore" + import { convertToJS } from "@budibase/string-templates" import { admin } from "stores/portal" import CodeEditor from "../CodeEditor/CodeEditor.svelte" @@ -339,25 +339,28 @@ {/if}
- - + {#if drawerActions?.hide} + + {/if} + {#if bindingDrawerActions?.save} + + {/if}
diff --git a/packages/builder/src/components/common/bindings/BindingPicker.svelte b/packages/builder/src/components/common/bindings/BindingPicker.svelte index 0f709fd262..50e7c66682 100644 --- a/packages/builder/src/components/common/bindings/BindingPicker.svelte +++ b/packages/builder/src/components/common/bindings/BindingPicker.svelte @@ -36,7 +36,7 @@ .map(([name, categoryBindings]) => ({ name, bindings: categoryBindings?.filter(binding => { - return binding.readableBinding.match(searchRgx) + return !search || binding.readableBinding.match(searchRgx) }), })) .filter(category => { @@ -46,7 +46,11 @@ ) }) $: filteredHelpers = helpers?.filter(helper => { - return helper.label.match(searchRgx) || helper.description.match(searchRgx) + return ( + !search || + helper.label.match(searchRgx) || + helper.description.match(searchRgx) + ) }) const getHelperExample = (helper, js) => { @@ -124,9 +128,6 @@ { - if (!search) { - return - } search = null }} class:searching={search} diff --git a/packages/builder/src/components/common/bindings/DrawerBindableCombobox.svelte b/packages/builder/src/components/common/bindings/DrawerBindableCombobox.svelte index bb01d557b8..55f7866453 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableCombobox.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableCombobox.svelte @@ -76,7 +76,7 @@ {/if}
- + Add the objects on the left to enrich your text. diff --git a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte index f41b66bd77..7fbbf75a30 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte @@ -5,8 +5,6 @@ runtimeToReadableBinding, } from "builderStore/dataBinding" - import { store } from "builderStore" - import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte" import { createEventDispatcher, setContext } from "svelte" import { isJSBinding } from "@budibase/string-templates" @@ -36,7 +34,6 @@ const saveBinding = () => { onChange(tempValue) - store.actions.settings.propertyFocus(null) onBlur() bindingDrawer.hide() } @@ -70,7 +67,6 @@
{ - store.actions.settings.propertyFocus(key) bindingDrawer.show() }} > diff --git a/packages/builder/src/components/design/settings/controls/PropertyControl.svelte b/packages/builder/src/components/design/settings/controls/PropertyControl.svelte index daa3f29592..57601d47ca 100644 --- a/packages/builder/src/components/design/settings/controls/PropertyControl.svelte +++ b/packages/builder/src/components/design/settings/controls/PropertyControl.svelte @@ -73,10 +73,6 @@ if (highlighted) { store.actions.settings.highlight(null) } - // To fix focus 'affect' when property is target of a drawer other actions in the builder. - if (propertyFocus) { - store.actions.settings.propertyFocus(null) - } }) diff --git a/packages/builder/src/components/integration/QueryEditor.svelte b/packages/builder/src/components/integration/QueryEditor.svelte index f543438b9c..51fdb4879e 100644 --- a/packages/builder/src/components/integration/QueryEditor.svelte +++ b/packages/builder/src/components/integration/QueryEditor.svelte @@ -186,7 +186,6 @@ } div :global(.CodeMirror) { - width: var(--code-mirror-width) !important; height: var(--code-mirror-height) !important; border-radius: var(--border-radius-s); font-family: var(--font-mono); diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte index a853fcea0c..c70ab492c4 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte @@ -65,7 +65,7 @@ } const saveDatasource = async () => { - if (integration.features[DatasourceFeature.CONNECTION_CHECKING]) { + if (integration.features?.[DatasourceFeature.CONNECTION_CHECKING]) { const valid = await validateConfig() if (!valid) { return false diff --git a/packages/frontend-core/src/components/grid/layout/NewRow.svelte b/packages/frontend-core/src/components/grid/layout/NewRow.svelte index 85b430f79b..40e43c2ed9 100644 --- a/packages/frontend-core/src/components/grid/layout/NewRow.svelte +++ b/packages/frontend-core/src/components/grid/layout/NewRow.svelte @@ -148,9 +148,9 @@ class:floating={offset > 0} style="--offset:{offset}px; --sticky-width:{width}px;" > -
-
-
+
+
+
{#if isAdding} @@ -179,7 +179,7 @@ {/if}
-
+
{#each $renderedColumns as column, columnIdx} @@ -209,7 +209,7 @@
-
+