Skip to content

Commit

Permalink
Merge branch 'master' into DYN-7466-Navigate-to-corresponding-node/gr…
Browse files Browse the repository at this point in the history
…oup-by-clicking-it-in-the-TuneUp-list
  • Loading branch information
ivaylo-matov authored Sep 24, 2024
2 parents 7cd8655 + 17ae9e1 commit 41253a7
Show file tree
Hide file tree
Showing 4 changed files with 386 additions and 229 deletions.
53 changes: 53 additions & 0 deletions TuneUp/ProfiledNodeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,59 @@ public string StateDescription

#endregion

/// <summary>
/// Getting the original name before graph author renamed the node
/// </summary>
/// <param name="node">target NodeModel</param>
/// <returns>Original node name as string</returns>
private static string GetOriginalName(NodeModel node)
{
if (node == null) return string.Empty;
// For dummy node, return the current name so that does not appear to be renamed
if (node is DummyNode)
{
return node.Name;
}
if (node.IsCustomFunction)
{
// If the custom node is not loaded, return the current name so that does not appear to be renamed
if ((node as Function).State == ElementState.Error && (node as Function).Definition.IsProxy)
{
return node.Name;
}
// If the custom node is loaded, return original name as usual
var customNodeFunction = node as Function;
return customNodeFunction?.Definition.DisplayName;
}

var function = node as DSFunctionBase;
if (function != null)
return function.Controller.Definition.DisplayName;

var nodeType = node.GetType();
var elNameAttrib = nodeType.GetCustomAttributes<NodeNameAttribute>(false).FirstOrDefault();
if (elNameAttrib != null)
return elNameAttrib.Name;

return nodeType.FullName;
}

internal void ResetGroupProperties()
{
GroupGUID = Guid.Empty;
GroupName = string.Empty;
GroupExecutionOrderNumber = null;
GroupExecutionTime = TimeSpan.Zero;
}

internal void ApplyGroupProperties(ProfiledNodeViewModel profiledGroup)
{
GroupGUID = profiledGroup.GroupGUID;
GroupName = profiledGroup.GroupName;
GroupExecutionOrderNumber = profiledGroup.GroupExecutionOrderNumber;
BackgroundBrush = profiledGroup.BackgroundBrush;
}

/// <summary>
/// Create a Profiled Node View Model from a NodeModel
/// </summary>
Expand Down
Loading

0 comments on commit 41253a7

Please sign in to comment.