controls/job-icon.ps1
function New-UDJobIcon { param( $Job, $Id, [Switch]$NoSpan, [Switch]$IconOnly ) $icon = switch($Job.Status) { # Job Status "Queued" { $StatusDisplay = "Queued" New-UDIcon -Icon clock_o -Color gray -Size lg } "Running" { $StatusDisplay = "Running" New-UDIcon -Icon spinner -Color green -Size lg -Spin } "Completed" { $StatusDisplay = "Completed" New-UDIcon -Icon check_circle -Color green -Size lg } "Failed" { $StatusDisplay = "Failed" if ($null -eq $Job.StatusDescription) { New-UDIcon -Icon times_circle -Color red -Size lg } else { New-UDTooltip -Content { New-UDIcon -Icon times_circle -Color red -Size lg } -TooltipContent { $Job.StatusDescription } } } "WaitingOnFeedback" { $StatusDisplay = "Waiting on Feedback" New-UDIcon -Icon question_circle -Color yellow -Size lg } "Canceling" { $StatusDisplay = "Canceling" New-UDIcon -Icon ban -Color orange -Size lg } "Canceled" { $StatusDisplay = "Canceled" New-UDIcon -Icon ban -Color orange -Size lg } } if ($NoSpan.IsPresent) { New-UDElement -Tag 'status' -Id $Id -Content { if($IconOnly.IsPresent) { $icon } else { $icon ($StatusDisplay) } } } else { New-UDElement -Tag 'span' -Id $Id -Content { if($IconOnly.IsPresent) { $icon } else { $icon ($StatusDisplay) } } } } |