diff --git a/.github/workflows/deploy-single-image.yml b/.github/workflows/deploy-single-image.yml index 8bf8f232c5..cd16574eea 100644 --- a/.github/workflows/deploy-single-image.yml +++ b/.github/workflows/deploy-single-image.yml @@ -4,8 +4,6 @@ on: workflow_dispatch: env: - BASE_BRANCH: ${{ github.event.pull_request.base.ref}} - BRANCH: ${{ github.event.pull_request.head.ref }} CI: true PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }} REGISTRY_URL: registry.hub.docker.com @@ -17,6 +15,11 @@ jobs: matrix: node-version: [14.x] steps: + - name: Fail if branch is not master + if: github.ref != 'refs/heads/master' + run: | + echo "Ref is not master, you must run this job from master." + exit 1 - name: "Checkout" uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} @@ -28,8 +31,6 @@ jobs: - name: Setup Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 - - name: Install Pro - run: yarn install:pro $BRANCH $BASE_BRANCH - name: Run Yarn run: yarn - name: Run Yarn Bootstrap diff --git a/.github/workflows/release-selfhost.yml b/.github/workflows/release-selfhost.yml index da064f3e32..d78180fdc7 100644 --- a/.github/workflows/release-selfhost.yml +++ b/.github/workflows/release-selfhost.yml @@ -3,10 +3,6 @@ name: Budibase Release Selfhost on: workflow_dispatch: -env: - BRANCH: ${{ github.event.pull_request.head.ref }} - BASE_BRANCH: ${{ github.event.pull_request.base.ref}} - jobs: release: runs-on: ubuntu-latest @@ -54,9 +50,6 @@ jobs: DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} SELFHOST_TAG: latest - - name: Install Pro - run: yarn install:pro $BRANCH $BASE_BRANCH - - name: Bootstrap and build (CLI) run: | yarn diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index 6517133a58..f72d1aef03 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -78,6 +78,8 @@ spec: key: objectStoreSecret - name: MINIO_URL value: {{ .Values.services.objectStore.url }} + - name: PLUGIN_BUCKET_NAME + value: {{ .Values.services.objectStore.pluginBucketName | default "plugins" | quote }} - name: PORT value: {{ .Values.services.apps.port | quote }} {{ if .Values.services.worker.publicApiRateLimitPerSecond }} diff --git a/charts/budibase/templates/worker-service-deployment.yaml b/charts/budibase/templates/worker-service-deployment.yaml index 902e9ac03d..b1c6110d95 100644 --- a/charts/budibase/templates/worker-service-deployment.yaml +++ b/charts/budibase/templates/worker-service-deployment.yaml @@ -77,6 +77,8 @@ spec: key: objectStoreSecret - name: MINIO_URL value: {{ .Values.services.objectStore.url }} + - name: PLUGIN_BUCKET_NAME + value: {{ .Values.services.objectStore.pluginBucketName | default "plugins" | quote }} - name: PORT value: {{ .Values.services.worker.port | quote }} - name: MULTI_TENANCY diff --git a/lerna.json b/lerna.json index 78897dabab..111a13702b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.4.8-alpha.12", + "version": "1.4.18-alpha.1", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index eacb2926c7..146e41e2e0 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.4.8-alpha.12", + "version": "1.4.18-alpha.1", "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.4.8-alpha.12", + "@budibase/types": "1.4.18-alpha.1", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", diff --git a/packages/backend-core/src/context/index.ts b/packages/backend-core/src/context/index.ts index 8e3cf8a0a2..7cc90e3c67 100644 --- a/packages/backend-core/src/context/index.ts +++ b/packages/backend-core/src/context/index.ts @@ -226,6 +226,10 @@ export const getAppId = () => { } } +export const isTenancyEnabled = () => { + return env.MULTI_TENANCY +} + /** * Opens the app database based on whatever the request * contained, dev or prod. diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index be1e1eacfc..6e2ac94be9 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -16,6 +16,15 @@ if (!LOADED && isDev() && !isTest()) { LOADED = true } +const DefaultBucketName = { + BACKUPS: "backups", + APPS: "prod-budi-app-assets", + TEMPLATES: "templates", + GLOBAL: "global", + CLOUD: "prod-budi-tenant-uploads", + PLUGINS: "plugins", +} + const env = { isTest, isDev, @@ -45,13 +54,17 @@ const env = { POSTHOG_TOKEN: process.env.POSTHOG_TOKEN, ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS, TENANT_FEATURE_FLAGS: process.env.TENANT_FEATURE_FLAGS, - BACKUPS_BUCKET_NAME: process.env.BACKUPS_BUCKET_NAME || "backups", - APPS_BUCKET_NAME: process.env.APPS_BUCKET_NAME || "prod-budi-app-assets", - TEMPLATES_BUCKET_NAME: process.env.TEMPLATES_BUCKET_NAME || "templates", - GLOBAL_BUCKET_NAME: process.env.GLOBAL_BUCKET_NAME || "global", + BACKUPS_BUCKET_NAME: + process.env.BACKUPS_BUCKET_NAME || DefaultBucketName.BACKUPS, + APPS_BUCKET_NAME: process.env.APPS_BUCKET_NAME || DefaultBucketName.APPS, + TEMPLATES_BUCKET_NAME: + process.env.TEMPLATES_BUCKET_NAME || DefaultBucketName.TEMPLATES, + GLOBAL_BUCKET_NAME: + process.env.GLOBAL_BUCKET_NAME || DefaultBucketName.GLOBAL, GLOBAL_CLOUD_BUCKET_NAME: - process.env.GLOBAL_CLOUD_BUCKET_NAME || "prod-budi-tenant-uploads", - PLUGIN_BUCKET_NAME: process.env.PLUGIN_BUCKET_NAME || "plugins", + process.env.GLOBAL_CLOUD_BUCKET_NAME || DefaultBucketName.CLOUD, + PLUGIN_BUCKET_NAME: + process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS, USE_COUCH: process.env.USE_COUCH || true, DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE, DEFAULT_LICENSE: process.env.DEFAULT_LICENSE, diff --git a/packages/backend-core/src/migrations/definitions.ts b/packages/backend-core/src/migrations/definitions.ts index 0eea946be8..946fc3f364 100644 --- a/packages/backend-core/src/migrations/definitions.ts +++ b/packages/backend-core/src/migrations/definitions.ts @@ -33,4 +33,8 @@ export const DEFINITIONS: MigrationDefinition[] = [ type: MigrationType.GLOBAL, name: MigrationName.GLOBAL_INFO_SYNC_USERS, }, + { + type: MigrationType.GLOBAL, + name: MigrationName.PLUGIN_COUNT, + }, ] diff --git a/packages/backend-core/src/objectStore/utils.js b/packages/backend-core/src/objectStore/utils.js index acc1b9904e..9cf4f5f70e 100644 --- a/packages/backend-core/src/objectStore/utils.js +++ b/packages/backend-core/src/objectStore/utils.js @@ -2,6 +2,11 @@ const { join } = require("path") const { tmpdir } = require("os") const env = require("../environment") +/**************************************************** + * NOTE: When adding a new bucket - name * + * sure that S3 usages (like budibase-infra) * + * have been updated to have a unique bucket name. * + ****************************************************/ exports.ObjectStoreBuckets = { BACKUPS: env.BACKUPS_BUCKET_NAME, APPS: env.APPS_BUCKET_NAME, diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 38e6f4ec45..b081f17943 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.4.8-alpha.12", + "version": "1.4.18-alpha.1", "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.4.8-alpha.12", + "@budibase/string-templates": "1.4.18-alpha.1", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte index 3102972d1e..51f6eef6f9 100644 --- a/packages/bbui/src/Form/Core/Dropzone.svelte +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -65,6 +65,9 @@ } } + $: showDropzone = + (!maximum || (maximum && value?.length < maximum)) && !disabled + async function processFileList(fileList) { if ( handleFileTooLarge && @@ -211,7 +214,7 @@ {/each} {/if} {/if} - {#if !maximum || (maximum && value?.length < maximum)} + {#if showDropzone}
{ + e.stopPropagation() + }} >
{attachment.extension} @@ -32,6 +35,9 @@ target="_blank" download={attachment.name} href={attachment.url} + on:click={e => { + e.stopPropagation() + }} > {attachment.extension} diff --git a/packages/builder/package.json b/packages/builder/package.json index fbf2f988a3..6cfbdb9710 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.4.8-alpha.12", + "version": "1.4.18-alpha.1", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "1.4.8-alpha.12", - "@budibase/client": "1.4.8-alpha.12", - "@budibase/frontend-core": "1.4.8-alpha.12", - "@budibase/string-templates": "1.4.8-alpha.12", + "@budibase/bbui": "1.4.18-alpha.1", + "@budibase/client": "1.4.18-alpha.1", + "@budibase/frontend-core": "1.4.18-alpha.1", + "@budibase/string-templates": "1.4.18-alpha.1", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 8016283094..bb70938dfe 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -113,8 +113,9 @@ // Extract all outputs from all previous steps as available bindins let bindings = [] + let loopBlockCount = 0 for (let idx = 0; idx < blockIdx; idx++) { - let wasLoopBlock = allSteps[idx]?.stepId === ActionStepID.LOOP + let wasLoopBlock = allSteps[idx - 1]?.stepId === ActionStepID.LOOP let isLoopBlock = allSteps[idx]?.stepId === ActionStepID.LOOP && allSteps.find(x => x.blockToLoop === block.id) @@ -122,7 +123,8 @@ // If the previous block was a loop block, decerement the index so the following // steps are in the correct order if (wasLoopBlock) { - blockIdx-- + loopBlockCount++ + continue } let schema = allSteps[idx]?.schema?.outputs?.properties ?? {} @@ -143,8 +145,8 @@ let runtimeName = isLoopBlock ? `loop.${name}` : block.name.startsWith("JS") - ? `steps[${idx}].${name}` - : `steps.${idx}.${name}` + ? `steps[${idx - loopBlockCount}].${name}` + : `steps.${idx - loopBlockCount}.${name}` const runtime = idx === 0 ? `trigger.${name}` : runtimeName return { label: runtime, @@ -155,7 +157,7 @@ ? "Trigger outputs" : isLoopBlock ? "Loop Outputs" - : `Step ${idx} outputs`, + : `Step ${idx - loopBlockCount} outputs`, path: runtime, } }) @@ -229,6 +231,7 @@ {bindings} {schemaFields} panel={AutomationBindingPanel} + fillWidth /> {:else if value.customType === "password"} diff --git a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte index 990aa736f6..230748b577 100644 --- a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte +++ b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte @@ -90,6 +90,16 @@ if (inSchema(toTable, toRelate.name, originalToName)) { errObj.toCol = colError } + + let fromType, toType + if (fromPrimary && fromRelate.fieldName) { + fromType = fromTable?.schema[fromPrimary]?.type + toType = toTable?.schema[fromRelate.fieldName]?.type + } + if (fromType && toType && fromType !== toType) { + errObj.foreign = + "Column type of the foreign key must match the primary key" + } errors = errObj } diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index ffa0e98819..3447106136 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -247,7 +247,7 @@ return } hoverTarget = { - title: binding.display.name || binding.fieldSchema.name, + title: binding.display?.name || binding.fieldSchema.name, description: binding.description, } popover.show() diff --git a/packages/builder/src/components/design/settings/controls/ColumnEditor/CellDrawer.svelte b/packages/builder/src/components/design/settings/controls/ColumnEditor/CellDrawer.svelte index 4443ff09ed..a03d22386d 100644 --- a/packages/builder/src/components/design/settings/controls/ColumnEditor/CellDrawer.svelte +++ b/packages/builder/src/components/design/settings/controls/ColumnEditor/CellDrawer.svelte @@ -32,6 +32,8 @@ { readableBinding: "Value", runtimeBinding: "[value]", + category: `Column: ${column.name}`, + icon: "TableColumnMerge", }, ]} /> diff --git a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte index 9bd66a4cb1..6c59119169 100644 --- a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte +++ b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte @@ -27,6 +27,7 @@ export let panel = ClientBindingPanel export let allowBindings = true export let allOr = false + export let fillWidth = false $: dispatch("change", filters) $: enrichedSchemaFields = getFields(schemaFields || []) @@ -177,6 +178,7 @@ {panel} {bindings} on:change={event => (filter.value = event.detail)} + {fillWidth} /> {:else if ["string", "longform", "number", "formula"].includes(filter.type)} diff --git a/packages/builder/src/components/portal/licensing/AccountDowngradedModal.svelte b/packages/builder/src/components/portal/licensing/AccountDowngradedModal.svelte index 53683faa87..2278b4f6df 100644 --- a/packages/builder/src/components/portal/licensing/AccountDowngradedModal.svelte +++ b/packages/builder/src/components/portal/licensing/AccountDowngradedModal.svelte @@ -8,7 +8,7 @@ let accountDowngradeModal $: accountUrl = $admin.accountPortalUrl - $: upgradeUrl = `${accountUrl}/portal/upgrade` + $: billingUrl = `${accountUrl}/portal/billing` export function show() { accountDowngradeModal.show() @@ -24,10 +24,10 @@ title="Your account is now on the Free plan" size="M" showCancelButton={$auth.user.accountPortalAccess} - confirmText={$auth.user.accountPortalAccess ? "Upgrade" : "Confirm"} + confirmText={$auth.user.accountPortalAccess ? "Billing" : "Confirm"} onConfirm={$auth.user.accountPortalAccess ? () => { - window.location.href = upgradeUrl + window.location.href = billingUrl } : null} > @@ -35,7 +35,9 @@ The payment for your subscription has failed and we have downgraded your account to the Free plan. - Upgrade to restore full functionality. + + Please update your billing details to restore full functionality. + {#if !$auth.user.accountPortalAccess} Please contact the account holder to upgrade. {/if} diff --git a/packages/builder/src/components/portal/licensing/PaymentFailedModal.svelte b/packages/builder/src/components/portal/licensing/PaymentFailedModal.svelte index 21a3c2dcd9..502d43d644 100644 --- a/packages/builder/src/components/portal/licensing/PaymentFailedModal.svelte +++ b/packages/builder/src/components/portal/licensing/PaymentFailedModal.svelte @@ -11,7 +11,7 @@ const paymentFailedTitle = "Payment failed" $: accountUrl = $admin.accountPortalUrl - $: upgradeUrl = `${accountUrl}/portal/upgrade` + $: billingUrl = `${accountUrl}/portal/billing` export function show() { paymentFailedModal.show() @@ -33,14 +33,14 @@ { - window.location.href = upgradeUrl + window.location.href = billingUrl }} > The payment for your subscription has failed - Please upgrade your billing details before your account gets downgraded + Please update your billing details before your account gets downgraded to the free plan diff --git a/packages/builder/src/components/portal/licensing/licensingBanners.js b/packages/builder/src/components/portal/licensing/licensingBanners.js index d93305cbf6..34df283b68 100644 --- a/packages/builder/src/components/portal/licensing/licensingBanners.js +++ b/packages/builder/src/components/portal/licensing/licensingBanners.js @@ -10,15 +10,31 @@ const defaultCacheFn = key => { temporalStore.actions.setExpiring(key, {}, oneDayInSeconds) } -const defaultAction = key => { +const upgradeAction = key => { + return defaultNavigateAction( + key, + "Upgrade Plan", + `${get(admin).accountPortalUrl}/portal/upgrade` + ) +} + +const billingAction = key => { + return defaultNavigateAction( + key, + "Billing", + `${get(admin).accountPortalUrl}/portal/billing` + ) +} + +const defaultNavigateAction = (key, actionText, url) => { if (!get(auth).user.accountPortalAccess) { return {} } return { - extraButtonText: "Upgrade Plan", + extraButtonText: actionText, extraButtonAction: () => { defaultCacheFn(key) - window.location.href = `${get(admin).accountPortalUrl}/portal/upgrade` + window.location.href = url }, } } @@ -65,7 +81,7 @@ const buildUsageInfoBanner = ( ? bannerConfig : { ...bannerConfig, - ...defaultAction(cacheKey), + ...upgradeAction(cacheKey), } } @@ -84,7 +100,7 @@ const buildDayPassBanner = () => { ? "" : "Please contact your account holder to upgrade." }`, - ...defaultAction(), + ...upgradeAction(), showCloseButton: false, } } @@ -115,11 +131,11 @@ const buildPaymentFailedBanner = () => { criteria: () => { return get(licensing)?.accountPastDue && !get(licensing).isFreePlan }, - message: `Payment Failed - Please update your billing details or your account will be downgrades in + message: `Payment Failed - Please update your billing details or your account will be downgraded in ${get(licensing)?.pastDueDaysRemaining} day${ get(licensing)?.pastDueDaysRemaining == 1 ? "" : "s" }`, - ...defaultAction(), + ...billingAction(), showCloseButton: false, tooltip: get(licensing).pastDueEndDate, } diff --git a/packages/builder/src/components/start/AppRow.svelte b/packages/builder/src/components/start/AppRow.svelte index 91920073bb..eee8aa19b2 100644 --- a/packages/builder/src/components/start/AppRow.svelte +++ b/packages/builder/src/components/start/AppRow.svelte @@ -9,7 +9,7 @@
-
+
@@ -61,6 +61,11 @@