For Dashboard Designers Functions Views
Thursday, April 25, 2024 10:25 AMViews
Views are a type of Function. Besides the usual features of Functions, they have their own. To start with, Views have a visual component on the web page. When executed, this visual component shows up on the page and often can be interacted with. This also means that newly executed Views are not directly destroyed after they finish execution: they can fire new Trigger events based on user input and can be updated to show different data. The available parameters and Trigger events are listed on the View reference page and more specific details on each individual View reference page.
Areas and containers
Views can be positioned in specific places on the page. Where exactly is specified by the $area
and $container
parameter.
Areas
A page can be divided into any number of areas. These are simply <div>
elements on the page with the area ID as id
attribute, and an additional attribute role=["view-area"]
. When executed, the View will be placed in the area that corresponds to its $area
parameter. In the Graphileon environment, there are 3 areas: content
(default), sidebar-left
and sidebar-right
. By default, Views will appear as a draggable panel in the content
area (center of the screen). If specified, they can appear as non-draggable panels in the left sidebar (sidebar-left
) or right sidebar (sidebar-right
).
Containers
Reusing containers
Before a View is placed in an area, it is wrapped in a container (ex. a floating window for the main area or a panel for the sidebars). This can be a new container (by default), or an existing container. In which container the View will appear is specified in the $container.id
parameter. By default, its value is _new
, meaning a new container will be created for the View. Alternatively, a name can be provided in the $container.id
parameter. In this case, if an existing container with that name is found on the page, the View replaces the previous View in that container. If no existing container with that name is found, a new one is created. The next View targeting the same container will then replace the current one.
Container properties
Name | Description | Default value | Accepted values |
---|---|---|---|
$container.id |
Identifier for the container. When set the container will be reused when the function is restarted | _new |
Valid identifier |
$container.height |
Width of the container | auto |
Positive number (for pixel sizing) or CSS dimension (ex: 50vh ) |
$container.preserveSizeOnReuse |
Keep the existing dimensions when the container is reused for a new Function instance | true |
boolean |
$container.state |
(Only for floating windows) State of the window | normalized |
normalized / maximized / minimized |
$container.title |
Title for the container. Set as null to disable the titlele |
undefined so the value is taken from the $name property of the function |
string |
$container.width |
Height of the container | auto |
Positive number (for pixel sizing) or CSS dimension (ex: 50vh ) |
Context menus
Some Views enable the use of context menus, which appear when the user right-clicks some part of the View. Context menus, if enabled, are populated by Triggers of type context
. A View can have multiple context menus, each appearing with a different right-click target. For example, in a NetworkView, the context menu that appears when the user clicks a node can be different from the menu that appears when the user right-clicks a relation.
To add a context menu item, a Trigger relation should be created from the View containing the context menu, to the Function that should be executed when the menu item is clicked. The Trigger should contain at least the following properties:
Key | Value | Description |
---|---|---|
action |
string | The text that should be displayed in the context menu item. |
enable |
string | Whether the context item is enabled/disabled. |
index |
number/string | Determines the order in which context menu items are displayed (see ../Reference/Index_Sorting) |
menu |
string | The menu in which the item should appear. * |
show |
expression | An expression based on the function or global state that should evaluate to true for the context menu item to be visible. |
type |
context |
Specifies that this Trigger defines a context menu item. Should have the exact value context . |
* The context menus of different Views are predefined. Some have multiple, some have only one. The possible context menus are listed on the corresponding Views' Reference page.
The context Trigger can also map data from the View to the next Function. Besides the usual Trigger properties, the Trigger event has the following property:
Key | Description | Possible values |
---|---|---|
target |
Data from the clicked target. Can be different for each View and menu. | object |
Example: From a NetworkView, a Trigger with type:"context"
, menu:"node"
and action:"Inspect this node"
would add an item to the context menu appearing when right-clicking a node, with the text "Inspect this node". Clicking it would execute the Function on the other side of the Trigger.
Batch triggers
Views can have so-called Batch Triggers, which show up as buttons at the top of the View. These are typically useful for performing actions on (a selection of) the data set in the View. More about batch triggers here