Dynamic Filtering

I have a dashboard that has a single table with 4 rows. Each row has a column for “SQLServerName” and a “Details” button. Ideally, I would like to click the button for row 1 “SQLServer1” and be navigated to a drilldown dashboard with the ServerName “SQLServer1” filter automatically applied to all charts on the page. If this is not possible, can I create separate dashboards for all my servers and just change the source code for each to point to the correct server and then have the buttons dynamically navigate to those pages? Ideally, the former option would be ideal as that would mean the entire solution is data-driven.

Edit: If going the filtering route, I need to make sure that the autorefresh interval does not reset the page level filter, which I don’t think it would because the filter would be separate of the table?

Code:

$Theme = @{

    palette = @{

        primary = @{

            main = '#111111'

        }

    }

}

New-UDDashboard -Title "Blocking" -Theme $Theme -Content {

    New-UDGrid -Item -ExtraSmallSize 12 -Content {  

        New-UDDynamic -Content {

            Import-module dbatools

                $ServerList = @("SQLServer1", "SQLServer2", "SQLServer3", "SQLServer4")

                $ServerResults = @()

                foreach($server in $ServerList){

                $Data = Get-WmiObject win32_processor -ComputerName $server | Measure-Object -property LoadPercentage -Average | Select Average 

                $BlockedProcesses = Invoke-DbaQuery -SqlInstance $server -Database Master -Query "SELECT cntr_value FROM sys.dm_os_performance_counters

WHERE counter_name = 'Processes blocked'"

                $tempdbLogUsage = Invoke-DbaQuery -SqlInstance $server -Database Master -Query "DECLARE @log_space_used decimal(19,2)

                declare @tran_log_space_usage table(

                database_name sysname

                ,       log_size_mb float

                ,       log_space_used float 

                ,       status int

                );

                

                insert into @tran_log_space_usage

                exec('DBCC SQLPERF ( LOGSPACE )')

                

                SELECT CAST(log_space_used as int) as TempDBLogUsage FROM @tran_log_space_usage

                WHERE database_name = 'tempdb'

                "

                $ServerResults += @(

    @{ServerName = $server; CPU = $Data.Average; BlockedProcesses = $BlockedProcesses.cntr_value; tempdbLogUsage = $tempdbLogUsage.TempDBLogUsage}

) 

                }

#new script

$Columns = @(

    

    New-UDTableColumn -Property Icon -Render { 

        New-UDIcon -Icon server -Size lg -Color green

    }  

    New-UDTableColumn -Property ServerName -Title ServerName

    New-UDTableColumn -Property CPU -Title CPU

    New-UDTableColumn -Property BlockedProcesses -Title BlockedProcesses

    New-UDTableColumn -Property TempDBLogUsage -Title TempDB_LogUsage

    New-UDTableColumn -Property Details -Title Details -Render { 

        New-UDButton -Text "Details" -Icon (New-UDIcon -Icon info) -OnClick { Show-UDToast -Message $server}

    }

)

    New-UDTable -Data $ServerResults -Columns $Columns 

    } -AutoRefresh -AutoRefreshInterval 5  

}

}