Skip to content

Latest commit

 

History

History
818 lines (596 loc) · 29.6 KB

client.md

File metadata and controls

818 lines (596 loc) · 29.6 KB

GeoNode MapStore Client Applications

This pages contain specific configurations and documentation related to the javascript applications only.

Configuration

The configuration file is located in client/static/mapstore/configs/localConfig.json and it exposes specific properties to customize:

localConfig.json

property type description
supportedLocales {object}
geoNodeConfiguration {object} contains all the configuration needed to change the theme, filters and navbar structures see available properties

GeoNode configuration

localConfig.geoNodeConfiguration

property type description
filters {object} configuration of filter
filters.order {object} configuration of order dropdown
filters.order.defaultLabelId {string} label id to use for the order dropdown button
filters.order.options {array} label id to use for the order dropdown button order object entry
filters.extent {object} configuration of extent filter
filters.extent.layers {array} a list of MapStore layers object used as extent background
filters.extent.style {object} a MapStore vector style object
cardsMenu {object} configuration of the menu of resource cards
cardsMenu.items {array} list of menu item objects, right placement menu item object entry
cardOptions {object} configuration of the resource cards dropdown
cardOptions.items {array} list of menu item objects, dropdown placement menu item object entry
filtersForm {object} configuration of the resource cards dropdown
filtersForm.items {array} list of filter objects, panel placement filter object

Order Object

Order object contains properties for an entry of the order dropdown. Configuration:

{
  "labelId": "gnhome.aZ", // message id for the dropdown item
  "value": "title" // value used in the sort filter
}

Menu Item Object

Menu item object contains properties for a list item rendered in a menu. Configuration:

  • type link
{
  "labelId": "gnhome.register", // label message id
  "type": "link", // one of 'link', 'dropdown', 'divider' or 'filter'
  "href": "/account/signup/?next=/",
  "badge": "{state.datasetsTotalCount}", // (menu configuration only) counter badge. variable available: datasetsTotalCount, mapsTotalCount,
  "authenticated": true, // true shows the item only when user authenticated while false only for anonymous user, if undefined the item is always visible
  "perms": [], // the value in array define the access to the contents
  "allowedRoles": [] // user roles to access  to the contents

}
  • type dropdown
{
  "labelId": "gnhome.register", // label message id
  "image": "", //the toogle image
  "type": "dropdown", // one of 'link', 'dropdown', 'divider' or 'filter'
  "authenticated": true, // true shows the item only when user authenticated while false only for anonymous user, if undefined the item is always visible
  "perms": [], // the value in array define the access to the contents
  "allowedRoles": [], // user roles to access  to the contents
  "items": []  // menu items of type link or divider
}
  • type divider
{
  "type": "divider", // one of 'link', 'dropdown', 'divider' or 'filter'
  "authenticated": true, // true shows the item only when user authenticated while false only for anonymous user, if undefined the item is always visible
  "perms": [], // the value in array define the access to the contents
  "allowedRoles": [], // user roles to access  to the contents
}
  • type filter
{
  "type": "filter", // one of 'link', 'dropdown', 'divider' or 'filter'
  "id": "landuse", // unique id of the filter
  "labelId": "gnhome.customFilterExample", // label message id
  "authenticated": true, // true shows the item only when user authenticated while false only for anonymous user, if undefined the item is always visible
  "perms": [], // the value in array define the access to the contents
  "allowedRoles": [],  // user roles to access  to the contents
  "query": { // query filter to use
    "filter{regions.name.in}": [
        "Global"
    ]
  }
}

Filter Object

