What are Actions in MDriven?
Actions in MDriven refer to things a user or an API can execute to create an effect in the running system. Generally, actions are the definition of what a user or an API can run within the model.
Different Kinds of Actions
There are a few different kinds of actions:
- There are Global actions, also called main menu actions. These are for the user to initiate something global in the always-available application.
- We have ViewModel actions which need a ViewModel as context to be executed. They act either on objects in the model or by using variables like the v_current and v_selected variables in a ViewModel to execute things from what the user sees.
- Then there are Class actions or model actions, as they could also be referred to. These are actions that are available everywhere a class is known to the user interface.
- These are the three kinds of actions one can define in the model. There are different ways to execute these actions.
- They can be executed simply by the user clicking on the action in the user interface - those are usually opted in or opted out of the views and are provided by the framework system to be available in menus.
- The other way to execute is to put a button on the view and then refer to the action by selecting it in the drop-down menu or by providing action language right in the button (that is the ViewModel action that doesn't have a full action definition).
- These are the three kinds of actions one can define in the model. There are different ways to execute these actions.
- Periodic actions are a definition in a ViewModel that runs an action on a set interval depending on settings in the view itself. It is a way, for example, to automatically execute an action based on changes in data.
- Then there are Server-side actions (server-side here refers to the MDriven server). These are ways to run things on a schedule, for example, to say that every minute, check this condition, and execute these actions. The ViewModel server-side periodic action has a way to find the information to act upon. The ViewModel defines the scope of the information that the action is using and then the action code - the EAL code.
There are ways to trigger the execution of actions in addition to these types of actions and what scope they execute. That is, you can execute actions from EAL and ask from code if an action can be executed. You can also say that for example, an action should be a response to a dragging or a drag-drop action. You can define that an action should be executed based on a swipe on a mobile device. When an action executes, it can either execute code as EAL or execute a standard function in the framework - that is, to save, cancel, undo, redo, and operations like that that you select from a drop-down menu.
Naming actions and their presentation
What actions can do
- Read more here for the details: What an Action can do