mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Feat: Add live log monitoring tab to UI
Introduces a new "Monitor" tab in the `BuildFFUVM` UI to display live log output from the build process. When a build is started, the UI now automatically switches to the Monitor tab. It tails the main log file in real-time and displays the content in a list view, which auto-scrolls as new entries appear. This provides immediate visual feedback on the build progress and any errors without needing to manually open the log file. Additionally, this change adds a Ctrl+C keyboard shortcut to copy selected log lines from the monitor view to the clipboard.
This commit is contained in:
@@ -756,5 +756,27 @@ function Register-EventHandlers {
|
||||
$localState = $window.Tag
|
||||
Invoke-SaveConfiguration -State $localState
|
||||
})
|
||||
|
||||
# Monitor Tab Event Handlers
|
||||
$State.Controls.lstLogOutput.Add_KeyDown({
|
||||
param($eventSource, $keyEventArgs)
|
||||
# Check for Ctrl+C
|
||||
if ($keyEventArgs.Key -eq 'C' -and ($keyEventArgs.KeyboardDevice.Modifiers -band [System.Windows.Input.ModifierKeys]::Control)) {
|
||||
$listBox = $eventSource
|
||||
if ($listBox.SelectedItems.Count -gt 0) {
|
||||
$selectedLines = $listBox.SelectedItems | ForEach-Object { $_.ToString() }
|
||||
$clipboardText = $selectedLines -join [System.Environment]::NewLine
|
||||
|
||||
try {
|
||||
[System.Windows.Clipboard]::SetText($clipboardText)
|
||||
WriteLog "Copied $($listBox.SelectedItems.Count) log lines to clipboard."
|
||||
}
|
||||
catch {
|
||||
WriteLog "Error copying to clipboard: $($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
$keyEventArgs.Handled = $true
|
||||
}
|
||||
})
|
||||
}
|
||||
Export-ModuleMember -Function *
|
||||
@@ -150,6 +150,14 @@ function Initialize-UIControls {
|
||||
$State.Controls.btnLoadConfig = $window.FindName('btnLoadConfig')
|
||||
$State.Controls.btnBuildConfig = $window.FindName('btnBuildConfig')
|
||||
|
||||
# Monitor Tab
|
||||
$State.Controls.MainTabControl = $window.FindName('MainTabControl')
|
||||
$State.Controls.MonitorTab = $window.FindName('MonitorTab')
|
||||
$State.Controls.lstLogOutput = $window.FindName('lstLogOutput')
|
||||
|
||||
# Initialize and bind the log data collection
|
||||
$State.Data.logData = New-Object System.Collections.ObjectModel.ObservableCollection[string]
|
||||
$State.Controls.lstLogOutput.ItemsSource = $State.Data.logData
|
||||
}
|
||||
|
||||
function Initialize-VMSwitchData {
|
||||
|
||||
Reference in New Issue
Block a user