UI Notifications
UI Notifications provide a way for external events/tasks to provide notifications to users that currently have the system open. This is especially useful if there are short running Slicer-CLI-Web tasks that want to provide information to the user. I.E. a quick Slicer-CLI task that finds a specific track and frame combination and wants the user to navigate to the specific location.
When a notification is detected on the client a dialog window will be displayed with custom text specified from the JSON body as well as indication of what actions will be performed such as "selecting TrackId 3" and "Going to Frame 200".
REST Endpoint
There is a REST endpoint: POST /dive_rpc/ui_notificaitions/{id}
that takes in a DatasetId and JSON body response to display the notification to the same user with the same DatasetId currently open. I.E. If you run a task the task is able to provide information back to the user in the form of a Dialog box and provide suggestion actions like selecting a track or going to a specific frame.
JSON Body Data
The JSON format is relatively simple but may be updated in the future to have additional fields and provide further actions.
- text (string) - This is a required string that is displayed to the user. It provides some context to the user about what is being selected or why data is being changed
- reloadAnnotations (boolean)
- If this is true it is the only action that will be performed. Instead of performing any other actions it will reload the page. - selectedTrack (number)
- integer number to select a specific track - selectedFrame (number)
- interger frame number to seek to that frame.
Sample JSON Body Data
1 2 3 4 5 |
|
Adding Actions to UI Notifications
The below example utilizes the UI-Actions to select a track that meets seom requirements.
You can specify a list of diveActions
that can be executed sequentially
The below action will select the next track that is of type mouse
and has a detection attribute named mouseState
that is =
to scratching
the UI-Actions pages has more information about the existing actions and their capabilities and configuration.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
Below adds a keyboard shortcut that will be added tied to the action. Now when hitting shift+p
it will perform the actions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
Type Definitions
UI Notification Type definition. Note: a ?
at the end of a key means it is optional in Typescript
1 2 3 4 5 6 7 8 |
|
The UIDIVEAction allows for executing actions or for creating shortcuts. A More detailed listing of this is available at: UI-Actions
1 2 3 4 5 6 7 8 9 |
|