Dynamic page not working


#1

I have some pages (code below) where a dynamic page should load but it does not appear to be working. When I click the button to navigate to the page it updates the URL but presents the original page as if I linked to my own page and just changed the URL. The dynamic page never seems to load?

Code is below. It’s part of a larger project here: https://github.com/theabraxas/project-neith Pages are loaded in main from the pages folder. Any ideas would be super awesome!

$CylanceComputerPage = New-UDPage -Url "/cylance/computer/:$ComputerName" -Endpoint {
    param($ComputerName)
    New-UDLayout -Columns 3 -Content {
        New-UdTable -Title "$ComputerName Agent Information" -Headers @(" ", " ") -Endpoint {
        @{
            'Operating System' = ($AgentData.os_version)
            'Cylance Policy' = ($AgentData.Policy)
            'Agent Version' = ($AgentData.agent_version)
            'Zone' = ($AgentData.zones)
            'Installed Date' = ($AgentData.created)
            'Files Analyzed' = ($AgentData.files_analyzed)
            'Last Online Date' = ($AgentData.online_date)
            'Last Reported User' = ($AgentData.last_reported_user)
            'IP Address' = ($AgentData.ip_addresses)
            'MAC Addresses' = ($AgentData.mac_addresses)
            }.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
        }
    }
}

#Add default policy counter and no-zone counters to table.
$CylancePage = New-UDPage -Name "Cylance" -Icon unlock -Endpoint {
    New-UDLayout -Columns 3 -Content {
        New-UDInput -Title "Enter Computer Name: " -Endpoint {
            param($ComputerName)
            New-UDInputAction -RedirectUrl "/cylance/computer/$ComputerName"
            }
        New-UDChart -Title "Devices by Zone" -Type HorizontalBar -Endpoint {
            $DevicesByZone | Out-UDChartData -DataProperty Count -LabelProperty Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "Devices by Policy" -Type HorizontalBar -Endpoint {
            $DevicesByPolicy | Out-UDChartData -DataProperty Count -LabelProperty Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "Top 10 Computers with Blocked Events" -Type Doughnut -Endpoint {
            $Top10ComputersWithBlockedThreats | Out-UDChartData -DataProperty Count -LabelProperty Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e","#1F1F1F","#777777","#FFFFFF") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "Quarantined vs Unquarantined Events" -Type Doughnut -Endpoint {
            $ThreatAction | Out-UDChartData -DataProperty Count -Label Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e","#1F1F1F","#777777","#FFFFFF") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "OS of Cylance Computers" -Type Doughnut -Endpoint {
            $CylanceOSList | Out-UDChartData -DataProperty Count -LabelProperty Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e","#1F1F1F","#777777","#FFFFFF") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "Cleared Threats by Type" -Type Doughnut -Endpoint {
            $ClearedThreatsByType | Out-UDChartData -DataProperty Count -Label Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e","#1F1F1F","#777777","#FFFFFF") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDCounter -Title "Cylance Computers" -Endpoint {
            $CylanceComputerCount
            }
        New-UDCounter -Title "Cylance Memory Protection Events (Past 7 Days)" -Endpoint {
            $RecentMemoryProtectHits
        }
    }
}

$CylancePages = @($CylancePage, $CylanceComputerPage)

#2

Remove the $ in the first line:

$CylanceComputerPage = New-UDPage -Url "/cylance/computer/:ComputerName" -Endpoint {

#3

This doesn’t appear to have fixed the issue. Adjusted code below, still redirecting to the same page.

$CylanceComputerPage = New-UDPage -Url "/cylance/computer/:CompName" -Endpoint {
    param($CompName)
    New-UDLayout -Columns 3 -Content {
        New-UdTable -Title "$CompName Agent Information" -Headers @(" ", " ") -Endpoint {
        @{
            'Operating System' = ($AgentData.os_version)
            'Cylance Policy' = ($AgentData.Policy)
            'Agent Version' = ($AgentData.agent_version)
            'Zone' = ($AgentData.zones)
            'Installed Date' = ($AgentData.created)
            'Files Analyzed' = ($AgentData.files_analyzed)
            'Last Online Date' = ($AgentData.online_date)
            'Last Reported User' = ($AgentData.last_reported_user)
            'IP Address' = ($AgentData.ip_addresses)
            'MAC Addresses' = ($AgentData.mac_addresses)
            }.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
        }
    }
}

#Add default policy counter and no-zone counters to table.
$CylancePage = New-UDPage -Name "Cylance" -Icon unlock -Endpoint {
    New-UDLayout -Columns 3 -Content {
        New-UDInput -Title "Enter Computer Name: " -Endpoint {
            param($Compname)
            New-UDInputAction -RedirectUrl "/cylance/computer/$CompName"
            }
        New-UDChart -Title "Devices by Zone" -Type HorizontalBar -Endpoint {
            $DevicesByZone | Out-UDChartData -DataProperty Count -LabelProperty Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "Devices by Policy" -Type HorizontalBar -Endpoint {
            $DevicesByPolicy | Out-UDChartData -DataProperty Count -LabelProperty Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "Top 10 Computers with Blocked Events" -Type Doughnut -Endpoint {
            $Top10ComputersWithBlockedThreats | Out-UDChartData -DataProperty Count -LabelProperty Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e","#1F1F1F","#777777","#FFFFFF") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "Quarantined vs Unquarantined Events" -Type Doughnut -Endpoint {
            $ThreatAction | Out-UDChartData -DataProperty Count -Label Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e","#1F1F1F","#777777","#FFFFFF") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "OS of Cylance Computers" -Type Doughnut -Endpoint {
            $CylanceOSList | Out-UDChartData -DataProperty Count -LabelProperty Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e","#1F1F1F","#777777","#FFFFFF") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDChart -Title "Cleared Threats by Type" -Type Doughnut -Endpoint {
            $ClearedThreatsByType | Out-UDChartData -DataProperty Count -Label Name -BackgroundColor @("#75cac3","#2a6171","#f3d516","#4b989e","#86df4a","#b816f3","#f31651","#4e4b9e","#1F1F1F","#777777","#FFFFFF") -BorderColor 'black' -HoverBackgroundColor '#FF9F0D'
            }
        New-UDCounter -Title "Cylance Computers" -Endpoint {
            $CylanceComputerCount
            }
        New-UDCounter -Title "Cylance Memory Protection Events (Past 7 Days)" -Endpoint {
            $RecentMemoryProtectHits
        }
    }
}

$CylancePages = @($CylancePage, $CylanceComputerPage)

I’ve also verified the page is loaded to the dashboard:

Type            : page
Name            : 
Url             : /cylance/computer/:CompName
DefaultHomePage : False
Icon            : None
Components      : {}
Dynamic         : True
Id              : b5a42448-21a9-43e1-86d5-cf6c9c199ab6
Callback        : UniversalDashboard.Models.Endpoint
RefreshInterval : 5
AutoRefresh     : False
Error           : 
HasCallback     : True

Here’s the screenshot of after submitting the field or manually navigating to that URL


#4

So I have found something weird. It seems that if I change the URL of the dynamic page to something which doesn’t start with /cylance it is able to load the page.

Are we unable to create child pages from a static page with dynamic pages?


#5

This is a known issue scheduled to be fixed in v 2.3.2. Again. :sunglasses:

Thanks,
Tim Curwick


#6

Ahh, thanks! I’m just glad I figured out what was up. I was so confused for awhile. lmao