From dd245b578bb3564243de70568e8be3f14c1c4449 Mon Sep 17 00:00:00 2001 From: Ivo Petrov Date: Mon, 21 Oct 2024 19:08:06 +0100 Subject: [PATCH 1/2] bugs fixed - retain group prefix when nodes move between state groups. - hide table labels when collections are empty. --- TuneUp/ProfiledNodeViewModel.cs | 19 +++++++++++++++---- TuneUp/TuneUpWindowViewModel.cs | 23 +++++++++++++++-------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/TuneUp/ProfiledNodeViewModel.cs b/TuneUp/ProfiledNodeViewModel.cs index d29c192..1cd3960 100644 --- a/TuneUp/ProfiledNodeViewModel.cs +++ b/TuneUp/ProfiledNodeViewModel.cs @@ -99,13 +99,16 @@ public string Name } else if (GroupModel != null) { - return GroupModel.AnnotationText == DefaultGroupName ? - $"{GroupNodePrefix}{DefaultDisplayGroupName}" : GroupModel.AnnotationText; + return GetGroupName(GroupModel.AnnotationText); } } return name; } - internal set { name = value; } + internal set + { + name = value; + RaisePropertyChanged(nameof(Name)); + } } /// @@ -420,7 +423,7 @@ public ProfiledNodeViewModel(AnnotationModel group) /// the annotation model public ProfiledNodeViewModel(ProfiledNodeViewModel pNode) { - Name = pNode.GroupName == DefaultGroupName ? DefaultDisplayGroupName : pNode.GroupName; + Name = GetGroupName(pNode.GroupName); GroupName = pNode.GroupName; State = pNode.State; NodeGUID = Guid.NewGuid(); @@ -429,5 +432,13 @@ public ProfiledNodeViewModel(ProfiledNodeViewModel pNode) BackgroundBrush = pNode.BackgroundBrush; ShowGroupIndicator = true; } + + public static string GetGroupName(string groupName) + { + return groupName == DefaultGroupName + ? $"{GroupNodePrefix}{DefaultDisplayGroupName}" + : $"{GroupNodePrefix}{groupName}"; + } + } } diff --git a/TuneUp/TuneUpWindowViewModel.cs b/TuneUp/TuneUpWindowViewModel.cs index 4fd2944..7cda950 100644 --- a/TuneUp/TuneUpWindowViewModel.cs +++ b/TuneUp/TuneUpWindowViewModel.cs @@ -360,9 +360,7 @@ internal void ResetProfiledNodes() ApplyGroupNodeFilter(); // Ensure table visibility is updated in case TuneUp was closed and reopened with the same graph. - RaisePropertyChanged(nameof(LatestRunTableVisibility)); - RaisePropertyChanged(nameof(PreviousRunTableVisibility)); - RaisePropertyChanged(nameof(NotExecutedTableVisibility)); + UpdateTableVisibility(); } /// @@ -451,10 +449,7 @@ private void CurrentWorkspaceModel_EvaluationCompleted(object sender, Dynamo.Mod CalculateGroupNodes(); UpdateExecutionTime(); - - RaisePropertyChanged(nameof(LatestRunTableVisibility)); - RaisePropertyChanged(nameof(PreviousRunTableVisibility)); - RaisePropertyChanged(nameof(NotExecutedTableVisibility)); + UpdateTableVisibility(); RaisePropertyChanged(nameof(ProfiledNodesCollectionLatestRun)); RaisePropertyChanged(nameof(ProfiledNodesCollectionPreviousRun)); @@ -699,7 +694,7 @@ internal void OnGroupPropertyChanged(object sender, PropertyChangedEventArgs e) { if (pNode.IsGroup) { - pNode.Name = $"{ProfiledNodeViewModel.GroupNodePrefix}{groupModel.AnnotationText}"; + pNode.Name = ProfiledNodeViewModel.GetGroupName(groupModel.AnnotationText); } pNode.GroupName = groupModel.AnnotationText; } @@ -887,6 +882,7 @@ private void CurrentWorkspaceModel_NodeRemoved(NodeModel node) //Recalculate the execution times UpdateExecutionTime(); + UpdateTableVisibility(); } private void CurrentWorkspaceModel_GroupAdded(AnnotationModel group) @@ -1001,6 +997,7 @@ private void CurrentWorkspaceModel_GroupRemoved(AnnotationModel group) } RefreshAllCollectionViews(); + UpdateTableVisibility(); } private void OnCurrentWorkspaceChanged(IWorkspaceModel workspace) @@ -1021,6 +1018,16 @@ private void OnCurrentWorkspaceCleared(IWorkspaceModel workspace) #region Helpers + /// + /// Raises property change notifications for the visibility of the Latest Run, Previous Run, and Not Executed tables. + /// + private void UpdateTableVisibility() + { + RaisePropertyChanged(nameof(LatestRunTableVisibility)); + RaisePropertyChanged(nameof(PreviousRunTableVisibility)); + RaisePropertyChanged(nameof(NotExecutedTableVisibility)); + } + /// /// Resets group-related properties of the node and unregisters it from the group model dictionary. /// From facb96396ff63b029b077a3d64f355dd2375b425 Mon Sep 17 00:00:00 2001 From: Ivo Petrov Date: Tue, 22 Oct 2024 10:04:08 +0100 Subject: [PATCH 2/2] xml summary --- TuneUp/ProfiledNodeViewModel.cs | 11 +++++++---- TuneUp/TuneUpWindowViewModel.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/TuneUp/ProfiledNodeViewModel.cs b/TuneUp/ProfiledNodeViewModel.cs index 1cd3960..67f175c 100644 --- a/TuneUp/ProfiledNodeViewModel.cs +++ b/TuneUp/ProfiledNodeViewModel.cs @@ -99,7 +99,7 @@ public string Name } else if (GroupModel != null) { - return GetGroupName(GroupModel.AnnotationText); + return GetProfiledGroupName(GroupModel.AnnotationText); } } return name; @@ -423,7 +423,7 @@ public ProfiledNodeViewModel(AnnotationModel group) /// the annotation model public ProfiledNodeViewModel(ProfiledNodeViewModel pNode) { - Name = GetGroupName(pNode.GroupName); + Name = GetProfiledGroupName(pNode.GroupName); GroupName = pNode.GroupName; State = pNode.State; NodeGUID = Guid.NewGuid(); @@ -433,12 +433,15 @@ public ProfiledNodeViewModel(ProfiledNodeViewModel pNode) ShowGroupIndicator = true; } - public static string GetGroupName(string groupName) + /// + /// Returns the formatted profiled group name with the group prefix. + /// Uses a default display name if the group name matches the default. + /// + public static string GetProfiledGroupName(string groupName) { return groupName == DefaultGroupName ? $"{GroupNodePrefix}{DefaultDisplayGroupName}" : $"{GroupNodePrefix}{groupName}"; } - } } diff --git a/TuneUp/TuneUpWindowViewModel.cs b/TuneUp/TuneUpWindowViewModel.cs index 7cda950..f0a3a6e 100644 --- a/TuneUp/TuneUpWindowViewModel.cs +++ b/TuneUp/TuneUpWindowViewModel.cs @@ -694,7 +694,7 @@ internal void OnGroupPropertyChanged(object sender, PropertyChangedEventArgs e) { if (pNode.IsGroup) { - pNode.Name = ProfiledNodeViewModel.GetGroupName(groupModel.AnnotationText); + pNode.Name = ProfiledNodeViewModel.GetProfiledGroupName(groupModel.AnnotationText); } pNode.GroupName = groupModel.AnnotationText; }