diff --git a/packages/builder/src/components/integration/index.svelte b/packages/builder/src/components/integration/index.svelte index e3d9eab414..114cec98e2 100644 --- a/packages/builder/src/components/integration/index.svelte +++ b/packages/builder/src/components/integration/index.svelte @@ -37,11 +37,16 @@ query.fields[schema.type] = detail.value } - function updateEditors(deleteIndex) { + function updateEditorsOnDelete(deleteIndex) { for (let i = deleteIndex; i < query.fields.steps?.length - 1; i++) { flowEditors[i].update(query.fields.steps[i + 1].value.value) } } + function updateEditorsOnSwap(actionIndex, targetIndex) { + const target = query.fields.steps[targetIndex].value.value + flowEditors[targetIndex].update(query.fields.steps[actionIndex].value.value) + flowEditors[actionIndex].update(target) + } function setEditorTemplate(fromKey, toKey, index) { const currentValue = query.fields.steps[index].value.value @@ -119,14 +124,44 @@
Stage {index + 1} - { - updateEditors(index) - query.fields.steps.splice(index, 1) - query.fields.steps = [...query.fields.steps] - }} - icon="DeleteOutline" - /> +
+
+ {#if index > 0} + { + updateEditorsOnSwap(index, index - 1) + const target = query.fields.steps[index - 1].key + query.fields.steps[index - 1].key = + query.fields.steps[index].key + query.fields.steps[index].key = target + }} + icon="ChevronUp" + /> + {/if} + {#if index < query.fields.steps.length - 1} + { + updateEditorsOnSwap(index, index + 1) + const target = query.fields.steps[index + 1].key + query.fields.steps[index + 1].key = + query.fields.steps[index].key + query.fields.steps[index].key = target + }} + icon="ChevronDown" + /> + {/if} +
+ { + updateEditorsOnDelete(index) + query.fields.steps.splice(index, 1) + query.fields.steps = [...query.fields.steps] + }} + icon="DeleteOutline" + /> +
@@ -209,6 +244,11 @@ align-items: center; padding-bottom: 24px; } + .block-actions { + justify-content: space-between; + display: flex; + align-items: right; + } .fields { display: flex;