You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2023/03/10 15:54:50 UTC

[camel-karavan] branch main updated: Fix #679

This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new 7b6229f6 Fix #679
7b6229f6 is described below

commit 7b6229f654ed198a97d8757ec3549a73945cb8dc
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Fri Mar 10 10:54:38 2023 -0500

    Fix #679
---
 .../src/designer/route/RouteDesignerLogic.tsx            | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/karavan-designer/src/designer/route/RouteDesignerLogic.tsx b/karavan-designer/src/designer/route/RouteDesignerLogic.tsx
index fb366b4d..252942c1 100644
--- a/karavan-designer/src/designer/route/RouteDesignerLogic.tsx
+++ b/karavan-designer/src/designer/route/RouteDesignerLogic.tsx
@@ -167,6 +167,7 @@ export class RouteDesignerLogic {
 
     showDeleteConfirmation = (id: string) => {
         let message: string;
+        const uuidsToDelete:string [] = [id];
         let ce: CamelElement;
         ce = CamelDefinitionApiExt.findElementInIntegration(this.routeDesigner.state.integration, id)!;
         if (ce.dslName === 'FromDefinition') { // Get the RouteDefinition for this.routeDesigner.  Use its uuid.
@@ -175,7 +176,7 @@ export class RouteDesignerLogic {
                 if (flows[i].dslName === 'RouteDefinition') {
                     let routeDefinition: RouteDefinition = flows[i];
                     if (routeDefinition.from.uuid === id) {
-                        id = routeDefinition.uuid;
+                        uuidsToDelete.push(routeDefinition.uuid);
                         break;
                     }
                 }
@@ -192,14 +193,13 @@ export class RouteDesignerLogic {
             showSelector: false,
             showDeleteConfirmation: true,
             deleteMessage: message,
-            selectedUuids: [id],
+            selectedUuids: uuidsToDelete,
         }));
     }
 
     deleteElement = () => {
-        const id = this.routeDesigner.state.selectedUuids.at(0);
-        if (id) {
-            const i = CamelDefinitionApiExt.deleteStepFromIntegration(this.routeDesigner.state.integration, id);
+        this.routeDesigner.state.selectedUuids.forEach(uuidToDelete => {
+            const i = CamelDefinitionApiExt.deleteStepFromIntegration(this.routeDesigner.state.integration, uuidToDelete);
             this.routeDesigner.setState(prevState => ({
                 integration: i,
                 showSelector: false,
@@ -208,12 +208,12 @@ export class RouteDesignerLogic {
                 key: Math.random().toString(),
                 selectedStep: undefined,
                 propertyOnly: false,
-                selectedUuids: [id],
+                selectedUuids: [uuidToDelete],
             }));
             const el = new CamelElement("");
-            el.uuid = id;
+            el.uuid = uuidToDelete;
             EventBus.sendPosition("delete", el, undefined, new DOMRect(), new DOMRect(), 0);
-        }
+        });
     }
 
     selectElement = (element: CamelElement) => {