Weird performance issue with adding buttons to grids

New-UDPage -Name 'YumiPage' -Icon link -Content {
    # Wait-Debugger

    New-UDGrid -Title 'Yumi' -Headers @('AgentName', 'ShortName', 'Last_Communication', 'OS', 'Note', 'Location', 'Katana', 'AgentStatus', 'Building', 'ReDeploy', 'Status') -Properties  @('AgentName', 'ShortName', 'Last_Communication', 'OS', 'Note', 'Location', 'Katana', 'AgentStatusReadable', 'Building', 'ReDeploy', 'Status') -Endpoint {

        $YumiGrid = $Cache:Yumi | ForEach-Object -Process {
            $AgentName = $_.hostname
            $KatanaServer = $_.katana_server
            $KatanaAgentInfo = $Cache:htKatanaAgents["$AgentName"]

            [PSCustomObject]@{
                AgentName           = $_.hostname
                ShortName           = $_.tcName
                Last_Communication  = $_.lastCommunication
                OS                  = $_.image.name
                Note                = $_.note
                Location            = $_.location.name
                Katana              = $_.katana_server
                Building            = $KatanaAgentInfo.Building
                AgentStatusReadable = $KatanaAgentInfo.AgentStatusReadable
                ReDeploy            = New-UDButton -Text "ReDeploy" -OnClick ( New-UDEndpoint -Endpoint { Redeploy-Yumi -ID $ArgumentList.ID } -ArgumentList $_ )
                Status              = New-UDButton -Text "Status" -OnClick (
                    New-UDEndpoint -Endpoint {

                        $Cache:KatanaStatus = Get-KatanaAgentInfo -agentName $argumentlist.hostname -KatanaServer $argumentlist.katana_server
                        #Wait-Debugger


                        Show-UDModal  -Header {
                            New-UDHeading -Size 4 -Text " Status $($ArgumentList.hostname)"
                        } -Content {
                            $red = "green"
                            if ($Cache:KatanaStatus.building) {
                                $BackGround = "red"
                                $AgentStatus = 'Agent is building'
                            }
                            else {
                                $BackGround = "green"
                                $AgentStatus = 'Agent is available'
                            }



                            New-UDCard -BackgroundColor "$BackGround"  -Title "$AgentStatus" -Content {

                                New-UDTable -Title "Additional information" -Style striped -Headers @(" ", " ") -Endpoint {
                                    Try {
                                        $Table = [ordered]@{
                                            'Yumi URL'         = New-UDLink -Text "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -Url "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -OpenInNewWindow
                                            'Katana URL'       = New-UDLink -Text $($Cache:KatanaStatus.KatanaURL) -Url $($Cache:KatanaStatus.KatanaURL) -OpenInNewWindow
                                            'Build URL'        = New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                                            'Builder Name'     = $Cache:KatanaStatus.BuilderName
                                            'Build Start Time' = $Cache:KatanaStatus.BuildStartTime | Out-String
                                            'Build ETA'        = $Cache:KatanaStatus.BuildETA
                                            'Reason'           = $Cache:KatanaStatus.Reason
                                        }
                                        $Table.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                                    }
                                    Catch {
                                        $Lookup = ' '
                                        $Lookup | Out-UDTableData -Property @("Name", "Value")
                                    }
                                } -ArgumentList $argumentlist


                                # New-UDCard -BackgroundColor white -Title 'Yumi URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.YumiURL) -Url $($Cache:KatanaStatus.YumiURL) -OpenInNewWindow
                                # }
                                # New-UDCard -BackgroundColor white -Title 'Build URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                                # }
                                # New-UDCard -BackgroundColor white -Title 'Builder Name'  -Content { $Cache:KatanaStatus.BuilderName
                                # }
                                # New-UDCard -BackgroundColor white -Title 'Build Start Time'  -Content { $Cache:KatanaStatus.BuildStartTime | Out-String
                                # }
                                # New-UDCard -BackgroundColor white -Title 'Build ETA'  -Content { $Cache:KatanaStatus.BuildETA
                                # }
                                # New-UDCard -BackgroundColor white -Title Reason  -Content { $Cache:KatanaStatus.Reason
                                # }
                            }
                        }
                    } -ArgumentList $_
                )
            }

        }

        $YumiGrid | Out-UDGridData
    } -PageSize 25 # -AutoRefresh -RefreshInterval 60
}

