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 application
  • namespace: package name of the application
  • mode: local or deployed
  • client_data:
    • authenticated_user: for deployed apps, the portal provides the logged on user info
      • user_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: a simian.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 string
    • subtitle (optional): HTML string

See also