-
Notifications
You must be signed in to change notification settings - Fork 122
Notifications format
All notifications are stored and uploaded in a single json file containing one JSON array. Each object in this array is representing a notification, when and how a notification will show up
Each of this notification specifications can have the following attributes
-
once
- After the notification is run once the triggers are removed and the notification won't be run for this session -
triggers
- an array of triggers defining the entry point to a notification -
conditions
- an array of conditions which have to be fulfilled in order to run the notification -
handlers
- an array of handlers which define how the user is informed -
ignoreDate
- All conditions related date are ignored; testing purpose
A concept which repeates itself on triggers, conditions and handlers is the selection.
Whenever a dom element is needed this can be defined either via htmlId
or htmlSelector
.
htmlId
is the id of the HTML element, e.g. tabConfiguration
htmlSelector
the htmlSelector of the HTML element, e.g. div.active
, #tabConfiguration.active
, ...
Under the hood, jquery is used so see https://learn.jquery.com/using-jquery-core/selecting-elements/
Example The same element is selected with the following definitions:
{
"htmlId": "tabConfiguration",
}
or
{
"htmlSelector": "#tabConfiguration",
}
If a notification has an empty array as triggers, or the triggers attribute is not given, the notification is run immediately. Otherwise event handlers on dom element are registered.
A trigger must use DOM selection to select a HTML element.
A trigger must contain one of the following attributes
-
event
- a HTML event, e.g.click
,hover
, ... -
addClass
orremoveClass
- a class which will trigger the event if it is added or removed to the selected element
A trigger can also define conditions
, see conditions
These conditions are specific to this trigger and are only evaluated if this specific trigger is triggered.
Examples
{
"htmlId": "tabProgram",
"event": "click",
"conditions": [
{
"equals": "calliope2017NoBlue",
"guiModel": "robot"
}
]
}
{
"htmlId": "simButton",
"addClass": "rightActive"
}
If a notification has an empty array as conditions or has no attribute condition, these are considered as "fulfilled".
A condition can have one of the following attributes to start with:
-
startTime
orendTime
- a start time or a end time for this notification, given in the formatYYYY-MM-DD HH:mm
and for the German timezone (+0200) -
hasClass
- if a selected element has the given class; here is a selector needed (see DOM selection) -
guiModel
- the value ofguiModel
gets evaluated while running, see further
Examples
{
"endTime": "2020-10-09 11:57"
}
{
"startTime": "2020-10-09 11:57"
}
{
"htmlId": "simButton",
"hasClass": "rightActive"
}
A condition can contain a guiModel
attribute which gets evaulated while running.
E.g. if "guiModel": "robot"
this gets evaluated to require("guiState.model").gui.robot
Then the value can be checked with one of the following attributes:
-
anyOf
- given as an array, the evaluated value ofguiModel
has to be one of the elements of the array -
equals
- given as a string, the evaluated value ofguiModel
must equal the value ofequals
-
notEquals
- given as a string or an array of string,
if it is a string - the evaluated value ofguiModel
must not be equal to the given string
if it is an array - the evaluated value ofguiModel
must not be equal to any of the given strings
Examples
{
"anyOf": ["ev3lejosv1", "calliope2017NoBlue"],
"guiModel": "robot"
}
{
"notEquals": ["ev3lejosv1", "calliope2017NoBlue"],
"guiModel": "robot"
}
{
"notEquals": "calliope2017NoBlue",
"guiModel": "robot"
}
{
"equals": "calliope2017NoBlue",
"guiModel": "robot"
}
Currently there are 3 possible handlers.
All handlers have in common that they can (but don't have to) contain an attribute time
.
After this given time the notification hides itself autmatically.
If the attribute once
is not set and this notification is triggered again, while still runing, the timer gets reseted.
All handlers have also in common that every text which is shown is given localized. Every text attribute must be wrapped in a JSON object defining the language.
Example
{
"content": {
"en":"English content", // necessary, since fallback for all other languages
"de":"German content", // optionally other languages
"fr":"French content" // optionally other languages
...
}
}
This notification appears on the startup of the lab, in red color, added to the bottom of the modal.
The handler need a (localized) attribute content
which defines which content to display for the start screen.
This attribute can have HTML code as content.
Example
{
"startScreen": {
"time": 6000,
"content": {
"de": "Wir verschenken Calliope",
"en": "We give away calliope"
}
}
}
This notification appears in the bottom right corner with a yellow background. This has to contain the following attributes:
-
title
- the title (displayed ash4
) of the notification, can also be HTML code (again localized) -
content
- the content of the notification, can also be HTML code (again localized)
Example
"popupNotification": {
"content": {
"de": "Hey, wir haben die Simulation angepasst.",
"en": "Hey, we changed the simulation ..."
},
"title": {
"de": "Simulationsanpassung",
"en": "Simulation changes"
},
"time": 5000
}
This notification appears on dom elements as little badge. The handler has to define the following attributes:
-
htmlId
orhtmlSelector
- to select the dom element, see DOM selection -
content
- the content of the badge, less text, can also be HTML code (again localized)
Example
"elementMarker": {
"htmlId": "tabConfiguration",
"content": {
"de": "Neu",
"en": "New"
}
}
[
{
"handlers": [
{
"startScreen": {
"time": 6000,
"content": {
"de": "Wir verschenken Calliope",
"en": "We give away calliope"
}
}
}
]
// No triggers set, this notification runs immediatlly
},
{
"once": true,
"handlers": [
{
"popupNotification": {
"content": {
"de": "Hey, wir haben die Simulation angepasst.",
"en": "Hey, we changed the simulation ..."
},
"time": 5000,
"title": {
"de": "Simulationsanpassung",
"en": "Simulation changes"
}
}
},
{
"elementMarker": {
"htmlId": "debugMode",
"time": 2000,
"content": {
"de": "Neu",
"en": "New"
}
}
}
],
"triggers": [
{
"htmlId": "simButton",
"addClass": "rightActive"
}
],
"conditions": [
{
"anyOf": [
"ev3lejosv1",
"calliope2017NoBlue"
],
"guiModel": "robot"
}
]
},
{
"once": false,
"conditions": [
{
"endTime": "2020-10-09 11:57"
}
],
"handlers": [
{
"popupNotification": {
"content": {
"de": "Hey, Calliope benutzt nun eine Konfiguration",
"en": "Hey, Calliope now uses a configuration"
},
"time": 5000,
"title": {
"de": "Konfiguration",
"en": "Configuration"
}
}
},
{
"elementMarker": {
"htmlId": "tabConfiguration",
"content": {
"de": "Neu"
}
}
}
],
"triggers": [
{
"htmlId": "tabProgram",
"event": "click",
"conditions": [
{
"equals": "calliope2017NoBlue",
"guiModel": "robot"
}
]
},
{
"htmlId": "menu-calliope2017NoBlue",
"event": "click",
"conditions": [
{
"equals": "tabProgram",
"guiModel": "view"
}
]
},
{
"htmlSelector": ".popup-robot[data-type='calliope2017NoBlue']:not(.slick-cloned)",
"event": "click"
}
]
}
]
Home | Community | Installation | Team
Installation Tutorials
- Instructions to run a openroberta lab server using DOCKER
- Instructions to run the Open Roberta Lab Server natively on ubuntu ‐ not recommended
- Raspberry Pi 2/3/4 and the Open Roberta Lab
- EV3 and leJOS
- EV3 and ev3dev
- Creating the OR leJOS image
- Arduino Create Agent
- Mbed DAL: Generation and automation
Development
-
Workflows
-
Architecture
-
Blockly
-
Software engineering issues
-
Misc
-
Notes on robots
Textual Representation
Contribution
Discussions on future development