When I run this on UD 2.4+ the code that adds the “status” button takes around 10-15 seconds to execute, every time the page is loaded… If I switch back to 2.3.2 it takes about 1-2 seconds. Is this an expected change in the newer versions, or is there a better way to do what I am trying to do ?

I am curious about this as well, I noticed something similar.

I kinda changed it and got some improvement by building the buttons into the Cache and having the data refresh on an endpoint schedule in the background.

It still takes forever for the cache to load when the site is first accessed after the nightly reboot.

I hope this idea helps you some, and i hope we get some feedback on the buttons taking so long.

No sure I follow you… How do you build the buttons into the cache ?

https://pastebin.com/2rB7dD3n

Here is what I do, $AllAccounts is just a Get-ADUser with a SearchBase set for the OU i care about.

@Jacob-Evans I’m a little confused looking at your example code. How do you call the $Cache:AllUsers variable on the page to display your table?

I have a similar issue that I am trying to improve. I have a page with a grid that takes 18 seconds to load.

I am using a grid for the purpose of searching AD users. I display basic info like Name, SamAccountName, and have a button in the last column of the grid. When clicked, a modal opens and displays 3 more buttons. Each one allows for editing different AD User Object attributes.

I would really like to cut the grid load time down as much as possible. I already have my grid data cached. From what I gather from your example, I may be able to cache the grid itself.

https://pastebin.com/i4j9UTxD

Here you go, this is a page out of my dashboard (In case the code wasn’t enough of a clue, i work in a school)

Hope this helps! If you have any more questions, feel free to ask.

@Jacob-Evans Thanks for sharing! I gained a better understanding after looking over what you posted.

@adam, are you able to give any insight into why this started happening?

My dashboard takes about 2-4 minutes to load because of all of my buttons i inject.

Oh. That’s weird. I will take a look at this today. Idk why that would be slow at all unless there were thousands of rows and even then…

Opened a Github issue.

1 Like

@Jacob-Evans @Claustn @guy Can I ask you guys how many rows you have in your grids?

@adam 3650 rows in my grid

Ok. I have some evidence and a potential work around for y’all.

The problem is that having large Endpoint script blocks, with lots of variables, is causing a big slow down.

Took @Claustn example and created a dashboard that had 1000 rows and 4 buttons per row.

I added the large endpoint script block into each button’s onClick handler. The end result was a grid that took 17.77 seconds to load.

I ran the performance profiler on it and the slowness is UD trying to resolve all the variables so that it can store them later.

So, this led me to a modified example. Instead of having a large script block, I instead put all that code into a function to be called and to pass in any arguments I’m looking for. This resulted in a grid that took 2.45 seconds to load.

Pretty big improvement! I’ve included the examples below for the good\bad performance.

Can you guys try making a similar change to your dashboards? I also think this will make it easier to read the dashboard scripts.

Bad Performance Example:

Import-Module UniversalDashboard

function Invoke-ButtonClick {
     param(
          $ArgumentList 
     )

     $Cache:KatanaStatus = Get-KatanaAgentInfo -agentName $argumentlist.hostname -KatanaServer $argumentlist.katana_server
     #Wait-Debugger


     Show-UDModal  -Header {
         New-UDHeading -Size 4 -Text " Status $($ArgumentList.hostname)"
     } -Content {
         $red = "green"
         if ($Cache:KatanaStatus.building) {
             $BackGround = "red"
             $AgentStatus = 'Agent is building'
         }
         else {
             $BackGround = "green"
             $AgentStatus = 'Agent is available'
         }



         New-UDCard -BackgroundColor "$BackGround"  -Title "$AgentStatus" -Content {

             New-UDTable -Title "Additional information" -Style striped -Headers @(" ", " ") -Endpoint {
                 Try {
                     $Table = [ordered]@{
                         'Yumi URL'         = New-UDLink -Text "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -Url "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -OpenInNewWindow
                         'Katana URL'       = New-UDLink -Text $($Cache:KatanaStatus.KatanaURL) -Url $($Cache:KatanaStatus.KatanaURL) -OpenInNewWindow
                         'Build URL'        = New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                         'Builder Name'     = $Cache:KatanaStatus.BuilderName
                         'Build Start Time' = $Cache:KatanaStatus.BuildStartTime | Out-String
                         'Build ETA'        = $Cache:KatanaStatus.BuildETA
                         'Reason'           = $Cache:KatanaStatus.Reason
                     }
                     $Table.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                 }
                 Catch {
                     $Lookup = ' '
                     $Lookup | Out-UDTableData -Property @("Name", "Value")
                 }
             } -ArgumentList $argumentlist


             # New-UDCard -BackgroundColor white -Title 'Yumi URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.YumiURL) -Url $($Cache:KatanaStatus.YumiURL) -OpenInNewWindow
             # }
             # New-UDCard -BackgroundColor white -Title 'Build URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
             # }
             # New-UDCard -BackgroundColor white -Title 'Builder Name'  -Content { $Cache:KatanaStatus.BuilderName
             # }
             # New-UDCard -BackgroundColor white -Title 'Build Start Time'  -Content { $Cache:KatanaStatus.BuildStartTime | Out-String
             # }
             # New-UDCard -BackgroundColor white -Title 'Build ETA'  -Content { $Cache:KatanaStatus.BuildETA
             # }
             # New-UDCard -BackgroundColor white -Title Reason  -Content { $Cache:KatanaStatus.Reason
             # }
         }
     }
}

