From 7ae2b994231255bcefbc989ecce6f7fc70482b70 Mon Sep 17 00:00:00 2001 From: Suhas G Date: Sun, 20 Oct 2024 22:34:31 +0530 Subject: [PATCH] fix: show only meaningful names for blocks in global input popup (#348) * fix: remove block.package from global port display * fix: show names for basic blocks in global input --- frontend/src/core/editor.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/core/editor.ts b/frontend/src/core/editor.ts index 1789c5e0..973bf50f 100644 --- a/frontend/src/core/editor.ts +++ b/frontend/src/core/editor.ts @@ -157,7 +157,20 @@ class Editor { })); } + public getNodeName(nodeType: string): string { + if (nodeType === 'basic.input') { + return 'Input'; + } else if (nodeType === 'basic.output') { + return 'Output'; + } else if (nodeType === 'basic.constant') { + return 'Parameter'; + } else if (nodeType === 'basic.code') { + return 'Code'; + } + return nodeType; + } + public getGInputsOutput(): [{ indexOne: number, label: string, id:string }[], { indexTwo: number, label: string,id:string }[]] { @@ -181,9 +194,9 @@ class Editor { let label = ``; var id = `${options.id}:${portOptions.label}:${linkIds}`; if(node.getType() == 'block.package'){ - label = `${node.getType()} -> : ${options.info.name} : ${portOptions.label}`; + label = `${options.info.name} -> : ${portOptions.label}`; }else{ - label = `${node.getType()} -> : ${portOptions.label}`; + label = `${this.getNodeName(node.getType())} -> : ${portOptions.label}`; } valueOne.push({ indexOne, label, id }); } @@ -193,9 +206,9 @@ class Editor { let label = ``; var id = `${options.id}:${portOptions.label}:${linkIds}`; if(node.getType() == 'block.package'){ - label = `${node.getType()} -> : ${options.info.name} : ${portOptions.label}`; + label = `${options.info.name} -> : ${portOptions.label}`; }else{ - label = `${node.getType()} -> : ${portOptions.label}`; + label = `${this.getNodeName(node.getType())} -> : ${portOptions.label}`; } valueTwo.push({ indexTwo, label, id }); }