controls/identity-grid.ps1
function New-UAIdentityGrid { New-UDGrid -Id 'identity-grid' -Title "Identities" -Headers @("Id", "Name", "Role", "Actions") -Properties @("Id", "Name", "Role", "Actions") -Endpoint { Get-UAIdentity | ForEach-Object { $Identity = $_ $IdentityEditModalButton = New-UDButton -Icon user_edit -OnClick { New-UDEditIdentityModal -Identity $Identity } $IdentityDeleteModalButton = New-UDButton -Icon user_slash -OnClick { New-UARemoveIdentityModal -Identity $Identity } $IdentityGetAppTokensModalButton = New-UDButton -Icon user_slash -OnClick { New-UARemoveIdentityModal -Identity $Identity } $ActionControls = New-UDElement -Tag div -Content { If($Identity.Name -ne "System" -and $Identity.Name -ne "admin") { New-UDTooltip -Content {$IdentityEditModalButton} -TooltipContent { "Edit the Identity" } " " New-UDTooltip -Content {$IdentityDeleteModalButton} -TooltipContent { "Delete the Identity" } } else { " " } } [PSCustomObject]@{ Id = $Identity.Id Name = $Identity.Name Role = $Identity.Role.Name Actions = $ActionControls } } | Out-UDGridData } } |