$Page = New-UDPage -Name 'YumiPage' -Icon link -Content {
     # Wait-Debugger
 
     New-UDGrid -Title 'Yumi' -Headers @('Status', 'Status1', 'Status2', 'Status3') -Properties  @('Status', 'Status1', 'Status2', 'Status3') -Endpoint {
 
         $YumiGrid = 1..1000 | ForEach-Object -Process {
             [PSCustomObject]@{
                 Status3             = New-UDButton -Text "Status" -OnClick (New-UDEndpoint -Endpoint {  


                    $Cache:KatanaStatus = Get-KatanaAgentInfo -agentName $argumentlist.hostname -KatanaServer $argumentlist.katana_server
                    #Wait-Debugger
               
               
                    Show-UDModal  -Header {
                        New-UDHeading -Size 4 -Text " Status $($ArgumentList.hostname)"
                    } -Content {
                        $red = "green"
                        if ($Cache:KatanaStatus.building) {
                            $BackGround = "red"
                            $AgentStatus = 'Agent is building'
                        }
                        else {
                            $BackGround = "green"
                            $AgentStatus = 'Agent is available'
                        }
               
               
               
                        New-UDCard -BackgroundColor "$BackGround"  -Title "$AgentStatus" -Content {
               
                            New-UDTable -Title "Additional information" -Style striped -Headers @(" ", " ") -Endpoint {
                                Try {
                                    $Table = [ordered]@{
                                        'Yumi URL'         = New-UDLink -Text "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -Url "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -OpenInNewWindow
                                        'Katana URL'       = New-UDLink -Text $($Cache:KatanaStatus.KatanaURL) -Url $($Cache:KatanaStatus.KatanaURL) -OpenInNewWindow
                                        'Build URL'        = New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                                        'Builder Name'     = $Cache:KatanaStatus.BuilderName
                                        'Build Start Time' = $Cache:KatanaStatus.BuildStartTime | Out-String
                                        'Build ETA'        = $Cache:KatanaStatus.BuildETA
                                        'Reason'           = $Cache:KatanaStatus.Reason
                                    }
                                    $Table.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                                }
                                Catch {
                                    $Lookup = ' '
                                    $Lookup | Out-UDTableData -Property @("Name", "Value")
                                }
                            } -ArgumentList $argumentlist
               
               
                            # New-UDCard -BackgroundColor white -Title 'Yumi URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.YumiURL) -Url $($Cache:KatanaStatus.YumiURL) -OpenInNewWindow
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Builder Name'  -Content { $Cache:KatanaStatus.BuilderName
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build Start Time'  -Content { $Cache:KatanaStatus.BuildStartTime | Out-String
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build ETA'  -Content { $Cache:KatanaStatus.BuildETA
                            # }
                            # New-UDCard -BackgroundColor white -Title Reason  -Content { $Cache:KatanaStatus.Reason
                            # }
                        }
                    }

                  })
                 Status2             = New-UDButton -Text "Status" -OnClick (New-UDEndpoint -Endpoint { 

                    
     $Cache:KatanaStatus = Get-KatanaAgentInfo -agentName $argumentlist.hostname -KatanaServer $argumentlist.katana_server
     #Wait-Debugger


     Show-UDModal  -Header {
         New-UDHeading -Size 4 -Text " Status $($ArgumentList.hostname)"
     } -Content {
         $red = "green"
         if ($Cache:KatanaStatus.building) {
             $BackGround = "red"
             $AgentStatus = 'Agent is building'
         }
         else {
             $BackGround = "green"
             $AgentStatus = 'Agent is available'
         }



         New-UDCard -BackgroundColor "$BackGround"  -Title "$AgentStatus" -Content {

             New-UDTable -Title "Additional information" -Style striped -Headers @(" ", " ") -Endpoint {
                 Try {
                     $Table = [ordered]@{
                         'Yumi URL'         = New-UDLink -Text "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -Url "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -OpenInNewWindow
                         'Katana URL'       = New-UDLink -Text $($Cache:KatanaStatus.KatanaURL) -Url $($Cache:KatanaStatus.KatanaURL) -OpenInNewWindow
                         'Build URL'        = New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                         'Builder Name'     = $Cache:KatanaStatus.BuilderName
                         'Build Start Time' = $Cache:KatanaStatus.BuildStartTime | Out-String
                         'Build ETA'        = $Cache:KatanaStatus.BuildETA
                         'Reason'           = $Cache:KatanaStatus.Reason
                     }
                     $Table.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                 }
                 Catch {
                     $Lookup = ' '
                     $Lookup | Out-UDTableData -Property @("Name", "Value")
                 }
             } -ArgumentList $argumentlist


             # New-UDCard -BackgroundColor white -Title 'Yumi URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.YumiURL) -Url $($Cache:KatanaStatus.YumiURL) -OpenInNewWindow
             # }
             # New-UDCard -BackgroundColor white -Title 'Build URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
             # }
             # New-UDCard -BackgroundColor white -Title 'Builder Name'  -Content { $Cache:KatanaStatus.BuilderName
             # }
             # New-UDCard -BackgroundColor white -Title 'Build Start Time'  -Content { $Cache:KatanaStatus.BuildStartTime | Out-String
             # }
             # New-UDCard -BackgroundColor white -Title 'Build ETA'  -Content { $Cache:KatanaStatus.BuildETA
             # }
             # New-UDCard -BackgroundColor white -Title Reason  -Content { $Cache:KatanaStatus.Reason
             # }
         }
     }
                  })
                 Status1             = New-UDButton -Text "Status" -OnClick (New-UDEndpoint -Endpoint {  
                     

                    $Cache:KatanaStatus = Get-KatanaAgentInfo -agentName $argumentlist.hostname -KatanaServer $argumentlist.katana_server
                    #Wait-Debugger
               
               
                    Show-UDModal  -Header {
                        New-UDHeading -Size 4 -Text " Status $($ArgumentList.hostname)"
                    } -Content {
                        $red = "green"
                        if ($Cache:KatanaStatus.building) {
                            $BackGround = "red"
                            $AgentStatus = 'Agent is building'
                        }
                        else {
                            $BackGround = "green"
                            $AgentStatus = 'Agent is available'
                        }
               
               
               
                        New-UDCard -BackgroundColor "$BackGround"  -Title "$AgentStatus" -Content {
               
                            New-UDTable -Title "Additional information" -Style striped -Headers @(" ", " ") -Endpoint {
                                Try {
                                    $Table = [ordered]@{
                                        'Yumi URL'         = New-UDLink -Text "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -Url "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -OpenInNewWindow
                                        'Katana URL'       = New-UDLink -Text $($Cache:KatanaStatus.KatanaURL) -Url $($Cache:KatanaStatus.KatanaURL) -OpenInNewWindow
                                        'Build URL'        = New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                                        'Builder Name'     = $Cache:KatanaStatus.BuilderName
                                        'Build Start Time' = $Cache:KatanaStatus.BuildStartTime | Out-String
                                        'Build ETA'        = $Cache:KatanaStatus.BuildETA
                                        'Reason'           = $Cache:KatanaStatus.Reason
                                    }
                                    $Table.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                                }
                                Catch {
                                    $Lookup = ' '
                                    $Lookup | Out-UDTableData -Property @("Name", "Value")
                                }
                            } -ArgumentList $argumentlist
               
               
                            # New-UDCard -BackgroundColor white -Title 'Yumi URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.YumiURL) -Url $($Cache:KatanaStatus.YumiURL) -OpenInNewWindow
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Builder Name'  -Content { $Cache:KatanaStatus.BuilderName
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build Start Time'  -Content { $Cache:KatanaStatus.BuildStartTime | Out-String
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build ETA'  -Content { $Cache:KatanaStatus.BuildETA
                            # }
                            # New-UDCard -BackgroundColor white -Title Reason  -Content { $Cache:KatanaStatus.Reason
                            # }
                        }
                    }

                 })
                 Status              = New-UDButton -Text "Status" -OnClick (New-UDEndpoint -Endpoint {  


                    $Cache:KatanaStatus = Get-KatanaAgentInfo -agentName $argumentlist.hostname -KatanaServer $argumentlist.katana_server
                    #Wait-Debugger
               
               
                    Show-UDModal  -Header {
                        New-UDHeading -Size 4 -Text " Status $($ArgumentList.hostname)"
                    } -Content {
                        $red = "green"
                        if ($Cache:KatanaStatus.building) {
                            $BackGround = "red"
                            $AgentStatus = 'Agent is building'
                        }
                        else {
                            $BackGround = "green"
                            $AgentStatus = 'Agent is available'
                        }
               
               
               
                        New-UDCard -BackgroundColor "$BackGround"  -Title "$AgentStatus" -Content {
               
                            New-UDTable -Title "Additional information" -Style striped -Headers @(" ", " ") -Endpoint {
                                Try {
                                    $Table = [ordered]@{
                                        'Yumi URL'         = New-UDLink -Text "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -Url "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -OpenInNewWindow
                                        'Katana URL'       = New-UDLink -Text $($Cache:KatanaStatus.KatanaURL) -Url $($Cache:KatanaStatus.KatanaURL) -OpenInNewWindow
                                        'Build URL'        = New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                                        'Builder Name'     = $Cache:KatanaStatus.BuilderName
                                        'Build Start Time' = $Cache:KatanaStatus.BuildStartTime | Out-String
                                        'Build ETA'        = $Cache:KatanaStatus.BuildETA
                                        'Reason'           = $Cache:KatanaStatus.Reason
                                    }
                                    $Table.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                                }
                                Catch {
                                    $Lookup = ' '
                                    $Lookup | Out-UDTableData -Property @("Name", "Value")
                                }
                            } -ArgumentList $argumentlist
               
               
                            # New-UDCard -BackgroundColor white -Title 'Yumi URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.YumiURL) -Url $($Cache:KatanaStatus.YumiURL) -OpenInNewWindow
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Builder Name'  -Content { $Cache:KatanaStatus.BuilderName
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build Start Time'  -Content { $Cache:KatanaStatus.BuildStartTime | Out-String
                            # }
                            # New-UDCard -BackgroundColor white -Title 'Build ETA'  -Content { $Cache:KatanaStatus.BuildETA
                            # }
                            # New-UDCard -BackgroundColor white -Title Reason  -Content { $Cache:KatanaStatus.Reason
                            # }
                        }
                    }

                 })
            }
          }

          $YumiGrid | Out-UDGridData
} -PageSize 25 # -AutoRefresh -RefreshInterval 60
}

