New-UDPage -Url "/PRD" -Name "PRD" -Content {
New-UDTypography -Text 'Remove Expired Files Log'
    
switch($env:COMPUTERNAME){
    "ITDWINAUTOT1" {
        $ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
        $Database = "ITD-Systems-Automation"
        $Table = "Infra_WindowsServer_FileManagement_RemoveITDExpiredFiles_NPD"
    }
    "ITDWINAUTOP1" {
        $ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
        $Database = "ITD-Systems-Automation"
        $Table = "Infra_WindowsServer_FileManagement_RemoveITDExpiredFiles_PRD"
    }
}

    $SqlQuery = "SELECT [PSUJobId],[DateTime],[ComputerName],[Status],[FullName] FROM [$Database].[dbo].[$Table]"
    $SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose

    New-UDTable -Columns @(
        New-UDTableColumn -Property 'PSUJobId' -Title 'PSUJobId' -ShowFilter
        New-UDTableColumn -Property 'DateTime' -Title 'DateTime' -ShowFilter
        New-UDTableColumn -Property 'ComputerName' -Title 'ComputerName' -ShowFilter
        New-UDTableColumn -Property 'Status' -Title 'Status' -ShowFilter
        New-UDTableColumn -Property 'FullName' -Title 'FullName' -ShowFilter
    ) -Data ($SqlRecords | Sort-Object -Descending Id) -ShowPagination -PageSize 20 -Dense
} -Title "PRD" -Icon @{
		id = 'd0f3391d-efa6-4210-b4dd-ef0cad028382'
		type = 'icon'
	}