What up everyone?!
Hopefully one of you can guide me to the right path.
I’ve been trying all day today to have the following accomplish. I have a page when it checks if a job is running, if so then display Code Editor box with job live output. However, when this code is hit, it does the while loop but nothing is displayed on the page other than the loading bars. Then when the while loop completes, page gets refreshed and show the completed job. Below is a snippet of what I’m using.
If more info is needed, I’ll provide as much as possible.
$Job = Get-UAJob -Id $reqstat[0].PSUJobId
if ($Job.Status -eq 'Running') {
New-UDRow -Columns {
New-UDGrid -Spacing 0 -Container -Content {
New-UDGrid -Item -LargeSize 10 -Content {
New-UDStyle -Id 'codestyle' -Style '.MuiGrid-grid-lg-10 { margin: 20px 5px; }' -Content {
New-UDCodeEditor -Id 'codeEditorReqProcess' -ReadOnly -Height 600
}
}
}
}
$AppToken = 'TOKEN_HERE'
Connect-PSUServer -ComputerName http://localhost:5000 -AppToken $AppToken
while($Job.Status -ne 'Completed')
{
Start-Sleep 1
$Output2 = (Get-UAJobOutput -JobId $Job.ID).Data -join ([Environment]::NewLine)
Set-UDElement -Id 'codeEditorReqProcess' -Properties @{
code = $Output2
}
$Job = Get-UAJob -Id $Job.ID
}
Invoke-UDRedirect -Url "http://localhost:5000/noc/deployer/request/view/$Id"
}
else
{
other stuff here
}
Product: PowerShell Universal
Version: 2.2.0