I currently have a form an -OnSubmit I open a modal that contains a New-UDTable (everything below shows the -OnSubmit action). Basically the table just contains a Status and Description column and for each server in my list I run a query… if the query comes back as successful I set the status to 1 in my array of PSCustomObjects where the description matches and then sync the table so the status flips to 1. This works perfectly as expected, but when trying to introduce a -Render component (see commented out section), it seems the table doesn’t recognize the $EventData.Status. I am having a lot of issues visualizing what is going on when the -Render component is called for each row. Any guidance is much appreciated… been stuck on this for over an hour.
$ValidationTableColumns = @(
New-UDTableColumn -Property 'Status' -Title "Status" <#-Render {
if($EventData.Status -eq 1) {
New-UDIcon -Icon checkcircle -Size 2x -Color green
} else {
New-UDIcon -Icon checkcircle -Size 2x -Color red
}
}#>
New-UDTableColumn -Property Description -Title "Description"
)
$ValidationData = @(
[PSCustomObject]@{Status = '1'; Description = 'Begin Validation'}
)
foreach ($server in $Session:SelectedServersList) {
$ValidationData += [PSCustomObject]@{Status = '0'; Description = "$($server.name)"}
}
$ValidationData += [PSCustomObject]@{Status = '0'; Description = 'End Validation'}
Show-UDModal -Header {New-UDHeading -Size 4 -Text "Validating New DBA Check..."} -Content {
New-UDDynamic -id "ValidationTableID" -Content {
New-UDTable -Data $ValidationData -Columns $ValidationTableColumns
}
}
foreach($server in $Session:SelectedServersList) {
TRY {
Invoke-DBAQuery -SqlInstance $($server.name) -Database master -Query (Get-UDElement -id 'CodeEditor').Code -EnableException
foreach($item in $ValidationData) {
if($item.Description -eq "$($server.name)") {
$item.Status = 1
}
}
Sync-UDElement -id "ValidationTableID"
} CATCH {
Show-UDToast -Message "Failure"
}
}
foreach($item in $ValidationData) {
if($item.Description -eq "End Validation") {
$item.Status = 1
}
}
Sync-UDElement -id "ValidationTableID"