forked from erikdarlingdata/PerformanceStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuerySessionControl.axaml
More file actions
136 lines (135 loc) · 8.85 KB
/
QuerySessionControl.axaml
File metadata and controls
136 lines (135 loc) · 8.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ae="using:AvaloniaEdit"
x:Class="PlanViewer.App.Controls.QuerySessionControl"
Background="{DynamicResource BackgroundBrush}">
<Grid RowDefinitions="Auto,*">
<!-- Toolbar -->
<Border Grid.Row="0" Background="{DynamicResource BackgroundDarkBrush}" Padding="8,6"
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
<DockPanel>
<TextBlock x:Name="StatusText" DockPanel.Dock="Right"
HorizontalAlignment="Right" VerticalAlignment="Center"
FontSize="11" Foreground="{DynamicResource ForegroundBrush}"
TextTrimming="CharacterEllipsis" Margin="8,0,0,0"/>
<WrapPanel Orientation="Horizontal">
<WrapPanel.Styles>
<Style Selector="Button">
<Setter Property="Margin" Value="0,2,4,2"/>
</Style>
<Style Selector="ComboBox">
<Setter Property="Margin" Value="0,2,4,2"/>
</Style>
</WrapPanel.Styles>
<Button x:Name="ConnectButton" Content="Connect" Click="Connect_Click"
Height="28" Padding="8,0" FontSize="12"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Connect to a SQL Server"/>
<TextBlock x:Name="ServerLabel" Text="Not connected"
VerticalAlignment="Center" FontSize="12"
Foreground="{DynamicResource ForegroundBrush}" Margin="2,0,0,0"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="2,0"/>
<ComboBox x:Name="DatabaseBox" Width="200" Height="28" FontSize="12"
IsEnabled="False" PlaceholderText="Database"
SelectionChanged="Database_SelectionChanged"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="2,0"/>
<Button x:Name="ExecuteButton" Content="▶ Actual Plan" Click="Execute_Click"
Height="28" Padding="8,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Run query and capture execution plan with runtime stats (F5 / Ctrl+E)"/>
<Button x:Name="ExecuteEstButton" Content="◇ Estimated Plan" Click="ExecuteEstimated_Click"
Height="28" Padding="8,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Capture estimated plan without executing (Ctrl+L)"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="2,0"/>
<Button x:Name="HumanAdviceButton" Content="🧑 Human Advice"
Click="HumanAdvice_Click"
Height="28" Padding="8,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Human-readable plan analysis"/>
<Button x:Name="RobotAdviceButton" Content="🤖 Robot Advice"
Click="RobotAdvice_Click"
Height="28" Padding="8,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="JSON analysis for LLMs and automation"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="2,0"/>
<Button x:Name="ComparePlansButton" Content="↔ Compare Plans"
Click="ComparePlans_Click"
Height="28" Padding="8,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Compare two plan tabs"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="2,0"/>
<Button x:Name="QueryStoreButton" Content="📊 Query Store"
Click="QueryStore_Click"
Height="28" Padding="8,0" FontSize="12"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Analyze top queries from Query Store"/>
<Button x:Name="QueryStoreOverviewButton" Content="📊 QS Overview"
Click="QueryStoreOverview_Click"
Height="28" Padding="8,0" FontSize="12"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Query Stores Overview across all databases"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="2,0"/>
<Button x:Name="CopyReproButton" Content="📋 Copy Repro"
Click="CopyRepro_Click"
Height="28" Padding="8,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Copy reproduction script to clipboard"/>
<Button x:Name="GetActualPlanButton" Content="▶ Run Repro"
Click="GetActualPlan_Click"
Height="28" Padding="8,0" FontSize="12" IsEnabled="False"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Execute the repro script and capture actual plan with runtime stats"/>
<TextBlock Text="|" VerticalAlignment="Center"
Foreground="{DynamicResource ForegroundBrush}" Margin="4,0"/>
<Button x:Name="FormatButton" Content="📝 Format" Click="Format_Click"
Height="28" Padding="10,0" FontSize="12"
Theme="{StaticResource AppButton}"
ToolTip.Tip="Format the SQL query"/>
</WrapPanel>
</DockPanel>
</Border>
<!-- Sub-TabControl: Editor + Plan tabs -->
<TabControl Grid.Row="1" x:Name="SubTabControl"
Background="{DynamicResource BackgroundBrush}" Padding="0">
<!-- Editor tab (always present) -->
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="Query Editor" VerticalAlignment="Center"/>
<ComboBox x:Name="ZoomBox" Width="72" Height="22" FontSize="11"
VerticalAlignment="Center"
SelectionChanged="Zoom_SelectionChanged"
ToolTip.Tip="Editor font size (Ctrl+mousewheel)">
<ComboBoxItem Content="50%" Tag="7"/>
<ComboBoxItem Content="75%" Tag="10"/>
<ComboBoxItem Content="100%" Tag="13" IsSelected="True"/>
<ComboBoxItem Content="125%" Tag="16"/>
<ComboBoxItem Content="150%" Tag="20"/>
<ComboBoxItem Content="200%" Tag="26"/>
<ComboBoxItem Content="300%" Tag="39"/>
<ComboBoxItem Content="400%" Tag="52"/>
</ComboBox>
</StackPanel>
</TabItem.Header>
<ae:TextEditor x:Name="QueryEditor"
FontFamily="Consolas, Menlo, monospace"
FontSize="13"
ShowLineNumbers="True"
Background="{DynamicResource BackgroundBrush}"
Foreground="{DynamicResource ForegroundBrush}"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Padding="4"/>
</TabItem>
</TabControl>
</Grid>
</UserControl>