controls/pipeline-details.modal.ps1

Function New-PipelineObjectDetailsModal {
    param(
        [Parameter(Mandatory = $true)]
        $PipelineObject
    )
    
    Show-UDModal -Width "75%" -Height "75%" -Content {
        New-UDPageHeader -Text ("Pipeline Object Details")

        If($PipelineObject.GetType().Name -eq "Hashtable")
        {
            New-UDGrid -Id ("PipelineHashTableDetailsGrid_" + $PipelineObject.ToString()) -Title ("Hashtable Details") -Headers @("Name", "Value") -Properties @("Name", "Value") -Endpoint {
                        
                $PipelineObject.GetEnumerator() | ForEach-Object {
                    [PSCustomObject]@{
                        Name = $_.Name
                        Value = $_.Value
                    }
                    
                } | Out-UDGridData
            }
        }
        else {
            New-UDGrid -Id ("PipelineDetailsGrid_" + $PipelineObject.ToString()) -Title ("Pipeline Object: " + $PipelineObject.ToString()) -Headers @("Name", "Value", "Actions") -Properties @("Name", "Value", "Actions") -Endpoint {
                $Members = $PipelineObject | Get-Member
                
                $Members | Sort-Object -Property Name | ForEach-Object {
                    $Member = $_
        
                    if ($Member.MemberType -eq "Property" -or $Member.MemberType -eq "ScriptProperty")
                    {
                        $PipelineObjectValue = $PipelineObject.($Member.Name)
                        
                        [PSCustomObject]@{
                            Name = $Member.Name
                            Value = If($null -eq $PipelineObjectValue -or $PipelineObjectValue -eq ""){""}else{$PipelineObjectValue.ToString()}
                            Actions = ""
                        }
                    }
                } | Out-UDGridData
            }
        }
    }
}