$EndInit = New-UDEndpointInitialization -Function 'Invoke-ButtonClick'
$ServiceOps = New-UDDashboard -Title "ServiceOps" -Pages $Page -EndpointInitialization $EndInit

Start-UDDashboard -Port 10001 -Dashboard $ServiceOps -Name "ServiceOps" -Force

Good Performance Example:

Import-Module UniversalDashboard

function Invoke-ButtonClick {
     param(
          $ArgumentList 
     )

     $Cache:KatanaStatus = Get-KatanaAgentInfo -agentName $argumentlist.hostname -KatanaServer $argumentlist.katana_server
     #Wait-Debugger


     Show-UDModal  -Header {
         New-UDHeading -Size 4 -Text " Status $($ArgumentList.hostname)"
     } -Content {
         $red = "green"
         if ($Cache:KatanaStatus.building) {
             $BackGround = "red"
             $AgentStatus = 'Agent is building'
         }
         else {
             $BackGround = "green"
             $AgentStatus = 'Agent is available'
         }



         New-UDCard -BackgroundColor "$BackGround"  -Title "$AgentStatus" -Content {

             New-UDTable -Title "Additional information" -Style striped -Headers @(" ", " ") -Endpoint {
                 Try {
                     $Table = [ordered]@{
                         'Yumi URL'         = New-UDLink -Text "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -Url "https://yumi.bf.unity3d.com/#/agents/$($Argumentlist.Id)" -OpenInNewWindow
                         'Katana URL'       = New-UDLink -Text $($Cache:KatanaStatus.KatanaURL) -Url $($Cache:KatanaStatus.KatanaURL) -OpenInNewWindow
                         'Build URL'        = New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
                         'Builder Name'     = $Cache:KatanaStatus.BuilderName
                         'Build Start Time' = $Cache:KatanaStatus.BuildStartTime | Out-String
                         'Build ETA'        = $Cache:KatanaStatus.BuildETA
                         'Reason'           = $Cache:KatanaStatus.Reason
                     }
                     $Table.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                 }
                 Catch {
                     $Lookup = ' '
                     $Lookup | Out-UDTableData -Property @("Name", "Value")
                 }
             } -ArgumentList $argumentlist


             # New-UDCard -BackgroundColor white -Title 'Yumi URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.YumiURL) -Url $($Cache:KatanaStatus.YumiURL) -OpenInNewWindow
             # }
             # New-UDCard -BackgroundColor white -Title 'Build URL'  -Content { New-UDLink -Text $($Cache:KatanaStatus.BuildURL) -Url $($Cache:KatanaStatus.BuildURL) -OpenInNewWindow
             # }
             # New-UDCard -BackgroundColor white -Title 'Builder Name'  -Content { $Cache:KatanaStatus.BuilderName
             # }
             # New-UDCard -BackgroundColor white -Title 'Build Start Time'  -Content { $Cache:KatanaStatus.BuildStartTime | Out-String
             # }
             # New-UDCard -BackgroundColor white -Title 'Build ETA'  -Content { $Cache:KatanaStatus.BuildETA
             # }
             # New-UDCard -BackgroundColor white -Title Reason  -Content { $Cache:KatanaStatus.Reason
             # }
         }
     }
}

