Universal Dashboard v3-beta2

I just published v3-beta2 to the Gallery. Check it out: https://ironmansoftware.com/powershell-universal-dashboard-v3-beta2/

5 Likes

@adam
thank you so much adam for working on this but can you kindly provide some docs on how the out-griddata now works and some other
i have tried v3 but the older ways in v2 to populate data into a grid does not seem to be working any more ,when its used the progress bar just keep spinning …

like a general kind of doc on how to use v3 to populate data in a grid or table.

1 Like

also i have noticed that -footer is no longer exists in v3 so far, is the footer feature removed in v3?

@adam

below is an example of a dashboard that is not working in V3

$Schedule1 = New-UDEndpointSchedule -Every 1 -Day


$Services = New-UDEndpoint -Schedule $Schedule1 -Endpoint {
   
              
    $Cache:Services = Get-Service | Select-Object Name, Status | Sort-Object Name | ForEach-Object { 
                    
                    
        $FontColor = 'Green'

        if ($_.Status -ne 'Running') {
                        
            $FontColor = 'Red'
        }
                    
                    
                    
        [PSCustomObject]@{
            Name   = $_.Name
            Status = $_.Status.ToString() 
            Select = if ($_.Status -eq 'Stopped') {

                
                    New-UDButton -Text "Start" -OnClick {
                        Get-Service -Name $_.Name | Start-Service
                        Show-UDToast -Message "Service Started!" -MessageColor Green -Title $_.Name -Position topCenter -Duration 2500
                    }
                

            }
            else {

                if ($_.Status -eq 'Running') {

                    
                        New-UDButton -Text "Stop" -Icon stop_circle -OnClick {
                            Get-Service -Name $_.Name | Stop-Service
                            Show-UDToast -Message "Service Stopped!" -MessageColor Red -Title $_.Name -Position topCenter -Duration 2500
                        
                        }
                    
                }
            }
        }
    }
}



