mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Allow custom BYO app list file paths in UI
Updates the FFU UI and orchestration scripts to allow users to specify custom file paths for their Bring Your Own (BYO) app lists, rather than forcing the use of `UserAppList.json` in a specific directory. Also modifies the orchestration to sync this custom path via `AppInstallConfig.json` so that the runtime orchestration phase resolves the correct file name and path during installation. Refreshes the Apps ISO if the custom BYO app list is updated.
This commit is contained in:
@@ -435,10 +435,18 @@ function Register-EventHandlers {
|
||||
param($eventSource, $routedEventArgs)
|
||||
$window = [System.Windows.Window]::GetWindow($eventSource)
|
||||
$localState = $window.Tag
|
||||
$selectedPath = Invoke-BrowseAction -Type 'OpenFile' -Title "Select AppList.json File" -Filter "JSON files (*.json)|*.json" -AllowNewFile
|
||||
$selectedPath = Invoke-BrowseAction -Type 'OpenFile' -Title "Select Winget AppList File" -Filter "JSON files (*.json)|*.json" -AllowNewFile
|
||||
if ($selectedPath) { $localState.Controls.txtAppListJsonPath.Text = $selectedPath }
|
||||
})
|
||||
|
||||
$State.Controls.btnBrowseUserAppListPath.Add_Click({
|
||||
param($eventSource, $routedEventArgs)
|
||||
$window = [System.Windows.Window]::GetWindow($eventSource)
|
||||
$localState = $window.Tag
|
||||
$selectedPath = Invoke-BrowseAction -Type 'OpenFile' -Title "Select BYO AppList File" -Filter "JSON files (*.json)|*.json" -AllowNewFile
|
||||
if ($selectedPath) { $localState.Controls.txtUserAppListPath.Text = $selectedPath }
|
||||
})
|
||||
|
||||
$State.Controls.btnBrowseAppSource.Add_Click({
|
||||
param($eventSource, $routedEventArgs)
|
||||
$window = [System.Windows.Window]::GetWindow($eventSource)
|
||||
@@ -466,17 +474,23 @@ function Register-EventHandlers {
|
||||
$window = [System.Windows.Window]::GetWindow($eventSource)
|
||||
$localState = $window.Tag
|
||||
|
||||
$initialDir = $localState.Controls.txtApplicationPath.Text
|
||||
# Default the save dialog to the configured BYO app list path.
|
||||
$currentPath = $localState.Controls.txtUserAppListPath.Text
|
||||
$initialDir = if (-not [string]::IsNullOrWhiteSpace($currentPath)) { Split-Path -Path $currentPath -Parent } else { $localState.Controls.txtApplicationPath.Text }
|
||||
if ([string]::IsNullOrWhiteSpace($initialDir) -or -not (Test-Path $initialDir)) { $initialDir = $localState.FFUDevelopmentPath }
|
||||
$fileName = if (-not [string]::IsNullOrWhiteSpace($currentPath)) { Split-Path -Path $currentPath -Leaf } else { "UserAppList.json" }
|
||||
|
||||
$savePath = Invoke-BrowseAction -Type 'SaveFile' `
|
||||
-Title "Save Application List" `
|
||||
-Title "Save BYO App List" `
|
||||
-Filter "JSON files (*.json)|*.json|All files (*.*)|*.*" `
|
||||
-InitialDirectory $initialDir `
|
||||
-FileName "UserAppList.json" `
|
||||
-FileName $fileName `
|
||||
-DefaultExt ".json"
|
||||
|
||||
if ($savePath) { Save-BYOApplicationList -Path $savePath -State $localState }
|
||||
if ($savePath) {
|
||||
$localState.Controls.txtUserAppListPath.Text = $savePath
|
||||
Save-BYOApplicationList -Path $savePath -State $localState
|
||||
}
|
||||
})
|
||||
|
||||
$State.Controls.btnLoadBYOApplications.Add_Click({
|
||||
@@ -484,15 +498,18 @@ function Register-EventHandlers {
|
||||
$window = [System.Windows.Window]::GetWindow($eventSource)
|
||||
$localState = $window.Tag
|
||||
|
||||
$initialDir = $localState.Controls.txtApplicationPath.Text
|
||||
# Default the import dialog to the configured BYO app list path.
|
||||
$currentPath = $localState.Controls.txtUserAppListPath.Text
|
||||
$initialDir = if (-not [string]::IsNullOrWhiteSpace($currentPath)) { Split-Path -Path $currentPath -Parent } else { $localState.Controls.txtApplicationPath.Text }
|
||||
if ([string]::IsNullOrWhiteSpace($initialDir) -or -not (Test-Path $initialDir)) { $initialDir = $localState.FFUDevelopmentPath }
|
||||
|
||||
$loadPath = Invoke-BrowseAction -Type 'OpenFile' `
|
||||
-Title "Import Application List" `
|
||||
-Title "Import BYO App List" `
|
||||
-Filter "JSON files (*.json)|*.json|All files (*.*)|*.*" `
|
||||
-InitialDirectory $initialDir
|
||||
|
||||
if ($loadPath) {
|
||||
if ($loadPath) {
|
||||
$localState.Controls.txtUserAppListPath.Text = $loadPath
|
||||
Import-BYOApplicationList -Path $loadPath -State $localState
|
||||
Update-CopyButtonState -State $localState
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user