Created
September 10, 2018 20:03
-
-
Save murrahjm/7af023679058ccecfad11b4f055cba03 to your computer and use it in GitHub Desktop.
This is the code for my dynamic page that sometimes reports an error but sometimes works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$DynamicBacklogListPage = New-UDPage -url "/backlog/:server/:folder" -EndPoint { | |
Param($server, $folder) | |
New-UDRow -endpoint { | |
$query = "Select [BacklogFiles] from [dbo].[dfsrlatestdata] Where Server = `'$server`' and ReplicatedFolder = `'$folder`'" | |
$BacklogFileList = @( | |
Foreach ($item in $(invoke-sqlcmd -MaxCharLength 25600 -connectionString $sqlconnectionstring -query $query | convertto-json | convertfrom-json).BacklogFiles.Split(',')) { | |
new-object psobject -Property @{ | |
Filename = $item | |
} | |
} | |
) | |
$GridProperties = @{ | |
Title = "First 100 backlogged files for $folder share on $server" | |
headers = @('File') | |
properties = @('Filename') | |
PageSize = 100 | |
Endpoint = { | |
$BacklogFileList | out-udgriddata | |
} | |
} | |
New-UDGrid @GridProperties | |
} | |
New-UDRow -Endpoint { | |
$sqldata = invoke-sqlcmd -ConnectionString $SQLConnectionString -query "Select | |
DATEADD(HOUR, DATEDIFF(HOUR, 0, [TimeStamp]), 0) AS TimeStamp, | |
Backlog | |
from [dfsralldata] | |
WHERE Server = `'$server`' AND | |
replicatedFolder = `'$folder`'" | sort-object -Property TimeStamp | select-object backlog, @{l='timestamp';e={$_.timestamp.ToString()}} | |
New-UDChart -Title "Backlog History" -Type Line -Endpoint { | |
$sqldata | Out-UDChartData -LabelProperty "TimeStamp" -DataProperty "backlog" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment