Skip to content

Commit

Permalink
[DYN-7334] Improvements after feedback - part 2 (#58)
Browse files Browse the repository at this point in the history
* progress record

1. help icon removed
5. minor UI changes
7. jagged edges fixed

* progress record

2. zoom on node when selected in the UI

* progress record

6. group title font color auto-adjusts for contrast with background color

* progress record

4. TuneUp loads in Extensions in non-default languages

* progress record

- grouping bugs on second graph fixed

* progress record

all should work

* Update TuneUpWindowViewModel.cs

* Update TuneUpWindowViewModel.cs

* Update pkg.json

* Revert "Update pkg.json"

This reverts commit 838aa69.
  • Loading branch information
ivaylo-matov authored Sep 23, 2024
1 parent 5f50398 commit 17ae9e1
Show file tree
Hide file tree
Showing 3 changed files with 384 additions and 266 deletions.
92 changes: 54 additions & 38 deletions TuneUp/ProfiledNodeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,44 +71,7 @@ public bool IsGroupExecutionTime
RaisePropertyChanged(nameof(IsGroupExecutionTime));
}
}
private bool isGroupExecutionTime = false;

/// <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;
}
private bool isGroupExecutionTime = false;

/// <summary>
/// Prefix string of execution time.
Expand Down Expand Up @@ -336,6 +299,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 17ae9e1

Please sign in to comment.