diff --git a/lerna.json b/lerna.json index 33b8ef3fc1..2f8752d390 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.1.22-alpha.0", + "version": "1.1.25-alpha.0", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 7aab95245c..8ac9dfbb25 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.1.22-alpha.0", + "version": "1.1.25-alpha.0", "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.1.22-alpha.0", + "@budibase/types": "^1.1.25-alpha.0", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/backend-core/src/cache/writethrough.ts b/packages/backend-core/src/cache/writethrough.ts index e11ca0acaa..ec6b1604c8 100644 --- a/packages/backend-core/src/cache/writethrough.ts +++ b/packages/backend-core/src/cache/writethrough.ts @@ -1,5 +1,6 @@ import BaseCache from "./base" import { getWritethroughClient } from "../redis/init" +import { logWarn } from "../logging" const DEFAULT_WRITE_RATE_MS = 10000 let CACHE: BaseCache | null = null @@ -51,10 +52,8 @@ export async function put( if (err.status !== 409) { throw err } else { - // get the rev, update over it - this is risky, may change in future - const readDoc = await db.get(doc._id) - doc._rev = readDoc._rev - await writeDb(doc) + // Swallow 409s but log them + logWarn(`Ignoring conflict in write-through cache`) } } } diff --git a/packages/backend-core/src/logging.ts b/packages/backend-core/src/logging.ts index 68c3307b2f..8eda15ac79 100644 --- a/packages/backend-core/src/logging.ts +++ b/packages/backend-core/src/logging.ts @@ -15,6 +15,11 @@ export function logAlert(message: string, e?: any) { console.error(`bb-alert: ${message} ${errorJson}`) } +export function logWarn(message: string) { + console.warn(`bb-warn: ${message}`) +} + export default { logAlert, + logWarn, } diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 80489d5b9a..7108ceaa29 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.1.22-alpha.0", + "version": "1.1.25-alpha.0", "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.1.22-alpha.0", + "@budibase/string-templates": "^1.1.25-alpha.0", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/bbui/src/Tooltip/Tooltip.svelte b/packages/bbui/src/Tooltip/Tooltip.svelte index 50a3242d1e..ea511b0060 100644 --- a/packages/bbui/src/Tooltip/Tooltip.svelte +++ b/packages/bbui/src/Tooltip/Tooltip.svelte @@ -26,5 +26,9 @@ diff --git a/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js b/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js index 562e1e149f..d6a49fe54e 100644 --- a/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js +++ b/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js @@ -57,6 +57,7 @@ filterTests(["smoke", "all"], () => { cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000}) cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click() cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).contains("bbuser").click() + cy.get(interact.SPECTRUM_HEADING).contains("bbuser", { timeout: 2000}) for (let i = 0; i < 3; i++) { cy.get(interact.SPECTRUM_TABLE, { timeout: 3000}) .eq(1) diff --git a/packages/builder/cypress/integration/revertApp.spec.js b/packages/builder/cypress/integration/revertApp.spec.js index 006b6854ba..9a3d17f7c3 100644 --- a/packages/builder/cypress/integration/revertApp.spec.js +++ b/packages/builder/cypress/integration/revertApp.spec.js @@ -15,7 +15,7 @@ filterTests(['smoke', 'all'], () => { }) cy.get(interact.SPECTRUM_MODAL).within(() => { // Enter app name before revert - cy.get("input").type("Cypress Tests") + cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("Cypress Tests") cy.intercept('**/revert').as('revertApp') // Click Revert cy.get(interact.SPECTRUM_BUTTON).contains("Revert").click({ force: true }) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index cc92ca280a..16381a8336 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -289,7 +289,7 @@ Cypress.Commands.add("updateAppName", (changedName, noName) => { }) Cypress.Commands.add("publishApp", resolvedAppPath => { - //Assumes you have navigated to an application first + // Assumes you have navigated to an application first cy.get(".toprightnav button.spectrum-Button") .contains("Publish") .click({ force: true }) @@ -301,7 +301,7 @@ Cypress.Commands.add("publishApp", resolvedAppPath => { cy.wait(1000) }) - //Verify that the app url is presented correctly to the user + // Verify that the app url is presented correctly to the user cy.get(".spectrum-Modal [data-cy='deploy-app-success-modal']") .should("be.visible") .within(() => { @@ -514,7 +514,8 @@ Cypress.Commands.add("searchAndAddComponent", component => { cy.get(".spectrum-Button").contains("Component").click({ force: true }) // Search and add component - cy.get(".spectrum-Textfield-input").wait(500).clear().type(component) + cy.wait(500) + cy.get(".spectrum-Textfield-input").clear().type(component) cy.get(".body").within(() => { cy.get(".component") .contains(new RegExp("^" + component + "$"), { timeout: 3000 }) diff --git a/packages/builder/cypress/support/interact.js b/packages/builder/cypress/support/interact.js index b96e2692b4..3f2f348847 100644 --- a/packages/builder/cypress/support/interact.js +++ b/packages/builder/cypress/support/interact.js @@ -108,6 +108,7 @@ export const CONTAINER = ".container" export const REGENERATE = ".regenerate" export const SPECTRUM_DIALOG_CONTENT = ".spectrum-Dialog-content" export const SPECTRUM_ICON = ".spectrum-Icon" +export const SPECTRUM_HEADING = ".spectrum-Heading" //createView export const SPECTRUM_MENU_ITEM_LABEL = ".spectrum-Menu-itemLabel" diff --git a/packages/builder/package.json b/packages/builder/package.json index 093dddbf50..f8adacda62 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.1.22-alpha.0", + "version": "1.1.25-alpha.0", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.1.22-alpha.0", - "@budibase/client": "^1.1.22-alpha.0", - "@budibase/frontend-core": "^1.1.22-alpha.0", - "@budibase/string-templates": "^1.1.22-alpha.0", + "@budibase/bbui": "^1.1.25-alpha.0", + "@budibase/client": "^1.1.25-alpha.0", + "@budibase/frontend-core": "^1.1.25-alpha.0", + "@budibase/string-templates": "^1.1.25-alpha.0", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/src/builderStore/store/theme.js b/packages/builder/src/builderStore/store/theme.js index bd3a149d63..54323ba55f 100644 --- a/packages/builder/src/builderStore/store/theme.js +++ b/packages/builder/src/builderStore/store/theme.js @@ -1,11 +1,10 @@ -import { createLocalStorageStore } from "@budibase/frontend-core" +import { Constants, createLocalStorageStore } from "@budibase/frontend-core" export const getThemeStore = () => { const themeElement = document.documentElement const initialValue = { theme: "darkest", - options: ["lightest", "light", "dark", "darkest", "nord"], } const store = createLocalStorageStore("bb-theme", initialValue) @@ -17,11 +16,14 @@ export const getThemeStore = () => { return } - state.options.forEach(option => { + Constants.ThemeOptions.forEach(option => { themeElement.classList.toggle( `spectrum--${option}`, option === state.theme ) + + // Ensure darkest is always added as this is the base class for custom + // themes themeElement.classList.add("spectrum--darkest") }) }) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 412683721f..c1618a890f 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -52,8 +52,9 @@ x => x.blockToLoop === block.id ) - $: setPermissions(role) - $: getPermissions(automationId) + $: isAppAction = block?.stepId === TriggerStepID.APP + $: isAppAction && setPermissions(role) + $: isAppAction && getPermissions(automationId) async function setPermissions(role) { if (!role || !automationId) { @@ -238,7 +239,7 @@ {/if} - {#if block.stepId === TriggerStepID.APP} + {#if isAppAction} {/if} diff --git a/packages/builder/src/main.js b/packages/builder/src/main.js index bc5ec4f009..dc1e1cf1bf 100644 --- a/packages/builder/src/main.js +++ b/packages/builder/src/main.js @@ -5,6 +5,8 @@ import "@spectrum-css/vars/dist/spectrum-darkest.css" import "@spectrum-css/vars/dist/spectrum-dark.css" import "@spectrum-css/vars/dist/spectrum-light.css" import "@spectrum-css/vars/dist/spectrum-lightest.css" +import "@budibase/frontend-core/src/themes/nord.css" +import "@budibase/frontend-core/src/themes/midnight.css" import "@spectrum-css/page/dist/index-vars.css" import "./global.css" import { suppressWarnings } from "./helpers/warnings" diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte index 5b86d4da29..1bb4e3d9cd 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte @@ -9,6 +9,7 @@ import { setContext } from "svelte" import DNDPositionIndicator from "./DNDPositionIndicator.svelte" import { DropPosition } from "./dndStore" + import { notifications } from "@budibase/bbui" let scrollRef @@ -55,6 +56,15 @@ }) } + const onDrop = async () => { + try { + await dndStore.actions.drop() + } catch (error) { + console.error(error) + notifications.error("Error saving component") + } + } + // Set scroll context so components can invoke scrolling when selected setContext("scroll", { scrollTo, @@ -83,6 +93,7 @@ opened scrollable icon="WebPage" + on:drop={onDrop} > diff --git a/packages/builder/src/pages/builder/portal/overview/[application]/index.svelte b/packages/builder/src/pages/builder/portal/overview/[application]/index.svelte index 63df464630..7fa878e54a 100644 --- a/packages/builder/src/pages/builder/portal/overview/[application]/index.svelte +++ b/packages/builder/src/pages/builder/portal/overview/[application]/index.svelte @@ -140,9 +140,10 @@ notifications.success("App ID copied to clipboard.") } - const exportApp = app => { - const id = isPublished ? app.prodId : app.devId + const exportApp = (app, opts = { published: false }) => { const appName = encodeURIComponent(app.name) + const id = opts?.published ? app.prodId : app.devId + // always export the development version window.location = `/api/backups/export?appId=${id}&appname=${appName}` } @@ -267,12 +268,21 @@ - exportApp(selectedApp)} icon="Download"> - Export + exportApp(selectedApp, { published: false })} + icon="DownloadFromCloud" + > + Export latest {#if isPublished} + exportApp(selectedApp, { published: true })} + icon="DownloadFromCloudOutline" + > + Export published + copyAppId(selectedApp)} icon="Copy"> - Copy App ID + Copy app ID {/if} {#if !isPublished} diff --git a/packages/builder/src/pages/builder/portal/settings/theming.svelte b/packages/builder/src/pages/builder/portal/settings/theming.svelte index 2a2aaa8a3b..2a8e82f0e5 100644 --- a/packages/builder/src/pages/builder/portal/settings/theming.svelte +++ b/packages/builder/src/pages/builder/portal/settings/theming.svelte @@ -2,6 +2,7 @@ import { Layout, Heading, Body, Divider, Label, Select } from "@budibase/bbui" import { themeStore } from "builderStore" import { capitalise } from "helpers" + import { Constants } from "@budibase/frontend-core" @@ -14,7 +15,7 @@