Skip to main content

New SAMO Browse

Header

Level: Intermediate

Keywords: SAMO Browse, application page, browse

The result: page SAMO Browse for working with feature data

Second type of application page are browse pages. Using samo-browse module, it is possible to show information about features (position, attributes, related features etc.). SAMO Browse offers wide functionality. It enables user to browse, filter, create, edit, delete the entity or run entity Intents.

The samo-browse web module is universal, it can display entities with different types of listings:

  • Table or list for displaying and filtering defined features
  • Map for presenting defined feature data in map view
  • Detail for displaying detail view of selected feature (see New Detail)
warning

It is very important to realize that the samo-browse web module is only capable of displaying entity detail, but its content is defined in configurations of entity metadata and their details, see New SAMO Entity and New Detail.

How to create new SAMO Browse?​

This chapter will describe how to implement SAMO Browse with most the common configuration options.

Include new page to folder structure​

All pages are located under the pages folder of the corresponding application part. See following folder structure:

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.

Define basic configuration​

The list of features may be homogeneous or heterogeneous, depending on whether it displays a list of instances of the same entities or different ones. Browser therefore works with a group of entities, see Defining entity group. Parameter entitiesGroup defines which feature types we want to work with in the SAMO Browse.

The second mandatory parameter is defaultView, which enables to configure the default display mode of SAMO Browse. Parameter values could be set to table or map. Each value represents initial view of feature data, to see data in map or just in table.

The last mandatory parameter is map which extends the basic configuration of SAMO Map module used to show data on map. To see map configuration posibilities, please check Samo map page.

example-browse.json - configuration example
{
"module" : {
"type": "component:entity-modules/browse/samo-browse",
"entitiesGroup": "example-group",
"defaultView": "table",
"map": {
"extends" : "default",
"enabledLayers" : ["searchLayer", "baseOSM"]
}
}
}

Properties that are shown as columns in SAMO Browse in the table view are set using propertyGroupId parameter. Here it is possilbe to use the id of LIDS form, or propertyGroups defined in SAMO client metadata.

Customize SAMO Browse​

In this chapter we will show some basic customization examples. All posibilities are documented in Dynamic-App Module Catalog

Table only view​

If we want to use only table view, it means we don't want to use map and hide possibility to switch between table and map view, we need do it in two steps.

  • set default view to table
  • disable changing view by setting property canChangeView to false
example-browse.json - configuration example
{
"type": "component:entity-modules/browse/samo-browse",
"entitiesGroup": "example-group",

"defaultView": "table",
"canChangeView" : false,

"map": {
"extends" : "default",
"enabledLayers" : ["searchLayer", "baseOSM"]
}
}

Browse with default filter condition​

If we want to configure SAMO Browse to show only entities based on some specific condition, entities in a particular state, or entities assigned to the logged in user, we need to define query parameter with condition for the Search Extension.

filter browse for ft_example in state with id = 1 - configuration example
{
"type": "component:entity-modules/browse/samo-browse",
"entitiesGroup": "example-group",

"query":{
"must" : [{
"type": "terms",
"field" : "at_example_cl_stateExample.ca_stateExample_id",
"values": [1]
}]
}

"map": {
"extends" : "default",
"enabledLayers" : ["searchLayer", "baseOSM"]
}
}