mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-10-09 21:21:18 +11:00
Fix legacy json import compatibility, UI sidebar refactor, and improved test coverage (#4911)
* Fix backward compatibility for old-style JSON config imports * Refactor sidebar UI generation and add tests for Get-WinUtilVariables * Fix appnavigation config test following UI generation refactor * Restore global sync state in variables tests * fix(impex): migrate supported legacy selections Keep modern imports strict while allowing legacy backups to skip retired entries with clear logging and user feedback. Add fixtures covering partial and all-retired imports. * test: strengthen UI and global state coverage Exercise app category rendering through Initialize-WPFUI and restore global sync without leaking test state. * fix(impex): ignore legacy metadata fields Limit legacy selection migration to supported WPF key families so unrelated string metadata does not produce false retired-setting warnings. * docs: clarify legacy config imports Distinguish strict modern flat imports from partial legacy object migration, including single-setting export shape and historical groups. --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
@@ -3,7 +3,9 @@ function Update-WinUtilSelections {
|
||||
[Parameter(Mandatory)]
|
||||
[string[]]$flatJson,
|
||||
|
||||
[switch]$Replace
|
||||
[switch]$Replace,
|
||||
|
||||
[switch]$SkipUnknown
|
||||
)
|
||||
|
||||
$nextSelections = @{
|
||||
@@ -25,6 +27,10 @@ function Update-WinUtilSelections {
|
||||
}
|
||||
|
||||
if (-not $listName) {
|
||||
if ($SkipUnknown) {
|
||||
$cbkey
|
||||
continue
|
||||
}
|
||||
throw "Unsupported selection key '$cbkey'."
|
||||
}
|
||||
|
||||
@@ -47,12 +53,21 @@ function Update-WinUtilSelections {
|
||||
}
|
||||
|
||||
if (-not $isKnownSelection) {
|
||||
if ($SkipUnknown) {
|
||||
$cbkey
|
||||
continue
|
||||
}
|
||||
throw "Unknown selection key '$cbkey'."
|
||||
}
|
||||
|
||||
$nextSelections[$listName].Add($cbkey)
|
||||
}
|
||||
|
||||
$validSelectionCount = ($nextSelections.Values | ForEach-Object { $_.Count } | Measure-Object -Sum).Sum
|
||||
if ($SkipUnknown -and $validSelectionCount -eq 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if ($Replace) {
|
||||
foreach ($listName in $nextSelections.Keys) {
|
||||
$sync[$listName] = $nextSelections[$listName]
|
||||
|
||||
Reference in New Issue
Block a user