-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Show configuration keys in UI tooltips #4968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Rene-Kuhm
wants to merge
3
commits into
ChrisTitusTech:main
from
Rene-Kuhm:agent/show-config-keys-in-tooltips
Closed
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| function Get-WinUtilConfigToolTip { | ||
| <# | ||
| .SYNOPSIS | ||
| Builds a tooltip that includes an entry's configuration key. | ||
| .PARAMETER Description | ||
| The user-facing description of the configuration entry. | ||
| .PARAMETER ConfigKey | ||
| The key used to reference the entry in an exported configuration. | ||
| #> | ||
| param( | ||
| [AllowEmptyString()] | ||
| [string]$Description, | ||
|
|
||
| [Parameter(Mandatory)] | ||
| [string]$ConfigKey | ||
| ) | ||
|
|
||
| $configKeyText = "Configuration key: $ConfigKey" | ||
| if ([string]::IsNullOrWhiteSpace($Description)) { | ||
| return $configKeyText | ||
| } | ||
|
|
||
| return "$Description`n`n$configKeyText" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #=========================================================================== | ||
| # Tests - Configuration tooltips | ||
| #=========================================================================== | ||
|
|
||
| BeforeAll { | ||
| $script:repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path | ||
| . (Join-Path $script:repoRoot "functions\private\Get-WinUtilConfigToolTip.ps1") | ||
| } | ||
|
|
||
| Describe "Get-WinUtilConfigToolTip" { | ||
| It "appends the configuration key to an existing description" { | ||
| $toolTip = Get-WinUtilConfigToolTip ` | ||
| -Description "Installs Mozilla Firefox." ` | ||
| -ConfigKey "WPFInstallfirefox" | ||
|
|
||
| $toolTip | Should -Be "Installs Mozilla Firefox.`n`nConfiguration key: WPFInstallfirefox" | ||
| } | ||
|
|
||
| It "shows the configuration key when an entry has no description" { | ||
| Get-WinUtilConfigToolTip -Description "" -ConfigKey "WPFOOSUbutton" | | ||
| Should -Be "Configuration key: WPFOOSUbutton" | ||
| } | ||
| } | ||
|
|
||
| Describe "Configuration tooltip rendering" { | ||
| It "uses configuration-key tooltips for install entries" { | ||
| $entryScript = Get-Content -Path (Join-Path $script:repoRoot "functions\private\Initialize-InstallAppEntry.ps1") -Raw | ||
|
|
||
| $entryScript | Should -Match '\$border\.ToolTip = Get-WinUtilConfigToolTip -Description \$app\.description -ConfigKey \$appKey' | ||
| } | ||
|
|
||
| It "uses configuration-key tooltips for generated tweak controls" { | ||
| $rendererScript = Get-Content -Path (Join-Path $script:repoRoot "functions\public\Invoke-WPFUIElements.ps1") -Raw | ||
|
|
||
| $rendererScript | Should -Match '\$isSelectableEntry = .*"Toggle", "ToggleButton"' | ||
| $rendererScript | Should -Match '\$isImportableKey = \$entry -match.*WPFTweaks.*WPFToggle.*WPFFeature.*WPFAppx' | ||
| $rendererScript | Should -Match '\$entryToolTip = Get-WinUtilConfigToolTip -Description \$entryInfo\.description -ConfigKey \$entry' | ||
| $rendererScript | Should -Match '\$label\.ToolTip = \$entryInfo\.ToolTip' | ||
| $rendererScript | Should -Match '\$toggleButton\.ToolTip = \$entryInfo\.ToolTip' | ||
| $rendererScript | Should -Match '\$checkBox\.ToolTip = \$entryInfo\.ToolTip' | ||
| } | ||
|
|
||
| It "keeps non-selectable controls out of configuration-key tooltips" { | ||
| $rendererScript = Get-Content -Path (Join-Path $script:repoRoot "functions\public\Invoke-WPFUIElements.ps1") -Raw | ||
|
|
||
| $rendererScript | Should -Not -Match '\$button\.ToolTip = \$entryInfo\.ToolTip' | ||
| $rendererScript | Should -Match '\$label\.ToolTip = \$entryInfo\.Description' | ||
| $rendererScript | Should -Match '\$radioButton\.ToolTip = \$entryInfo\.Description' | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a user adds an advertised
WPFToggle*key to a configuration and launches the documented-Configworkflow,Update-WinUtilSelectionsstores it only inselectedToggles, but thescripts/main.ps1config path callsInvoke-WinUtilAutoRun, which processes only tweaks, features, apps, and AppX entries. Because this headless path never creates the form whose Checked handlers apply toggles, the key is silently ignored; excludeWPFTogglehere or add toggle handling to the automation path.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 8b1c15c. WPFToggle entries are now excluded from advertised configuration keys because Invoke-WinUtilAutoRun does not process selectedToggles in the documented headless -Config path. The tooltip is now limited to checkbox selections that automation actually consumes, and the focused test locks in that exclusion. All 557 tests and Compile.ps1 pass.