Configuration¶
The add-on is configured in Lime Admin under Settings -> Protocol.
Actions on protocol items should be configured under Actions per limetype. It is the recommended way to configure actions: it uses the standard action configuration in Lime Admin, with a command picker, icon and color pickers, and the command's own parameter editor.
Enable comments¶
To enable the "Add comment" action in the protocol item menu, add an action with command id limepkg_form.addcomment and icon comments for your parent limetype under Actions per limetype.
Enable add picture action¶
To enable the "Add picture" action in the protocol item menu, the following steps are required:
- Make sure
limepkg-document-widgetis installed in your solution - Add an action with command id
limepkg_form.addpictureand iconcamerafor your parent limetype under Actions per limetype.
Add custom actions¶
You can create your own actions. Read here to see how you can create them.
Actions per limetype¶
Actions are shown only when the protocols are viewed on a record of the selected limetype, for example only on protocols on work orders.
For each entry you pick a limetype and add one or more actions to it. The same limetype can only be configured once. In Lime Admin, the command picker and the command's own parameter editor use the selected limetype, so a command that lets you choose properties shows the properties of that limetype. If the action's context is protocol or protocol_response, the parameter editor uses limepkg_form_protocol or limepkg_form_answer instead.
Example configuration¶
"actions_per_limetype": [
{
"limetype": "workorder",
"actions": [
{
"id": "limepkg_form.addcomment",
"icon": "comments"
},
{
"id": "limepkg_form.addpicture",
"icon": "camera"
},
{
"id": "solution_my_customer.create_deviation",
"label": "Create deviation",
"icon": "error",
"color": "rgb(var(--color-red-default))",
"context": "protocol_response",
"params": {
"severity": "high"
}
}
]
}
]
Properties in config¶
| Name | Data type | Description |
|---|---|---|
| limetype | string | The parent limetype these actions are shown for |
| actions | array | The actions for this limetype, see below |
Each action supports:
| Name | Data type | Description |
|---|---|---|
| id | string | Id of the command to execute |
| context | string | Optional, which object is sent to the command as context. Defaults to default, see below |
| label | string | Optional, override the command's default name (can be translation key or just the text) |
| icon | string | Optional, name of icon to show |
| color | string | Optional icon color, using the same color picker as Views. Only use it when the color means something |
| params | object | Optional, custom properties sent to the command |
| hideLabel | boolean | Available in Lime Admin, but not currently used by the protocol item menu |
| iconTitle | string | Available in Lime Admin, but not currently used by the protocol item menu |
Action context¶
The context property controls which object the command receives in its context property:
| Value | Command context |
|---|---|
default |
The parent object, for example the work order |
protocol |
The protocol (limepkg_form_protocol) the item belongs to |
protocol_response |
The protocol response (limepkg_form_answer) of the item |
The object is loaded before the command is dispatched, so the handler can read it from the LimeObjectRepository straight away. If the protocol or protocol response id can't be resolved, the command is not run and the user gets an error message instead.
Actions¶
The Actions list is the older way to configure actions. Use Actions per limetype for new configurations.
Actions in this list are shown on protocol items for every parent limetype, before any actions per limetype. They always receive the parent object as context and don't support color or context.
Properties in config¶
| Name | Data type | Description |
|---|---|---|
| id | string | Id of the command to execute |
| icon | string | Name of icon to show |
| custom_title | string | optional, override default name of action (can be translation key or just the text) |
| params | object | optional, send in custom properties to the command |