-
Notifications
You must be signed in to change notification settings - Fork 47
Experimental features
The developers feel sometimes that a feature might work well, but would probably improve if more feedback could be obtained. In the same time, the developers don't want Hajk to become unstable, full of untested features.
In order to make it possible for Hajk administrators, we have introduced experimental features.
All experimental features are hidden behind one or more experimental flags. The flags are to be set in appConfig.json
. See below for further documentation of each experimental feature.
This function makes it possible for admins to show a snackbar to a user.
The snackbar should contain a short message to the user. The snackbar comes in 5 pre-defined styles for different kinds of messages (infos, errors, etc).
The snackbar can be set to auto-hide or to be permanent. In that case it will contain a × icon that user can click to close the snackbar.
The snackbar can be defined but disabled, which makes it possible to have certain pre-defined messages for different occasions and enable/disable them when needed.
Admin can set the snackbar to show as soon as it is activated, or only when a certain timeframe is met. All combinations of dates and timestamps are possible.
Admin can precisely pinpoint which maps will show a given announcement, or specific maps: "all"
in order to show an item on all maps.
Finally, the snackbar can be defined to show up only once on each device (this is achieved by setting a cookie in local storage), or to show on each app load.
Prior Hajk 3.13 there was also an option to limit which browsers were showing a certain announcement. Please note that as of Hajk 3.13, the browsers
property has been removed. For reasoning and motivation, see issue #1349.
A consequence of this is that if you previously used browsers
to limit announcements (e.g. showing an "Unsupported browser" on IE11), this announcement will now be visible on all browsers. The correct solution is to disable/remove those announcements from appConfig.json
.
Below follows an example on how to configure this feature. Please note that configuration goes into appConfig.json
which was needed to achieve map-wide configuration. Otherwise we would need to duplicate announcements in each map_x.json
config that should show them, which would lead to more cumbersome administration.
// Note that you MUST remove the comments prior inserting this to your appConfig.json
// or else you will get a parsing error (JSON files don't allow comments).
"announcements": [
{
"id": 1, // Numeric. Must be a unique ID for this item in array of objects.
"text": "Message to show to the user. Keep it short.", // String. Self-documenting.
"active": true, // Boolean. Makes it possible to turn off messages completely without removing them.
"showOnlyOnce": true, // Boolean. If true, a cookie will be saved on users browser and message will show only once.
"maps": ["map_1", "another_map"], // Array. Only specified maps will show message.
"timeout": null, // null or Numeric. Snackbar will auto hide after specified amount of millisecond, or be persistent (if null).
"startTime": "2020-01-01", // DateTime. Earliest timestamp for this to be visible. Must be a string parsable by Date.parse().
"stopTime": "2020-12-31", // DateTime. Last timestamp when this will be visible.
"type": "info" // String. See Notistack docs for allowed options, usually "default", "info", "warning", "success" and "error".
}, {
"id": 2,
// ... and so on
},
// ... and more objects here
]
This feature will add a download button next to each layer in LayerSwitcher. Upon click, the download button will preform a request to the specified WMS service and try to download a KML version of the layer. Expect a request that looks something like:
https://mydomain.com/geoserver/wms/kml?layers=myworkspace:mylayer&mode=download
In order for this to work, your WMS service must support downloading KML for vector layers (GeoServer does this by default).
{boolean} experimentalDownloadLink
"experimentalDownloadLink": true
For introducing new users to a web app (as well as to show off some new features), it's common to use a quick guide that shows up the first time a user enters a web app. To simplify developing those guides, frameworks such as IntroJS, have become popular.
Some requirements and things to keep in mind when setting this up:
- For this feature to be useful, it is important to select correct
elements
that will be highlighted. Bear in mind that the selector uses CSS syntax. - You don't need to specify your own steps (
experimentalIntroductionSteps
) - there are some defaults that should be good. - If you want to specify your own steps, make sure that the array contains at least two steps. Otherwise you won't see any guide.
{boolean} experimentalIntroductionEnabled
{Array.{ element: string, intro: string }} experimentalIntroductionStepsObj
"experimentalIntroductionEnabled": true,
"experimentalIntroductionSteps": [
{
"element": "header",
"intro": "<b>Welcome!</b><br><br>Here is a first card of this nice guide."
},
{
"element": "#drawerToggler",
"intro": "And here is another element that we want to highlight."
}
]