Skip to content

Commit

Permalink
fix: show only meaningful names for blocks in global input popup (#348)
Browse files Browse the repository at this point in the history
* fix: remove block.package from global port display

* fix: show names for basic blocks in global input
  • Loading branch information
Suhas-G authored Oct 20, 2024
1 parent 122b26b commit 7ae2b99
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions frontend/src/core/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }[]] {
Expand All @@ -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 });
}
Expand All @@ -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 });
}
Expand Down

0 comments on commit 7ae2b99

Please sign in to comment.