Management of actions in VS Code
Actions in Slingr Explorer
We will add some tools to easily handle actions through the Slingr Explorer. First, we will add a new node in the explorer named Actions. It will have the following structure:
- Data
- Actions
- Global actions
- Global action 1
- Global action 2
- Model and object actions
As you can see, we will have a section for global actions and another for actions related to a model. This will make it easy to find actions that are related to specific models.
Then, on each action you will have the following structure:
- Create Task
- Parameters
- Project
- Title
- Description
- Response
- Number
- Project
- Title
- Status
- Description
The section Parameters is the model that is used as the parameter of the action. All the features available in models should be present here, like adding new fields, managing relationships, etc. Then, we have the Response node, which in the same way, is a model where you can do any operation that is possible with data models. If the action doesn’t take parameters or doesn’t return anything, these nodes should be there so the developer can easily add them if needed.
Create a new action
It should be possible to create a new action by clicking on Global actions or Model and object actions. When you do that, you will be asked for the following things:
- Name of the action
- Model (if model/object action and you didn’t clicked on an specific model)
- Docs of the action (optional)
Adding parameters
When you create an action, parameters will be empty. You can right-click on Parameters and you will have the following actions:
- Use existing model: If you already have a model you want to use as params, you will be able to select it here. All models should be listed, not only data models.
- Add field: Allow you to add a new field. This works in the same way as for data models.
- Define fields with AI: Allow you to define fields using AI. This works in the same way as for data models.
If you don’t have any field, a new model will be created with the name of the action and the suffix Params. The action will be modified to take that object as a parameter. The same should happen when we add a field to the response but in this case the suffix will be Response. You could also select an existing model for response.
Shortcuts in models
It is very convenient to see actions associated with models right in the model structure. We use that a lot in the current platform and it is actually the main way to access actions. This will require that we make a small changes in the tree for models as well, that will look like this now:
- Data
- Task
- Fields
- number
- project
- title
- status
- description
- Actions
So, you can see that model and objects actions as displayed under the model they are associated with. Also, we had to move fields to their own node Fields.
Implementing actions with AI
Once you have defined parameters and response, AI should be able to implement the action. This is probably something provided by Copilot out of the box, but we should check if there is anything we can do to make this simpler.
Management of actions in VS Code
Actions in Slingr Explorer
We will add some tools to easily handle actions through the Slingr Explorer. First, we will add a new node in the explorer named
Actions. It will have the following structure:As you can see, we will have a section for global actions and another for actions related to a model. This will make it easy to find actions that are related to specific models.
Then, on each action you will have the following structure:
The section
Parametersis the model that is used as the parameter of the action. All the features available in models should be present here, like adding new fields, managing relationships, etc. Then, we have theResponsenode, which in the same way, is a model where you can do any operation that is possible with data models. If the action doesn’t take parameters or doesn’t return anything, these nodes should be there so the developer can easily add them if needed.Create a new action
It should be possible to create a new action by clicking on
Global actionsorModel and object actions. When you do that, you will be asked for the following things:Adding parameters
When you create an action, parameters will be empty. You can right-click on
Parametersand you will have the following actions:If you don’t have any field, a new model will be created with the name of the action and the suffix
Params. The action will be modified to take that object as a parameter. The same should happen when we add a field to the response but in this case the suffix will beResponse. You could also select an existing model for response.Shortcuts in models
It is very convenient to see actions associated with models right in the model structure. We use that a lot in the current platform and it is actually the main way to access actions. This will require that we make a small changes in the tree for models as well, that will look like this now:
So, you can see that model and objects actions as displayed under the model they are associated with. Also, we had to move fields to their own node
Fields.Implementing actions with AI
Once you have defined parameters and response, AI should be able to implement the action. This is probably something provided by Copilot out of the box, but we should check if there is anything we can do to make this simpler.