sdi_appstatemanagementshared

This bundle provides components that are used by both the sdi_appstatemanagement and the sdi_appstatemanagerintegration bundle. These components are required for saving, loading, and sharing app states.

Usage

App states are saved in the map.apps SDI database on the server, so it is required to install and configure the map.apps SDI savestate backend web application on the application server. You can find detailed installation instructions in the map.apps SDI product documentation.

How it works internally

For generating a new app state, the data from all components providing the ct.api.parametermanager.Parametrizable service is collected. For example, the map-widget bundle has a component BasemapsParameterResolver that provides a parametermanager.Parametrizable service.

Please refer to the parametermanager documentation for fore information.

Constraints

This bundle is not compatible with the map.apps parametermanager bundle. Please make sure that the parametermanager and the appstatemanagementshared bundles are not present in the same app at the same time.

Note that some bundles, like the parameter-url bundle, depend on the parametermanager bundle and cause it to be started in the app without explicitly mentioning it in the app's allowedBundles list. Therefore, exclude all bundles that depend on the parametermanager bundle, too.

Configuration Reference

The following sections describe the configurable components and properties for the app.json of this bundle's components.

FilteredAppStateStoreFactory

If the listOwnSharedAppStates property is true, only the app states for the currently logged-in user are shown in the list.

"sdi_appstatemanagementshared": {
    "FilteredAppStateStoreFactory": {        
        "listOwnSharedAppStates" : false
    } 
}

StateController

The askBeforeLoading property can be used to control whether a confirmation dialog should be shown before an app state is loaded.

"sdi_appstatemanagementshared": {
    "StateController": {
        "askBeforeLoading": true
    }
}

Configure role-alias and aria-labels for StateDetail Widget

When creating or editing app states in the StateDetail widget, the permissions section show which role can view and edit the current app state.

It is possible to configure i18n labels to replace role names that are displayed in the widget. This can be done by overriding the i18n of the sdi_appstatemanagementshared bundle in an app like documented in map.apps. The following example from bundle.js file demonstrates the configuration of aliases for the special roles _public_ and _private_, as well as for the roleXY.

"sdi_appstatemanagementshared": {
    "stateDetails": {
        "permissions": {
            "roleAlias": {
                "_public_": "Owner",
                "_private_": "Everyone",
                "roleXY": "Role YZ"
            },
            "ariaLabels": {
                "viewCheckbox": "${role} may view",
                "editCheckbox": "${role} may edit"
            }
        }     
    }
}

Note in this sample snippet, you can also modify the 'aria-label', which instructs a screen reader what to read to the user when they tab over the view and edit checkboxes.

StateDetailsModelFactory

This component can be used to configure the UI for creation and editing an app state.

The visibilityOptions property can be used to control with whom and with which permissions the user can share the state.

The allowedRoles property can be used to control with which user roles a state can be shared.

"sdi_appstatemanagementshared": {
    "StateDetailsModelFactory": {
        "visibilityOptions": ["PUBLIC", "PRIVATE", "ROLES", "VIEW", "EDIT"],
        "allowedRoles": ["role1", "role2"]        
    }
}

StateColumnExtender

The showLinkButton property controls whether to show the "Create link" button next to every app state in the app state list.

"sdi_appstatemanagementshared": {
    "StateColumnExtender":{
        "showLinkButton": true
    }
}

LayerOrderParameterResolver

This component controls how the order of layers and layer groups are stored in an app state. For this task, each service must be clearly indentifiable. Therefore, you need to assign IDs to the services you configured in the app.json file.

Services that were dynamically added using the sdi_loadservice bundle are identified using their URL and the fact that they are children of the same root note. In case you changed that root node's ID using the rootId property of the sdi_loadservice.AddLayerService component, you need to configure the same value here for the addLayerServiceRootId. If you didn't change the rootId property, you can keep the default value my_services for the addLayerServiceRootId.

"sdi_appstatemanagementshared": {
    "LayerOrderParameterResolver": {
        "addLayerServiceRootId": "my_services"
    }
}

SketchingParameterResolver

Collects the graphics to save from the map. By default, only those graphics created with the map.apps "sketching" bundle are saved. The corresponding graphics layer has the ID "sketch-graphics".

You can configure a list of additional graphic layer IDs to save using the property graphicLayerIds. In the following example, we add a layer with the ID my_custom_graphics_layer to the existing one:

"sdi_appstatemanagementshared": {
    "SketchingParameterResolver": {
        "graphicLayerIds": ["sketch-graphics", "my_custom_graphics_layer"]
    }
}