Fix to ensure events are ignored when the viewport isnt initialised. Add a delete confirmation for branches
This commit is contained in:
parent
30a3013e7f
commit
79970ae07d
|
@ -211,6 +211,10 @@
|
|||
|
||||
// Optimization options
|
||||
const onViewMouseMove = async e => {
|
||||
if (!viewPort) {
|
||||
return
|
||||
}
|
||||
|
||||
const { x, y } = eleXY(e, viewPort)
|
||||
|
||||
internalPos.update(() => ({
|
||||
|
@ -225,25 +229,6 @@
|
|||
y: y - dragOffset[1],
|
||||
}))
|
||||
}
|
||||
|
||||
// Needs to handle when the mouse leaves the screen
|
||||
// Needs to know the direction of movement and accelerate/decelerate
|
||||
if (y < (viewDims.height / 100) * 20 && $view.dragging) {
|
||||
// if (!scrollInterval) {
|
||||
// scrollInterval = setInterval(() => {
|
||||
// contentPos.update(state => ({
|
||||
// ...state,
|
||||
// x: contentPos.x,
|
||||
// y: contentPos.y + 35,
|
||||
// }))
|
||||
// }, 100)
|
||||
// }
|
||||
// } else {
|
||||
// if (scrollInterval) {
|
||||
// clearInterval(scrollInterval)
|
||||
// scrollInterval = undefined
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
const onViewDragEnd = () => {
|
||||
|
@ -288,6 +273,9 @@
|
|||
}
|
||||
|
||||
const onMouseMove = async e => {
|
||||
if (!viewPort) {
|
||||
return
|
||||
}
|
||||
// Update viewDims to get the latest viewport dimensions
|
||||
viewDims = viewPort.getBoundingClientRect()
|
||||
|
||||
|
@ -345,7 +333,7 @@
|
|||
}
|
||||
|
||||
const onMoveContent = e => {
|
||||
if (down) {
|
||||
if (down || !viewPort) {
|
||||
return
|
||||
}
|
||||
const { x, y } = eleXY(e, viewPort)
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
TooltipPosition,
|
||||
TooltipType,
|
||||
Button,
|
||||
Modal,
|
||||
ModalContent,
|
||||
} from "@budibase/bbui"
|
||||
import PropField from "components/automation/SetupPanel/PropField.svelte"
|
||||
import AutomationBindingPanel from "components/common/bindings/ServerBindingPanel.svelte"
|
||||
|
@ -36,6 +38,7 @@
|
|||
let drawer
|
||||
let condition
|
||||
let open = true
|
||||
let confirmDeleteModal
|
||||
|
||||
$: branch = step.inputs?.branches?.[branchIdx]
|
||||
$: editableConditionUI = cloneDeep(branch.conditionUI || {})
|
||||
|
@ -55,6 +58,22 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:this={confirmDeleteModal}>
|
||||
<ModalContent
|
||||
size="M"
|
||||
title={"Are you sure you want to delete?"}
|
||||
confirmText="Delete"
|
||||
onConfirm={async () => {
|
||||
await automationStore.actions.deleteBranch(
|
||||
branchBlockRef.pathTo,
|
||||
$selectedAutomation.data
|
||||
)
|
||||
}}
|
||||
>
|
||||
<Body>By deleting this branch, you will delete all of its contents.</Body>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
|
||||
<Drawer bind:this={drawer} title="Branch condition" forceModal>
|
||||
<Button
|
||||
cta
|
||||
|
@ -101,10 +120,15 @@
|
|||
itemName={branch.name}
|
||||
block={step}
|
||||
deleteStep={async () => {
|
||||
await automationStore.actions.deleteBranch(
|
||||
branchBlockRef.pathTo,
|
||||
$selectedAutomation.data
|
||||
)
|
||||
const branchSteps = step.inputs?.children[branch.id]
|
||||
if (branchSteps.length) {
|
||||
confirmDeleteModal.show()
|
||||
} else {
|
||||
await automationStore.actions.deleteBranch(
|
||||
branchBlockRef.pathTo,
|
||||
$selectedAutomation.data
|
||||
)
|
||||
}
|
||||
}}
|
||||
on:update={async e => {
|
||||
let stepUpdate = cloneDeep(step)
|
||||
|
|
Loading…
Reference in New Issue