Home > @activeviam/activeui-sdk > ActionImplementationProperties
ActionImplementationProperties interface
Build an action offered to users in several places of the UI.
Signature:
export interface ActionImplementationProperties
Remarks
For example in the title bar of a dock in a dashboard, or in context menus or other user event handlers. Most of its methods are optional but one, execute. The methods are given different payloads depending on the situation in which they are instantiated (see ActionSituation to have a list of the different situations).
Properties
| Property | Type | Description |
|---|---|---|
| execute | (event: React.SyntheticEvent, actionPayload: ActionPayload) => void | Promise<ActionResult> | Called when the action is being interacted with. |
| getBadge | (actionPayload: ActionPayload) => string | number | Returns a number or a string that will be displayed inside a badge on the bottom left corner of the icon. Not implementing this function means that no badge will be displayed. |
| getCaption | (actionPayload: ActionPayload) => TranslationPayload | Returns the caption of the action. Defaults to 'errors.noCaption'. |
| getIconSrcKey | (actionPayload: ActionPayload) => string | Returns the icon key for the action. Default to having no icon. |
| isAvailable | (actionPayload: ActionPayload) => boolean | Returns whether the action should be present in the UI. This can be used to hide actions dynamically based on the conditions in which it is used. Defaults to true. |
| isDisabled | (actionPayload: ActionPayload) => boolean | Returns whether the action should be disabled if present. This comes on top of isAvailable in order to still display the action but in a disabled mode. Defaults to false. |
| load | (actionPayload: ActionPayload) => void | (() => void) | Called when the action is loaded in the UI. Can return a function to perform some cleanup. |
| unload | (actionPayload: ActionPayload) => void | Called when the action is unloaded from the UI. |