AppBar / Drawer, Show-UDToast icon

Hi, I have a couple of different things to ask about, I don’t know if these should be different topics or not, if so, please let me know.

First, I am trying to add a permanent AppBar / Drawer to my dashboard.
I tried with using the Drawer, and -Navigation $Navigation -NavigationLayout permanent, which adds the bar like I want.
When I then tried to exclude different items in the bar based on $Roles, it doesn’t work, as $Roles seems to be populated first after New-UDPage has run.
I then switched to AppBar, which works with $Roles, but I can not make it permanent, without it creating a new header.
Is there some way to work with $Roles when using -Navigation $Navigation -NavigationLayout permanent, or is there some way to make the AppBar permanent?

Some example code:
Appbar:

function New-AppBar {
    param($Title)
    $Drawer = New-UDDrawer -Children {
        New-UDList -Children {
            New-UDListItem -Label "Home" -OnClick { Invoke-UDRedirect "/" }
            if ($Roles -eq "Reader") {
                New-UDListItem -Label "User" -OnClick { Invoke-UDRedirect "/User" }
            }
        }
    }
    New-UDAppBar -Position fixed -Children { 
        New-UDTypography -Text $Title -Variant h6
    } -Drawer $Drawer
}
New-UDPage -Name "Test" -Url "/User" -Role "Reader" -Content {
    New-AppBar -Title "User"
}

Drawer:

$Navigation = @(
    New-UDListItem -Label "Home" -OnClick { Invoke-UDRedirect "/" }
    if ($Roles -eq "Reader") {
        New-UDListItem -Label "User" -OnClick { Invoke-UDRedirect "/User" }
    }
)
New-UDPage -Name "Test" -Url "/User" -Role "Reader" -Navigation $Navigation -NavigationLayout permanent -Content {
}

Secondly I am wondering if “-Icon” is broken for Show-UDToast?
I can not make any icon visible, neither with just
Show-UDToast -Icon "ad"
nor
Show-UDToast -Icon (New-UDIcon -Icon "ad")

Product: PowerShell Universal
Version: 1.4.6
Dashboard Framework: 3.1.6

When I then tried to exclude different items in the bar based on $Roles , it doesn’t work, as $Roles seems to be populated first after New-UDPage has run.

We need to fix this. It shouldn’t work that way. I’ll take a look at what we can do there. The problem is we have to adjust the page to make a permanent bar so adding it using the New-AppBar method isn’t going to work.

Secondly I am wondering if “-Icon” is broken for Show-UDToast?

Unfortunately, this looks like a bug as well. I’ll get both of these added to our backlog to be resolved.

Ah, then I wasn’t crazy.
Thanks for your answer @adam!

1 Like