Filter object contains properties for a select input rendered inside the filter form. Configurations:

  • type select

    • properties for select input with static options:
    {
      "id": "title", // filter id used for the request filter{title.in}=
      "labelId": "gnhome.labelId", // message id for select label
      "placeholderId": "gnhome.placeholderId", // message id for select placeholder
      "type": "select",
      "options": [ // list of string values
          "Title 1",
          "Title 2",
          "Title 3",
          "Title 4"
      ]
    }
    • properties for select input with suggestions request:
    {
      "labelId": "gnhome.resourceTypes", // message id for select label
      "placeholderId": "gnhome.resourceTypesPlaceholder", // message id for select placeholder
      "type": "select",
      "suggestionsRequestKey": "resourceTypes" // available 'resourceTypes', 'categories', 'keywords', 'regions' or 'owners'
    }
  • type group

{
  "type": "group",
  "labelId": "gnhome.customFiltersTitle", // label message id
  "authenticated": true, // true shows the item only when user authenticated while false only for anonymous user, if undefined the item is always visible
  "items": [
    //... list of filter objects excluding type group
  ]
}

Filter items supports also the following types from menu object configuration: filter, divider and link.

Modules

actions/gnresource

Actions for GeoNode resource store information of the resource in use

actions/gnsave

Actions for GeoNode save workflow

actions/gnsearch

Actions for GeoNode resource featured items set new Featured Resources includes data, page, links

epics/index
epics/visualstyleeditor
plugins/LayerSettings
plugins/MediaViewer
plugins/Save
plugins/SaveAs
plugins/Sync
selectors/config
utils/APIUtils

Utilities for api requests

utils/CoordinatesUtils

Utilities for api requests

utils/FileUtils
utils/MenuUtils
utils/ResourceUtils

Constants

SYNC_RESOURCES

Sync geostory components with their live resources on geonode

gnSyncComponentsWithResourcesObservable

Sync reources in current geostory or dashboard with their respective sources

getGeonodeResourceDataFromGeostoryArray

Get geonode resources from within a Geostory

Functions

getSyncInfo(appType, resourceData, successArr)Object

Get resource type and data for state update in sync process

getNotificationInfo(errors, successes)Object

Get notification title, leve, and message for showNotification

actions/gnresource

Actions for GeoNode resource store information of the resource in use

actions/gnresource.resourceLoading()

Initialize loading state

Kind: static method of actions/gnresource

actions/gnresource.setResource(data)

Set the resource in the state

Kind: static method of actions/gnresource

Param Type Description
data object resource data object

actions/gnresource.editTitleResource(title)

edit the title resource in the state

Kind: static method of actions/gnresource

Param Type Description
title string resource

actions/gnresource.editAbstractResource(abstract)

edit the abstract resource in the state

Kind: static method of actions/gnresource

Param Type Description
abstract string resource

actions/gnresource.editThumbnailResource(image)

edit the image resource in the state

Kind: static method of actions/gnresource

Param Type Description
image string resource

actions/gnresource.setResourceType(resourceType)

Set the resource type in the state

Kind: static method of actions/gnresource

Param Type Description
resourceType object resource type

actions/gnresource.resourceError(error)

Set error of resource request

Kind: static method of actions/gnresource

Param Type Description
error object error data object

actions/gnresource.updateResourceProperties(properties)

Update resource properties

Kind: static method of actions/gnresource

Param Type Description
properties object resource properties to override

actions/gnresource.setNewResource()

Set the current resource as new

Kind: static method of actions/gnresource

actions/gnresource.setResourceId(id)

Set resource id or primary key

Kind: static method of actions/gnresource

Param Type Description
id number | string resource id or primary key

actions/gnresource.setResourcePermissions(permissions)

Set resource permissions

Kind: static method of actions/gnresource

Param Type Description
permissions object permissions info
permissions.canEdit bool can edit permission
permissions.canView bool can view permission

actions/gnresource.setSelectedDatasetPermissions(permissions)

Set resource permissions

Kind: static method of actions/gnresource

Param Type Description
permissions object permissions info
permissions.canEdit bool can edit permission
permissions.canView bool can view permission

actions/gnresource.setFavoriteResource(favorite)

