adam
August 27, 2019, 3:03pm
1
To add a logo to the navbar, you can specify a published folder to host you icon and then use -NavBarLogo
to specify the icon.
$PublishedFolder = Publish-UDFolder -Path $PSScriptRoot -RequestPath "/images"
$Dashboard = New-UDDashboard -Title "Logo" -Content {} -NavBarLogo (New-UDImage -Url '/images/UDLogo.png' -Height 32 -Width 32)
Start-UDDashboard -Dashboard $Dashboard -Port 10000 -PublishedFolder $PublishedFolder -Force
6 Likes
Using this exact code I cannot get this to work. It has a broken image link. I am putting the file in the .\images directory where the PS1 is located then running the PS1 just as you have above. Let me know what more details I can provide.
Try adding
Write-Host $PSScriptRoot
as your first line in the PS1, see what the console outputs for it.
The location of image is C:\repos\Dashboards\images\whatever.png
PS C:\repos\Dashboards> .\Icon.ps1
C:\repos\Dashboards
Name Port Running DashboardService
---- ---- ------- ----------------
Dashboard21 10000 True UniversalDashboard.Services.DashboardService
PS C:\repos\Dashboards>
Current Script for troubleshooting purposes.
get-UDDASHboard | Stop-uddAshboard
Write-Host $PSScriptRoot
$PublishedFolder = Publish-UDFolder -Path $PSScriptRoot -RequestPath "/images"
$Dashboard = New-UDDashboard -Title "Logo" -Content {} -NavBarLogo (New-UDImage -Url '/images/UDLogo.png' -Height 32 -Width 32)
Start-UDDashboard -Dashboard $Dashboard -Port 10000 -PublishedFolder $PublishedFolder -Force
So, this might just be a typo on your partā¦ but you say the location of your image is
c:\repos\Dashboards\images\whatever.png
yet you are calling /images/UDLogo.png
Is the image named UDLogo.png or whatever.png ?
Yeah I didnāt remember what it was named when I put that up there but it is named UDLogo.png I just went and verified it is there and named UDLogo.png
Solved, Need to specify images in your path. This below works for me.
get-UDDASHboard | Stop-uddAshboard
$PublishedFolder = Publish-UDFolder -Path "$PSScriptroot\images" -RequestPath "/images"
$Dashboard = New-UDDashboard -Title "Logo" -Content {} -NavBarLogo (New-UDImage -Url '/images/UDLogo.png' -Width 32)
Start-UDDashboard -Dashboard $Dashboard -Port 10000 -PublishedFolder $PublishedFolder -Force
1 Like
Ah, he didnāt have an images folder in his original example. That would explain it.
He had the image file in the same directory as the .PS1
1 Like
adam:
ā/images/UDLogo.pngā
Ahā¦ I took this as there wasā¦ #Noob LOL
Yeah, that -RequestPath ā/imagesā makes that a virtual directory.
Does it support @psDevUK UDGhost?
1 Like
@adam any option to do this in universal at the moment?
Seems that parameter is gone now.
adam
July 21, 2020, 3:36pm
13
Whoops. Not at the moment. Iāll make sure that gets added.
Thanks @adam , not to hijack this thread but what about the -scripts parameter? Is there an alternative way to do it now? I was going to fallback to UDHelmet if that is my only option.
adam
July 21, 2020, 3:54pm
15
Currently the only option but Iāll get that added as well. Should be easy to get in a 1.3 nightly build.