Fixed issues on take node which is not working on the list of response class for get apis
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace Nodify.Calculator
|
||||
IsInput = false,
|
||||
Shape = ConnectorShape.Square,
|
||||
ConnectorColor = Color.MediumPurple,
|
||||
DataType = responseClassName.ToLower()
|
||||
DataType = responseClassName
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user