Hi all,
Having trouble getting UDStyle to work again. Previously Adam advised me to put new-udelement before it, but this doesn’t seem to be working. I have confirmed the css works if I change it via developer tools
I have included Import-Module UniversalDashboard.Style in my dashboard.ps1.
Any pointers would be great.
Thanks
New-UDPage -Name "Availability" -Icon link -Content {
New-UDCard -id Availabilitycard -Content {
New-UDLayout -Columns 2 -Content {
New-UDElement -Tag 'div' -Id 'a' -Endpoint {
New-UDStyle -id 'Availabilitystyle' -Style '
.card .card-content {
font-size = 80px }' -Content {
New-UDGrid -Title " " -ID Availability -AutoRefresh -RefreshInterval 250 -PageSize 10 -NoFilter -Endpoint {
$cache:status | Select-Object -First 6 | ForEach-Object {
$BgColor = '#8EA294'
$FontColor = '#E4EAED'
if ($_.'Status' -ne 'IN') {
$BgColor = '#63474D'
$FontColor = '#E4EAED'
}
[PSCustomObject]@{
'Name' = New-UDElement -Tag 'div' -Attributes @{ style = @{ 'backgroundColor' = $BgColor; color = $fontColor } } -Content { $_.'Name' }
'Status' = New-UDElement -Tag 'div' -Attributes @{ style = @{ 'backgroundColor' = $BgColor; color = $fontColor } } -Content { $_.'Status' }
}
} |
Out-UDGridData
}
}
}
New-UDElement -Tag 'div' -Id 'a2' -Endpoint {
New-UDStyle -id 'Availabilitystyle2' -Style '
.card .card-content {
font-size = 80px }' -Content {
New-UDGrid -Title " " -ID Availability2 -AutoRefresh -RefreshInterval 250 -PageSize 10 -NoFilter -Endpoint {
$cache:status | Select-Object -Last 6 | ForEach-Object {
$BgColor = '#8EA294'
$FontColor = '#E4EAED'
if ($_.'Status' -ne 'IN') {
$BgColor = '#63474D'
$FontColor = '#E4EAED'
}
[PSCustomObject]@{
'Name' = New-UDElement -Tag 'div' -Attributes @{ style = @{ 'backgroundColor' = $BgColor; color = $fontColor } } -Content { $_.'Name' }
'Status' = New-UDElement -Tag 'div' -Attributes @{ style = @{ 'backgroundColor' = $BgColor; color = $fontColor } } -Content { $_.'Status' }
}
} |
Out-UDGridData
}
}
}
}
}
}