1
0
Fork 0
mirror of synced 2024-07-02 21:10:43 +12:00

Merge branch 'feature/whitelabelling' into feature/whitelabelling-pro

This commit is contained in:
deanhannigan 2023-03-28 09:13:47 +01:00 committed by GitHub
commit dfe6b55c1a
22 changed files with 194 additions and 80 deletions

View file

@ -1,5 +1,5 @@
{
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"npmClient": "yarn",
"packages": [
"packages/*"

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -24,7 +24,7 @@
"dependencies": {
"@budibase/nano": "10.1.2",
"@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/types": "2.4.27-alpha.6",
"@budibase/types": "2.4.27-alpha.7",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@ -38,8 +38,8 @@
],
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "1.2.1",
"@budibase/shared-core": "2.4.27-alpha.6",
"@budibase/string-templates": "2.4.27-alpha.6",
"@budibase/shared-core": "2.4.27-alpha.7",
"@budibase/string-templates": "2.4.27-alpha.7",
"@spectrum-css/accordion": "3.0.24",
"@spectrum-css/actionbutton": "1.0.1",
"@spectrum-css/actiongroup": "1.0.1",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -58,11 +58,11 @@
}
},
"dependencies": {
"@budibase/bbui": "2.4.27-alpha.6",
"@budibase/client": "2.4.27-alpha.6",
"@budibase/frontend-core": "2.4.27-alpha.6",
"@budibase/shared-core": "2.4.27-alpha.6",
"@budibase/string-templates": "2.4.27-alpha.6",
"@budibase/bbui": "2.4.27-alpha.7",
"@budibase/client": "2.4.27-alpha.7",
"@budibase/frontend-core": "2.4.27-alpha.7",
"@budibase/shared-core": "2.4.27-alpha.7",
"@budibase/string-templates": "2.4.27-alpha.7",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",

View file

@ -182,12 +182,13 @@
}
const handleKeyDown = e => {
if (e.key === "Tab") {
if (e.key === "Tab" || e.key === "ArrowDown" || e.key === "ArrowUp") {
// Cycle selected components on tab press
if (selectedIndex == null) {
selectedIndex = 0
} else {
selectedIndex = (selectedIndex + 1) % componentList.length
const direction = e.key === "ArrowUp" ? -1 : 1
selectedIndex = (selectedIndex + direction) % componentList.length
}
e.preventDefault()
e.stopPropagation()

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "dist/index.js",
"bin": {
@ -29,9 +29,9 @@
"outputPath": "build"
},
"dependencies": {
"@budibase/backend-core": "2.4.27-alpha.6",
"@budibase/string-templates": "2.4.27-alpha.6",
"@budibase/types": "2.4.27-alpha.6",
"@budibase/backend-core": "2.4.27-alpha.7",
"@budibase/string-templates": "2.4.27-alpha.7",
"@budibase/types": "2.4.27-alpha.7",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,11 +19,11 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "2.4.27-alpha.6",
"@budibase/frontend-core": "2.4.27-alpha.6",
"@budibase/shared-core": "2.4.27-alpha.6",
"@budibase/string-templates": "2.4.27-alpha.6",
"@budibase/types": "2.4.27-alpha.6",
"@budibase/bbui": "2.4.27-alpha.7",
"@budibase/frontend-core": "2.4.27-alpha.7",
"@budibase/shared-core": "2.4.27-alpha.7",
"@budibase/string-templates": "2.4.27-alpha.7",
"@budibase/types": "2.4.27-alpha.7",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View file

@ -1,13 +1,13 @@
{
"name": "@budibase/frontend-core",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "2.4.27-alpha.6",
"@budibase/shared-core": "2.4.27-alpha.6",
"@budibase/bbui": "2.4.27-alpha.7",
"@budibase/shared-core": "2.4.27-alpha.7",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -43,12 +43,12 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.4.27-alpha.6",
"@budibase/client": "2.4.27-alpha.6",
"@budibase/pro": "2.4.27-alpha.6",
"@budibase/shared-core": "2.4.27-alpha.6",
"@budibase/string-templates": "2.4.27-alpha.6",
"@budibase/types": "2.4.27-alpha.6",
"@budibase/backend-core": "2.4.27-alpha.7",
"@budibase/client": "2.4.27-alpha.7",
"@budibase/pro": "2.4.27-alpha.7",
"@budibase/shared-core": "2.4.27-alpha.7",
"@budibase/string-templates": "2.4.27-alpha.7",
"@budibase/types": "2.4.27-alpha.7",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View file

@ -1278,14 +1278,14 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.4.27-alpha.6":
version "2.4.27-alpha.6"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.27-alpha.6.tgz#8105c400fd0a3fa6264d95e9b99c712e84a07007"
integrity sha512-an+r4AMNhxPUJGxokA/W1PvUsdYih14QcQLfN3Howd0A6h4PZaHpjTC/6xmdDNv0XUcDZ8l8LkAoaW/kMLJG3Q==
"@budibase/backend-core@2.4.27-alpha.7":
version "2.4.27-alpha.7"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.27-alpha.7.tgz#6c7d6e6832a1875de845072bc7134722f99dfcd1"
integrity sha512-PjyPMx+6XvcMmY0+rtBSAkqnO0Pj+dy55aw645fNvI9shWsR1fiy/uyNi+sA1JhcqurnE4h/tDsCTjAi1ihAvA==
dependencies:
"@budibase/nano" "10.1.2"
"@budibase/pouchdb-replication-stream" "1.2.10"
"@budibase/types" "2.4.27-alpha.6"
"@budibase/types" "2.4.27-alpha.7"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0"
@ -1417,14 +1417,14 @@
pouchdb-promise "^6.0.4"
through2 "^2.0.0"
"@budibase/pro@2.4.27-alpha.6":
version "2.4.27-alpha.6"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.27-alpha.6.tgz#2184aea5e640a2abf4a8803a4acac0b5516a8b01"
integrity sha512-gAxuZnfEo1z65Zuf8S9g7qDrrJOVkayKw2GbdX6pbZ1dJbKDu6N3WDJjWfkyLFAOLu4Oy1XtOsHX8AobHZ42xQ==
"@budibase/pro@2.4.27-alpha.7":
version "2.4.27-alpha.7"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.27-alpha.7.tgz#ad8ab70b4fa7d5e28a2d4363e11127eb0b9670bd"
integrity sha512-Up1If7wsHMqjkZZ2770QCnL+ESChXjjmL7biBeu0QtI/VgnGAWg+/RzWpOzJOYXpGInRKfjITYz1X+PZmT+bGQ==
dependencies:
"@budibase/backend-core" "2.4.27-alpha.6"
"@budibase/backend-core" "2.4.27-alpha.7"
"@budibase/string-templates" "2.3.20"
"@budibase/types" "2.4.27-alpha.6"
"@budibase/types" "2.4.27-alpha.7"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
@ -1463,10 +1463,10 @@
lodash "^4.17.20"
vm2 "^3.9.4"
"@budibase/types@2.4.27-alpha.6":
version "2.4.27-alpha.6"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.27-alpha.6.tgz#9235b86764e4c837bab45779a9596233662de8be"
integrity sha512-4+b3NKiqOndNjmzsgr1mZvt4VFhkRVlyMTss9Iu0T4o9SBW20GhJa6iWkiypqHiA50uGDAzgA2u2n/5m59aMyA==
"@budibase/types@2.4.27-alpha.7":
version "2.4.27-alpha.7"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.27-alpha.7.tgz#66966e869d99e51bc2067adc0f955312fc236862"
integrity sha512-4lGc3Idp/+u6CQfv/0GxF2QytYFtATmHBh/faudZk1hhrGFFDRVocnsPjNDYt13PQGdz0VfPBc6zg6hiE3GEhw==
"@bull-board/api@3.7.0":
version "3.7.0"

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/shared-core",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Shared data utils",
"main": "dist/cjs/src/index.js",
"types": "dist/mjs/src/index.d.ts",
@ -20,7 +20,7 @@
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\""
},
"dependencies": {
"@budibase/types": "2.4.27-alpha.6"
"@budibase/types": "2.4.27-alpha.7"
},
"devDependencies": {
"concurrently": "^7.6.0",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Budibase types",
"main": "dist/cjs/index.js",
"types": "dist/mjs/index.d.ts",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "2.4.27-alpha.6",
"version": "2.4.27-alpha.7",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -36,10 +36,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "2.4.27-alpha.6",
"@budibase/pro": "2.4.27-alpha.6",
"@budibase/string-templates": "2.4.27-alpha.6",
"@budibase/types": "2.4.27-alpha.6",
"@budibase/backend-core": "2.4.27-alpha.7",
"@budibase/pro": "2.4.27-alpha.7",
"@budibase/string-templates": "2.4.27-alpha.7",
"@budibase/types": "2.4.27-alpha.7",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",

View file

@ -11,6 +11,7 @@ import {
tenancy,
} from "@budibase/backend-core"
import { checkAnyUserExists } from "../../../utilities/users"
import { getLicensedConfig } from "../../../utilities/configs"
import {
Config,
ConfigType,
@ -211,6 +212,38 @@ export async function save(ctx: UserCtx<Config>) {
ctx.throw(400, err)
}
// Ignore branding changes if the license does not permit it
// Favicon and Logo Url are excluded.
try {
const brandingEnabled = await pro.features.isBrandingEnabled()
if (existingConfig?.config && !brandingEnabled) {
const {
emailBrandingEnabled,
testimonialsEnabled,
platformTitle,
metaDescription,
loginHeading,
loginButton,
metaImageUrl,
metaTitle,
} = existingConfig.config
body.config = {
...body.config,
emailBrandingEnabled,
testimonialsEnabled,
platformTitle,
metaDescription,
loginHeading,
loginButton,
metaImageUrl,
metaTitle,
}
}
} catch (e) {
console.error("There was an issue retrieving the license", e)
}
try {
body._id = configs.generateConfigID(type)
const response = await configs.save(body)

View file

@ -0,0 +1,27 @@
import * as pro from "@budibase/pro"
export async function getLicensedConfig() {
let licensedConfig: object = {}
const defaults = {
emailBrandingEnabled: true,
testimonialsEnabled: true,
platformTitle: undefined,
metaDescription: undefined,
loginHeading: undefined,
loginButton: undefined,
metaImageUrl: undefined,
metaTitle: undefined,
}
try {
// License/Feature Checks
const enabled = await pro.features.isBrandingEnabled()
if (!enabled) {
licensedConfig = { ...defaults }
}
} catch (e) {
licensedConfig = { ...defaults }
console.info("Could not retrieve license", e)
}
return licensedConfig
}

View file

@ -1,10 +1,13 @@
import { tenancy, configs } from "@budibase/backend-core"
import { SettingsInnerConfig } from "@budibase/types"
import {
InternalTemplateBinding,
LOGO_URL,
EmailTemplatePurpose,
} from "../constants"
import { checkSlashesInUrl } from "./index"
import { getLicensedConfig } from "./configs"
const BASE_COMPANY = "Budibase"
import * as pro from "@budibase/pro"

View file

@ -475,14 +475,14 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.4.27-alpha.6":
version "2.4.27-alpha.6"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.27-alpha.6.tgz#8105c400fd0a3fa6264d95e9b99c712e84a07007"
integrity sha512-an+r4AMNhxPUJGxokA/W1PvUsdYih14QcQLfN3Howd0A6h4PZaHpjTC/6xmdDNv0XUcDZ8l8LkAoaW/kMLJG3Q==
"@budibase/backend-core@2.4.27-alpha.7":
version "2.4.27-alpha.7"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.27-alpha.7.tgz#6c7d6e6832a1875de845072bc7134722f99dfcd1"
integrity sha512-PjyPMx+6XvcMmY0+rtBSAkqnO0Pj+dy55aw645fNvI9shWsR1fiy/uyNi+sA1JhcqurnE4h/tDsCTjAi1ihAvA==
dependencies:
"@budibase/nano" "10.1.2"
"@budibase/pouchdb-replication-stream" "1.2.10"
"@budibase/types" "2.4.27-alpha.6"
"@budibase/types" "2.4.27-alpha.7"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0"
@ -564,14 +564,14 @@
pouchdb-promise "^6.0.4"
through2 "^2.0.0"
"@budibase/pro@2.4.27-alpha.6":
version "2.4.27-alpha.6"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.27-alpha.6.tgz#2184aea5e640a2abf4a8803a4acac0b5516a8b01"
integrity sha512-gAxuZnfEo1z65Zuf8S9g7qDrrJOVkayKw2GbdX6pbZ1dJbKDu6N3WDJjWfkyLFAOLu4Oy1XtOsHX8AobHZ42xQ==
"@budibase/pro@2.4.27-alpha.7":
version "2.4.27-alpha.7"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.27-alpha.7.tgz#ad8ab70b4fa7d5e28a2d4363e11127eb0b9670bd"
integrity sha512-Up1If7wsHMqjkZZ2770QCnL+ESChXjjmL7biBeu0QtI/VgnGAWg+/RzWpOzJOYXpGInRKfjITYz1X+PZmT+bGQ==
dependencies:
"@budibase/backend-core" "2.4.27-alpha.6"
"@budibase/backend-core" "2.4.27-alpha.7"
"@budibase/string-templates" "2.3.20"
"@budibase/types" "2.4.27-alpha.6"
"@budibase/types" "2.4.27-alpha.7"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
@ -592,10 +592,10 @@
lodash "^4.17.20"
vm2 "^3.9.4"
"@budibase/types@2.4.27-alpha.6":
version "2.4.27-alpha.6"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.27-alpha.6.tgz#9235b86764e4c837bab45779a9596233662de8be"
integrity sha512-4+b3NKiqOndNjmzsgr1mZvt4VFhkRVlyMTss9Iu0T4o9SBW20GhJa6iWkiypqHiA50uGDAzgA2u2n/5m59aMyA==
"@budibase/types@2.4.27-alpha.7":
version "2.4.27-alpha.7"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.27-alpha.7.tgz#66966e869d99e51bc2067adc0f955312fc236862"
integrity sha512-4lGc3Idp/+u6CQfv/0GxF2QytYFtATmHBh/faudZk1hhrGFFDRVocnsPjNDYt13PQGdz0VfPBc6zg6hiE3GEhw==
"@cspotcode/source-map-support@^0.8.0":
version "0.8.1"

View file

@ -3,20 +3,32 @@
The QA Core API tests are a jest suite that run directly against the budibase backend APIs.
## Auto Setup
You can run the whole test suite with one command, that spins up the budibase server and runs the jest tests:
`yarn api:test`
`yarn api:test`
## Setup Server Only
You can also just stand up the budibase server alone.
`yarn api:server:setup`
`yarn api:server:setup`
## Run Tests
If you configured the server using the previous command, you can run the whole test suite by using:
`yarn test`
`yarn test`
for watch mode, where the tests will run on every change:
`yarn test:watch`
`yarn test:watch`
To run tests locally against a cloud service you can use the command:
`yarn run api:test:local`
To run the tests in CI, it assumes the correct environment variables are set, and the server is already running. Use the command:
`yarn run api:test:ci`
To run the nightly tests against the QA environment, use the command:
`yarn run api:test:nightly`

View file

@ -13,13 +13,15 @@
"test:watch": "env-cmd jest --watch",
"test:debug": "DEBUG=1 jest",
"test:notify": "node scripts/testResultsWebhook",
"test:ci": "jest --runInBand --json --outputFile=testResults.json",
"test:ci": "jest --runInBand --json --outputFile=testResults.json --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"",
"docker:up": "docker-compose up -d",
"docker:down": "docker-compose down",
"api:server:setup": "npm run docker:up && env-cmd ts-node ../packages/builder/ts/setup.ts",
"api:server:setup:ci": "env-cmd node ../packages/builder/setup.js",
"api:test:ci": "start-server-and-test api:server:setup:ci http://localhost:4100/builder test",
"api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test"
"api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test",
"api:test:local": "env-cmd jest --runInBand --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"",
"api:test:nightly": "env-cmd jest --runInBand --outputFile=testResults.json"
},
"jest": {
"preset": "ts-jest",

View file

@ -0,0 +1,36 @@
import TestConfiguration from "../../../config/internal-api/TestConfiguration"
import { App } from "@budibase/types"
import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient"
import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient"
import { generateApp } from "../../../config/internal-api/fixtures/applications"
import { Screen } from "@budibase/types"
import generateScreen from "../../../config/internal-api/fixtures/screens"
describe("Internal API - Data Sources", () => {
const api = new InternalAPIClient()
const accountsAPI = new AccountsAPIClient()
const config = new TestConfiguration<Screen>(api, accountsAPI)
const appConfig = new TestConfiguration<App>(api, accountsAPI)
beforeAll(async () => {
await config.setupAccountAndTenant()
})
afterAll(async () => {
await config.afterAll()
})
it("Create an app with a data source", async () => {
// Create app
const app = await appConfig.applications.create(generateApp())
// Create Screen
const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"]
appConfig.applications.api.appId = app.appId
for (let role in roleArray) {
const [response, screen] = await config.screen.create(
generateScreen(roleArray[role])
)
}
})
})