From b92b2448630137b3b552d93d4f2f09f6741198a3 Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Sun, 8 Mar 2026 07:29:52 -0500 Subject: [PATCH] Issue #48: Advice window styling, operator timing, new rules, UI consistency - Expensive operators: multi-line format with CPU + elapsed, node IDs, transparent operator CPU fix - Rule 25: tighten Ineffective Parallelism threshold to 0.8-1.3 - Rule 31: new Parallel Wait Bottleneck rule (elapsed >> CPU) - Rules 1/10/12: structured multi-line warning format with bullet stats - Warning newlines: escape with U+001F to survive line splitter, restore in AdviceContentBuilder - Advice window: SelectableTextBlock for copy/paste, color-coded operator timing lines - Plan Insights: Server Context pane always visible with placeholder, Runtime Summary empty state - Toolbar: disabled Query Store button in file-mode, shortened button labels for space - Wait Stats panel: wider column (2*) with MinWidth=280 Co-Authored-By: Claude Opus 4.6 --- .../Controls/PlanViewerControl.axaml | 12 +- .../Controls/PlanViewerControl.axaml.cs | 15 +- .../Controls/QuerySessionControl.axaml | 8 +- .../Controls/QuerySessionControl.axaml.cs | 14 +- src/PlanViewer.App/MainWindow.axaml.cs | 257 +------- .../Services/AdviceContentBuilder.cs | 581 ++++++++++++++++++ src/PlanViewer.Core/Output/TextFormatter.cs | 283 ++++++--- src/PlanViewer.Core/Services/PlanAnalyzer.cs | 78 ++- 8 files changed, 904 insertions(+), 344 deletions(-) create mode 100644 src/PlanViewer.App/Services/AdviceContentBuilder.cs diff --git a/src/PlanViewer.App/Controls/PlanViewerControl.axaml b/src/PlanViewer.App/Controls/PlanViewerControl.axaml index b050af6..f632500 100644 --- a/src/PlanViewer.App/Controls/PlanViewerControl.axaml +++ b/src/PlanViewer.App/Controls/PlanViewerControl.axaml @@ -64,10 +64,10 @@ - + - + + @@ -96,6 +100,10 @@ Foreground="{DynamicResource ForegroundBrush}" Margin="0,0,0,4"/> + diff --git a/src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs b/src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs index 90d0b97..0c4b1a0 100644 --- a/src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs +++ b/src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs @@ -2385,7 +2385,15 @@ void AddRow(string label, string value) if (!string.IsNullOrEmpty(statement.StatementOptmEarlyAbortReason)) AddRow("Early abort", statement.StatementOptmEarlyAbortReason); - RuntimeSummaryContent.Children.Add(grid); + if (grid.Children.Count > 0) + { + RuntimeSummaryContent.Children.Add(grid); + RuntimeSummaryEmpty.IsVisible = false; + } + else + { + RuntimeSummaryEmpty.IsVisible = true; + } ShowServerContext(); } @@ -2394,10 +2402,13 @@ private void ShowServerContext() ServerContextContent.Children.Clear(); if (_serverMetadata == null) { - ServerContextBorder.IsVisible = false; + ServerContextEmpty.IsVisible = true; + ServerContextBorder.IsVisible = true; return; } + ServerContextEmpty.IsVisible = false; + var m = _serverMetadata; var fgColor = "#E4E6EB"; diff --git a/src/PlanViewer.App/Controls/QuerySessionControl.axaml b/src/PlanViewer.App/Controls/QuerySessionControl.axaml index 7262b7e..be49eb2 100644 --- a/src/PlanViewer.App/Controls/QuerySessionControl.axaml +++ b/src/PlanViewer.App/Controls/QuerySessionControl.axaml @@ -33,12 +33,12 @@ ToolTip.Tip="Capture estimated plan without executing (Ctrl+L)"/> -