Added custom connectors for array and list
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
@@ -117,6 +117,25 @@ namespace Nodify.Calculator
|
||||
};
|
||||
newObjectNode.Input.Add("");
|
||||
|
||||
var forEachNode = new OperationInfoViewModel()
|
||||
{
|
||||
Title = "ForEach",
|
||||
Type = OperationType.System,
|
||||
sysOp = SystemOperations.FOREACH,
|
||||
IsFlowNode = true
|
||||
};
|
||||
forEachNode.Input.Add("List");
|
||||
|
||||
var assertNode = new OperationInfoViewModel()
|
||||
{
|
||||
Title = "Assert",
|
||||
Type = OperationType.System,
|
||||
sysOp = SystemOperations.ASSERT,
|
||||
IsFlowNode = true
|
||||
};
|
||||
assertNode.Input.Add("Actual");
|
||||
assertNode.Input.Add("Expected");
|
||||
|
||||
systemNodes.Add(authNode);
|
||||
systemNodes.Add(copynode);
|
||||
systemNodes.Add(debugNode);
|
||||
@@ -127,6 +146,8 @@ namespace Nodify.Calculator
|
||||
systemNodes.Add(jsonParseNode);
|
||||
systemNodes.Add(splitNode);
|
||||
systemNodes.Add(takeNode);
|
||||
systemNodes.Add(forEachNode);
|
||||
systemNodes.Add(assertNode);
|
||||
return systemNodes;
|
||||
}
|
||||
|
||||
@@ -292,13 +313,13 @@ namespace Nodify.Calculator
|
||||
bool isList = responseClassName.StartsWith("List<") && responseClassName.EndsWith(">");
|
||||
var innerType = isList ? responseClassName.Substring(5, responseClassName.Length - 6) : responseClassName;
|
||||
|
||||
// Square connector for model output
|
||||
// Use Grid shape for list/array types, Square for single model
|
||||
_o.Output.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = responseClassName,
|
||||
IsInput = false,
|
||||
Shape = ConnectorShape.Square,
|
||||
ConnectorColor = Color.MediumPurple,
|
||||
Shape = isList ? ConnectorShape.Grid : ConnectorShape.Square,
|
||||
ConnectorColor = isList ? Color.MediumSpringGreen : Color.MediumPurple,
|
||||
DataType = responseClassName
|
||||
});
|
||||
}
|
||||
@@ -370,6 +391,79 @@ namespace Nodify.Calculator
|
||||
return newObjOp;
|
||||
}
|
||||
|
||||
if (info.sysOp == SystemOperations.FOREACH)
|
||||
{
|
||||
var forEachOp = new ForEachOperationViewModel
|
||||
{
|
||||
Title = info.Title
|
||||
};
|
||||
// Flow connectors
|
||||
forEachOp.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle });
|
||||
forEachOp.Output.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle, IsInput = false });
|
||||
// List data input (Grid shape for array/list types)
|
||||
forEachOp.Input.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = "List",
|
||||
Shape = ConnectorShape.Grid,
|
||||
ConnectorColor = Color.MediumSpringGreen
|
||||
});
|
||||
// "Loop Body" flow output — connects to nodes executed per iteration
|
||||
forEachOp.Output.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = "Loop Body",
|
||||
IsInput = false,
|
||||
Shape = ConnectorShape.Triangle,
|
||||
ConnectorColor = Color.MediumSpringGreen
|
||||
});
|
||||
// "Current Item" data output — the element of the current iteration
|
||||
forEachOp.Output.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = "Current Item",
|
||||
IsInput = false,
|
||||
Shape = ConnectorShape.Circle,
|
||||
ConnectorColor = Color.MediumSpringGreen,
|
||||
DataType = "object"
|
||||
});
|
||||
// "Index" data output — current iteration index
|
||||
forEachOp.Output.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = "Index",
|
||||
IsInput = false,
|
||||
Shape = ConnectorShape.Circle,
|
||||
ConnectorColor = Color.LightSkyBlue,
|
||||
DataType = "int"
|
||||
});
|
||||
return forEachOp;
|
||||
}
|
||||
|
||||
if (info.sysOp == SystemOperations.ASSERT)
|
||||
{
|
||||
var assertOp = new AssertOperationViewModel
|
||||
{
|
||||
Title = info.Title
|
||||
};
|
||||
// Flow connectors
|
||||
assertOp.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle });
|
||||
assertOp.Output.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle, IsInput = false });
|
||||
// Data inputs
|
||||
foreach (var inp in input)
|
||||
{
|
||||
inp.ConnectorColor = Color.Gold;
|
||||
inp.Shape = ConnectorShape.Circle;
|
||||
assertOp.Input.Add(inp);
|
||||
}
|
||||
// "Result" output — pass/fail boolean
|
||||
assertOp.Output.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = "Result",
|
||||
IsInput = false,
|
||||
Shape = ConnectorShape.Circle,
|
||||
ConnectorColor = Color.Gold,
|
||||
DataType = "bool"
|
||||
});
|
||||
return assertOp;
|
||||
}
|
||||
|
||||
if (info.sysOp == SystemOperations.DEBUG)
|
||||
{
|
||||
var debugOp = new SystemOperationViewModel
|
||||
|
||||
Reference in New Issue
Block a user