prevent code fields to show on group node (#1035)

refactor(reactflowUtils.ts): change display_name of generated group node
from "group Component" to "Group" for better clarity and understanding
This commit is contained in:
anovazzi1 2023-10-10 16:01:04 -03:00 • committed by GitHub
commit a95db60a89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -648,6 +648,10 @@ function updateGroupNodeTemplate(template: APITemplateType) {
) { ) {
template[key].advanced = true; template[key].advanced = true;
} }
//prevent code fields from showing on the group node
if (type === "code") {
template[key].show = false;
}
}); });
return template; return template;
} }
@ -669,10 +673,7 @@ export function mergeNodeTemplates({
Object.keys(nodeTemplate) Object.keys(nodeTemplate)
.filter((field_name) => field_name.charAt(0) !== "_") .filter((field_name) => field_name.charAt(0) !== "_")
.forEach((key) => { .forEach((key) => {
if ( if (!isHandleConnected(edges, key, nodeTemplate[key], node.id)) {
nodeTemplate[key].show &&
!isHandleConnected(edges, key, nodeTemplate[key], node.id)
) {
template[key + "_" + node.id] = nodeTemplate[key]; template[key + "_" + node.id] = nodeTemplate[key];
template[key + "_" + node.id].proxy = { id: node.id, field: key }; template[key + "_" + node.id].proxy = { id: node.id, field: key };
if (node.type === "groupNode") { if (node.type === "groupNode") {
@ -764,7 +765,7 @@ export function generateNodeFromFlow(
type: outputNode?.data.type!, type: outputNode?.data.type!,
node: { node: {
output_types: outputNode!.data.node!.output_types, output_types: outputNode!.data.node!.output_types,
display_name: "group Component", display_name: "Group",
documentation: "", documentation: "",
base_classes: outputNode!.data.node!.base_classes, base_classes: outputNode!.data.node!.base_classes,
description: "double click to edit description", description: "double click to edit description",