$Page = New-UDPage -Name 'YumiPage' -Icon link -Content {
     # Wait-Debugger
 
     New-UDGrid -Title 'Yumi' -Headers @('Status', 'Status1', 'Status2', 'Status3') -Properties  @('Status', 'Status1', 'Status2', 'Status3') -Endpoint {
 
         $YumiGrid = 1..1000 | ForEach-Object -Process {
             [PSCustomObject]@{
                 Status3             = New-UDButton -Text "Status" -OnClick (New-UDEndpoint -Endpoint {  Invoke-ButtonClick -ArgumentList $ArgumentList })
                 Status2             = New-UDButton -Text "Status" -OnClick (New-UDEndpoint -Endpoint {  Invoke-ButtonClick -ArgumentList $ArgumentList })
                 Status1             = New-UDButton -Text "Status" -OnClick (New-UDEndpoint -Endpoint {  Invoke-ButtonClick -ArgumentList $ArgumentList})
                 Status              = New-UDButton -Text "Status" -OnClick (New-UDEndpoint -Endpoint {  Invoke-ButtonClick -ArgumentList $ArgumentList})
            }
          }

          $YumiGrid | Out-UDGridData
} -PageSize 25 # -AutoRefresh -RefreshInterval 60
}

$EndInit = New-UDEndpointInitialization -Function 'Invoke-ButtonClick'
$ServiceOps = New-UDDashboard -Title "ServiceOps" -Pages $Page -EndpointInitialization $EndInit

Start-UDDashboard -Port 10001 -Dashboard $ServiceOps -Name "ServiceOps" -Force
1 Like

Thanks! Check out my latest reply. That’s kinda what I was figuring.

@adam Thanks! I will try and test the work around in the next couple of days and post an update here. I am also having an issue with this same grid where after clicking one of the buttons a modal opens and has several more buttons. After you select one of these buttons the screen freezes and you have to refresh the page. Do you have suggestions on what might be causing this? I wouldn’t think it is because of the large amount of data since at that point it is already loaded and rendered on the screen.
Thanks again!
guy

Hmmm no I dont think thats the same issue. Is the browser totally locked up or can you do an F5 and refresh it?

I am able to F5 and refresh.

Ok. Might be worth opening the developer tools (F12) and seeing if there are any errors in there after the page locks up.

I have around 700 items in my array… I have just switched back to 2.5.3 from 2.3.1, and I am down from 10-12 seconds to 2-3 seconds… I need to do some more measuring…It still does not feel as fast as 2.3.1… But this is acceptable speeds.

Ok. Cool. I will see how I can improve this in UD without having to do the work around.