Skip to main content

New Application part

Header

Level: Beginner

Keywords: application part, shared configurations

The result: correct folder structure, link to the application part on the cockpit dashboard

How to set up new application part?​

In general each project consists of multiple application parts. As an application part, we understand a logical subset of application defined from the business point of view. An application part usually aggregates application pages and functionality for selected entities. It is possible to navigate and communicate between application parts and even take over some functionality. An example of application part could be Assets, Defects administration, or single agenda.

Following chapters describe the steps needed to successfully configure a new application part.

Create application part folder structure​

We will take as an example the "assets" application part. Corresponding folder structure should look like this. The part.json is mandatory.

dynamic-app
β”‚
└───samo-demo\configuration
β”‚
└───application\parts
β”‚
└───ap_assets
β”‚
└───pages
β”‚ β”‚ pg_dashboard.json
β”‚ β”‚ pg_assets-browse.json
β”‚ └───...
└───part.json

More about folder structure of Gateway metadata and dynamic app metadata can be found in SAMO Lighthouse.

part.json - configuration example
{
"defaultPage": "dashboard",
"defaultGuestPage": "login",
"shared": {
"pages": [
"documents",
"login",
"logout",
"messages-config",
"messages",
"profile"
],
"applicationModules": [
"entity-cart",
"recent-entities",
"reports",
"user-messages",
"user"
]
}
}

If you want to modify the configuration, relate to the Dynamic-App Configuration.

Add application part to the cockpit​

Cockpit is an application home page and usually navigates to single application parts. Basically it is another base application part, and is implemented similar to other application parts. It has its own part.json and dashboard.json. A link to the new application part is added to the cockpit using navigation shortcut widgets or a menu item.

Change application menu for specific application part​

The application part menu is configured in the application.json and used throughout the whole application. However you can define a custom menu for each application part by adding the menu object to your application part.json.

Each menu item can consist of title, id of the page to navigate, and icon. You can have simple one-level menu, or two-level menu (using the categories cofiguration parameter).

Application part menu - configuration example
"menu": {
"items": [
{
"type" : "part",
"icon" : "samo-default-icons:home",
"title" : "Cockpit",
"part" : "cockpit",

"security": {
"loggedIn": true
}
},
{
"type": "page",
"id": "all-assets",
"icon" : "samo-default-icons:flag"
},
{
"type": "category",
"title": "{tr:assets.assetsLighting}",
"id": "lighting-assets-category",
"icon" : "samo-default-icons:folder-close-filled",
"items": [
{
"type": "page",
"id": "lighting-assets",
"icon" : "samo-default-icons:flag"
},
{
"type": "page",
"id": "ft_ligLighting",
"icon" : "samo-default-icons:flag"
},
{
"type": "page",
"id": "ft_ligPowerCable",
"icon" : "samo-default-icons:flag"
}
]
}
]
}

If you want to modify the configuration, relate to the Dynamic-App Module Configuration.