Bug fixes
This commit is contained in:
parent
11d24db255
commit
0c4df817bf
|
@ -9,6 +9,7 @@
|
||||||
Tags,
|
Tags,
|
||||||
Tag,
|
Tag,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
|
import { AutomationActionStepId } from "@budibase/types"
|
||||||
import { automationStore, selectedAutomation } from "stores/builder"
|
import { automationStore, selectedAutomation } from "stores/builder"
|
||||||
import { admin, licensing } from "stores/portal"
|
import { admin, licensing } from "stores/portal"
|
||||||
import { externalActions } from "./ExternalActions"
|
import { externalActions } from "./ExternalActions"
|
||||||
|
@ -21,7 +22,12 @@
|
||||||
let triggerAutomationRunEnabled = $licensing.triggerAutomationRunEnabled
|
let triggerAutomationRunEnabled = $licensing.triggerAutomationRunEnabled
|
||||||
let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK]
|
let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK]
|
||||||
let selectedAction
|
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 = [
|
let lockedFeatures = [
|
||||||
ActionStepID.COLLECT,
|
ActionStepID.COLLECT,
|
||||||
ActionStepID.TRIGGER_AUTOMATION_RUN,
|
ActionStepID.TRIGGER_AUTOMATION_RUN,
|
||||||
|
|
|
@ -45,12 +45,18 @@
|
||||||
let role
|
let role
|
||||||
let blockEle
|
let blockEle
|
||||||
let positionStyles
|
let positionStyles
|
||||||
|
let blockDims
|
||||||
|
|
||||||
|
const updateBlockDims = () => {
|
||||||
|
blockDims = blockEle?.getBoundingClientRect()
|
||||||
|
}
|
||||||
|
|
||||||
const loadSteps = blockRef => {
|
const loadSteps = blockRef => {
|
||||||
return blockRef
|
return blockRef
|
||||||
? automationStore.actions.getPathSteps(blockRef.pathTo, automation)
|
? automationStore.actions.getPathSteps(blockRef.pathTo, automation)
|
||||||
: []
|
: []
|
||||||
}
|
}
|
||||||
|
|
||||||
$: pathSteps = loadSteps(blockRef)
|
$: pathSteps = loadSteps(blockRef)
|
||||||
|
|
||||||
$: collectBlockExists = pathSteps.some(
|
$: collectBlockExists = pathSteps.some(
|
||||||
|
@ -74,8 +80,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$: selected = $view?.moveStep && $view?.moveStep?.id === block.id
|
$: selected = $view?.moveStep && $view?.moveStep?.id === block.id
|
||||||
$: blockDims = blockEle?.getBoundingClientRect()
|
|
||||||
$: placeholderDims = buildPlaceholderStyles(blockDims)
|
$: {
|
||||||
|
selected, updateBlockDims()
|
||||||
|
}
|
||||||
|
|
||||||
|
$: placeholderDims = buildPlaceholderStyles(blockDims, selected)
|
||||||
|
|
||||||
// Move the selected item
|
// Move the selected item
|
||||||
// Listen for scrolling in the content. As its scrolled this will be updated
|
// Listen for scrolling in the content. As its scrolled this will be updated
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
let editing = false
|
let editing = false
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
$: blockRefs = $selectedAutomation.blockRefs || {}
|
||||||
$: stepNames = automation?.definition.stepNames
|
$: stepNames = automation?.definition.stepNames
|
||||||
$: allSteps = automation?.definition.steps || []
|
$: allSteps = automation?.definition.steps || []
|
||||||
$: automationName = itemName || stepNames?.[block.id] || block?.name || ""
|
$: automationName = itemName || stepNames?.[block.id] || block?.name || ""
|
||||||
|
@ -37,11 +38,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: blockRef = $selectedAutomation.blockRefs[block.id]
|
$: blockRef = blockRefs[block.id]
|
||||||
$: isLooped = blockRef?.looped
|
$: isLooped = blockRef?.looped
|
||||||
|
|
||||||
async function onSelect(block) {
|
async function onSelect(block) {
|
||||||
await automationStore.update(state => {
|
automationStore.update(state => {
|
||||||
state.selectedBlock = block
|
state.selectedBlock = block
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
import FlowItemHeader from "./FlowChart/FlowItemHeader.svelte"
|
import FlowItemHeader from "./FlowChart/FlowItemHeader.svelte"
|
||||||
import { ActionStepID } from "constants/backend/automations"
|
import { ActionStepID } from "constants/backend/automations"
|
||||||
import { JsonView } from "@zerodevx/svelte-json-view"
|
import { JsonView } from "@zerodevx/svelte-json-view"
|
||||||
import { automationStore, selectedAutomation } from "stores/builder"
|
import { automationStore } from "stores/builder"
|
||||||
import { AutomationActionStepId } from "@budibase/types"
|
import { AutomationActionStepId } from "@budibase/types"
|
||||||
|
|
||||||
export let automation
|
export let automation
|
||||||
|
export let automationBlockRefs = {}
|
||||||
export let testResults
|
export let testResults
|
||||||
|
|
||||||
let openBlocks = {}
|
let openBlocks = {}
|
||||||
|
@ -39,18 +40,18 @@
|
||||||
$: filteredResults = prepTestResults(testResults)
|
$: filteredResults = prepTestResults(testResults)
|
||||||
$: {
|
$: {
|
||||||
if (testResults.message) {
|
if (testResults.message) {
|
||||||
blocks = automation?.definition?.trigger
|
const trigger = automation?.definition?.trigger
|
||||||
? [automation.definition.trigger]
|
blocks = trigger ? [trigger] : []
|
||||||
: []
|
|
||||||
} else if (automation) {
|
} else if (automation) {
|
||||||
const terminatingStep = filteredResults.at(-1)
|
const terminatingStep = filteredResults.at(-1)
|
||||||
const terminatingBlockRef =
|
const terminatingBlockRef = automationBlockRefs[terminatingStep.id]
|
||||||
$selectedAutomation.blockRefs[terminatingStep.id]
|
if (terminatingBlockRef) {
|
||||||
const pathSteps = automationStore.actions.getPathSteps(
|
const pathSteps = automationStore.actions.getPathSteps(
|
||||||
terminatingBlockRef.pathTo,
|
terminatingBlockRef.pathTo,
|
||||||
automation
|
automation
|
||||||
)
|
)
|
||||||
blocks = [...pathSteps].filter(x => x.stepId !== ActionStepID.LOOP)
|
blocks = [...pathSteps].filter(x => x.stepId !== ActionStepID.LOOP)
|
||||||
|
}
|
||||||
} else if (filteredResults) {
|
} else if (filteredResults) {
|
||||||
blocks = filteredResults || []
|
blocks = filteredResults || []
|
||||||
// make sure there is an ID for each block being displayed
|
// make sure there is an ID for each block being displayed
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { Icon, Divider } from "@budibase/bbui"
|
import { Icon, Divider } from "@budibase/bbui"
|
||||||
import TestDisplay from "./TestDisplay.svelte"
|
import TestDisplay from "./TestDisplay.svelte"
|
||||||
import { automationStore } from "stores/builder"
|
import { automationStore, selectedAutomation } from "stores/builder"
|
||||||
|
|
||||||
export let automation
|
export let automation
|
||||||
</script>
|
</script>
|
||||||
|
@ -24,7 +24,11 @@
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<TestDisplay {automation} testResults={$automationStore.testResults} />
|
<TestDisplay
|
||||||
|
{automation}
|
||||||
|
testResults={$automationStore.testResults}
|
||||||
|
automationBlockRefs={$selectedAutomation.blockRefs}
|
||||||
|
/>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.title {
|
.title {
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
{#key history}
|
{#key history}
|
||||||
<div class="history">
|
<div class="history">
|
||||||
<TestDisplay testResults={history} width="320px" />
|
<TestDisplay testResults={history} />
|
||||||
</div>
|
</div>
|
||||||
{/key}
|
{/key}
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -65,6 +65,14 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.history :global(.block) {
|
||||||
|
min-width: unset;
|
||||||
|
}
|
||||||
|
.history :global(> .container) {
|
||||||
|
max-width: 320px;
|
||||||
|
width: 320px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
.controls {
|
.controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--spacing-s);
|
gap: var(--spacing-s);
|
||||||
|
@ -76,7 +84,4 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.history {
|
|
||||||
margin: 0 -30px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -559,13 +559,6 @@ const automationActions = store => ({
|
||||||
: pathBlock.icon
|
: pathBlock.icon
|
||||||
|
|
||||||
if (blockIdx === 0 && isTrigger) {
|
if (blockIdx === 0 && isTrigger) {
|
||||||
schema = Object.fromEntries(
|
|
||||||
Object.keys(pathBlock.inputs.fields || []).map(key => [
|
|
||||||
key,
|
|
||||||
{ type: pathBlock.inputs.fields[key] },
|
|
||||||
])
|
|
||||||
)
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pathBlock.event === AutomationEventType.ROW_UPDATE ||
|
pathBlock.event === AutomationEventType.ROW_UPDATE ||
|
||||||
pathBlock.event === AutomationEventType.ROW_SAVE
|
pathBlock.event === AutomationEventType.ROW_SAVE
|
||||||
|
@ -582,6 +575,13 @@ const automationActions = store => ({
|
||||||
}
|
}
|
||||||
// remove the original binding
|
// remove the original binding
|
||||||
delete schema.row
|
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] },
|
||||||
|
])
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue