From 6e8737fa2a9177495c9a185d00d3c88f45a203c6 Mon Sep 17 00:00:00 2001
From: Robin Leber <rleber98@gmail.com>
Date: Wed, 26 Jun 2024 11:31:49 +0200
Subject: [PATCH] Queue Anpassung

---
 src/functions/endpoints.js   |  4 ++--
 src/functions/pipeBinding.js | 11 +++--------
 src/index.html               |  4 ++--
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/functions/endpoints.js b/src/functions/endpoints.js
index 48b097d..f3faa9f 100644
--- a/src/functions/endpoints.js
+++ b/src/functions/endpoints.js
@@ -15,14 +15,14 @@ const severalEndpointsLeft = {
   anchor: ["LeftMiddle"],
   isTarget: true,
   connectionType: "flow",
-  maxConnections: 3,
+  maxConnections: 5,
 };
 const severalEndpointsRight = {
   endpoint: ["Dot", { radius: 5 }],
   anchor: ["RightMiddle"],
   isSource: true,
   connectionType: "flow",
-  maxConnections: 3,
+  maxConnections: 5,
 };
 
 export const createEndpoints = (instance, id, type) => {
diff --git a/src/functions/pipeBinding.js b/src/functions/pipeBinding.js
index 597f540..5df12ed 100644
--- a/src/functions/pipeBinding.js
+++ b/src/functions/pipeBinding.js
@@ -9,16 +9,14 @@ export const getPipesForFilter = (instance) => {
     .filter((connection) => connection.targetId === filter)
     .map((connection) => ({
       pipeId: connection.sourceId,
-      pipeType:
-        connection.source.dataset.type === "Default" ? "Queue" : "Topic",
+      pipeType: connection.source.dataset.pipetype,
       pipeDirection: "in",
     }));
   const outgoingConnections = allConnections
     .filter((connection) => connection.sourceId === filter)
     .map((connection) => ({
       pipeId: connection.targetId,
-      pipeType:
-        connection.target.dataset.type === "Default" ? "Queue" : "Topic",
+      pipeType: connection.target.dataset.pipetype,
       pipeDirection: "out",
     }));
 
@@ -60,14 +58,11 @@ export const handlePipeBinding = (pipeMapping, editor) => {
     ) {
       return;
     } else {
-      let queue = pipe.pipeType === "Queue" ? true : false;
       let line = editor.state.doc.line(lineNumber);
       let position = line.from;
       let pipeNameUserGiven = pipe.pipeName;
       let pipeNameDeklaration = makeValidConstName(pipeNameUserGiven);
-      let insertCode = `\t\tconst ${pipeNameDeklaration} = "${pipeNameUserGiven}";\n\t\tawait channel.${
-        queue ? "assertQueue" : "assertTopic"
-      }(${pipeNameDeklaration}, {\n\t\t\tdurable: false\n\t\t});\n`;
+      let insertCode = `\t\tconst ${pipeNameDeklaration} = "${pipeNameUserGiven}";\n\t\tawait channel.assert${pipe.pipeType}(${pipeNameDeklaration}, {\n\t\t\tdurable: false\n\t\t});\n`;
       let transaction = editor.state.update({
         changes: {
           from: position,
diff --git a/src/index.html b/src/index.html
index bf27ecd..6c6a9e4 100644
--- a/src/index.html
+++ b/src/index.html
@@ -25,7 +25,7 @@
           <h4>TOOLBOX</h4>
           <div>
             <h5>PIPES</h5>
-            <div class="Pipe" data-type="Default">
+            <div class="Pipe" data-type="Distributor" data-pipetype="Queue">
               Queue
               <br />
               <span id="PipeName"></span>
@@ -36,7 +36,7 @@
               <i id="Check" class="fa-sharp fa-xl fa-solid fa-circle-check"></i>
               <i id="Docker" class="fa-brands fa-xl fa-docker"></i>
             </div>
-            <div class="Pipe" data-type="Distributor">
+            <div class="Pipe" data-type="Distributor" data-pipetype="Topic">
               Topic
               <br />
               <span id="PipeName"></span>
-- 
GitLab