controls/job-output-modal.ps1

function New-UDJobOutputModal {
    param (
        [Parameter(Mandatory = $true)]
        $Job
    )

    $Script = Get-UAScript -ID $Job.Script.Id

    Show-UDModal -Width "75%" -Height "75%" -Content {
        New-UDPageHeader -Text ("Output for Job: $($Job.Id)")
        New-UDElement -Tag div -Content { 
            New-UDLink -Text "Script ID: $($Script.Id) - $($Script.Name)" -Url "/script/$($Script.Ifd)"
        }
        New-UDElement -Tag 'b' -Content { "Status: " }
        New-UDJobIcon -Id 'icon' -Job $Job
        New-UDHtml -Markup ("<b>Start Time</b>: $($Job.StartTime)")
        if($Job.Status -eq "Completed" -or $Job.Status -eq "Failed" -or $Job.Status -eq "Canceled"){
            New-UDHtml -Markup ("<b>End Time</b>: " + ($Job.EndTime))
        }
        
        New-UdCard -Content {
            New-UDTabContainer -Tabs {
                
                New-UDTab -Text "Output" -Content {
                    New-UDCard -Content {
                        New-UDElement -Tag 'div' -Attributes @{
                            style = @{
                                height = "500px"
                            }
                        } -Content {
                            $Message = (Get-UAJobOutput -JobId $Job.Id | ForEach-Object { "[$($_.Timestamp)] [$($_.Type.ToString().ToUpper())] $($_.Message)" }) -join "`n"
                            New-UDCodeEditor -Language "powershell" -ReadOnly -Code $Message -Theme 'vs-dark' -Autosize
                        }
                    }
                }
                
                $PipelineOutput = Get-UAJobPipelineOutput -Job $Job 
                if ($null -ne $PipelineOutput)
                {
                    New-UDTab -Text "Pipeline Output" -Content {
                        New-PipelineGrid -Job $Job
                    }
                }
            }
        }
    }
}