{#if Object.keys(blockRefs).length} {#each blocks as block, idx (block.id)} @@ -179,9 +179,6 @@ display: flex; flex-direction: column; align-items: center; - max-height: 100%; - height: 100%; - width: 100%; } .header-left { @@ -221,15 +218,26 @@ display: flex; justify-content: space-between; align-items: center; - padding-left: var(--spacing-l); - transition: background 130ms ease-out; + padding: var(--spacing-l); flex: 0 0 60px; padding-right: var(--spacing-xl); + position: absolute; + width: 100%; + box-sizing: border-box; + pointer-events: none; + } + + .header > * { + pointer-events: auto; } .controls { display: flex; - gap: var(--spacing-xl); + gap: var(--spacing-l); + } + + .controls .toggle-active :global(.spectrum-Switch-label) { + margin-right: 0px; } .buttons { @@ -243,11 +251,6 @@ cursor: pointer; } - .disabled { - pointer-events: none; - color: var(--spectrum-global-color-gray-500) !important; - } - .group { border-radius: 4px; display: flex; diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index f55feb97ed..0e5a932aa0 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -51,8 +51,13 @@ if (!blockEle) { return } - const { width, height } = blockEle.getBoundingClientRect() - blockDims = { width: width / $view.scale, height: height / $view.scale } + const { width, height, top, left } = blockEle.getBoundingClientRect() + blockDims = { + width: width / $view.scale, + height: height / $view.scale, + top, + left, + } } const loadSteps = blockRef => { @@ -174,12 +179,21 @@ e.stopPropagation() + updateBlockDims() + + const { clientX, clientY } = e view.update(state => ({ ...state, moveStep: { id: block.id, offsetX: $pos.x, offsetY: $pos.y, + w: blockDims.width, + h: blockDims.height, + mouse: { + x: Math.max(Math.round(clientX - blockDims.left), 0), + y: Math.max(Math.round(clientY - blockDims.top), 0), + }, }, })) } @@ -386,6 +400,7 @@ width: 480px; font-size: 16px; border-radius: 4px; + cursor: default; } .block .wrap { width: 100%; diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemActions.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemActions.svelte index 1542c65650..e3014f3e56 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemActions.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemActions.svelte @@ -47,5 +47,6 @@ display: flex; gap: var(--spacing-m); padding: 8px 12px; + cursor: default; } diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/StepNode.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/StepNode.svelte index 4132cf3516..a320973333 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/StepNode.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/StepNode.svelte @@ -50,9 +50,12 @@ // Register the trigger as the focus element for the automation // Onload, the canvas will use the dimensions to center the step if (stepEle && step.type === "TRIGGER" && !$view.focusEle) { + const { width, height, left, right, top, bottom, x, y } = + stepEle.getBoundingClientRect() + view.update(state => ({ ...state, - focusEle: stepEle.getBoundingClientRect(), + focusEle: { width, height, left, right, top, bottom, x, y }, })) } }) diff --git a/packages/builder/src/stores/builder/automations.js b/packages/builder/src/stores/builder/automations.js index e6a27f5dcc..771ae97cf8 100644 --- a/packages/builder/src/stores/builder/automations.js +++ b/packages/builder/src/stores/builder/automations.js @@ -78,6 +78,27 @@ const automationActions = store => ({ * @param {Object} automation the automaton to be mutated */ moveBlock: async (sourcePath, destPath, automation) => { + // The last part of the source node address, containing the id. + const pathSource = sourcePath.at(-1) + + // The last part of the destination node address, containing the id. + const pathEnd = destPath.at(-1) + + // Check if dragging a step into its own drag zone + const isOwnDragzone = pathSource.id === pathEnd.id + + // Check if dragging the first branch step into the branch node drag zone + const isFirstBranchStep = + pathEnd.branchStepId && + pathEnd.branchIdx === pathSource.branchIdx && + pathSource.stepIdx === 0 + + // If dragging into an area that will not affect the tree structure + // Ignore the drag and drop. + if (isOwnDragzone || isFirstBranchStep) { + return + } + // Use core delete to remove and return the deleted block // from the automation const { deleted, newAutomation } = store.actions.deleteBlock( @@ -90,9 +111,6 @@ const automationActions = store => ({ const newRefs = {} store.actions.traverse(newRefs, newAutomation) - // The last part of the destination node address, containing the id. - const pathEnd = destPath.at(-1) - let finalPath // If dropping in a branch-step dropzone you need to find // the updated parent step route then add the branch details again diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte index 1610f36bdc..2840d82f47 100644 --- a/packages/client/src/components/ClientApp.svelte +++ b/packages/client/src/components/ClientApp.svelte @@ -2,7 +2,7 @@ import { writable, get } from "svelte/store" import { setContext, onMount } from "svelte" import { Layout, Heading, Body } from "@budibase/bbui" - import ErrorSVG from "@budibase/frontend-core/assets/error.svg" + import ErrorSVG from "@budibase/frontend-core/assets/error.svg?raw" import { Constants, CookieUtils } from "@budibase/frontend-core" import { getThemeClassNames } from "@budibase/shared-core" import Component from "./Component.svelte" diff --git a/packages/server/src/api/controllers/permission.ts b/packages/server/src/api/controllers/permission.ts index 2ef197dbca..e38c736c20 100644 --- a/packages/server/src/api/controllers/permission.ts +++ b/packages/server/src/api/controllers/permission.ts @@ -9,7 +9,7 @@ import { RemovePermissionRequest, RemovePermissionResponse, FetchResourcePermissionInfoResponse, - FetchBuiltinPermissionsRequest, + FetchBuiltinPermissionsResponse, FetchPermissionLevelsRequest, } from "@budibase/types" import { @@ -22,7 +22,7 @@ import { PermissionUpdateType } from "../../sdk/app/permissions" const SUPPORTED_LEVELS = CURRENTLY_SUPPORTED_LEVELS export function fetchBuiltin( - ctx: UserCtx + ctx: UserCtx ) { ctx.body = Object.values(permissions.getBuiltinPermissions()) } diff --git a/packages/types/src/api/web/app/permission.ts b/packages/types/src/api/web/app/permission.ts index 1a19fb0834..407dc2be86 100644 --- a/packages/types/src/api/web/app/permission.ts +++ b/packages/types/src/api/web/app/permission.ts @@ -1,6 +1,6 @@ import { BuiltinPermission, PermissionLevel } from "../../../sdk" -export type FetchBuiltinPermissionsRequest = BuiltinPermission[] +export type FetchBuiltinPermissionsResponse = BuiltinPermission[] export type FetchPermissionLevelsRequest = string[] diff --git a/packages/types/src/api/web/global/self.ts b/packages/types/src/api/web/global/self.ts index 4ba51d2cd5..5f21a8ddc5 100644 --- a/packages/types/src/api/web/global/self.ts +++ b/packages/types/src/api/web/global/self.ts @@ -1,7 +1,7 @@ import { DevInfo, User } from "../../../documents" export interface GenerateAPIKeyRequest { - userId: string + userId?: string } export interface GenerateAPIKeyResponse extends DevInfo {} diff --git a/packages/types/src/documents/app/app.ts b/packages/types/src/documents/app/app.ts index 06fca8307c..e31dd1e9ac 100644 --- a/packages/types/src/documents/app/app.ts +++ b/packages/types/src/documents/app/app.ts @@ -28,6 +28,7 @@ export interface App extends Document { upgradableVersion?: string snippets?: Snippet[] creationVersion?: string + updatedBy?: string } export interface AppInstance {