Product: PowerShell Universal
Version: 2.1.2
Dashboard Framework: 3.5.0
Hi all,
I’m evaluating PowerShell Universal for work use. Good progress so far, but looking at optimizing load times on some pages. I have a section that’s showing recent AD object creation, but its slowing down the page quite a bit when it first loads. Is there a way to have the Expansion Panels process when expanded, instead of when the page loads? A combination of -Content
and -OnClick
or something?
Here’s the code I’m working with:
New-UDCard -Title 'Active Directory' -Content {
New-UDExpansionPanelGroup -Children {
New-UDExpansionPanel -Title 'Recent Users' -Content {
$ADUserChangesColumns = @(
New-UDTableColumn -Title 'Name' -Property 'Name'
New-UDTableColumn -Title 'Title' -Property 'Title'
New-UDTableColumn -Title 'Department' -Property 'Department'
New-UDTableColumn -Title 'City' -Property 'City'
New-UDTableColumn -Title 'whenCreated' -Property 'whenCreated'
New-UDTableColumn -Title 'whenChanged' -Property 'whenChanged'
)
$ADUserChangesData = Get-ADUser -Filter * -Properties Title, Department, City, whenCreated, whenChanged | Select-Object -Property Name, Title, Department, City, whenCreated, whenChanged | Sort-Object -Property whenCreated, whenChanged -Descending | Select-Object -First 50
New-UDTable -Columns $ADUserChangesColumns -Data $ADUserChangesData -Dense -PageSize 10 -ShowPagination
}
New-UDExpansionPanel -Title 'Recent Computers' -Content {
$ADComputerChangesColumns = @(
New-UDTableColumn -Title 'Name' -Property 'Name'
New-UDTableColumn -Title 'OperatingSystem' -Property 'OperatingSystem'
New-UDTableColumn -Title 'whenCreated' -Property 'whenCreated'
New-UDTableColumn -Title 'whenChanged' -Property 'whenChanged'
)
$ADComputerChangesData = Get-ADComputer -Filter * -Properties OperatingSystem, whenCreated, whenChanged | Select-Object -Property Name, OperatingSystem, whenCreated, whenChanged | Sort-Object -Property whenCreated, whenChanged -Descending | Select-Object -First 50
New-UDTable -Columns $ADComputerChangesColumns -Data $ADComputerChangesData -Dense -PageSize 10 -ShowPagination
}
New-UDExpansionPanel -Title 'Recent Objects' -Content {
$ADObjectChangesColumns = @(
New-UDTableColumn -Title 'DistinguishedName' -Property 'DistinguishedName'
New-UDTableColumn -Title 'ObjectClass' -Property 'ObjectClass'
New-UDTableColumn -Title 'whenCreated' -Property 'whenCreated'
New-UDTableColumn -Title 'whenChanged' -Property 'whenChanged'
)
$ADObjectChangesData = Get-ADObject -Filter { ObjectClass -ne 'computer' -and ObjectClass -ne 'user' } -Properties Name, whenCreated, whenChanged | Select-Object -Property DistinguishedName, ObjectClass, whenCreated, whenChanged | Sort-Object -Property whenCreated, whenChanged -Descending | Select-Object -First 50
New-UDTable -Columns $ADObjectChangesColumns -Data $ADObjectChangesData -Dense -PageSize 10 -ShowPagination
}
}
}
Thanks!