From 5b6fbe96097050aebbf1e4c53f6550d1729d0c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Paunovi=C4=87?= Date: Thu, 30 Jan 2025 14:25:30 +0100 Subject: [PATCH] feat(ui): improve the task array component (#7095) * feat(ui): improve the task array component * chore(ui): replace existing task on editing during creation instead of re-adding them --- ui/src/components/code/segments/Task.vue | 26 +++--- ui/src/components/flows/tasks/TaskArray.vue | 98 ++++++--------------- 2 files changed, 40 insertions(+), 84 deletions(-) diff --git a/ui/src/components/code/segments/Task.vue b/ui/src/components/code/segments/Task.vue index dcbb7107113..82f0f1f67c1 100644 --- a/ui/src/components/code/segments/Task.vue +++ b/ui/src/components/code/segments/Task.vue @@ -142,18 +142,20 @@ emits("updateTask", YamlUtils.insertTrigger(source, CURRENT.value)); CURRENT.value = null; } else { - const action = props.creation - ? YamlUtils.insertTask( - source, - route.query.target ?? YamlUtils.getLastTask(source), - task, - route.query.position ?? "after", - ) - : YamlUtils.replaceTaskInDocument( - source, - route.query.identifier, - task, - ); + const action = + props.creation && + (!route.query.identifier || route.query.identifier === "new") + ? YamlUtils.insertTask( + source, + route.query.target ?? YamlUtils.getLastTask(source), + task, + route.query.position ?? "after", + ) + : YamlUtils.replaceTaskInDocument( + source, + route.query.identifier, + task, + ); emits("updateTask", action); } diff --git a/ui/src/components/flows/tasks/TaskArray.vue b/ui/src/components/flows/tasks/TaskArray.vue index 657d11e853c..b019037ce55 100644 --- a/ui/src/components/flows/tasks/TaskArray.vue +++ b/ui/src/components/flows/tasks/TaskArray.vue @@ -1,97 +1,51 @@ - - - - -