Implementing gui_init
The gui_init
function is called during initialization of the application and provides the form definition.
In this section the calling syntax, arguments and return values will be discussed, followed by a small example.
Syntax
def gui_init(meta_data: dict) -> dict:
...
return payload
function payload = guiInit(metaData)
...
end
Arguments
meta_data
:
Meta data describing the client session.
Dict/struct with fields:
session_id
: unique ID for the session, can be used to differentiate between multiple instances of the applicationnamespace
: package name of the applicationmode
:local
ordeployed
client_data
:authenticated_user
: for deployed apps, the portal provides the logged on user infouser_displayname
: user name for printing (e.g. "John Smith")username
: unique identifier used by the authentication protocol
In the gui_init
function, form is defined by filling the form
field of the payload
.
The payload is then sent to the front-end in order to present the form to the user.
payload
:
Return value with the form definition.
Dict/struct with fields:
form
: asimian.gui.Form
navbar
(optional): dict/struct with fields:logo
(optional): image source reference (anything that can be put in HTML<img src="..." />
)title
(optional): HTML stringsubtitle
(optional): HTML string
See also
- For an example see Hello world!.