Bug fixes

This commit is contained in:
Dean 2024-10-28 12:46:45 +00:00
parent 11d24db255
commit 0c4df817bf
7 changed files with 56 additions and 29 deletions

View File

@ -9,6 +9,7 @@
Tags,
Tag,
} from "@budibase/bbui"
import { AutomationActionStepId } from "@budibase/types"
import { automationStore, selectedAutomation } from "stores/builder"
import { admin, licensing } from "stores/portal"
import { externalActions } from "./ExternalActions"
@ -21,7 +22,12 @@
let triggerAutomationRunEnabled = $licensing.triggerAutomationRunEnabled
let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK]
let selectedAction
let actions = Object.entries($automationStore.blockDefinitions.ACTION)
let actions = Object.entries($automationStore.blockDefinitions.ACTION).filter(
entry => {
const [key] = entry
return key !== AutomationActionStepId.BRANCH
}
)
let lockedFeatures = [
ActionStepID.COLLECT,
ActionStepID.TRIGGER_AUTOMATION_RUN,

View File

@ -45,12 +45,18 @@
let role
let blockEle
let positionStyles
let blockDims
const updateBlockDims = () => {
blockDims = blockEle?.getBoundingClientRect()
}
const loadSteps = blockRef => {
return blockRef
? automationStore.actions.getPathSteps(blockRef.pathTo, automation)
: []
}
$: pathSteps = loadSteps(blockRef)
$: collectBlockExists = pathSteps.some(
@ -74,8 +80,12 @@
}
$: selected = $view?.moveStep && $view?.moveStep?.id === block.id
$: blockDims = blockEle?.getBoundingClientRect()
$: placeholderDims = buildPlaceholderStyles(blockDims)
$: {
selected, updateBlockDims()
}
$: placeholderDims = buildPlaceholderStyles(blockDims, selected)
// Move the selected item
// Listen for scrolling in the content. As its scrolled this will be updated

View File

@ -21,6 +21,7 @@
let editing = false
const dispatch = createEventDispatcher()
$: blockRefs = $selectedAutomation.blockRefs || {}
$: stepNames = automation?.definition.stepNames
$: allSteps = automation?.definition.steps || []
$: automationName = itemName || stepNames?.[block.id] || block?.name || ""
@ -37,11 +38,11 @@
}
}
$: blockRef = $selectedAutomation.blockRefs[block.id]
$: blockRef = blockRefs[block.id]
$: isLooped = blockRef?.looped
async function onSelect(block) {
await automationStore.update(state => {
automationStore.update(state => {
state.selectedBlock = block
return state
})

View File

@ -3,10 +3,11 @@
import FlowItemHeader from "./FlowChart/FlowItemHeader.svelte"
import { ActionStepID } from "constants/backend/automations"
import { JsonView } from "@zerodevx/svelte-json-view"
import { automationStore, selectedAutomation } from "stores/builder"
import { automationStore } from "stores/builder"
import { AutomationActionStepId } from "@budibase/types"
export let automation
export let automationBlockRefs = {}
export let testResults
let openBlocks = {}
@ -39,18 +40,18 @@
$: filteredResults = prepTestResults(testResults)
$: {
if (testResults.message) {
blocks = automation?.definition?.trigger
? [automation.definition.trigger]
: []
const trigger = automation?.definition?.trigger
blocks = trigger ? [trigger] : []
} else if (automation) {
const terminatingStep = filteredResults.at(-1)
const terminatingBlockRef =
$selectedAutomation.blockRefs[terminatingStep.id]
const pathSteps = automationStore.actions.getPathSteps(
terminatingBlockRef.pathTo,
automation
)
blocks = [...pathSteps].filter(x => x.stepId !== ActionStepID.LOOP)
const terminatingBlockRef = automationBlockRefs[terminatingStep.id]
if (terminatingBlockRef) {
const pathSteps = automationStore.actions.getPathSteps(
terminatingBlockRef.pathTo,
automation
)
blocks = [...pathSteps].filter(x => x.stepId !== ActionStepID.LOOP)
}
} else if (filteredResults) {
blocks = filteredResults || []
// make sure there is an ID for each block being displayed

View File

@ -1,7 +1,7 @@
<script>
import { Icon, Divider } from "@budibase/bbui"
import TestDisplay from "./TestDisplay.svelte"
import { automationStore } from "stores/builder"
import { automationStore, selectedAutomation } from "stores/builder"
export let automation
</script>
@ -24,7 +24,11 @@
<Divider />
<TestDisplay {automation} testResults={$automationStore.testResults} />
<TestDisplay
{automation}
testResults={$automationStore.testResults}
automationBlockRefs={$selectedAutomation.blockRefs}
/>
<style>
.title {

View File

@ -56,7 +56,7 @@
{/if}
{#key history}
<div class="history">
<TestDisplay testResults={history} width="320px" />
<TestDisplay testResults={history} />
</div>
{/key}
</Layout>
@ -65,6 +65,14 @@
{/if}
<style>
.history :global(.block) {
min-width: unset;
}
.history :global(> .container) {
max-width: 320px;
width: 320px;
padding: 0px;
}
.controls {
display: flex;
gap: var(--spacing-s);
@ -76,7 +84,4 @@
width: 100%;
justify-content: center;
}
.history {
margin: 0 -30px;
}
</style>

View File

@ -559,13 +559,6 @@ const automationActions = store => ({
: pathBlock.icon
if (blockIdx === 0 && isTrigger) {
schema = Object.fromEntries(
Object.keys(pathBlock.inputs.fields || []).map(key => [
key,
{ type: pathBlock.inputs.fields[key] },
])
)
if (
pathBlock.event === AutomationEventType.ROW_UPDATE ||
pathBlock.event === AutomationEventType.ROW_SAVE
@ -582,6 +575,13 @@ const automationActions = store => ({
}
// remove the original binding
delete schema.row
} else if (pathBlock.event === AutomationEventType.APP_TRIGGER) {
schema = Object.fromEntries(
Object.keys(pathBlock.inputs.fields || []).map(key => [
key,
{ type: pathBlock.inputs.fields[key] },
])
)
}
}