Fixed issues on take node which is not working on the list of response class for get apis

This commit is contained in:
Ankitkumar Satapara
2026-04-18 23:30:55 +05:30
parent 863fc679ed
commit 9c3241cea4
2 changed files with 12 additions and 6 deletions

View File

@@ -452,15 +452,21 @@ namespace Nodify.Calculator
takeListInput.ConnectorColor = sourceConnector.RawColor;
takeListInput.DataType = sourceConnector.DataType;
// Determine the element type from a list type (e.g. "list<int>" -> "int")
// Determine the element type from a list type (e.g. "List<ClassName>" -> "ClassName")
var elementType = sourceConnector.DataType ?? "";
if (elementType.StartsWith("list<") && elementType.EndsWith(">"))
if (elementType.StartsWith("List<", System.StringComparison.OrdinalIgnoreCase) && elementType.EndsWith(">"))
{
elementType = elementType.Substring(5, elementType.Length - 6);
}
var elementColor = ConnectorViewModel.GetColorForType(elementType);
// Check if the element type is a model class (has a .cs file in CustomModels)
bool isModelType = false;
var modelFilePath = Path.Combine("CustomModels", $"{elementType}.cs");
if (File.Exists(modelFilePath))
isModelType = true;
// Remove existing outputs
var toRemove = takeOp.Output.ToList();
toRemove.ForEach(o =>
@@ -469,13 +475,13 @@ namespace Nodify.Calculator
takeOp.Output.Remove(o);
});
// Add single output for the element type
// Add single output for the element type — use Square shape for model types
takeOp.Output.Add(new ConnectorViewModel
{
Title = "Element",
IsInput = false,
Shape = ConnectorShape.Circle,
ConnectorColor = elementColor,
Shape = isModelType ? ConnectorShape.Square : ConnectorShape.Circle,
ConnectorColor = isModelType ? System.Drawing.Color.MediumPurple : elementColor,
DataType = elementType
});
}

View File

@@ -279,7 +279,7 @@ namespace Nodify.Calculator
IsInput = false,
Shape = ConnectorShape.Square,
ConnectorColor = Color.MediumPurple,
DataType = responseClassName.ToLower()
DataType = responseClassName
});
}
else