Merge pull request #7670 from Budibase/update-preview-endpoint

Update preview endpoint
This commit is contained in:
Andrew Kingston 2022-09-07 12:21:48 +01:00 committed by GitHub
commit 925477e156
5 changed files with 4 additions and 12 deletions

View File

@ -65,10 +65,6 @@ http {
proxy_pass http://{{ address }}:4001;
}
location /preview {
proxy_pass http://{{ address }}:4001;
}
location /builder {
proxy_pass http://{{ address }}:3000;
rewrite ^/builder(.*)$ /builder/$1 break;

View File

@ -88,10 +88,6 @@ http {
proxy_pass http://$apps:4002;
}
location /preview {
proxy_pass http://$apps:4002;
}
location = / {
proxy_pass http://$apps:4002;
}

View File

@ -290,7 +290,7 @@
<iframe
title="componentPreview"
bind:this={iframe}
src="/preview"
src="/app/preview"
class:hidden={loading || error}
class:tablet={$store.previewDevice === "tablet"}
class:mobile={$store.previewDevice === "mobile"}

View File

@ -56,7 +56,7 @@ router
authorized(PermissionTypes.TABLE, PermissionLevels.WRITE),
controller.deleteObjects
)
.get("/preview", authorized(BUILDER), controller.serveBuilderPreview)
.get("/app/preview", authorized(BUILDER), controller.serveBuilderPreview)
.get("/:appId/:path*", controller.serveApp)
.get("/app/:appUrl/:path*", controller.serveApp)
.post(

View File

@ -150,14 +150,14 @@ describe("/static", () => {
})
})
describe("/preview", () => {
describe("/app/preview", () => {
beforeEach(() => {
jest.clearAllMocks()
})
it("should serve the builder preview", async () => {
const headers = config.defaultHeaders()
const res = await request.get(`/preview`).set(headers).expect(200)
const res = await request.get(`/app/preview`).set(headers).expect(200)
expect(res.body.appId).toBe(config.appId)
expect(res.body.builderPreview).toBe(true)