Is there a system variable that tracks all of the pages that are created? I’ve seen some references to $pages, but that doesn’t seem to work for me. I want to create a list of the pages on the homepage (mainly for debugging).
Thanks!
Is there a system variable that tracks all of the pages that are created? I’ve seen some references to $pages, but that doesn’t seem to work for me. I want to create a list of the pages on the homepage (mainly for debugging).
Thanks!
Hi @eefisherv
As far as i know, there is none.
If you do however go for the “reccomended” method of adding pages: IE create a folder called “Pages” with all your pages in separate files you can do the following:
$Pages = Get-ChildItem (Join-Path $PSScriptRoot 'Pages') -Recurse -File | ForEach-Object {
& $_.FullName
}
And then you do New-UDDashboard -pages $pages to add the pages to the dashboard. Also you’ll have a variable with all the active pages.
If you store the $Pages variable in a $cache:pages it’ll also be avaliable to your endpoints.
Actually! You can!
Try this:
$DashboardService = (Get-UDDashboard).DashboardService
$DashboardService.Dashboard.Pages
You can access all your favorite Dashboard properties: https://github.com/ironmansoftware/universal-dashboard/blob/master/src/UniversalDashboard/Models/Dashboard.cs
Damn, our lord and savior!
/r/todayilearned
Hats off !
So close. This works if I run it locally, but doesn’t seem to work when I’m running it within IIS. I assume it has to do with the “-Wait” required to run in IIS.
Still playing, but would love any commentary.
Yeah. Wait will block. You can try to include that snippet in an endpoint as it should work there too. Then it’ll run on an unblocked runspace.
Meh, not working. I’ve tried it in all different kinds of places. Endpoints, its own function, a different page. Get-UDDashboard won’t return anything when running under IIS. I even created a break point, entered it and tried to run Get-UDDashboard.
Ah well, I’ll keep poking around. Thanks for the help.
I’ll give it a shot this weekend and see if I can figure it out as well.