Skip to content

Commit

Permalink
RunAll disabled in CustomNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaylo-matov committed Nov 15, 2024
1 parent 5d3052c commit e96fd0d
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
9 changes: 9 additions & 0 deletions TuneUp/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions TuneUp/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@
<data name="ToolTip_RunAll" xml:space="preserve">
<value>Execute entire graph, including nodes with no change since the latest run.</value>
</data>
<data name="ToolTip_RunAllDisabled" xml:space="preserve">
<value>Custom Node mode does not support Run All.</value>
</data>
<data name="ToolTip_TotalExecutionTime" xml:space="preserve">
<value>Combined execution time of latest and previous run.</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions TuneUp/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@
<data name="ToolTip_RunAll" xml:space="preserve">
<value>Execute entire graph, including nodes with no change since the latest run.</value>
</data>
<data name="ToolTip_RunAllDisabled" xml:space="preserve">
<value>Custom Node mode does not support Run All.</value>
</data>
<data name="ToolTip_TotalExecutionTime" xml:space="preserve">
<value>Combined execution time of latest and previous run.</value>
</data>
Expand Down
8 changes: 6 additions & 2 deletions TuneUp/TuneUpWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" />
</Trigger>
</Style.Triggers>
</Style>
<!-- Context Menu style for Export button * -->
Expand Down Expand Up @@ -483,10 +486,11 @@
Content="{x:Static resx:Resources.Button_RunAll}"
Cursor="Hand"
IsEnabled="{Binding Path=IsRecomputeEnabled}"
Style="{StaticResource ButtonStyleTuneUp}" >
Style="{StaticResource ButtonStyleTuneUp}"
ToolTipService.ShowOnDisabled="True" >
<Button.ToolTip>
<ToolTip Style="{StaticResource ToolTipPointerTopRight}">
<TextBlock Text="{x:Static resx:Resources.ToolTip_RunAll}" Style="{StaticResource ToolTipContent}"/>
<TextBlock Style="{StaticResource ToolTipContent}" Text="{Binding RunAllTooltipMessage}" />
</ToolTip>
</Button.ToolTip>
</Button>
Expand Down
34 changes: 34 additions & 0 deletions TuneUp/TuneUpWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ private set
{
isRecomputeEnabled = value;
RaisePropertyChanged(nameof(IsRecomputeEnabled));
RaisePropertyChanged(nameof(RunAllTooltipMessage));
}
}
}
Expand Down Expand Up @@ -279,6 +280,7 @@ public string SortingOrder
public const string SortByName = "name";
public const string SortByNumber = "number";
public const string SortByTime = "time";
public string RunAllTooltipMessage => IsRecomputeEnabled ? Resources.ToolTip_RunAll : Resources.ToolTip_RunAllDisabled;

#endregion

Expand Down Expand Up @@ -998,6 +1000,17 @@ private void OnCurrentWorkspaceChanged(IWorkspaceModel workspace)
{
// Profiling needs to be enabled per workspace so mark it false after switching
isProfilingEnabled = false;

// Disable IsRecomputeEnabled if the workspace is a CustomNodeWorkspaceModel
IsRecomputeEnabled = !(workspace is CustomNodeWorkspaceModel);

if (workspace is CustomNodeWorkspaceModel)
{
ResetForCustomNodeWorkspace();
CurrentWorkspace = null;
return;
}

CurrentWorkspace = workspace as HomeWorkspaceModel;
}

Expand Down Expand Up @@ -1376,6 +1389,27 @@ private void RefreshGroupNodeUI()
RaisePropertyChanged(nameof(ProfiledNodesCollectionPreviousRun));
}

/// <summary>
/// Resets the UI and profiling state when the workspace is a custom node.
/// </summary>
private void ResetForCustomNodeWorkspace()
{
// Clear node data for custom nodes
ProfiledNodesLatestRun.Clear();
ProfiledNodesPreviousRun.Clear();
ProfiledNodesNotExecuted.Clear();

// Trigger UI refresh
RaisePropertyChanged(nameof(ProfiledNodesCollectionLatestRun));
RaisePropertyChanged(nameof(ProfiledNodesCollectionPreviousRun));
RaisePropertyChanged(nameof(ProfiledNodesCollectionNotExecuted));

// Reset execution time stats
LatestGraphExecutionTime = PreviousGraphExecutionTime = TotalGraphExecutionTime = defaultExecutionTime;

UpdateTableVisibility();
}

#endregion

#region Dispose or setup
Expand Down

0 comments on commit e96fd0d

Please sign in to comment.