controls/powershell-help-modal.ps1

Function New-PowerShellHelpModal {
    param (
        $Object
    )

    Show-UDModal -Content {
        New-UDHeading -Text "Universal Automation PowerShell Scripting Help"

        New-UDElement -Tag 'div' -Endpoint {
            New-UDTabContainer -Tabs {
                New-UDTab -Text 'UA CMDlets' -Content {
                    
                    if(($Object.GetType().Name) -eq "Script")
                    {
                        
                        New-UDCard -Title "Get Script Information" -Content {
                            New-UDElement -Tag 'pre' -Content {
                                'Get-UAScript -Id '+$Object.Id
                            }
                        }
            
                        New-UDCard -Title "Execute Script Immediately" -Content {
                            New-UDElement -Tag 'pre' -Content {
                                'Invoke-UAScript -Id '+$Object.Id
                            }
                        }

                        New-UDCard -Title "Schedule Script" -Content {
                            New-UDElement -Tag 'pre' -Content {
                                "New-UASchedule -Script (Get-UAScript -Id $($Object.Id)) -Cron '*/12 * * * *'"

                            }
                        }

                        New-UDCard -Title "Update Script Information" -Content {
                            New-UDElement -Tag 'pre' -Content {
                                'Set-UAScript -Id ' + $Object.Id+' -Name "Test Script" -ManualTime 60 -ScriptBlock ([ScriptBlock]::Create("Write-Host Hello_World"))' #TODO - Give a real example please
                            }
                        }
                        
                    }
                    elseif (($Object.GetType().Name) -eq "Job")
                    {
                        New-UDCard -Title "Get Job Information" -Content {
                            New-UDElement -Tag 'pre' -Content {
                                'Get-UAJob -Id ' + $Object.Id
                            }
                        }
                    }
                    elseif (($Object.GetType().Name) -eq "Schedule")
                    {
                        New-UDCard -Title "Get Job Information" -Content {
                            New-UDElement -Tag 'pre' -Content {
                                'Get-UASchedule -Id ' + $Object.Id
                            }
                        }
                    
                    }
                    elseif (($Object.GetType().Name) -eq "Variable")
                    {
                        New-UDCard -Title "Get Variable" -Content {
                            New-UDElement -Tag 'pre' -Content {
                                'Get-UAVariable -Id ' + $Object.Id
                            }
                        }
                    
                    }
                }

                if(($Object.GetType().Name) -eq "Script")
                {
                    New-UDTab -Text 'Scriptblock' -Content {
                        New-UDCard -Content {
                            New-UDElement -Tag 'div' -Attributes @{
                                style = @{
                                    height = "500px"
                                }
                            } -Content {
                                New-UDCodeEditor -Language 'powershell' -ReadOnly -Code $Object.Content -Theme 'vs-dark' -Autosize
                            }
                        }
                    }
                }
                
            }
        }
    }
}