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 ($null -eq $Session:AuthorizationPolicies -or ($Session:UserRole -eq 'Administrator' -or $Session:UserRole -eq 'Operator'))
            {
                $ActionButtons =  New-UDElement -Tag div -Content{
                    New-UDTooltip -Content{$EditButton} -TooltipContent {"Edit PowerShell Version"}
                    " "
                    New-UDTooltip -Content{$RemoveButton} -TooltipContent {"Remove PowerShell Version"}
                }
            }
            else {
                $ActionButtons = "N/A"
            }


            [PSCustomObject]@{
                Id = $_.Id
                Version = $_.Version
                Path = $_.Path
                Arguments = $_.Arguments
                Actions = $ActionButtons
            }
        }  | Out-UDGridData
    }
}