mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-04-01 17:12:09 +00:00
add Update History
- add Computername into DataGrid (if needed) - add toggle for Update History - add Update History interface - add Update Interface Toggle Logic - add Update scan logic - initialize Update selected / all logic - center specific datagrid columns
This commit is contained in:
parent
eea96f596e
commit
e830ff03b1
6
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
6
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
@ -7,10 +7,10 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
# 🐞 **Issue Report**
|
# 🐞 **Issue Report**
|
||||||
Thank you for taking the time to report an issue! Please provide as much detail as possible to help us address the problem efficiently.
|
Thank you for taking the time to report an issue! Please provide as much detail as possible to help us address the problem efficiently.
|
||||||
|
|
||||||
## ⚠️ **IMPORTANT**
|
## ⚠️ **IMPORTANT**
|
||||||
- 🛠️ **Supported environments only:** We only support Windows 11. Custom ISOs that are not made using Microwin are not supported.
|
- 🛠️ **Supported environments only:** We only support Windows 11. Custom ISOs that are not made using Microwin are not supported.
|
||||||
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
||||||
|
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
|
4
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
4
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
@ -9,7 +9,7 @@ body:
|
|||||||
# ✨ **Feature request**
|
# ✨ **Feature request**
|
||||||
Thank you for taking the time to suggest a feature! Please provide as much detail as possible to help us understand and evaluate your request.
|
Thank you for taking the time to suggest a feature! Please provide as much detail as possible to help us understand and evaluate your request.
|
||||||
|
|
||||||
## ⚠️ **IMPORTANT**
|
## ⚠️ **IMPORTANT**
|
||||||
- 🛠️ **Supported environments only:** We only support Windows 11.
|
- 🛠️ **Supported environments only:** We only support Windows 11.
|
||||||
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
||||||
|
|
||||||
@ -54,4 +54,4 @@ body:
|
|||||||
label: 🖼️ Additional context
|
label: 🖼️ Additional context
|
||||||
placeholder: "Include screenshots, code blocks (use triple backticks ```), or any other relevant information."
|
placeholder: "Include screenshots, code blocks (use triple backticks ```), or any other relevant information."
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
@ -61,6 +61,10 @@ function Invoke-WPFButton {
|
|||||||
"WPFWinUtilInstallPSProfile" {Invoke-WinUtilInstallPSProfile}
|
"WPFWinUtilInstallPSProfile" {Invoke-WinUtilInstallPSProfile}
|
||||||
"WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile}
|
"WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile}
|
||||||
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
|
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
|
||||||
"WPFScanUpdates" {Invoke-WPFScanUpdates}
|
"WPFScanUpdates" {Invoke-WPFUpdatesScan}
|
||||||
|
"WPFShowUpdateHistory" { Invoke-WPFUpdateHistoryToggle }
|
||||||
|
"WPFUpdateSelectedInstall" {Invoke-WPFUpdateMGMT -Selected}
|
||||||
|
"WPFUpdateAllInstall" {Invoke-WPFUpdateMGMT -All}
|
||||||
|
"WPFUpdateScanHistory" {Invoke-WPFUpdateScanHistory}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
functions/public/Invoke-WPFUpdateHistoryToggle.ps1
Normal file
11
functions/public/Invoke-WPFUpdateHistoryToggle.ps1
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
function Invoke-WPFUpdateHistoryToggle {
|
||||||
|
if ($sync["WPFShowUpdateHistory"].Content -eq "Show History") {
|
||||||
|
$sync["WPFShowUpdateHistory"].Content = "Show available Updates"
|
||||||
|
$sync["HistoryGrid"].Visibility = "Visible"
|
||||||
|
$sync["UpdatesGrid"].Visibility = "Collapsed"
|
||||||
|
} else {
|
||||||
|
$sync["WPFShowUpdateHistory"].Content = "Show History"
|
||||||
|
$sync["HistoryGrid"].Visibility = "Collapsed"
|
||||||
|
$sync["UpdatesGrid"].Visibility = "Visible"
|
||||||
|
}
|
||||||
|
}
|
13
functions/public/Invoke-WPFUpdateMGMGT.ps1
Normal file
13
functions/public/Invoke-WPFUpdateMGMGT.ps1
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
function Invoke-WPFUpdateMGMT {
|
||||||
|
param (
|
||||||
|
[switch]$Selected,
|
||||||
|
[switch]$All
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($Selected) {
|
||||||
|
write-host "Installing selected updates"
|
||||||
|
} elseif ($All) {
|
||||||
|
Write-Host "Installing all available updates"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
46
functions/public/Invoke-WPFUpdateScanHistory.ps1
Normal file
46
functions/public/Invoke-WPFUpdateScanHistory.ps1
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
function Invoke-WPFUpdateScanHistory {
|
||||||
|
$sync["WPFUpdateHistory"].Items.Clear()
|
||||||
|
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
|
write-host "Scanning for Windows update history..."
|
||||||
|
$UpdateHistory = Get-WUHistory -Last 50 -ErrorAction SilentlyContinue
|
||||||
|
if ($UpdateHistory) {
|
||||||
|
foreach ($update in $UpdateHistory) {
|
||||||
|
$item = New-Object PSObject -Property @{
|
||||||
|
ComputerName = $update.ComputerName
|
||||||
|
Result = $update.Result
|
||||||
|
Title = $update.Title -replace '\s*\(KB\d+\)', '' -replace '\s*KB\d+\b', '' # Remove KB number from title, first in parentheses, then standalone
|
||||||
|
KB = $update.KB
|
||||||
|
Date = $update.Date
|
||||||
|
}
|
||||||
|
$Computers = $item | Select-Object -ExpandProperty ComputerName -Unique
|
||||||
|
$sync.form.Dispatcher.Invoke([action] {
|
||||||
|
$sync["WPFUpdateHistory"].Items.Add($item)
|
||||||
|
if ($item.Result -eq "Succeeded") {
|
||||||
|
# does not work : $sync["WPFUpdateHistory"].Items[$sync["WPFUpdateHistory"].Items.Count - 1].Foreground = "Green"
|
||||||
|
#write-host "$($item.Title) was successful"
|
||||||
|
}
|
||||||
|
elseif ($item.Result -eq "Failed") {
|
||||||
|
# does not work : $sync["WPFUpdateHistory"].Items[$sync["WPFUpdateHistory"].Items.Count - 1].Foreground = "Red"
|
||||||
|
#write-host "$($item.Title) failed"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
write-host "Found $($UpdateHistory.Count) updates."
|
||||||
|
$sync.form.Dispatcher.Invoke([action] {
|
||||||
|
if ($Computers.Count -gt 1) {
|
||||||
|
$sync["WPFUpdateHistory"].Columns[0].Visibility = "Visible"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Debug "Hiding ComputerName column, only $item.ComputerName"
|
||||||
|
$sync["WPFUpdateHistory"].Columns[0].Visibility = "Collapsed"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sync.form.Dispatcher.Invoke([action] {
|
||||||
|
$sync["WPFUpdateHistory"].Items.Clear()
|
||||||
|
})
|
||||||
|
Write-Host "No update history available."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
function Invoke-WPFScanUpdates {
|
function Invoke-WPFUpdatesScan {
|
||||||
|
|
||||||
|
|
||||||
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock {
|
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
@ -26,7 +26,6 @@ function Invoke-WPFScanUpdates {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Host "Clearing updates list..."
|
|
||||||
$sync.form.Dispatcher.Invoke([action] { $sync["WPFUpdatesList"].Items.Clear() })
|
$sync.form.Dispatcher.Invoke([action] { $sync["WPFUpdatesList"].Items.Clear() })
|
||||||
Write-Host "Scanning for Windows updates..."
|
Write-Host "Scanning for Windows updates..."
|
||||||
$updates = Get-WindowsUpdate -ErrorAction Stop
|
$updates = Get-WindowsUpdate -ErrorAction Stop
|
||||||
@ -35,13 +34,21 @@ function Invoke-WPFScanUpdates {
|
|||||||
$sync.form.Dispatcher.Invoke([action] {
|
$sync.form.Dispatcher.Invoke([action] {
|
||||||
foreach ($update in $updates) {
|
foreach ($update in $updates) {
|
||||||
$item = New-Object PSObject -Property @{
|
$item = New-Object PSObject -Property @{
|
||||||
|
ComputerName = $update.ComputerName
|
||||||
KB = $update.KB
|
KB = $update.KB
|
||||||
Size = $update.Size
|
Size = $update.Size
|
||||||
Title = $update.Title -replace '\s*\(KB\d+\)', '' -replace '\s*KB\d+\b', '' # Remove KB number from title, first in parentheses, then standalone
|
Title = $update.Title -replace '\s*\(KB\d+\)', '' -replace '\s*KB\d+\b', '' # Remove KB number from title, first in parentheses, then standalone
|
||||||
Status = "Not Installed"
|
Status = "Not Installed"
|
||||||
}
|
}
|
||||||
|
$Computers = $item | Select-Object -ExpandProperty ComputerName -Unique
|
||||||
$sync["WPFUpdatesList"].Items.Add($item)
|
$sync["WPFUpdatesList"].Items.Add($item)
|
||||||
}
|
}
|
||||||
|
if ($Computers.Count -gt 1) {
|
||||||
|
$sync["WPFUpdatesList"].Columns[0].Visibility = "Visible"
|
||||||
|
} else {
|
||||||
|
Write-Debug "Hiding ComputerName column, only $item.ComputerName"
|
||||||
|
$sync["WPFUpdatesList"].Columns[0].Visibility = "Collapsed"
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} catch {
|
} catch {
|
||||||
Write-Error "Error scanning for updates: $_"
|
Write-Error "Error scanning for updates: $_"
|
@ -1308,7 +1308,7 @@
|
|||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Updates" Visibility="Collapsed" Name="WPFTab4">
|
<TabItem Header="Updates" Visibility="Collapsed" Name="WPFTab4">
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{DynamicResource TabContentMargin}">
|
<!-- <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{DynamicResource TabContentMargin}"> -->
|
||||||
<Grid Background="Transparent">
|
<Grid Background="Transparent">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
@ -1352,51 +1352,163 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Button Name="WPFScanUpdates"
|
<!-- Toggle button at the top -->
|
||||||
Content="Scan for Updates"
|
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
|
||||||
Grid.Row="0"
|
<ToggleButton Name="WPFShowUpdateHistory"
|
||||||
Margin="5"
|
Content="Show History"
|
||||||
HorizontalAlignment="Left"
|
Style="{StaticResource ToggleButtonStyle}"
|
||||||
Padding="10,5"/>
|
Margin="5"
|
||||||
|
Padding="10,5"
|
||||||
<DataGrid Name="WPFUpdatesList"
|
ToolTip="Toggle between pending updates and update history"/>
|
||||||
Grid.Row="1"
|
|
||||||
Margin="5"
|
|
||||||
AutoGenerateColumns="False"
|
|
||||||
Background="Transparent"
|
|
||||||
IsReadOnly="True">
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTextColumn Header="Title"
|
|
||||||
Binding="{Binding Title}"
|
|
||||||
Width="*"/>
|
|
||||||
<DataGridTextColumn Header="KB"
|
|
||||||
Binding="{Binding KB}"
|
|
||||||
Width="100"/>
|
|
||||||
<DataGridTextColumn Header="Size"
|
|
||||||
Binding="{Binding Size}"
|
|
||||||
Width="80"/>
|
|
||||||
<DataGridTextColumn Header="Status"
|
|
||||||
Binding="{Binding Status}"
|
|
||||||
Width="100"/>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
|
|
||||||
<StackPanel Grid.Row="2"
|
|
||||||
Orientation="Horizontal"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Margin="5">
|
|
||||||
<Button Name="WPFInstallSelected"
|
|
||||||
Content="Install Selected"
|
|
||||||
Margin="5"
|
|
||||||
Padding="10,5"/>
|
|
||||||
<Button Name="WPFInstallAll"
|
|
||||||
Content="Install All"
|
|
||||||
Margin="5"
|
|
||||||
Padding="10,5"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Updates Grid - Visible by default -->
|
||||||
|
<Grid Grid.Row="1" Name="UpdatesGrid" Visibility="Visible">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Button Name="WPFScanUpdates"
|
||||||
|
Content="Scan for Updates"
|
||||||
|
Grid.Row="0"
|
||||||
|
Margin="5"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Padding="10,5"/>
|
||||||
|
|
||||||
|
<DataGrid Name="WPFUpdatesList"
|
||||||
|
Grid.Row="1"
|
||||||
|
Margin="5"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
Background="Transparent"
|
||||||
|
IsReadOnly="True"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="ComputerName"
|
||||||
|
Binding="{Binding ComputerName}"
|
||||||
|
Width="Auto"
|
||||||
|
Visibility="Collapsed"/>
|
||||||
|
<DataGridTextColumn Header="Title"
|
||||||
|
Binding="{Binding Title}"
|
||||||
|
Width="*"
|
||||||
|
MinWidth="100"/>
|
||||||
|
<DataGridTextColumn Header="KB"
|
||||||
|
Binding="{Binding KB}"
|
||||||
|
Width="Auto"
|
||||||
|
MinWidth="100">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextAlignment" Value="Center"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="Size"
|
||||||
|
Binding="{Binding Size}"
|
||||||
|
Width="Auto"
|
||||||
|
MinWidth="80">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextAlignment" Value="Center"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="Status"
|
||||||
|
Binding="{Binding Status}"
|
||||||
|
Width="Auto"
|
||||||
|
MinWidth="100">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextAlignment" Value="Center"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="2"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Margin="5">
|
||||||
|
<Button Name="WPFUpdateSelectedInstall"
|
||||||
|
Content="Install Selected"
|
||||||
|
Margin="5"
|
||||||
|
Padding="10,5"/>
|
||||||
|
<Button Name="WPFUpdateAllInstall"
|
||||||
|
Content="Install All"
|
||||||
|
Margin="5"
|
||||||
|
Padding="10,5"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- History Grid - Collapsed by default -->
|
||||||
|
<Grid Grid.Row="1" Name="HistoryGrid" Visibility="Collapsed">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Button Name="WPFUpdateScanHistory"
|
||||||
|
Content="Scan History"
|
||||||
|
Grid.Row="0"
|
||||||
|
Margin="5"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Padding="10,5"/>
|
||||||
|
|
||||||
|
<DataGrid Name="WPFUpdateHistory"
|
||||||
|
Grid.Row="1"
|
||||||
|
Margin="5"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
Background="Transparent"
|
||||||
|
IsReadOnly="True"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="ComputerName"
|
||||||
|
Binding="{Binding ComputerName}"
|
||||||
|
Width="Auto"
|
||||||
|
Visibility="Collapsed"/>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="Result"
|
||||||
|
Binding="{Binding Result}"
|
||||||
|
Width="Auto"
|
||||||
|
MinWidth="100">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextAlignment" Value="Center"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="Title"
|
||||||
|
Binding="{Binding Title}"
|
||||||
|
Width="*"/>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="KB"
|
||||||
|
Binding="{Binding KB}"
|
||||||
|
Width="Auto"
|
||||||
|
MinWidth="100">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextAlignment" Value="Center"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="Date"
|
||||||
|
Binding="{Binding Date}"
|
||||||
|
Width="Auto"
|
||||||
|
MinWidth="160">
|
||||||
|
</DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -1409,7 +1521,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
<!-- </ScrollViewer> -->
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="MicroWin" Visibility="Collapsed" Name="WPFTab5">
|
<TabItem Header="MicroWin" Visibility="Collapsed" Name="WPFTab5">
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{DynamicResource TabContentMargin}">
|
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{DynamicResource TabContentMargin}">
|
||||||
|
Loading…
Reference in New Issue
Block a user