app/client/src/PluginActionEditor/readme.md
Appsmith allows its users to connect their UI to various different data sources e.g. API end points or SQL Query Databases. These data sources are configured using "Plugins" that define various details about the configuration and execution. Each data source is a specific connection and users can have multiple "Actions" built on top of these data sources.
Actions are implementations that can store and retrieve data from the data source.
The Plugin Action Editor is a module that exposes the UX that is used by the users to implement details about these actions, its settings and test them in edit mode.
This module is divided into 3 major composable sections.
One can use these 3 sections to define their compose different experiences.
All the sections and its children are connected via the "Plugin Action Context" that allows for easy data passing.
The Wrapper "PluginActionEditor" will pass this context down. This includes:
The UI state is managed via redux, and it is exposed out as well for use
Below we illustrate how by using a Composable structure to create the Action Editor
const AppPluginActionEditor = () => {
// Define the actionId that needs to be configured via the editor.
// In the example we fetch it from the route
const actionId = getActionIDFromRoute();
return (
/** Plugin Action Editor is our wrapper composable fragment.
* This will fetch the action and other related info
* from state and pass it down to its children via "context".
* This will ensure all children have the same way to access the action
* i.e. via context. Hence, this component is only responsible for
* abstracting the
* action state management
*/
<PluginActionEditor actionID={actionID}>
<PluginActionToolbar />
<PluginActionForm />
<PluginActionResponse />
</PluginActionEditor>
)
}
It is completely possible to mix and match these components, and compose them further to build other experiences with them. For example if you need to just have the Response view without the form you can do the following
const PluginActionResponseView = () => {
// Define the actionId that needs to be configured via the editor.
// In the example we fetch it from the route
const actionId = getActionIDFromRoute();
return (
<PluginActionEditor actionID={actionID}>
<PluginActionResponse />
</PluginActionEditor>
)
}