Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

GUI Action Type

 

An action that the user can do in JSA.

In JSA, GUI Actions are represented as either buttons in page toolbars, or as right-click menu options. On touchscreen devices, GUI Actions are for items that are pressed for a long time.

When run, GUI Actions run a block of JavaScript, or invoke a REST method, or a combination of both. If you use both the rest_method and javascript attributes, the GUI Action invokes the server-side REST method within your app. It then runs the client-side JavaScript.

The following table describes the gui_actions block fields in the manifest.json file.

Table 1: GUI_Actions Block Fields

Field

Required

Type

Description

id

Yes

String

A unique ID for this area within the application.

text

Yes

String

Concise text to display that describes the area. Can optionally point at a resource bundle key if the application is globalized.

description

No

String

Detailed text to display that describes the area. Can optionally point at a resource bundle key if the application is globalized.

icon

Yes

String

Path to the toolbar or right-click menu icon to load, relative to the application root.

Icons must be 16x16 pixels.

If you do not want to add an icon, set the value of this parameter to null.

rest_method

No

String

A REST method to call when this action is performed. The context parameter must be specified as an argument. The REST method is populated with whatever the context of the GUI Action group is. The GUI Action group context varies, depending on what GUI Action group the action is invoked from. As an example, on the right-click menu of an IP address, the context parameter contains the IP address.

Either this argument or the JavaScript argument is required. If both are specified, then the REST method is run first, the results of which can be passed back into the JavaScript code block by using the result variable. This method must be declared in the rest_methods block of the manifest.

javascript

No

String

A JavaScript code block to run when this action is performed. Either this argument or the REST method argument is required. If both are specified, then the REST method is executed first, the results of which are passed into the JavaScript code block that uses the result variable.

If only the JavaScript argument is specified, a context variable that contains the context of the GUI action, is passed into the JavaScript code block.

groups

Yes

Array of String

A list of one or more GUI Action groups to install the action into (in other words, the identifier of the toolbar or right-click menu). You must provide at least 1 group.

You can also use a group name in this format ariel:<FIELD_NAME>, where <FIELD_NAME> is the name of a field in the JSA Event or Flow viewer. If this field is specified, the action is installed into the menu of that field, and the context parameter is the contents of the field.

required_capabilities

No

Array of String

A set of capabilities that a user must affiliate with their user role to access this area.

The following code is a sample gui_actions block from the manifest.json file:

... "gui_actions": [ { "id":"addToReferenceSet", "text":"Add To Reference Set", "description":"Adds to a reference set", "icon":"static/images/Btn1.png", "rest_method":"addToReferenceSet", "javascript":"alert(result)", "groups":[ "ipPopup" ], "required_capabilities":[ "ADMIN" ] }, { "id":"sampleToolbarButton", "text":"Sample Toolbar Button", "description":"Sample toolbar button that calls a REST method, passing an offense ID along", "icon":"static/images/Btn2.png", "rest_method":"sampleToolbarMethod", "javascript":"alert(result)", "groups":[ "OffenseListToolbar" ], "required_capabilities":[ "ADMIN" ] } ], ..