Skip to content

Commit 7ae2b99

Browse files
authored
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
1 parent 122b26b commit 7ae2b99

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

frontend/src/core/editor.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,20 @@ class Editor {
157157
}));
158158
}
159159

160+
public getNodeName(nodeType: string): string {
161+
if (nodeType === 'basic.input') {
162+
return 'Input';
163+
} else if (nodeType === 'basic.output') {
164+
return 'Output';
165+
} else if (nodeType === 'basic.constant') {
166+
return 'Parameter';
167+
} else if (nodeType === 'basic.code') {
168+
return 'Code';
169+
}
160170

171+
return nodeType;
172+
}
173+
161174

162175

163176
public getGInputsOutput(): [{ indexOne: number, label: string, id:string }[], { indexTwo: number, label: string,id:string }[]] {
@@ -181,9 +194,9 @@ class Editor {
181194
let label = ``;
182195
var id = `${options.id}:${portOptions.label}:${linkIds}`;
183196
if(node.getType() == 'block.package'){
184-
label = `${node.getType()} -> : ${options.info.name} : ${portOptions.label}`;
197+
label = `${options.info.name} -> : ${portOptions.label}`;
185198
}else{
186-
label = `${node.getType()} -> : ${portOptions.label}`;
199+
label = `${this.getNodeName(node.getType())} -> : ${portOptions.label}`;
187200
}
188201
valueOne.push({ indexOne, label, id });
189202
}
@@ -193,9 +206,9 @@ class Editor {
193206
let label = ``;
194207
var id = `${options.id}:${portOptions.label}:${linkIds}`;
195208
if(node.getType() == 'block.package'){
196-
label = `${node.getType()} -> : ${options.info.name} : ${portOptions.label}`;
209+
label = `${options.info.name} -> : ${portOptions.label}`;
197210
}else{
198-
label = `${node.getType()} -> : ${portOptions.label}`;
211+
label = `${this.getNodeName(node.getType())} -> : ${portOptions.label}`;
199212
}
200213
valueTwo.push({ indexTwo, label, id });
201214
}

0 commit comments

Comments
 (0)