Pages
Information about Universal App pages.
An app can consist of one or more pages. A page can have a particular name and URL. You can define a URL that accepts one or more variables in the URL to define a dynamic page.
Creating a new page
Within the app editor, expand the Pages navigation menu and click New Page.
You can edit a page by clicking the link in the menu. The code editor will switch to the page's content.
To reference the page in your dashboard, use Get-UDPage
.
Basic Page
A basic page can be defined using the New-UDPage
cmdlet. You could navigate to this page by visiting the /app
URL of your dashboard.
App with Multiple Pages
Apps can have multiple pages and those pages can be defined by passing an array of UDPages to New-UDApp
You may want to organize your app into multiple PS1 files. You can do this using pages.
Page with a Custom URL
A page can have a custom URL by using the -Url
parameter. You could navigate to this page by visiting the /db
URL of your app.
Page with Variables in URL
You can define a page with variables in the URL to create pages that adapt based on that URL.
Query string parameters
Query string parameters are passed to pages and other endpoints as a hashtable variable called $Query
.
For example, if you visited a page with the following query string parameter: http://localhost:5000/dashboard/Page1?test=123
You would have access to this value using the following syntax:
Role-Based Access
This feature requires a license.
You can prevent users from accessing pages based on their role by using the -Role
parameter of pages. You can configure roles and role policies on the Security page.
Header
The following options are available for customizing the header.
Position
Use the -HeaderPosition
parameter to adjust the behavior of the header.
absolute\fixed - Remains at the top of the page, even when scrolling
relative - Remains at the top of the page. Not visible when scrolling.
Colors
You can adjust the colors of the header by specifying the -HeaderColor
and -HeaderBackgroundColor
parameters. These colors will override the theme colors.
Navigation
You can customize the navigation of a page using the -Navigation
and -NavigationLayout
parameters. Navigation is defined using the List component. Navigation layouts are either permanent or temporary.
Custom Navigation
Custom navigation can be defined with a list. List items can include children to create drop down sections in the navigation.
Dynamic Navigation
Dynamic navigation can be used to execute scripts during page load to determine which navigation components to show based on variables like the user, IP address or roles.
You can generate dynamic navigation by using the -LoadNavigation
parameter. The value of the parameter should be a script block to execute when loading the navigation.
Role-Based Access
You can use dynamic navigation to create a navigation menu that takes advantage of roles. Use Protect-UDSection
to limit who has access to particular menu items. Ensure that you also include the same role on the page.
Layouts
The permanent layout creates a static navigation drawer on the left hand side of the page. It cannot be hidden by the user.
The temporary layout creates a navigation drawer that can be opened using a hamburger menu found in the top left corner. This is the default setting.
Horizontal Navigation
You can use New-UDAppBar
with a blank page to create horizontal navigation.
Logo
You can display a logo in the navigation bar by using the -Logo
parameter.
First, setup a published folder to host your logo.
Now, when creating your page, you can specify the path to the logo.
The logo will display in the top left corner.
To customize the style of your logo, you can use a cascading style sheet and target the ud-logo
element ID.
Header Content
You can define custom content to include in the header by using the -HeaderContent
parameter.
Dynamic Page Title
Page titles are static by default, but you can override this behavior by using -LoadTitle
. It will be called when the page is loaded. This is useful when defining pages in multilingual dashboards.
Static Pages
Static pages allow for better performance by not executing PowerShell to load the content of the page. This can be useful when displaying data that does not require dynamic PowerShell execution. The page content is constructed when the dashboard is started.
Static pages do not have access to user specific data. This includes variables such as:
$Headers
$User
$Roles
You can still include dynamic regions within pages. These dynamic regions will have access to user data. Reloading the below example will update the date and time listed in the page.
API
Last updated