controls/powershell-version-create-modal.ps1
function New-UDCreatePowerShellVersionModal { Show-UDModal -Content { New-UDPageHeader -Text ("Add new Powershell Version") New-UDParagraph -Text "Specify new PowerShell Version properties" New-UDTextbox -Id "NewPowerShellVersionTextBoxVersion" -Label "Version" -Type text New-UDTextbox -Id "NewPowerShellVersionTextBoxPath" -Label "Path" -Type text New-UDTextbox -Id "NewPowerShellVersionTextBoxArguments" -Label "Arguments" -Type text New-UDElement -Tag div -Attributes @{ style = @{ textAlign = "right" } } -Content { New-UDButton -Text "Add PowerShell Version" -Icon folder_plus -OnClick { # Get Input Data $Version = ((Get-UDElement -Id 'NewPowerShellVersionTextBoxVersion').Attributes["value"]) $Path = ((Get-UDElement -Id 'NewPowerShellVersionTextBoxPath').Attributes["value"]) $Arguments = ((Get-UDElement -Id 'NewPowerShellVersionTextBoxArguments').Attributes["value"]) # Null Checks $Arguments = if (!$Arguments -or $Arguments -eq "" -or $Arguments -eq "null") {@("")} else { $Arguments } # Update Script New-UAPowerShellVersion -Version $Version -Path $Path -Arguments $Arguments # Grid Sync Sync-UDElement -Id "PowerShellVersionsGrid" -Broadcast Hide-UDModal } } } } |