$HomePage = New-UDPage -Name "Home" -Icon home -Content {

    

    New-UDCard -Title "Welcome to Dashboard! You can begin by clicking hamburger menu icon above"

    New-UdRow {
        New-UdColumn -Size 6 -Content {
            New-UdRow {
                New-UdColumn -Size 12 -Content {
                    New-UdTable -Title "Server Information" -Headers @(" ", " ") -BackgroundColor "#050f7f" -FontColor "#FFFFFF" -Endpoint {
                        @{
                            'Computer Name'         = $env:COMPUTERNAME
                            'Operating System'      = (Get-CimInstance -ClassName Win32_OperatingSystem).Caption
                            'Total Disk Space (C:)' = (Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").Size / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
                            'Free Disk Space (C:)'  = (Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").FreeSpace / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
                            'Product Version'       = "2.8.3"
                        }.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                    }
                }
            }
            New-UdRow {
                New-UdColumn -Size 3 -Content {
                    New-UdChart -Title "Memory by Process" -Type Doughnut -RefreshInterval 5 -Endpoint {
                        Get-Process | ForEach-Object { [PSCustomObject]@{ Name = $_.Name; WorkingSet = [Math]::Round($_.WorkingSet / 1MB, 2) } } | Out-UDChartData -DataProperty "WorkingSet" -LabelProperty Name
                    } -Options @{
                        legend = @{
                            display = $false
                        }
                    }
                }
                New-UdColumn -Size 3 -Content {
                    New-UdChart -Title "CPU by Process" -Type Doughnut -RefreshInterval 5 -Endpoint {
                        Get-Process | ForEach-Object { [PSCustomObject]@{ Name = $_.Name; CPU = $_.CPU } } | Out-UDChartData -DataProperty "CPU" -LabelProperty Name
                    } -Options @{
                        legend = @{
                            display = $false
                        }
                    }
                }
                New-UdColumn -Size 3 -Content {
                    New-UdChart -Title "Handle by Process" -Type Doughnut -RefreshInterval 5 -Endpoint {
                        Get-Process | Out-UDChartData -DataProperty "HandleCount" -LabelProperty Name
                    } -Options @{
                        legend = @{
                            display = $false
                        }
                    }
                }
                New-UdColumn -Size 3 -Content {
                    New-UdChart -Title "Threads by Process" -Type Doughnut -RefreshInterval 5 -Endpoint {
                        Get-Process | ForEach-Object { [PSCustomObject]@{ Name = $_.Name; Threads = $_.Threads.Count } } | Out-UDChartData -DataProperty "Threads" -LabelProperty Name
                    } -Options @{
                        legend = @{
                            display = $false
                        }
                    }
                }
            }
            New-UdRow {
                New-UdColumn -Size 12 -Content {
                    New-UdChart -Title "Disk Space by Drive" -Type Bar -AutoRefresh -Endpoint {
                        Get-CimInstance -ClassName Win32_LogicalDisk | ForEach-Object {
                            [PSCustomObject]@{ DeviceId = $_.DeviceID;
                                Size                    = [Math]::Round($_.Size / 1GB, 2);
                                FreeSpace               = [Math]::Round($_.FreeSpace / 1GB, 2); 
                            } } | Out-UDChartData -LabelProperty "DeviceID" -Dataset @(
                            New-UdChartDataset -DataProperty "Size" -Label "Size" -BackgroundColor "#80962F23" -HoverBackgroundColor "#80962F23"
                            New-UdChartDataset -DataProperty "FreeSpace" -Label "Free Space" -BackgroundColor "#8014558C" -HoverBackgroundColor "#8014558C"
                        )
                    } -Options @{
                        scales = @{
                            yAxes = @(@{
                                    min = 0
                                })
                        }
                    }
                }
            }
        }
        New-UdColumn -Size 6 -Content {
            New-UdRow {
                New-UdColumn -Size 6 -Content {
                    New-UdMonitor -Title "CPU (% processor time)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80FF6B63' -ChartBorderColor '#FFFF6B63'  -Endpoint {
                        try {
                            Get-Counter '\Processor(_Total)\% Processor Time' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
                        }
                        catch {
                            0 | Out-UDMonitorData
                        }
                    }
                }
                
                New-UdColumn -Size 6 -Content {
                    New-UdMonitor -Title "Memory (% in use)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#8028E842' -ChartBorderColor '#FF28E842'  -Endpoint {
                        try {
                            Get-Counter '\memory\% committed bytes in use' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
                        }
                        catch {
                            0 | Out-UDMonitorData
                        }
                    }
                }
               
            }
            New-UdRow {
                New-UdColumn -Size 6 -Content {
                    New-UdMonitor -Title "Network (IO Read Bytes/sec)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80E8611D' -ChartBorderColor '#FFE8611D'  -Endpoint {
                        try {
                            Get-Counter '\Process(_Total)\IO Read Bytes/sec' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
                        }
                        catch {
                            0 | Out-UDMonitorData
                        }
                    }
                }
                
                New-UdColumn -Size 6 -Content {
                    New-UdMonitor -Title "Disk (% disk time)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80E8611D' -ChartBorderColor '#FFE8611D'  -Endpoint {
                        try {
                            Get-Counter '\physicaldisk(_total)\% disk time' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
                        }
                        catch {
                            0 | Out-UDMonitorData
                        }
                    }
                }
                
            }
            New-UdRow {
                New-UdColumn -Size 12 {
                    New-UdGrid -Title "Processes" -Headers @("Name", "ID", "Working Set", "CPU") -Properties @("Name", "Id", "WorkingSet", "CPU") -AutoRefresh -RefreshInterval 60 -Endpoint {
                        Get-Process | Select-Object Name, ID, WorkingSet, CPU | Out-UDGridData
                    }
                }
            }
        }
    }
}

$Footer = New-UDFooter -Copyright "$([char]169) company" -FontColor "#FF0000"

$Page1 = New-UDPage -Name "Services" -Icon server -Content { 

    

    New-UDElement -Id "Services" -Tag div4 -EndPoint {
    
        New-UDGrid -Id "Grid" -Title "Services" -Headers @("Name", "Status", "Select") -Properties @("Name", "Status", "Select") -Endpoint {
        
            $Cache:Services | Out-UDGridData
               
        }
                                 
    }  
                        
    New-UDButton -Text "Refresh" -OnClick {
        Start-Sleep -Seconds 2
        Sync-UDElement -Id "Grid" -Broadcast 
        Start-Sleep -Seconds 2      
    } 
} 
           

    

Start-UDDashboard -AutoReload -Endpoint @($Services) -Content {  
    New-UDDashboard -Pages @($HomePage, $Page1) -Title "Dashboard" 
} -Port 1000 -Name Dashboard  

appreciate any guide lines on how to convert above code to work in V3

1 Like

I’ll work on making an example of that this weekend. I think that’s a great idea. I haven’t started making a migration doc yet but it’s a good exercise and documentation.

In terms of the footer, we’ll get that back in there.

2 Likes

If anyone else has problems with Install-module insisting on downloading Beta 1, add “-RequiredVersion 3.0.0-beta2” to the command.

My powershell might have had a case of the pre monday blues though.

Hi all, Is there an equivalent example of this dashboard for PSU? Migrating existing ud dashboards and running into a some hurdles… thanks