tidy up and issues found in testing
This commit is contained in:
parent
9838c7ad02
commit
81ca48a331
|
@ -22,9 +22,8 @@ export const getAutomationStore = () => {
|
||||||
return store
|
return store
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateReferencesInObject(obj, modifiedIndex, action) {
|
const updateReferencesInObject = (obj, modifiedIndex, action) => {
|
||||||
const regex = /{{\s*steps\.(\d+)\./g
|
const regex = /{{\s*steps\.(\d+)\./g
|
||||||
|
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
if (typeof obj[key] === "string") {
|
if (typeof obj[key] === "string") {
|
||||||
let matches
|
let matches
|
||||||
|
@ -48,7 +47,7 @@ function updateReferencesInObject(obj, modifiedIndex, action) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateStepReferences(steps, modifiedIndex, action) {
|
const updateStepReferences = (steps, modifiedIndex, action) => {
|
||||||
steps.forEach(step => {
|
steps.forEach(step => {
|
||||||
updateReferencesInObject(step.inputs, modifiedIndex, action)
|
updateReferencesInObject(step.inputs, modifiedIndex, action)
|
||||||
})
|
})
|
||||||
|
@ -296,7 +295,7 @@ const automationActions = store => ({
|
||||||
newAutomation.definition.steps = newAutomation.definition.steps.filter(
|
newAutomation.definition.steps = newAutomation.definition.steps.filter(
|
||||||
step => step.id !== block.id
|
step => step.id !== block.id
|
||||||
)
|
)
|
||||||
delete newAutomation.definition.stepNames[block.id]
|
delete newAutomation.definition.stepNames?.[block.id]
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
updateStepReferences(newAutomation.definition.steps, blockIdx, "delete")
|
updateStepReferences(newAutomation.definition.steps, blockIdx, "delete")
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
let testDataModal
|
let testDataModal
|
||||||
let confirmDeleteDialog
|
let confirmDeleteDialog
|
||||||
let scrolling = false
|
let scrolling = false
|
||||||
$: blocks = getBlocks(automation)
|
$: blocks = getBlocks(automation).filter(x => x.stepId !== ActionStepID.LOOP)
|
||||||
|
|
||||||
const getBlocks = automation => {
|
const getBlocks = automation => {
|
||||||
let blocks = []
|
let blocks = []
|
||||||
if (automation.definition.trigger) {
|
if (automation.definition.trigger) {
|
||||||
|
@ -138,9 +137,9 @@
|
||||||
|
|
||||||
.header.scrolling {
|
.header.scrolling {
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
z-index: -1;
|
|
||||||
border-bottom: var(--border-light);
|
border-bottom: var(--border-light);
|
||||||
background: var(--background);
|
border-left: var(--border-light);
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
Detail,
|
Detail,
|
||||||
Modal,
|
Modal,
|
||||||
Button,
|
Button,
|
||||||
ActionButton,
|
|
||||||
notifications,
|
notifications,
|
||||||
Label,
|
Label,
|
||||||
|
AbsTooltip,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte"
|
import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte"
|
||||||
import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte"
|
import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte"
|
||||||
|
@ -125,6 +125,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="blockTitle">
|
<div class="blockTitle">
|
||||||
|
<AbsTooltip type="negative" text="Remove looping">
|
||||||
|
<Icon on:click={removeLooping} hoverable name="DeleteOutline" />
|
||||||
|
</AbsTooltip>
|
||||||
|
|
||||||
<div style="margin-left: 10px;" on:click={() => {}}>
|
<div style="margin-left: 10px;" on:click={() => {}}>
|
||||||
<Icon hoverable name={showLooping ? "ChevronDown" : "ChevronUp"} />
|
<Icon hoverable name={showLooping ? "ChevronDown" : "ChevronUp"} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -135,9 +139,6 @@
|
||||||
<Divider noMargin />
|
<Divider noMargin />
|
||||||
{#if !showLooping}
|
{#if !showLooping}
|
||||||
<div class="blockSection">
|
<div class="blockSection">
|
||||||
<div class="block-options">
|
|
||||||
<ActionButton on:click={() => removeLooping()} icon="DeleteOutline" />
|
|
||||||
</div>
|
|
||||||
<Layout noPadding gap="S">
|
<Layout noPadding gap="S">
|
||||||
<AutomationBlockSetup
|
<AutomationBlockSetup
|
||||||
schemaProperties={Object.entries(
|
schemaProperties={Object.entries(
|
||||||
|
@ -252,5 +253,6 @@
|
||||||
.blockTitle {
|
.blockTitle {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: var(--spacing-s);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
let fillWidth = true
|
let fillWidth = true
|
||||||
let inputData
|
let inputData
|
||||||
let codeBindingOpen = false
|
let codeBindingOpen = false
|
||||||
$: console.log($selectedAutomation?.definition)
|
|
||||||
$: filters = lookForFilters(schemaProperties) || []
|
$: filters = lookForFilters(schemaProperties) || []
|
||||||
$: tempFilters = filters
|
$: tempFilters = filters
|
||||||
$: stepId = block.stepId
|
$: stepId = block.stepId
|
||||||
|
@ -136,7 +135,6 @@
|
||||||
await automationStore.actions.addTestDataToAutomation(newTestData)
|
await automationStore.actions.addTestDataToAutomation(newTestData)
|
||||||
} else {
|
} else {
|
||||||
const data = { schema, [key]: e.detail }
|
const data = { schema, [key]: e.detail }
|
||||||
console.log(data)
|
|
||||||
await automationStore.actions.updateBlockInputs(block, data)
|
await automationStore.actions.updateBlockInputs(block, data)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -156,7 +154,7 @@
|
||||||
}
|
}
|
||||||
let blockIdx = allSteps.findIndex(step => step.id === block.id)
|
let blockIdx = allSteps.findIndex(step => step.id === block.id)
|
||||||
|
|
||||||
// Extract all outputs from all previous steps as available bindins
|
// Extract all outputs from all previous steps as available bindingsx§x
|
||||||
let bindings = []
|
let bindings = []
|
||||||
let loopBlockCount = 0
|
let loopBlockCount = 0
|
||||||
for (let idx = 0; idx < blockIdx; idx++) {
|
for (let idx = 0; idx < blockIdx; idx++) {
|
||||||
|
@ -197,7 +195,6 @@
|
||||||
}
|
}
|
||||||
let bindingName =
|
let bindingName =
|
||||||
automation.stepNames?.[allSteps[idx - loopBlockCount].id]
|
automation.stepNames?.[allSteps[idx - loopBlockCount].id]
|
||||||
console.log(bindingName)
|
|
||||||
bindings = bindings.concat(
|
bindings = bindings.concat(
|
||||||
outputs.map(([name, value]) => {
|
outputs.map(([name, value]) => {
|
||||||
let runtimeName = isLoopBlock
|
let runtimeName = isLoopBlock
|
||||||
|
|
Loading…
Reference in New Issue