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, click the Create App Page button.
Once the page has been created, it will be listed in the pages tab.
To update the content of a page, click the Edit Code button.
As an example, you could add a button to your page.
New-UDButton-Text 'What page is this?'-OnClick {Show-UDToast $UDPage}
Once you have added the controls you would like to the page, you can add it to your app. To reference the page in your app, use Get-UDPage.
New-UDApp-Pages @(Get-UDPage-Name 'Users')
Basic Page
A basic page can be defined using the New-UDPage cmdlet. You could navigate to this page by visiting the /appURL of your dashboard.
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.
You can adjust the colors of the header by specifying the -HeaderColor and -HeaderBackgroundColor parameters. These colors will override the theme colors.
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 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.
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.
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 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.