Set the resource favorite field (trigger epic gnSaveFavoriteContent)

Kind: static method of actions/gnresource

Param Type Description
favorite bool resource data field

actions/gnresource.enableMapThumbnailViewer()

Enable or disable map thumbnail viewer

Kind: static method of actions/gnresource

actions/gnresource.setMapThumbnail()

Set map like thumbnail to map or layer (trigger epic gnSaveDirectContent)

Kind: static method of actions/gnresource

actions/gnsave

Actions for GeoNode save workflow

actions/gnsave.savingResource()

Initialize saving loading state

Kind: static method of actions/gnsave

actions/gnsave.saveSuccess(success)

Set success response of save workflow

Kind: static method of actions/gnsave

Param Type Description
success object success response

actions/gnsave.saveError(error)

Set error response of save workflow

Kind: static method of actions/gnsave

Param Type Description
error object error response

actions/gnsave.clearSave()

Clear state of actions.gnsave reducer

Kind: static method of actions/gnsave

actions/gnsave.saveContent(id, metadata, reload, showNotifications)

Save or create a resource (trigger epic actions.gnsaveContent)

Kind: static method of actions/gnsave

Param Type Description
id number | string resource id or primary key, create a new resource if undefined
metadata object properties to update { name, description, thumbnail }
reload bool reload page on create
showNotifications bool show notifications to user

actions/gnsave.saveDirectContent()

Save or updates a resource (trigger epic actions.gnsaveDirectContent)

Kind: static method of actions/gnsave

actions/gnsearch

Actions for GeoNode resource featured items set new Featured Resources includes data, page, links

actions/gnsearch.loadFeaturedResources(action, pageSize)

Actions for GeoNode resource featured items loads new featured resources basing on the action, previous or next

Kind: static method of actions/gnsearch

Param Type Description
action string can be either next or previous
pageSize number page_size of items to load defaults to 4;

epics/index

epics/index.gnCheckSelectedDatasetPermissions

Handles checking and for permissions of a layer when its selected

Kind: static constant of epics/index

epics/index.gnSetDatasetsPermissions

Checks the permissions for layers when a map is loaded and when a new layer is added to a map

Kind: static constant of epics/index

epics/visualstyleeditor

epics/visualstyleeditor~getGnStyleQueryParams(style, styleService) ⇒ Promise

Get Mapstore style in JSON, editor type and code for layer style in Promise

Kind: inner method of epics/visualstyleeditor

Param Type Description
style Object layer default style
styleService Object Object containing baseUrl for getStylesInfo

plugins/LayerSettings

plugins/LayerSettings~LayerSettings

Plugin for layer and groups settings

Kind: inner property of plugins/LayerSettings
Example

{
  "name": "LayerSettings",
}

plugins/MediaViewer

plugins/MediaViewer~MediaViewer

Plugin for Media Viewer

Kind: inner property of plugins/MediaViewer
Properties

Name Type Description
cfg.gltf.environmentFiles string path to an hdr environment file for the 3d scene (format gltf)
cfg.pcd.environmentFiles string path to an hdr environment file for the 3d scene (format pcd)

plugins/Save

plugins/Save~Save

Plugin for Save modal

Kind: inner property of plugins/Save

plugins/SaveAs

plugins/SaveAs~SaveAs

Plugin for SaveAs modal

Kind: inner property of plugins/SaveAs

plugins/Sync

selectors/config

selectors/config.getParsedGeoNodeConfiguration

get the parsed geonode configuration that take into account user permissions and expressions

Kind: static constant of selectors/config

Param Type Description
state object redux state

selectors/config.getCustomMenuFilters

return all the custom filters available in the GeoNode configuration from localConfig

Kind: static constant of selectors/config

Param Type Description
state object redux state

utils/APIUtils

Utilities for api requests

utils/APIUtils.parseDevHostname ⇒ string

