diff --git a/frontend/src/components/resources/action/config.tsx b/frontend/src/components/resources/action/config.tsx index 79c855f1c..b41079718 100644 --- a/frontend/src/components/resources/action/config.tsx +++ b/frontend/src/components/resources/action/config.tsx @@ -296,7 +296,7 @@ export const ActionConfig = ({ id }: { id: string }) => {
Listen on branch:
-
+
{ components: { stages: (stages, set) => (
- {stages && - stages.map((stage, index) => ( - - set({ - stages: stages.map((s, i) => - index === i ? stage : s - ), - }) - } - removeStage={() => - set({ - stages: stages.filter((_, i) => index !== i), - }) - } - moveUp={ - index === 0 - ? undefined - : () => - set({ - stages: stages.map((stage, i) => { - // Make sure its not the first row - if (i === index && index !== 0) { - return stages[index - 1]; - } else if (i === index - 1) { - // Reverse the entry, moving this row "Up" - return stages[index]; - } else { - return stage; - } - }), - }) - } - moveDown={ - index === stages.length - 1 - ? undefined - : () => - set({ - stages: stages.map((stage, i) => { - // The index also cannot be the last index, which cannot be moved down - if ( - i === index && - index !== stages.length - 1 - ) { - return stages[index + 1]; - } else if (i === index + 1) { - // Move the row "Down" - return stages[index]; - } else { - return stage; - } - }), - }) - } - insertAbove={() => - set({ - stages: [ - ...stages.slice(0, index), - new_stage(index + 1), - ...stages.slice(index), - ], - }) - } - insertBelow={() => - set({ - stages: [ - ...stages.slice(0, index + 1), - new_stage(index + 2), - ...stages.slice(index + 1), - ], - }) - } - disabled={disabled} - /> - ))} + {stages?.map((stage, index) => ( + + set({ + stages: stages.map((s, i) => + index === i ? stage : s + ), + }) + } + removeStage={() => + set({ + stages: stages.filter((_, i) => index !== i), + }) + } + moveUp={ + index === 0 + ? undefined + : () => + set({ + stages: stages.map((stage, i) => { + // Make sure its not the first row + if (i === index && index !== 0) { + return stages[index - 1]; + } else if (i === index - 1) { + // Reverse the entry, moving this row "Up" + return stages[index]; + } else { + return stage; + } + }), + }) + } + moveDown={ + index === stages.length - 1 + ? undefined + : () => + set({ + stages: stages.map((stage, i) => { + // The index also cannot be the last index, which cannot be moved down + if ( + i === index && + index !== stages.length - 1 + ) { + return stages[index + 1]; + } else if (i === index + 1) { + // Move the row "Down" + return stages[index]; + } else { + return stage; + } + }), + }) + } + insertAbove={() => + set({ + stages: [ + ...stages.slice(0, index), + new_stage(index + 1), + ...stages.slice(index), + ], + }) + } + insertBelow={() => + set({ + stages: [ + ...stages.slice(0, index + 1), + new_stage(index + 2), + ...stages.slice(index + 1), + ], + }) + } + disabled={disabled} + /> + ))}