Jun 11, 2026, 10:38 AM
This commit is contained in:
@@ -47,6 +47,7 @@ $dgServerInfo = $Window.FindName("dgServerInfo")
|
|||||||
$tvServers = $Window.FindName("tvServers")
|
$tvServers = $Window.FindName("tvServers")
|
||||||
$btnAddServer = $Window.FindName("btnAddServer")
|
$btnAddServer = $Window.FindName("btnAddServer")
|
||||||
$btnRemoveServer = $Window.FindName("btnRemoveServer")
|
$btnRemoveServer = $Window.FindName("btnRemoveServer")
|
||||||
|
$gridDetails = $Window.FindName("gridDetails")
|
||||||
|
|
||||||
# Set initial values from settings
|
# Set initial values from settings
|
||||||
$txtServerName.Text = $settings.LastServer
|
$txtServerName.Text = $settings.LastServer
|
||||||
@@ -135,10 +136,11 @@ function Refresh-ServerTree {
|
|||||||
$tvServers.Add_SelectedItemChanged({
|
$tvServers.Add_SelectedItemChanged({
|
||||||
param($sender, $e)
|
param($sender, $e)
|
||||||
$selectedItem = $tvServers.SelectedItem
|
$selectedItem = $tvServers.SelectedItem
|
||||||
if ($null -ne $selectedItem -and $null -ne $selectedItem.Tag) {
|
if ($null -ne $selectedItem -and $null -ne $selectedItem.Tag -and $selectedItem.Tag -ne "__ROOT__") {
|
||||||
|
# Show detail panel
|
||||||
|
$gridDetails.Visibility = "Visible"
|
||||||
|
|
||||||
if ($selectedItem.Tag -is [string]) {
|
if ($selectedItem.Tag -is [string]) {
|
||||||
if ($selectedItem.Tag -eq "__ROOT__") { return }
|
|
||||||
|
|
||||||
# It's a server node, copy its name to TextBox
|
# It's a server node, copy its name to TextBox
|
||||||
$txtServerName.Text = $selectedItem.Tag
|
$txtServerName.Text = $selectedItem.Tag
|
||||||
Write-Log "Selected server: $($selectedItem.Tag)"
|
Write-Log "Selected server: $($selectedItem.Tag)"
|
||||||
@@ -147,6 +149,9 @@ $tvServers.Add_SelectedItemChanged({
|
|||||||
$db = $selectedItem.Tag
|
$db = $selectedItem.Tag
|
||||||
Write-Log "Selected database: $($db.Name) (Size: $($db.Size), Status: $($db.Status))"
|
Write-Log "Selected database: $($db.Name) (Size: $($db.Size), Status: $($db.Status))"
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
# Hide detail panel if selection is null or ROOT
|
||||||
|
$gridDetails.Visibility = "Collapsed"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+21
-14
@@ -48,25 +48,32 @@
|
|||||||
<!-- Right Panel: Connection and Main Workspace -->
|
<!-- Right Panel: Connection and Main Workspace -->
|
||||||
<Grid Grid.Column="2" Margin="10,0,0,0">
|
<Grid Grid.Column="2" Margin="10,0,0,0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<Grid.RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="*"/>
|
<Grid.RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Connection Panel -->
|
<!-- Information/Connection Panel (Hidden until a server/db is selected) -->
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
|
<Grid x:Name="gridDetails" Grid.Row="0" Visibility="Collapsed">
|
||||||
<Label Content="Server Name:" VerticalAlignment="Center" FontWeight="SemiBold"/>
|
<Grid.RowDefinitions>
|
||||||
<TextBox x:Name="txtServerName" Width="250" VerticalAlignment="Center" Margin="5,0,10,0" Padding="4"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<Button x:Name="btnConnect" Content="Connect & Test" Width="120" Padding="5" Background="#007ACC" Foreground="White" BorderThickness="0" Cursor="Hand"/>
|
<RowDefinition Height="*"/>
|
||||||
</StackPanel>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Main Content Area -->
|
<!-- Connection Panel -->
|
||||||
<GroupBox Grid.Row="1" Header="Server Information" Margin="0,0,0,10" Foreground="#2D3E50" FontWeight="SemiBold">
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,10">
|
||||||
<DataGrid x:Name="dgServerInfo" AutoGenerateColumns="True" IsReadOnly="True" Background="White" BorderBrush="#CCCCCC" Margin="5"/>
|
<Label Content="Server Name:" VerticalAlignment="Center" FontWeight="SemiBold"/>
|
||||||
</GroupBox>
|
<TextBox x:Name="txtServerName" Width="250" VerticalAlignment="Center" Margin="5,0,10,0" Padding="4"/>
|
||||||
|
<Button x:Name="btnConnect" Content="Connect & Test" Width="120" Padding="5" Background="#007ACC" Foreground="White" BorderThickness="0" Cursor="Hand"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Main Content Area -->
|
||||||
|
<GroupBox Grid.Row="1" Header="Server Information" Margin="0,0,0,10" Foreground="#2D3E50" FontWeight="SemiBold">
|
||||||
|
<DataGrid x:Name="dgServerInfo" AutoGenerateColumns="True" IsReadOnly="True" Background="White" BorderBrush="#CCCCCC" Margin="5"/>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<!-- Log Area -->
|
<!-- Log Area -->
|
||||||
<TextBox Grid.Row="2" x:Name="txtLogs" Height="120" IsReadOnly="True" VerticalScrollBarVisibility="Auto" Background="#E8E8E8" FontFamily="Consolas" FontSize="11" TextWrapping="Wrap" BorderBrush="#CCCCCC" Padding="5"/>
|
<TextBox Grid.Row="1" x:Name="txtLogs" Height="120" IsReadOnly="True" VerticalScrollBarVisibility="Auto" Background="#E8E8E8" FontFamily="Consolas" FontSize="11" TextWrapping="Wrap" BorderBrush="#CCCCCC" Padding="5"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user