In development mode it returns the request with a relative path if the request url contain localhost:8000

Kind: static constant of utils/APIUtils
Returns: string - correct url for localhost

Param Type Description
requestUrl string request url

utils/CoordinatesUtils

Utilities for api requests

utils/CoordinatesUtils.boundsToExtentString ⇒ string

Given a bounds { minx, miny, maxx, maxy } and a crs return the extent param as string

Kind: static constant of utils/CoordinatesUtils
Returns: string - extent param

utils/CoordinatesUtils.getExtent ⇒ Array

Get the extent of area of interest from map bbox the values of the extent are expressed in the unit of the projection

Kind: static constant of utils/CoordinatesUtils
Returns: Array - containng minx, miny, maxx, maxy minx, miny -> bottom-left corner of square maxx, maxy -> top-right corner of square

Param Type Description
Options Object containing layers and features

utils/FileUtils

utils/FileUtils.getFileFromDownload ⇒ string

Generates a blob path for a resource

Kind: static constant of utils/FileUtils
Returns: string - Object url to view resource in browser

Param Type Description
downloadURL string remote path to a resource
type string type of the file to be converted to default application/json

utils/FileUtils.determineResourceType ⇒ string

check if a resource extension is supported for display in the media viewer

Kind: static constant of utils/FileUtils
Returns: string - pdf image video unsupported

Param Type Description
extension string extension of the resource accessed on resource.extenstion

utils/MenuUtils

utils/MenuUtils.hasPermissionsTo(perms, objResource, objType) ⇒ boolean

check if the menu perms is allowed by user or resource

Kind: static method of utils/MenuUtils

Param Type Description
perms array array with perms of user or resource
objResource array menu or resource perms
objType string type of objcet (user / resource)

utils/ResourceUtils

utils/ResourceUtils.resourceToLayerConfig ⇒ object

convert resource layer configuration to a mapstore layer object

Kind: static constant of utils/ResourceUtils

Param Type Description
resource object geonode layer resource

utils/ResourceUtils.setAvailableResourceTypes

A setter funtion to assign a value to availableResourceTypes

Kind: static constant of utils/ResourceUtils

Param Type Description
value * Value to be assign to availableResourceTypes (gotten from resource_types response payload)

utils/ResourceUtils.getResourcePermissions ⇒

Extracts lists of permissions into an object for use in the Share plugin select elements

Kind: static constant of utils/ResourceUtils
Returns: An object containing permissions for each type of user/group

Param Type Description
options Object Permission Object to extract permissions from

utils/ResourceUtils.parseDocumentConfig ⇒ Object

Parse document response object (for image and video)

Kind: static constant of utils/ResourceUtils
Returns: Object - new document config object

Param Type Description
docResponse Object api response object
resource Object optional resource object

utils/ResourceUtils.parseMapConfig ⇒ Object

Parse map response object

Kind: static constant of utils/ResourceUtils
Returns: Object - new map config object

Param Type Description
mapResponse Object api response object
resource Object optional resource object

SYNC_RESOURCES

Sync geostory components with their live resources on geonode

Kind: global constant

gnSyncComponentsWithResources ⇒ Observable

Sync reources in current geostory or dashboard with their respective sources

Kind: global constant

Param Type Description
action$ * the actions
store Object

getGeonodeResourceDataFromGeostory ⇒ Array

Get geonode resources from within a Geostory

Kind: global constant
Returns: Array - Array of geonode resources

Param Type Description
state Object App state

getSyncInfo(appType, resourceData, successArr) ⇒ Object

Get resource type and data for state update in sync process

Kind: global function

Param Type Description
appType String geostory or dashboard
resourceData Object Resource Object
successArr Array Array of success responses only used in case of dashboard

getNotificationInfo(errors, successes) ⇒ Object

Get notification title, leve, and message for showNotification

Kind: global function

Param Type Description
errors Number length of errors array
successes Number length of success arra