controls/powershell-version-grid.ps1
function New-PowerShellVersionGrid { New-UDGrid -Id "PowerShellVersionsGrid" -Title "PowerShell Versions" -Headers @("Id", "Version","Path","Arguments","Actions") -Properties @("Id", "Version","Path","Arguments","Actions") -Endpoint { $PowerShellVersions = Get-UAPowerShellVersion $PowerShellVersions | ForEach-Object{ $PowerShellVersion = $_ $RemoveButton = New-UDButton -Text "" -Icon ban -OnClick { New-UDDeletePowerShellVersionModal -PowerShellVersion $PowerShellVersion } $EditButton = New-UDButton -Text "" -Icon edit -OnClick { New-UDEditPowerShellVersionModal -PowerShellVersion $PowerShellVersion } if ($Session:UserRole -eq 'Administrator' -or $Session:UserRole -eq 'Operator') { $ActionControls = New-UDElement -Tag div -Content{ New-UDTooltip -Content{$EditButton} -TooltipContent {"Edit PowerShell Version"} " " New-UDTooltip -Content{$RemoveButton} -TooltipContent {"Remove PowerShell Version"} } } [PSCustomObject]@{ Id = $_.Id Version = $_.Version Path = $_.Path Arguments = $_.Arguments Actions = $ActionControls } } | Out-UDGridData } } |