diff --git a/hosting/nginx.dev.conf.hbs b/hosting/nginx.dev.conf.hbs
index 14c32b1bba..39a8dc52af 100644
--- a/hosting/nginx.dev.conf.hbs
+++ b/hosting/nginx.dev.conf.hbs
@@ -24,6 +24,21 @@ http {
default "upgrade";
}
+ upstream app-service {
+ server {{address}}:4001;
+ keepalive 32;
+ }
+
+ upstream worker-service {
+ server {{address}}:4002;
+ keepalive 32;
+ }
+
+ upstream builder {
+ server {{address}}:3000;
+ keepalive 32;
+ }
+
server {
listen 10000 default_server;
server_name _;
@@ -43,45 +58,78 @@ http {
}
location ~ ^/api/(system|admin|global)/ {
- proxy_pass http://{{ address }}:4002;
+ proxy_pass http://worker-service;
+ proxy_read_timeout 120s;
+ proxy_connect_timeout 120s;
+ proxy_send_timeout 120s;
+ proxy_http_version 1.1;
+ proxy_set_header Connection "";
}
location /api/ {
proxy_read_timeout 120s;
proxy_connect_timeout 120s;
proxy_send_timeout 120s;
- proxy_pass http://{{ address }}:4001;
+ proxy_pass http://app-service;
+ proxy_http_version 1.1;
+ proxy_set_header Connection "";
}
location = / {
- proxy_pass http://{{ address }}:4001;
+ proxy_pass http://app-service;
+ proxy_read_timeout 120s;
+ proxy_connect_timeout 120s;
+ proxy_send_timeout 120s;
+ proxy_http_version 1.1;
+ proxy_set_header Connection "";
}
location /app_ {
- proxy_pass http://{{ address }}:4001;
+ proxy_pass http://app-service;
+ proxy_read_timeout 120s;
+ proxy_connect_timeout 120s;
+ proxy_send_timeout 120s;
+ proxy_http_version 1.1;
+ proxy_set_header Connection "";
}
location /app {
- proxy_pass http://{{ address }}:4001;
+ proxy_pass http://app-service;
+ proxy_read_timeout 120s;
+ proxy_connect_timeout 120s;
+ proxy_send_timeout 120s;
+ proxy_http_version 1.1;
+ proxy_set_header Connection "";
}
location /builder {
- proxy_pass http://{{ address }}:3000;
+ proxy_pass http://builder;
+ proxy_read_timeout 120s;
+ proxy_connect_timeout 120s;
+ proxy_send_timeout 120s;
+ proxy_http_version 1.1;
+ proxy_set_header Connection "";
rewrite ^/builder(.*)$ /builder/$1 break;
}
location /builder/ {
- proxy_pass http://{{ address }}:3000;
+ proxy_pass http://builder;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_read_timeout 120s;
+ proxy_connect_timeout 120s;
+ proxy_send_timeout 120s;
}
location /vite/ {
- proxy_pass http://{{ address }}:3000;
+ proxy_pass http://builder;
+ proxy_read_timeout 120s;
+ proxy_connect_timeout 120s;
+ proxy_send_timeout 120s;
rewrite ^/vite(.*)$ /$1 break;
}
@@ -91,7 +139,7 @@ http {
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
- proxy_pass http://{{ address }}:4001;
+ proxy_pass http://app-service;
}
location / {
diff --git a/lerna.json b/lerna.json
index 2413e7d417..0aadebb725 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-alpha.10",
"npmClient": "yarn",
"packages": [
"packages/*"
diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json
index 2a6754bd5c..01dc0fdef4 100644
--- a/packages/backend-core/package.json
+++ b/packages/backend-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-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": "2.0.30-alpha.8",
+ "@budibase/types": "2.0.30-alpha.10",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0",
diff --git a/packages/bbui/package.json b/packages/bbui/package.json
index 5f31948513..91d5825bbf 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": "2.0.30-alpha.8",
+ "version": "2.0.30-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": "2.0.30-alpha.8",
+ "@budibase/string-templates": "2.0.30-alpha.10",
"@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",
diff --git a/packages/bbui/src/Actions/click_outside.js b/packages/bbui/src/Actions/click_outside.js
index 49a15d36a3..7fd2879071 100644
--- a/packages/bbui/src/Actions/click_outside.js
+++ b/packages/bbui/src/Actions/click_outside.js
@@ -1,18 +1,18 @@
export default function clickOutside(element, callbackFunction) {
function onClick(event) {
if (!element.contains(event.target)) {
- callbackFunction()
+ callbackFunction(event)
}
}
- document.body.addEventListener("mousedown", onClick, true)
+ document.body.addEventListener("click", onClick, true)
return {
update(newCallbackFunction) {
callbackFunction = newCallbackFunction
},
destroy() {
- document.body.removeEventListener("mousedown", onClick, true)
+ document.body.removeEventListener("click", onClick, true)
},
}
}
diff --git a/packages/bbui/src/Popover/Popover.svelte b/packages/bbui/src/Popover/Popover.svelte
index ded0ed6cfd..b81e76dc1f 100644
--- a/packages/bbui/src/Popover/Popover.svelte
+++ b/packages/bbui/src/Popover/Popover.svelte
@@ -33,6 +33,13 @@
open = false
}
+ const handleOutsideClick = e => {
+ if (open) {
+ e.stopPropagation()
+ hide()
+ }
+ }
+
let open = null
function handleEscape(e) {
@@ -47,7 +54,7 @@
- import { Body } from "@budibase/bbui"
+ import { Label, Body } from "@budibase/bbui"
+ import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
+
+ export let parameters
+ export let bindings = []
+Navigate To screen, or leave blank.
+
- This action doesn't require any additional settings.
-
- This action won't do anything if there isn't a screen modal open.
-
+ Screen
+ (parameters.url = value.detail)}
+ {bindings}
+ />
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 5bd2d1c8a9..91d0952b62 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-alpha.10",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {
@@ -26,9 +26,9 @@
"outputPath": "build"
},
"dependencies": {
- "@budibase/backend-core": "2.0.30-alpha.8",
- "@budibase/string-templates": "2.0.30-alpha.8",
- "@budibase/types": "2.0.30-alpha.8",
+ "@budibase/backend-core": "2.0.30-alpha.10",
+ "@budibase/string-templates": "2.0.30-alpha.10",
+ "@budibase/types": "2.0.30-alpha.10",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",
diff --git a/packages/client/package.json b/packages/client/package.json
index 16b6b6f2b7..6dc56bf484 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/client",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-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": "2.0.30-alpha.8",
- "@budibase/frontend-core": "2.0.30-alpha.8",
- "@budibase/string-templates": "2.0.30-alpha.8",
+ "@budibase/bbui": "2.0.30-alpha.10",
+ "@budibase/frontend-core": "2.0.30-alpha.10",
+ "@budibase/string-templates": "2.0.30-alpha.10",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",
diff --git a/packages/client/src/components/Router.svelte b/packages/client/src/components/Router.svelte
index 49cbc3f821..551a564094 100644
--- a/packages/client/src/components/Router.svelte
+++ b/packages/client/src/components/Router.svelte
@@ -43,6 +43,7 @@
}
const onRouteLoading = ({ detail }) => {
+ routeStore.actions.setRouteParams(detail.params || {})
routeStore.actions.setActiveRoute(detail.route)
}
diff --git a/packages/client/src/components/Screen.svelte b/packages/client/src/components/Screen.svelte
index 0ce89f1ff4..f6f9a932f0 100644
--- a/packages/client/src/components/Screen.svelte
+++ b/packages/client/src/components/Screen.svelte
@@ -10,9 +10,6 @@
const context = getContext("context")
- // Keep route params up to date
- $: routeStore.actions.setRouteParams(params || {})
-
// Get the screen definition for the current route
$: screenDefinition = $screenStore.activeScreen?.props
diff --git a/packages/client/src/components/overlay/PeekScreenDisplay.svelte b/packages/client/src/components/overlay/PeekScreenDisplay.svelte
index d6da9ca3f0..b9f4914624 100644
--- a/packages/client/src/components/overlay/PeekScreenDisplay.svelte
+++ b/packages/client/src/components/overlay/PeekScreenDisplay.svelte
@@ -45,6 +45,9 @@
},
[MessageTypes.CLOSE_SCREEN_MODAL]: () => {
peekStore.actions.hidePeek()
+ if (message.data?.url) {
+ routeStore.actions.navigate(message.data.url)
+ }
},
[MessageTypes.INVALIDATE_DATASOURCE]: () => {
proxyInvalidation(message.data)
diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js
index a534ee8326..e44ed2451c 100644
--- a/packages/client/src/utils/buttonActions.js
+++ b/packages/client/src/utils/buttonActions.js
@@ -224,10 +224,11 @@ const changeFormStepHandler = async (action, context) => {
)
}
-const closeScreenModalHandler = () => {
+const closeScreenModalHandler = action => {
+ let { url } = action.parameters
// Emit this as a window event, so parent screens which are iframing us in
// can close the modal
- window.parent.postMessage({ type: "close-screen-modal" })
+ window.parent.postMessage({ type: "close-screen-modal", url })
}
const updateStateHandler = action => {
diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json
index ebda9dab9a..c80090ec31 100644
--- a/packages/frontend-core/package.json
+++ b/packages/frontend-core/package.json
@@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-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": "2.0.30-alpha.8",
+ "@budibase/bbui": "2.0.30-alpha.10",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
index 0e004e83f2..a62c74c7af 100644
--- a/packages/sdk/package.json
+++ b/packages/sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-alpha.10",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",
diff --git a/packages/server/package.json b/packages/server/package.json
index aa82380914..9caed3dfa8 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-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": "2.0.30-alpha.8",
- "@budibase/client": "2.0.30-alpha.8",
- "@budibase/pro": "2.0.30-alpha.8",
- "@budibase/string-templates": "2.0.30-alpha.8",
- "@budibase/types": "2.0.30-alpha.8",
+ "@budibase/backend-core": "2.0.30-alpha.10",
+ "@budibase/client": "2.0.30-alpha.10",
+ "@budibase/pro": "2.0.30-alpha.10",
+ "@budibase/string-templates": "2.0.30-alpha.10",
+ "@budibase/types": "2.0.30-alpha.10",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",
diff --git a/packages/server/src/integrations/arangodb.ts b/packages/server/src/integrations/arangodb.ts
index 6df96501a4..e28940f36e 100644
--- a/packages/server/src/integrations/arangodb.ts
+++ b/packages/server/src/integrations/arangodb.ts
@@ -62,6 +62,8 @@ class ArangoDBIntegration implements IntegrationBase {
constructor(config: ArangodbConfig) {
const newConfig = {
+ url: config.url,
+ databaseName: config.databaseName,
auth: {
username: config.username,
password: config.password,
diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock
index 8528ba9354..3e89dab309 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@2.0.30-alpha.8":
- version "2.0.30-alpha.8"
- resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.30-alpha.8.tgz#2eef65f40c3859c96268f0c709c57bb225cf7ca3"
- integrity sha512-ZjoTLoNeLaU7+YNltOS9tG7/GNR22iyR8O8TCXyqK0u1fyL/MFLp8Cj3Epv7JBfBkLtVg9ah8ACPK/kCNemahQ==
+"@budibase/backend-core@2.0.30-alpha.10":
+ version "2.0.30-alpha.10"
+ resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.30-alpha.10.tgz#ff11327ad0456d1af40839f3a89002487d0e3173"
+ integrity sha512-KGX0k5h1IBE5hNmPBRC58hk0XfXzeBmFcXzveA8YAXboeYo0Rzo2xQr5oSbT9766JaNaHTwF9J1luyxq0Zr7KA==
dependencies:
- "@budibase/types" "2.0.30-alpha.8"
+ "@budibase/types" "2.0.30-alpha.10"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@@ -1180,13 +1180,13 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
-"@budibase/pro@2.0.30-alpha.8":
- version "2.0.30-alpha.8"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.30-alpha.8.tgz#1bcab899326e04607a74112482ff2ffca3776cf1"
- integrity sha512-QhfTZn5oaJIPSUYFTnShgqADXeikVi4xbsOJGhGR2Ysl/7DlTRse9JVhql6OpRO9ozbab6tSJ2NxIJFgznsvhQ==
+"@budibase/pro@2.0.30-alpha.10":
+ version "2.0.30-alpha.10"
+ resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.30-alpha.10.tgz#2bd878840f705a1d344da5fac1d588a06e5eefed"
+ integrity sha512-cXnbYsrx9Y9t4XAnzoFnNXJaJfd+vnIFaX5ULnJYTPsmouDij/A/qU8lNDtpxciss4dgxO9AnZH31ZXFVlJj0Q==
dependencies:
- "@budibase/backend-core" "2.0.30-alpha.8"
- "@budibase/types" "2.0.30-alpha.8"
+ "@budibase/backend-core" "2.0.30-alpha.10"
+ "@budibase/types" "2.0.30-alpha.10"
"@koa/router" "8.0.8"
joi "17.6.0"
node-fetch "^2.6.1"
@@ -1209,10 +1209,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
-"@budibase/types@2.0.30-alpha.8":
- version "2.0.30-alpha.8"
- resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.30-alpha.8.tgz#36fb30fcb121904754369e4312892a34bdff63cd"
- integrity sha512-I5+W+JU95jSRGhN7dvmdiQPyAHa+OUttc4WYYAkE6MYlaraOZd9aVF4IcY9aQR6cZWZ1GZIxoGPJPoNjU3tDLQ==
+"@budibase/types@2.0.30-alpha.10":
+ version "2.0.30-alpha.10"
+ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.30-alpha.10.tgz#9b0ecc9d68ad5694a10f4390dd0ca64b93127e5b"
+ integrity sha512-qaXoUdHWhvym085dHt0WB+U7Lap1mqwh2zRo+2e+kfvEqzOyvj2H7ILK3wjVGYlrFrr7qceQaMnDCAEzad6aMg==
"@bull-board/api@3.7.0":
version "3.7.0"
diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json
index e92f64b186..78e5803316 100644
--- a/packages/string-templates/package.json
+++ b/packages/string-templates/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-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 7c30c04384..09c31556e0 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/types",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-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 1c47bec021..50fa1db46a 100644
--- a/packages/worker/package.json
+++ b/packages/worker/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
- "version": "2.0.30-alpha.8",
+ "version": "2.0.30-alpha.10",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@@ -36,10 +36,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
- "@budibase/backend-core": "2.0.30-alpha.8",
- "@budibase/pro": "2.0.30-alpha.8",
- "@budibase/string-templates": "2.0.30-alpha.8",
- "@budibase/types": "2.0.30-alpha.8",
+ "@budibase/backend-core": "2.0.30-alpha.10",
+ "@budibase/pro": "2.0.30-alpha.10",
+ "@budibase/string-templates": "2.0.30-alpha.10",
+ "@budibase/types": "2.0.30-alpha.10",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",
diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock
index ea169beb9a..8f7503d6ac 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@2.0.30-alpha.8":
- version "2.0.30-alpha.8"
- resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.30-alpha.8.tgz#2eef65f40c3859c96268f0c709c57bb225cf7ca3"
- integrity sha512-ZjoTLoNeLaU7+YNltOS9tG7/GNR22iyR8O8TCXyqK0u1fyL/MFLp8Cj3Epv7JBfBkLtVg9ah8ACPK/kCNemahQ==
+"@budibase/backend-core@2.0.30-alpha.10":
+ version "2.0.30-alpha.10"
+ resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.30-alpha.10.tgz#ff11327ad0456d1af40839f3a89002487d0e3173"
+ integrity sha512-KGX0k5h1IBE5hNmPBRC58hk0XfXzeBmFcXzveA8YAXboeYo0Rzo2xQr5oSbT9766JaNaHTwF9J1luyxq0Zr7KA==
dependencies:
- "@budibase/types" "2.0.30-alpha.8"
+ "@budibase/types" "2.0.30-alpha.10"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@@ -327,21 +327,21 @@
uuid "8.3.2"
zlib "1.0.5"
-"@budibase/pro@2.0.30-alpha.8":
- version "2.0.30-alpha.8"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.30-alpha.8.tgz#1bcab899326e04607a74112482ff2ffca3776cf1"
- integrity sha512-QhfTZn5oaJIPSUYFTnShgqADXeikVi4xbsOJGhGR2Ysl/7DlTRse9JVhql6OpRO9ozbab6tSJ2NxIJFgznsvhQ==
+"@budibase/pro@2.0.30-alpha.10":
+ version "2.0.30-alpha.10"
+ resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.30-alpha.10.tgz#2bd878840f705a1d344da5fac1d588a06e5eefed"
+ integrity sha512-cXnbYsrx9Y9t4XAnzoFnNXJaJfd+vnIFaX5ULnJYTPsmouDij/A/qU8lNDtpxciss4dgxO9AnZH31ZXFVlJj0Q==
dependencies:
- "@budibase/backend-core" "2.0.30-alpha.8"
- "@budibase/types" "2.0.30-alpha.8"
+ "@budibase/backend-core" "2.0.30-alpha.10"
+ "@budibase/types" "2.0.30-alpha.10"
"@koa/router" "8.0.8"
joi "17.6.0"
node-fetch "^2.6.1"
-"@budibase/types@2.0.30-alpha.8":
- version "2.0.30-alpha.8"
- resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.30-alpha.8.tgz#36fb30fcb121904754369e4312892a34bdff63cd"
- integrity sha512-I5+W+JU95jSRGhN7dvmdiQPyAHa+OUttc4WYYAkE6MYlaraOZd9aVF4IcY9aQR6cZWZ1GZIxoGPJPoNjU3tDLQ==
+"@budibase/types@2.0.30-alpha.10":
+ version "2.0.30-alpha.10"
+ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.30-alpha.10.tgz#9b0ecc9d68ad5694a10f4390dd0ca64b93127e5b"
+ integrity sha512-qaXoUdHWhvym085dHt0WB+U7Lap1mqwh2zRo+2e+kfvEqzOyvj2H7ILK3wjVGYlrFrr7qceQaMnDCAEzad6aMg==
"@cspotcode/source-map-consumer@0.8.0":
version "0.8.0"
diff --git a/qa-core/src/config/internal-api/TestConfiguration/index.ts b/qa-core/src/config/internal-api/TestConfiguration/index.ts
index b433fd98ea..d90c315849 100644
--- a/qa-core/src/config/internal-api/TestConfiguration/index.ts
+++ b/qa-core/src/config/internal-api/TestConfiguration/index.ts
@@ -1,15 +1,18 @@
import ApplicationApi from "./applications"
import AuthApi from "./auth"
import InternalAPIClient from "./InternalAPIClient"
+import ScreenApi from "./screens"
export default class TestConfiguration
{
applications: ApplicationApi
auth: AuthApi
+ screen: ScreenApi
context: T
constructor(apiClient: InternalAPIClient) {
this.applications = new ApplicationApi(apiClient)
this.auth = new AuthApi(apiClient)
+ this.screen = new ScreenApi(apiClient)
this.context = {}
}
diff --git a/qa-core/src/config/internal-api/TestConfiguration/screens.ts b/qa-core/src/config/internal-api/TestConfiguration/screens.ts
new file mode 100644
index 0000000000..30c688022a
--- /dev/null
+++ b/qa-core/src/config/internal-api/TestConfiguration/screens.ts
@@ -0,0 +1,23 @@
+import { Screen } from "@budibase/types"
+import { Response } from "node-fetch"
+import InternalAPIClient from "./InternalAPIClient"
+
+ export default class ScreenApi {
+ api: InternalAPIClient
+
+ constructor(apiClient: InternalAPIClient) {
+ this.api = apiClient
+ }
+
+ async create(body: any): Promise<[Response, Screen]> {
+ const response = await this.api.post(`/screens`, { body })
+ const json = await response.json()
+ return [response, json]
+ }
+
+ async delete(screenId: string, rev: string): Promise<[Response, Screen]> {
+ const response = await this.api.del(`/screens/${screenId}/${rev}`)
+ const json = await response.json()
+ return [response, json]
+ }
+ }
diff --git a/qa-core/src/config/internal-api/fixtures/screens.ts b/qa-core/src/config/internal-api/fixtures/screens.ts
index 28e58e8eb8..1ebc1eb5c8 100644
--- a/qa-core/src/config/internal-api/fixtures/screens.ts
+++ b/qa-core/src/config/internal-api/fixtures/screens.ts
@@ -2,33 +2,33 @@ import generator from "../../generator"
const randomId = generator.guid()
-const generateScreen = (): any => ({
- showNavigation: true,
- width: "Large",
- props: {
- _id: randomId,
- _component: "@budibase/standard-components/container",
- _styles: {
- normal: {},
- hover: {},
- active: {},
- selected: {},
+const generateScreen = (roleId: string): any => ({
+ showNavigation: true,
+ width: "Large",
+ name: randomId,
+ template: "createFromScratch",
+ props: {
+ _id: randomId,
+ _component:
+ "@budibase/standard-components/container",
+ _styles: {
+ normal: {},
+ hover: {},
+ active: {},
+ selected: {}
+ },
+ _children: [],
+ _instanceName: "New Screen",
+ direction: "column",
+ hAlign: "stretch",
+ vAlign: "top",
+ size: "grow",
+ gap: "M"
+ }, routing: {
+ route: "/test",
+ roleId: roleId,
+ homeScreen: false
},
- _children: [],
- _instanceName: "New Screen",
- direction: "column",
- hAlign: "stretch",
- vAlign: "top",
- size: "grow",
- gap: "M",
- },
- routing: {
- route: "/test",
- roleId: "BASIC",
- homeScreen: false,
- },
- name: randomId,
- template: "createFromScratch",
})
export default generateScreen
diff --git a/qa-core/src/tests/internal-api/applications/create.spec.ts b/qa-core/src/tests/internal-api/applications/create.spec.ts
index c09af632de..aa71724cac 100644
--- a/qa-core/src/tests/internal-api/applications/create.spec.ts
+++ b/qa-core/src/tests/internal-api/applications/create.spec.ts
@@ -164,7 +164,7 @@ describe("Internal API - /applications endpoints", () => {
// Change/add component to the app
const [screenResponse, screen] = await config.applications.addScreentoApp(
- generateScreen()
+ generateScreen("BASIC")
)
expect(screenResponse).toHaveStatusCode(200)
expect(screen._id).toBeDefined()
diff --git a/qa-core/src/tests/internal-api/screens/screens.spec.ts b/qa-core/src/tests/internal-api/screens/screens.spec.ts
new file mode 100644
index 0000000000..68e1022cb4
--- /dev/null
+++ b/qa-core/src/tests/internal-api/screens/screens.spec.ts
@@ -0,0 +1,62 @@
+import TestConfiguration from "../../../config/internal-api/TestConfiguration"
+import { App } from "@budibase/types"
+import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient"
+import generateApp from "../../../config/internal-api/fixtures/applications"
+import { Screen } from "@budibase/types"
+import generateScreen from "../../../config/internal-api/fixtures/screens"
+
+
+describe("Internal API - /screens endpoints", () => {
+ const api = new InternalAPIClient()
+ const config = new TestConfiguration(api)
+ const appConfig = new TestConfiguration(api)
+
+ beforeAll(async () => {
+ await config.beforeAll()
+ })
+
+ afterAll(async () => {
+ await config.afterAll()
+ })
+
+ it("POST - Create a screen with each role type", async () => {
+ // Create app
+ const [appResponse, 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]))
+ expect(response).toHaveStatusCode(200)
+ expect(screen.routing.roleId).toEqual(roleArray[role])
+ }
+ })
+
+ it("GET - Fetch screens", async () => {
+ // Create app
+ const [appResponse, app] = await appConfig.applications.create(generateApp())
+
+ // Create Screen
+ appConfig.applications.api.appId = app.appId
+ const [response, screen] = await config.screen.create(generateScreen("BASIC"))
+
+ // Check screen exists
+ const [routesResponse, routes] = await appConfig.applications.getRoutes()
+ expect(routesResponse).toHaveStatusCode(200)
+ expect(routes.routes["/test"]).toBeTruthy()
+ })
+
+ it("DELETE - Delete a screen", async () => {
+ // Create app
+ const [appResponse, app] = await appConfig.applications.create(generateApp())
+
+ // Create Screen
+ appConfig.applications.api.appId = app.appId
+ const [screenResponse, screen] = await config.screen.create(generateScreen("BASIC"))
+
+ // Delete Screen
+ const [response] = await config.screen.delete(screen._id!, screen._rev!)
+ expect(response).toHaveStatusCode(200)
+ })
+})