Global Actions
In the user interface globalActions are buttons that trigger an action relative to a table globally
Here is the code needed to add those two buttons to the user interface
Config
globalActions is an array of objects, each object representing an action, here are the parameters for each action
name
Name of the action, this will be used to identify the action, must be unique for the model
e.g. the API endpoint generated will look like this if name = ‘add-random-idea’
POST /adomin/api/actions/Idea/add-random-idea
tooltip
Tooltip shown on the frontend, when hovering the button
icon
Icon name, by default this uses Tabler icons
You can browse the list of available icons at: https://tabler.io/icons
iconColor
Color of the icon, this will be passed as the css color property, so you can use any valid css color
action
Function to execute when the action is triggered
It will be called with the http context as a parameter
You are in charge of doing authorization checks if you want to restrict which backoffice users can use this action