controls/identity-create-modal.ps1
function New-UACreateIdentityModal { Show-UDModal -Content { New-UDPageHeader -Text ("Creating new Identity") New-UDParagraph -Text "Specify a new Identity" New-UDCard -Content { New-UDTextbox -Id "NewIdentityModalTextBoxIdentityName" -Label "Identity Name" -Type text New-UDSelect -Id "NewIdentityModalSelectRole" -Label "Assign to Role" -Option { New-UDSelectOption -Name "None" -Value "None" -Selected $true Get-UARole | ForEach-Object{ New-UDSelectOption -Name $_.Name -Value $_.Id } } New-UDElement -Tag div -Attributes @{ style = @{ textAlign = "right" } } -Content { New-UDButton -Text "Create Identity" -Icon user_plus -OnClick { # Get Input Data $Name = ((Get-UDElement -Id 'NewIdentityModalTextBoxIdentityName').Attributes["value"]) $RoleID = ((Get-UDElement -Id 'NewIdentityModalSelectRole').Attributes["value"]) $Role = Get-UARole -Id $RoleID # Create SCript if($null -ne $Role -or $Role -eq "None") { New-UAIdentity -Name $Name -Role $Role } else { New-UAIdentity -Name $Name } # Grid Sync Sync-UDElement -Id "role-grid" -Broadcast Sync-UDElement -Id "identity-grid" -Broadcast Hide-UDModal } } } } } |