diff --git a/packages/builder/cypress.json b/packages/builder/cypress.json index a68cea053f..d76078f509 100644 --- a/packages/builder/cypress.json +++ b/packages/builder/cypress.json @@ -1,5 +1,8 @@ { - "baseUrl": "http://localhost:4001/_builder/", + "baseUrl": "http://localhost:4005/_builder/", "video": true, - "projectId": "bmbemn" + "projectId": "bmbemn", + "env": { + "PORT": "4005" + } } diff --git a/packages/builder/cypress/integration/createApp.spec.js b/packages/builder/cypress/integration/createApp.spec.js index 5382aa04cc..a32782867a 100644 --- a/packages/builder/cypress/integration/createApp.spec.js +++ b/packages/builder/cypress/integration/createApp.spec.js @@ -2,7 +2,7 @@ context('Create an Application', () => { beforeEach(() => { cy.server() - cy.visit('localhost:4001/_builder') + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) }) // https://on.cypress.io/interacting-with-elements @@ -11,7 +11,7 @@ context('Create an Application', () => { // https://on.cypress.io/type cy.createApp('My Cool App', 'This is a description') - cy.visit('localhost:4001/_builder') + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) cy.contains('My Cool App').should('exist') }) diff --git a/packages/builder/cypress/integration/createAutomation.spec.js b/packages/builder/cypress/integration/createAutomation.spec.js index efc185be7c..97b67cf15c 100644 --- a/packages/builder/cypress/integration/createAutomation.spec.js +++ b/packages/builder/cypress/integration/createAutomation.spec.js @@ -1,7 +1,7 @@ context("Create a automation", () => { before(() => { cy.server() - cy.visit("localhost:4001/_builder") + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) cy.createApp( "Automation Test App", diff --git a/packages/builder/cypress/integration/createBinding.spec.js b/packages/builder/cypress/integration/createBinding.spec.js index 971df3ed75..4074aca112 100644 --- a/packages/builder/cypress/integration/createBinding.spec.js +++ b/packages/builder/cypress/integration/createBinding.spec.js @@ -1,6 +1,6 @@ xcontext('Create a Binding', () => { before(() => { - cy.visit('localhost:4001/_builder') + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) cy.createApp('Binding App', 'Binding App Description') cy.navigateToFrontend() }) diff --git a/packages/builder/cypress/integration/createComponents.spec.js b/packages/builder/cypress/integration/createComponents.spec.js index 6931fdb86b..b87e863e53 100644 --- a/packages/builder/cypress/integration/createComponents.spec.js +++ b/packages/builder/cypress/integration/createComponents.spec.js @@ -1,7 +1,7 @@ xcontext("Create Components", () => { before(() => { cy.server() - cy.visit("localhost:4001/_builder") + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) // https://on.cypress.io/type cy.createApp("Table App", "Table App Description") cy.createTable("dog", "name", "age") diff --git a/packages/builder/cypress/integration/createTable.spec.js b/packages/builder/cypress/integration/createTable.spec.js index 067505cfab..3a8b466502 100644 --- a/packages/builder/cypress/integration/createTable.spec.js +++ b/packages/builder/cypress/integration/createTable.spec.js @@ -1,6 +1,6 @@ context("Create a Table", () => { before(() => { - cy.visit("localhost:4001/_builder") + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) cy.createApp("Table App", "Table App Description") }) diff --git a/packages/builder/cypress/integration/createUser.spec.js b/packages/builder/cypress/integration/createUser.spec.js index a5f9934dd7..45a1ffcc68 100644 --- a/packages/builder/cypress/integration/createUser.spec.js +++ b/packages/builder/cypress/integration/createUser.spec.js @@ -2,7 +2,7 @@ context('Create a User', () => { before(() => { cy.server() - cy.visit('localhost:4001/_builder') + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) // https://on.cypress.io/type cy.createApp('User App', 'This app is used to test user creation') }) diff --git a/packages/builder/cypress/integration/createView.spec.js b/packages/builder/cypress/integration/createView.spec.js index cfafdc6705..6f321ab16f 100644 --- a/packages/builder/cypress/integration/createView.spec.js +++ b/packages/builder/cypress/integration/createView.spec.js @@ -8,7 +8,7 @@ function removeSpacing(headers) { context("Create a View", () => { before(() => { - cy.visit("localhost:4001/_builder") + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) cy.createApp("View App", "View App Description") cy.createTable("data") cy.addColumn("data", "group", "Text") diff --git a/packages/builder/cypress/integration/screens.spec.js b/packages/builder/cypress/integration/screens.spec.js index 6df8af3602..d219e7daa7 100644 --- a/packages/builder/cypress/integration/screens.spec.js +++ b/packages/builder/cypress/integration/screens.spec.js @@ -2,7 +2,7 @@ context('Screen Tests', () => { before(() => { cy.server() - cy.visit('localhost:4001/_builder') + cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) cy.createApp('Conor Cy App', 'Table App Description') cy.navigateToFrontend() }) diff --git a/packages/builder/cypress/setup.js b/packages/builder/cypress/setup.js index 5f80c05fae..d6b60d194e 100644 --- a/packages/builder/cypress/setup.js +++ b/packages/builder/cypress/setup.js @@ -6,6 +6,7 @@ const rimraf = require("rimraf") const { join, resolve } = require("path") const initialiseBudibase = require("../../server/src/utilities/initialiseBudibase") +const cypressConfig = require("../cypress.json") const homedir = join(require("os").homedir(), ".budibase") @@ -14,6 +15,7 @@ rimraf.sync(homedir) process.env.BUDIBASE_API_KEY = "6BE826CB-6B30-4AEC-8777-2E90464633DE" process.env.NODE_ENV = "cypress" process.env.ENABLE_ANALYTICS = "false" +process.env.PORT = cypressConfig.env.PORT // Stop info logs polluting test outputs process.env.LOG_LEVEL = "error" diff --git a/packages/builder/package.json b/packages/builder/package.json index fdcb9ae4a1..46141a4d4f 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -14,8 +14,8 @@ "cy:run": "cypress run", "cy:open": "cypress open", "cy:run:ci": "cypress run --browser electron --record --key f308590b-6070-41af-b970-794a3823d451", - "cy:test": "start-server-and-test cy:setup http://localhost:4001/_builder cy:run", - "cy:ci": "start-server-and-test cy:setup http://localhost:4001/_builder cy:run:ci" + "cy:test": "start-server-and-test cy:setup http://localhost:4005/_builder cy:run", + "cy:ci": "start-server-and-test cy:setup http://localhost:4005/_builder cy:run:ci" }, "jest": { "globals": { diff --git a/packages/builder/src/analytics.js b/packages/builder/src/analytics.js index c68f228c12..df91c16e00 100644 --- a/packages/builder/src/analytics.js +++ b/packages/builder/src/analytics.js @@ -125,7 +125,12 @@ export default { requestFeedbackOnDeploy, submitFeedback, highlightFeedbackIcon, - disabled: ifAnalyticsEnabled(disabled), + disabled: () => { + if (analyticsEnabled == null) { + return true + } + return ifAnalyticsEnabled(disabled) + }, optIn: ifAnalyticsEnabled(optIn), optOut: ifAnalyticsEnabled(optOut), } diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 7edc378900..19987764e5 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -290,7 +290,7 @@ export const getFrontendStore = () => { ...extras, } }, - create: (componentName, presetProps) => { + create: async (componentName, presetProps) => { const selected = get(selectedComponent) const asset = get(currentAsset) const state = get(store) @@ -346,7 +346,7 @@ export const getFrontendStore = () => { parentComponent._children.push(componentInstance) // Save components and update UI - store.actions.preview.saveSelected() + await store.actions.preview.saveSelected() store.update(state => { state.currentView = "component" state.selectedComponentId = componentInstance._id @@ -360,7 +360,7 @@ export const getFrontendStore = () => { return componentInstance }, - delete: component => { + delete: async component => { if (!component) { return } @@ -375,7 +375,7 @@ export const getFrontendStore = () => { ) store.actions.components.select(parent) } - store.actions.preview.saveSelected() + await store.actions.preview.saveSelected() }, copy: (component, cut = false) => { const selectedAsset = get(currentAsset) @@ -487,7 +487,7 @@ export const getFrontendStore = () => { selected._styles = { normal: {}, hover: {}, active: {} } await store.actions.preview.saveSelected() }, - updateProp: (name, value) => { + updateProp: async (name, value) => { let component = get(selectedComponent) if (!name || !component) { return @@ -497,7 +497,7 @@ export const getFrontendStore = () => { state.selectedComponentId = component._id return state }) - store.actions.preview.saveSelected() + await store.actions.preview.saveSelected() }, links: { save: async (url, title) => { diff --git a/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte b/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte index 2edcbec3f1..18fff8153d 100644 --- a/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte +++ b/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte @@ -13,7 +13,8 @@ if (production) { return `${appUrl}/${uri}` } else { - return `http://localhost:4001/${uri}` + + return `${window.location.origin}/${uri}` } } diff --git a/packages/builder/src/components/backend/DataTable/Table.svelte b/packages/builder/src/components/backend/DataTable/Table.svelte index fa04829634..459b1c0d59 100644 --- a/packages/builder/src/components/backend/DataTable/Table.svelte +++ b/packages/builder/src/components/backend/DataTable/Table.svelte @@ -15,7 +15,7 @@ import TableLoadingOverlay from "./TableLoadingOverlay" import TableHeader from "./TableHeader" import "@budibase/svelte-ag-grid/dist/index.css" - import { TableNames } from "constants" + import { TableNames, UNEDITABLE_USER_FIELDS } from "constants" export let schema = {} export let data = [] @@ -53,6 +53,9 @@ if (isUsersTable) { schema.email.displayFieldName = "Email" schema.roleId.displayFieldName = "Role" + if (schema.status) { + schema.status.displayFieldName = "Status" + } } } @@ -83,7 +86,7 @@ if (!allowEditing) { return false } - return !(isUsersTable && ["email", "roleId"].includes(key)) + return !(isUsersTable && UNEDITABLE_USER_FIELDS.includes(key)) } for (let [key, value] of Object.entries(schema || {})) { diff --git a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte index 4ac5ec80a8..365f9aee9e 100644 --- a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte @@ -53,6 +53,7 @@ diff --git a/packages/builder/src/components/backend/DataTable/popovers/FilterPopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/FilterPopover.svelte index 871b1a699e..f76564b087 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/FilterPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/FilterPopover.svelte @@ -168,7 +168,9 @@ {/if}