Oskari API Documentation

Select bundle

admindown-arrow
cataloguedown-arrow
  • metadata
    Generic functionality to display metadata from a CSW-service
  • metadatasearch
    Provides metadata catalogue search user-interface for an application.
frameworkdown-arrow
  • announcements
    Bundle for displaying announcements made with admin-announcements.
  • Core services
    Provided by the framework
  • layeranalytics
    Map layer problem tracker
  • layerlist
    A layer listing functionality for the geoportal.
  • mydata
    Provides generic container for listing user data and offers other functionalities a way to present user-specific information.
  • Map Publisher 2
    Allows creation of embedded maps
  • RPC
  • Search
    Provides basic search functionality without any UI
  • Selected-featuredata
    Allows infobox opening in new flyout
  • statehandler
    History functionality and state saving.
  • usagetracker
    Pings the server when any of the configured events occur.
mappingdown-arrow
statisticsdown-arrow
  • statsgrid2016
    Statistics data display. This will replace the statsgrid bundle specification when the implementation has the comparable functionalities as the current one. The bundle depends on mapstats-bundle that provides support for statslayer layertype.
uidown-arrow

mydata

Provides generic container for listing user data and offers other functionalities a way to present user-specific information.

Description

The bundle lists user's account information and saved data in the application. By default mydata lists account info, saved map views and embedded maps. Other bundles can add tabs to list data related to their domain (eg. my places, user indicators) here.

Display user data

Here shown with tabs added by myplaces and myplacesimport bundles

TODO

  • Move embedded maps tab implementation from mydata to publisher functionality

Usage from other bundles

If mydata bundle is present in the app (and started before running this code) other bundles can access the service it provides through the Oskari sandbox. The provided service has a function addTab() that takes the following parameters:

const myDataService = sandbox.getService('Oskari.mapframework.bundle.mydata.service.MyDataService');
if (myDataService) {
    myDataService.addTab('[identifier string for tab]', 'Title for tab', MyTabImpl, MyTabImplUIHandler);
}

The UIHandler is expected to have addStateListener(), getState() (inherited from StateHandler) and getController() (from controllerMixin) functions. The objects returned by getState() and getController() functions are passed to the React-component as props state and controller. When a statechange is triggered on the MyTabImplHandler the UI will be re-rendered (by the state listener registered by mydata).

Example MyTabImplUIHandler:

class UIHandler extends StateHandler {
     changeState () {
         this.updateState({ updated: 'state' });
     }
};
export const MyTabImplUIHandler = controllerMixin(UIHandler, ['changeState']);

Example MyTabImpl:

export const MyTabImpl = ({ state, controller }) => {
  return (<p>
    My state: {{JSON.stringify(state)}}
    <button onClick={() => controller.changeState()}>Do stuff</button>
  </p>)
}

Bundle configuration

Configuration is optional:

conf: {
  showUser: true,
  showViews: true
}
  • If showUser is true (defaults to true on server) the user account tab will be shown.
  • If showViews is true (defaults to true on server) the saved views tab will be shown.

These can be configured on the Oskari-server oskari-ext.properties configuration file:

mydata.tabs.showUser=true
mydata.tabs.showViews=true

Also uses Oskari.urls.getLocation('profile') to provide a link where the user can update their profile information. The easiest way for the link to be configured is defining it on the Oskari-server oskari-ext.properties configuration file:

auth.profile.url=/profile

Or for language-specific links with:

auth.profile.url.en=https://sso.org/profile
auth.profile.url.fi=https://sso.org/profiili

The bundle will show a link on the account tab to the configured URL when configured.

Requests the bundle sends out

Request Where/why it's used
`Publisher.PublishMapEditorRequest` When an embedded maps 'Edit' link is clicked to activate the publisher bundle
`userinterface.UpdateExtensionRequest` When an embedded maps 'Edit' link is clicked to close the personaldata flyout
`Toolbar.AddToolButtonRequest` If 'StateHandler.SaveStateRequest' can be used/is part of the application. Adds a toolbar button for saving views when the bundle is started. Button is disabled for guest users.
`StateHandler.SaveStateRequest` When the save view button is clicked
`StateHandler.SetStateRequest` When the name of a saved view or 'Show' link of an embedded map is clicked

Events the bundle listens to

Event How does the bundle react
`Publisher.MapPublishedEvent` Refreshes the embedded maps listing
`StateSavedEvent` Refreshes the saved views listing

Dependencies

Dependency Linked from Purpose
Oskari divmanazer Expects to be present in application setup Bundle has a Flyout and Tile so a divmanazer is needed