SnV
September 17, 2020, 4:57pm
1
Looks like there is a bug in this, if I have multiple Items within the content, only the first item loads.
Also Dynamic is slow to load
Any idea?
code being used:
New-UDForm -Content {
New-UDSelect -id selectaclient -Label “Select a client” -option {
New-UDSelectOption -name “Select a client” -Value 0
foreach ($RDMvault in $Cache:RDMvaults)
{
New-UDSelectOption -name $RDMvault.name -Value $RDMvault.name
}
}-OnChange {
$Selectedclient = Cache:RDMvaults | where { .name -like (Get-UDElement -id “selectaclient”)[“value”]}
Set-RDMCurrentRepository $Selectedclient.id
cache:PARDMpasswordLists = Get-RDMSession | where { .ConnectionType -eq “Credential”} | select name,id
$cache:PLS = 1
Sync-UDElement -id PasswordList
}
New-UDDynamic -id PasswordList -content {
New-UDSelect -id “passswordselect” -Label “Select a Password List” -option {
if ($cache:PLS -eq 0)
{
}else{
New-UDSelectOption -name “Select a password list” -Value 1
foreach ($PARDMpasswordList in $cache:PARDMpasswordLists)
{
New-UDSelectOption -name $PARDMpasswordList.name -Value $PARDMpasswordList.name
}
New-UDTextbox -id ‘Host’ -Label ‘Host’
New-UDTextbox -id ‘Username’ -Label ‘Username’
New-UDTextbox -id ‘Domain’ -Label ‘Domain’
New-UDTextbox -id ‘Password’ -Label ‘Password’ -Type password
New-UDTextbox -id ‘ConfirmPassword’ -Label ‘Confirm Password’ -Type password
}
}
}
}
The textboxes never show up.
adam
September 17, 2020, 6:45pm
2
I just validated that this works in my environment:
New-UDDashboard -Title "Hello, World!" -Content {
New-UDButton -Text 'Refresh' -OnClick {
Sync-UDElement -Id 'Dyn'
}
New-UDDynamic -Id 'Dyn' -Content {
1..(Get-Random -Min 1 -Max 10) | ForEach-Object {
New-UDTextbox -Label $_
}
}
}
SnV
September 17, 2020, 7:01pm
3
What if after that text box you add another one but not via the 4 each? All the textboxes above dont show up
adam
September 17, 2020, 7:07pm
4
Still working for me.
New-UDDashboard -Title "Hello, World!" -Content {
New-UDButton -Text 'Refresh' -OnClick {
Sync-UDElement -Id 'Dyn'
}
New-UDDynamic -Id 'Dyn' -Content {
1..(Get-Random -Min 1 -Max 10) | ForEach-Object {
New-UDTextbox -Label $_
}
New-UDTextBox -Label 'not in loop'
}
}
SnV
September 17, 2020, 7:10pm
5
Ill have to try again. Maybe it was something on my end…
SnV
September 17, 2020, 7:36pm
6
Looks like it was me, I put them in the UDSelect part
1 Like
SnV
September 18, 2020, 2:00pm
8
When using UDDynamic with UDSelects the UDSelects are very slow to update. UDTables seem to update quickly. Any thoughts on this?
SnV
September 18, 2020, 6:06pm
9
Tables seem to update pretty instantly but select boxes even just removing them takes around 10-15 seconds.
SnV
September 21, 2020, 1:07pm
10
Bumping this for any thoughts
adam
September 21, 2020, 1:56pm
11
10-15 seconds is a very long time. You’re just using the script above with the cache variables? It’s not calling out to any other service?
SnV
September 21, 2020, 2:01pm
12
Hey,
Its porbably more like 6-8 seconds but still long.
The above does call out to a service that returns pretty instant but I changed it to static variables already populated for testing and I get the same result. Tables however update strait away. Its just selects.
adam
September 21, 2020, 2:07pm
13
Can you paste a reproducable example here so I can try locally without the call out to the service?
SnV
September 21, 2020, 2:58pm
14
Ok I rebuilt this with no call outs (before I think I had the call outs in the script but was just not using them) and it works pretty instant, So something about the call out is slowing it down. However I have similar callouts that dont have this issue. And when I test the callout in powershell it returns the results pretty instantly.
So not sure how to troubleshoot this now.
SnV
September 21, 2020, 3:02pm
15
Ok yeah defo something about the call out I put a toast and that took a min to update. Need to work out why its taking so long in the code.
If it works fine in a normal powershell session but takes longer in your dashboard, I would try troubleshoot with the following:
Attempt to run it non-interactivly outside the dashboard, say within task scheduler
Test it running with your account and the service account that runs your dashboard.
Also if you havent been, wrap your commands with measure-command -expression { commands here }
and see how long it takes.
If you can reproduce the slowdown with either of those methods you know the issue isn’t dashboard related!
SnV
September 21, 2020, 4:17pm
17
Thanks I will try that, I did just make it change to the loading icon and then back so it at least tells the user its working on something so it interacts better now.