Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/PlanViewer.App/Controls/PlanViewerControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
<ColumnDefinition Width="Auto" MinWidth="180"/>
<ColumnDefinition Width="*" MinWidth="200"/>
<ColumnDefinition Width="*" MinWidth="200"/>
<ColumnDefinition Width="*" MinWidth="200"/>
<ColumnDefinition Width="2*" MinWidth="280"/>
</Grid.ColumnDefinitions>

<!-- Server Context (first, only visible when connected) -->
<!-- Server Context (first, placeholder when no metadata) -->
<Border x:Name="ServerContextBorder" Grid.Column="0" Padding="10,4,10,8"
Background="#1A1A2D"
BorderBrush="#3A3A5A" BorderThickness="0,0,1,0"
Expand All @@ -81,6 +81,10 @@
Foreground="#9B9BFF"
Margin="0,0,0,6"/>
<StackPanel x:Name="ServerContextContent"/>
<TextBlock x:Name="ServerContextEmpty"
Text="Run Repro Script to capture server context"
FontSize="12" IsVisible="False"
Foreground="{DynamicResource ForegroundBrush}"/>
</StackPanel>
</ScrollViewer>
</Border>
Expand All @@ -96,6 +100,10 @@
Foreground="{DynamicResource ForegroundBrush}"
Margin="0,0,0,4"/>
<StackPanel x:Name="RuntimeSummaryContent"/>
<TextBlock x:Name="RuntimeSummaryEmpty"
Text="Estimated plan — no runtime stats"
FontSize="12" IsVisible="False"
Foreground="{DynamicResource ForegroundBrush}"/>
</StackPanel>
</Border>

Expand Down
15 changes: 13 additions & 2 deletions src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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";

Expand Down
8 changes: 4 additions & 4 deletions src/PlanViewer.App/Controls/QuerySessionControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
ToolTip.Tip="Capture estimated plan without executing (Ctrl+L)"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="4,0"/>
<Button x:Name="HumanAdviceButton" Content="&#x1F9D1; Advice for Humans"
<Button x:Name="HumanAdviceButton" Content="&#x1F9D1; Human Advice"
Click="HumanAdvice_Click"
Height="28" Padding="10,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Human-readable plan analysis"/>
<Button x:Name="RobotAdviceButton" Content="&#x1F916; Advice for Robots"
<Button x:Name="RobotAdviceButton" Content="&#x1F916; Robot Advice"
Click="RobotAdvice_Click"
Height="28" Padding="10,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
Expand All @@ -59,12 +59,12 @@
ToolTip.Tip="Analyze top queries from Query Store"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="4,0"/>
<Button x:Name="CopyReproButton" Content="&#x1F4CB; Copy Repro Script"
<Button x:Name="CopyReproButton" Content="&#x1F4CB; Copy Repro"
Click="CopyRepro_Click"
Height="28" Padding="10,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Copy reproduction script to clipboard"/>
<Button x:Name="GetActualPlanButton" Content="&#x25B6; Run Repro Script"
<Button x:Name="GetActualPlanButton" Content="&#x25B6; Run Repro"
Click="GetActualPlan_Click"
Height="28" Padding="10,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
Expand Down
14 changes: 2 additions & 12 deletions src/PlanViewer.App/Controls/QuerySessionControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -708,21 +708,11 @@ private void RobotAdvice_Click(object? sender, RoutedEventArgs e)

private void ShowAdviceWindow(string title, string content)
{
var textBox = new TextBox
{
Text = content,
IsReadOnly = true,
AcceptsReturn = true,
FontFamily = new FontFamily("Consolas, Menlo, monospace"),
FontSize = 12,
Background = Brushes.Transparent,
BorderThickness = new Avalonia.Thickness(0),
TextWrapping = TextWrapping.Wrap
};
var styledContent = AdviceContentBuilder.Build(content);

var scrollViewer = new ScrollViewer
{
Content = textBox,
Content = styledContent,
HorizontalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Disabled,
VerticalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Auto
};
Expand Down
Loading
Loading