Good morning everyone,
Not sure if this is possible but am trying to accomplish the following:
- have a table that display latest logged error
- have two buttons above the table section where if on is clicked, table section should now change/update to display last 7 days
Unfortunately, Iām not able to accomplish this and get two tables instead of one. Screenshot below and code snippet. Hopefully any of you have an idea
Thank you in advanced.
New-UDColumn -LargeSize 6 -Content {
New-UDButton -Text "View"
New-UDButton -Id 'btnLast7' -Text "Last 7 Days" -OnClick {
Sync-UDElement -Id 'dynlast7'
}
New-UDDynamic -Id 'dynlast7' -Content {
#$dyn = Get-UDElement -Id 'btnLast7'
$webcfgcomplast7 = $sqltskresult | Where-Object {$_.Task -notin ('This is a task ') -and $_.Status -eq "FAIL" -and $_.StartDate -gt $today.AddDays(-7) -and $_.StartDate -lt $today.AddDays(-1)} | Sort-Object ID -Descending
#if(-not($webcfgcomplast7 -eq $null)){
$ErrorsGridColumns = @(
New-UDTableColumn -Property ID -Title " " -Render {
if(-not($EventData.Note -eq $null -or $EventData.Note -eq "")){
New-UDButton -Id "btn$($EventData.ID)" -Text "View" -OnClick {
Show-UDModal -Content {
$preHTML = $($($EventData.Note) -replace "`n","<br>")
New-UDHtml -Markup "<div>$preHTML</div>"
} -Footer {
New-UDButton -Text "Close" -OnClick {Hide-UDModal}
}
}
}
else{""}
}
New-UDTableColumn -Property Task
New-UDTableColumn -Property Status
New-UDTableColumn -Property StartDate
New-UDTableColumn -Property EndDate
)
New-UDStyle -Style '.MuiTableCell-head { font-weight: bold !important; }' -Content {
New-UDTable -Id 'errors' -Data $webcfgcomplast7 -Columns $ErrorsGridColumns -Title 'Last 7 Days Errors' -ShowPagination -Dense -PageSize 3 #-PageSizeOption @(5,10,20)
}
#}
#else{
# New-UDTypography -Text "No script errors found for today!" -Variant h4 -Align Center -Style @{color = 'green'}
# # Add btn here to change table dyn to view prev day and other way around
#}
}
if(-not($webcfgcomplatest -eq $null)){
$ErrorsGridColumns = @(
New-UDTableColumn -Property ID -Title " " -Render {
if(-not($EventData.Note -eq $null -or $EventData.Note -eq "")){
New-UDButton -Id "btn$($EventData.ID)" -Text "View" -OnClick {
Show-UDModal -Content {
$preHTML = $($($EventData.Note) -replace "`n","<br>")
New-UDHtml -Markup "<div>$preHTML</div>"
} -Footer {
New-UDButton -Text "Close" -OnClick {Hide-UDModal}
}
}
}
else{""}
}
New-UDTableColumn -Property Task
New-UDTableColumn -Property Status
New-UDTableColumn -Property StartDate
New-UDTableColumn -Property EndDate
)
New-UDStyle -Style '.MuiTableCell-head { font-weight: bold !important; }' -Content {
New-UDTable -Id 'errors' -Data $webcfgcomplatest -Columns $ErrorsGridColumns -Title 'Latest Error' -ShowPagination -Dense -PageSize 3 #-PageSizeOption @(5,10,20)
}
}
else{
New-UDTypography -Text "No script errors found for today!" -Variant h4 -Align Center -Style @{color = 'green'}
# Add btn here to change table dyn to view prev day and other way around
}
}
Product: PowerShell Universal
Version: 1.5.16