Improve Automatic Actions plugin api
This commit is contained in:
@@ -25,24 +25,24 @@ Response example:
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1217735483,
|
||||
"result": {
|
||||
"TaskLogMoveAnotherColumn": "Add a comment logging moving the task between columns",
|
||||
"TaskAssignColorUser": "Assign a color to a specific user",
|
||||
"TaskAssignColorColumn": "Assign a color when the task is moved to a specific column",
|
||||
"TaskAssignCategoryColor": "Assign automatically a category based on a color",
|
||||
"TaskAssignColorCategory": "Assign automatically a color based on a category",
|
||||
"TaskAssignSpecificUser": "Assign the task to a specific user",
|
||||
"TaskAssignCurrentUser": "Assign the task to the person who does the action",
|
||||
"TaskUpdateStartDate": "Automatically update the start date",
|
||||
"TaskAssignUser": "Change the assignee based on an external username",
|
||||
"TaskAssignCategoryLabel": "Change the category based on an external label",
|
||||
"TaskClose": "Close a task",
|
||||
"CommentCreation": "Create a comment from an external provider",
|
||||
"TaskCreation": "Create a task from an external provider",
|
||||
"TaskDuplicateAnotherProject": "Duplicate the task to another project",
|
||||
"TaskMoveColumnAssigned": "Move the task to another column when assigned to a user",
|
||||
"TaskMoveColumnUnAssigned": "Move the task to another column when assignee is cleared",
|
||||
"TaskMoveAnotherProject": "Move the task to another project",
|
||||
"TaskOpen": "Open a task"
|
||||
"\Kanboard\Action\TaskLogMoveAnotherColumn": "Add a comment logging moving the task between columns",
|
||||
"\Kanboard\Action\TaskAssignColorUser": "Assign a color to a specific user",
|
||||
"\Kanboard\Action\TaskAssignColorColumn": "Assign a color when the task is moved to a specific column",
|
||||
"\Kanboard\Action\TaskAssignCategoryColor": "Assign automatically a category based on a color",
|
||||
"\Kanboard\Action\TaskAssignColorCategory": "Assign automatically a color based on a category",
|
||||
"\Kanboard\Action\TaskAssignSpecificUser": "Assign the task to a specific user",
|
||||
"\Kanboard\Action\TaskAssignCurrentUser": "Assign the task to the person who does the action",
|
||||
"\Kanboard\Action\TaskUpdateStartDate": "Automatically update the start date",
|
||||
"\Kanboard\Action\TaskAssignUser": "Change the assignee based on an external username",
|
||||
"\Kanboard\Action\TaskAssignCategoryLabel": "Change the category based on an external label",
|
||||
"\Kanboard\Action\TaskClose": "Close a task",
|
||||
"\Kanboard\Action\CommentCreation": "Create a comment from an external provider",
|
||||
"\Kanboard\Action\TaskCreation": "Create a task from an external provider",
|
||||
"\Kanboard\Action\TaskDuplicateAnotherProject": "Duplicate the task to another project",
|
||||
"\Kanboard\Action\TaskMoveColumnAssigned": "Move the task to another column when assigned to a user",
|
||||
"\Kanboard\Action\TaskMoveColumnUnAssigned": "Move the task to another column when assignee is cleared",
|
||||
"\Kanboard\Action\TaskMoveAnotherProject": "Move the task to another project",
|
||||
"\Kanboard\Action\TaskOpen": "Open a task"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -109,7 +109,7 @@ Request example:
|
||||
"method": "getCompatibleActionEvents",
|
||||
"id": 899370297,
|
||||
"params": [
|
||||
"TaskClose"
|
||||
"\Kanboard\Action\TaskClose"
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -163,7 +163,7 @@ Response example:
|
||||
"id" : "13",
|
||||
"project_id" : "2",
|
||||
"event_name" : "task.move.column",
|
||||
"action_name" : "TaskAssignSpecificUser",
|
||||
"action_name" : "\Kanboard\Action\TaskAssignSpecificUser",
|
||||
"params" : {
|
||||
"column_id" : "5",
|
||||
"user_id" : "1"
|
||||
@@ -194,7 +194,7 @@ Request example:
|
||||
"params": {
|
||||
"project_id" : "2",
|
||||
"event_name" : "task.move.column",
|
||||
"action_name" : "TaskAssignSpecificUser",
|
||||
"action_name" : "\Kanboard\Action\TaskAssignSpecificUser",
|
||||
"params" : {
|
||||
"column_id" : "3",
|
||||
"user_id" : "2"
|
||||
|
||||
@@ -26,59 +26,33 @@ Add a new action
|
||||
|
||||

|
||||
|
||||
List of available events
|
||||
------------------------
|
||||
|
||||
- Move a task to another column
|
||||
- Move a task to another position in the same column
|
||||
- Task modification
|
||||
- Task creation
|
||||
- Reopen a task
|
||||
- Closing a task
|
||||
- Task creation or modification
|
||||
- Task assignee change
|
||||
- Task link created or updated
|
||||
- Github commit received
|
||||
- Github issue opened
|
||||
- Github issue closed
|
||||
- Github issue reopened
|
||||
- Github issue assignee change
|
||||
- Github issue label change
|
||||
- Github issue comment created
|
||||
- Gitlab issue opened
|
||||
- Gitlab issue closed
|
||||
- Gitlab commit received
|
||||
- Bitbucket commit received
|
||||
- Bitbucket issue opened
|
||||
- Bitbucket issue closed
|
||||
- Bitbucket issue reopened
|
||||
- Bitbucket issue assignee change
|
||||
- Bitbucket issue comment created
|
||||
|
||||
List of available actions
|
||||
-------------------------
|
||||
|
||||
- Close the task
|
||||
- Open a task
|
||||
- Assign the task to a specific user
|
||||
- Create a comment from an external provider
|
||||
- Add a comment log when moving the task between columns
|
||||
- Assign automatically a category based on a color
|
||||
- Change the category based on an external label
|
||||
- Assign automatically a category based on a link
|
||||
- Assign automatically a color based on a category
|
||||
- Assign a color when the task is moved to a specific column
|
||||
- Change task color when using a specific task link
|
||||
- Assign a color to a specific user
|
||||
- Assign the task to the person who does the action
|
||||
- Assign the task to the person who does the action when the column is changed
|
||||
- Assign the task to a specific user
|
||||
- Change the assignee based on an external username
|
||||
- Close the task
|
||||
- Close a task in a specific column
|
||||
- Create a task from an external provider
|
||||
- Duplicate the task to another project
|
||||
- Send a task by email to someone
|
||||
- Move the task to another project
|
||||
- Move the task to another column when assigned to a user
|
||||
- Move the task to another column when assignee is cleared
|
||||
- Assign color when the task is moved to a specific column
|
||||
- Assign color to a specific user
|
||||
- Assign automatically a color based on a category
|
||||
- Assign automatically a category based on a color
|
||||
- Create a comment from an external provider
|
||||
- Create a task from an external provider
|
||||
- Add a comment log when moving the task between columns
|
||||
- Change the assignee based on an external username
|
||||
- Change the category based on an external label
|
||||
- Automatically update the start date
|
||||
- Move the task to another column when the category is changed
|
||||
- Send a task by email to someone
|
||||
- Change task color when using a specific task link
|
||||
- Move the task to another column when assignee is cleared
|
||||
- Open a task
|
||||
- Automatically update the start date
|
||||
|
||||
Examples
|
||||
--------
|
||||
@@ -87,7 +61,7 @@ Here are some examples used in real life:
|
||||
|
||||
### When I move a task to the column "Done", automatically close this task
|
||||
|
||||
- Choose action: **Close the task**
|
||||
- Choose action: **Close a task in a specific column**
|
||||
- Choose the event: **Move a task to another column**
|
||||
- Define action parameter: **Column = Done** (this is the destination column)
|
||||
|
||||
@@ -99,7 +73,7 @@ Here are some examples used in real life:
|
||||
|
||||
### When I move a task to the column "Work in progress", assign this task to the current user
|
||||
|
||||
- Choose action: **Assign the task to the person who does the action**
|
||||
- Choose action: **Assign the task to the person who does the action when the column is changed**
|
||||
- Choose the event: **Move a task to another column**
|
||||
- Define action parameter: **Column = Work in progress**
|
||||
|
||||
|
||||
@@ -138,40 +138,3 @@ $this->on('app.bootstrap', function($container) {
|
||||
|
||||
- The first argument is the event name
|
||||
- The second argument is a PHP callable function (closure or class method)
|
||||
|
||||
Extend Automatic Actions
|
||||
------------------------
|
||||
|
||||
To define a new automatic action with a plugin, you just need to call the method `extendActions()` from the class `Kanboard\Model\Action`, here an example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Plugin\AutomaticAction;
|
||||
|
||||
use Kanboard\Core\Plugin\Base;
|
||||
|
||||
class Plugin extends Base
|
||||
{
|
||||
public function initialize()
|
||||
{
|
||||
$this->action->extendActions(
|
||||
'\Kanboard\Plugin\AutomaticAction\Action\DoSomething', // Use absolute namespace
|
||||
t('Do something when the task color change')
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- The first argument of the method `extendActions()` is the action class with the complete namespace path. **The namespace path must starts with a backslash** otherwise Kanboard will not be able to load your class.
|
||||
- The second argument is the description of your automatic action.
|
||||
|
||||
The automatic action class must inherit from the class `Kanboard\Action\Base` and implements all abstract methods:
|
||||
|
||||
- `getCompatibleEvents()`
|
||||
- `getActionRequiredParameters()`
|
||||
- `getEventRequiredParameters()`
|
||||
- `doAction(array $data)`
|
||||
- `hasRequiredCondition(array $data)`
|
||||
|
||||
For more details you should take a look to existing automatic actions or this [plugin example](https://github.com/kanboard/plugin-example-automatic-action).
|
||||
|
||||
Reference in New Issue
Block a user