WorkFlow
Note: see also the TracWorkflow page which describes the Trac workflow features that will be available in Trac 0.11. The present page rather describes the work in progress on the topic of workflow support in Trac, not focusing on 0.11
Development
Phase 1
Phase 1 of the WorkFlow adds configurable workflow states to Trac. Thus you can have more ticket states, change what they are, and specify what happens when a ticket transitions from one state to another.
WorkFlow is built on 0.11dev and can be found in trunk! It is integrated for 0.11.
Phase 2 and beyond
Phase 2 and beyond will bring in more of the functionality developed on the original workflow branch, such as custom ticket fields and field types provided by plugins (see also FieldRefactoring).
See source:sandbox/workflow@3378 for the original incarnation of the WorkFlow branch, based on 0.10dev (last sync with trunk was with r3377, i.e. June 2006).
Configurable Workflow
implemented in phase1
Configurable workflow allows you to change the ticket states and state transitions. A common desire is to have a "testing" state where QA can get involved. The default WorkFlow implementation (ConfigurableTicketWorkflow) allows you to configure that workflow from the trac.ini.
There are several working configuration examples available. (Along with a couple tools for working with workflow configurations.) There are also some pretty diagrams on WorkFlow/Examples.
But you can do more than that with plugins. Plugins may augment the default WorkFlow, adding actions and side-effects to ticket state transitions. There are a few working plugin examples available. (They're simplistic, but should be useful nonetheless.) Plugins may also add actions that do not affect ticket state. If a drastically different WorkFlow is needed, ConfigurableTicketWorkflow may be disabled and entirely replaced by a plugin.
Plugin Configurable Ticket Fields
unimplemented
Plugins will be able to specify custom ticket fields without having to modify trac.ini.
Plugin Configurable Ticket Field Types
unimplemented
Plugins will be able to provide new field types in addition to those provided in the core. So dates, progress bars, and the like can be added as new field types with their own rendering. This should also provide support for validating field input values.
Old Workflow Discussion
API Requirements
Control of action transitions
- This interface should be stackable (useful eg. with a DeleteTicket plugin which adds a single 'delete' action, which can be used in conjunction with a full workflow replacement plugin).
- Plugins should register which actions they handle, and then handle them when requested to do so.
- Ensure that the user has sufficient permission to perform this action.
Control of ticket fields
- Manipulate custom/built-in fields via plugin architecture. eg. hiding existing fields, changing their attributes, etc. An example of this is the DuplicateField plugin which removes the "duplicate" status from the "resolve" action and adds a new action "resolve as xxx".
- Pluggable field types, eg. percentage bar, checkbox set, numeric input field, dollar field, etc.
Validation
- Validation of ticket date before being committed to the database.
Trunk Ticket Action Flowchart
These two flowcharts represent the current trunk ticket creation and modification logic.
Left, the New Ticket Flowchart and right, the Modify Ticket Flowchart.
Proposed Unified Flowchart + Extension Points
This proposes a unification of the logic for both creating and modifying tickets. In addition it adds extension points where plugins can modify the behaviour of the ticketing system.
Taking the above requirements into consideration, I think the following extension points should cater for all (most?) aspects.
Tasks
Done
- Add a disabled attribute to fields so that workflow hooks can disable fields but still leave them visible.
- Add a hidden attribute for the same reason. I've actually already done this, simply by renaming the skip attribute to hidden. Did this to be more consistent with HTML.
- Add a fullrow attribute which signifies that the form element will span both columns of the ticket property fieldset. eg. summary, type, description and reporter would all be fullrow=1. [2833]
- Remove code specific to individual fields from ticket.cs/newticket.cs. The summary, type, description and reporter would be converted to use the the same generic code as the rest of the fields. [2833]
- Remove large if/elif statement from ticket.cs/newticket.cs. Currently there is a large if/then/else style block which is used to display all fields other than the four described above. This could be removed and replaced with a call to form_control(). [2833]
- In order to specify the order the generic field display code would use, the above changes would probably require the ticket.fields.* HDF branch to be changed to an array (currently it is a dict). This change would be in api.py (return fields in the correct display order) and the .cs files, possibly elsewhere. [2832].
- If possible I would also like to factor out the ticket field display/edit code from both ticket.cs and newticket.cs into ticket_fields.cs, as the template code is basically functionally identical. [2833]
- Need a clean way to differentiate between fields that should not be displayed in the summary and those that should not be displayed at all. eg. summary should be hidden in the ticket summary (as it is used for the title), and should only be editable by users with TICKET_ADMIN privileges. Perhaps the logic should be that if a field is hidden it is not displayed anywhere, unless it is also editable, in which case it is only displayed in the ticket properties. [2837]
- Add a .plaintext option which negates the default behaviour of WikiFormatting field labels and values (see #925, #1395 and #1791 for related information). [2849]
- Add a .title option, or maybe .tooltip, though I think for the sake of consisteny it should be .title. [2851]
- There are a number of locations in the ticket code where permissions are hard coded. As an example, the TICKET_CREATE permission is required to create a new ticket. Should this be overridable by ITicketWorkflow implementors?
- It might be an idea to simply have a apply_ticket_changes() method instead of having apply_ticket_action() and update_ticket_fields().
TODO
- Remove ticket_custom_props() macro? It does not appear to be referenced.
Pluggable Workflow
See the source for extension points.
Here is a brief summary of the current extension interfaces:
Interface | Description |
ITicketChangeListener | Listen for changes in tickets. |
ITicketAdjunctChangeListener | Listen for changes in adjunct types (component, status, etc.) |
ITicketAdjunctContributor | Contribute values to adjunct types. |
ITicketFieldProvider | Programmatically add fields to tickets. |
ITicketFieldTypeProvider | Add new field types (built in types are text, select, checkbox, etc.) |
ITicketManipulator | General manipulation of tickets, including validation. |
ITicketActionController | Provide and control tickets actions. |
ITicketSimilarityDetector | Allows plugins to replace the default duplicate detection. |
Available Field Types and Options
Common options:
- name: Field name.
- label: Descriptive label.
- value: Default value.
- order: Sort order placement. (Determines relative placement in forms.)
- visible: Whether field is visible. Useful for storing extra ticket attributes programmatically (false by default).
- editable: Field is editable (true by default if field is visible). If a field is hidden but editable, it will not display in the ticket summary but will be displayed and editable in the ticket properties.
- fullrow: Field spans a full row when displayed in the ticket properties.
- plaintext: Field labels and values use WikiFormatting by default. To display plain text set this option to true.
- title: HTML title (tooltip) for this field.
Types and type-specific options:
-
text: A simple (one line) text field.
- size: Size of text field.
-
checkbox: A boolean value check box.
- value: Default value (0 or 1).
-
select: Drop-down select box. Uses a list of values.
- options: List of values, separated by | (vertical pipe).
- value: Default value (Item #, starting at 0).
-
radio: Radio buttons. Essentially the same as select.
- options: List of values, separated by | (vertical pipe).
- value: Default value (Item #, starting at 0).
-
textarea: Multi-line text area.
- cols: Width in columns.
- rows: Height in lines.
Attachments
- workflow-edit.png (16.2 kB) - added by athomas 2 years ago. Ticket editing flowchart
- workflow-new.png (17.1 kB) - added by athomas 2 years ago. New ticket flowchart
- workflow.png (32.6 kB) - added by athomas 2 years ago. Unified workflow flowchart
- enterprise-workflow.large.png (35.5 kB) - added by ecarter 12 months ago. Large diagram for the enterprise workflow
- opensource-workflow.large.png (49.9 kB) - added by ecarter 12 months ago. Large diagram for the opensource workflow
- original-workflow.large.png (15.7 kB) - added by ecarter 12 months ago. Large diagram for the original workflow
- simple-workflow.large.png (12.4 kB) - added by ecarter 12 months ago. Large diagram for the simple workflow
- trivial-workflow.large.png (4.5 kB) - added by ecarter 12 months ago. Large diagram for the trivial workflow
- basic-workflow.large.png (23.7 kB) - added by ecarter 10 months ago. Large diagram for the basic workflow
[Trac - WorkFlow - 文档]
http://trac.edgewall.org/wiki/WorkFlow
[Trac - 官方网站]
http://trac.edgewall.org/
[Trac - 关键词]
Trac
[Trac - 相关论坛]
http://groups.google.com/group/trac-announce
http://groups.google.com/group/trac-dev
http://groups.google.com/group/trac-tickets
http://groups.google.com/group/trac-users
http://softeng.board.newsmth.net/
[Trac - 下载]
源代码SVN, http://svn.edgewall.com/repos/trac
下载, http://trac.edgewall.org/wiki/TracDownload
[Trac - 基础知识]
Trac源代码格式化,http://trac.edgewall.org/wiki/WikiProcessors
Trac Links,http://trac.edgewall.org/wiki/TracLinks
Trac的数据结构, http://trac.edgewall.org/wiki/TracDev/DatabaseSchema
Trac - 创建自定义报表,http://trac.edgewall.org/wiki/TracReports#CreatingCustomReports
The Trac Ticket Workflow System - Trac Ticket工作流系统, http://trac.edgewall.org/wiki/TracWorkflow
WorkFlow - 工作流程, http://trac.edgewall.org/wiki/WorkFlow
[Trac - 常见问题]
Trac导出的csv格式文件在Excel中处理unix时间戳
Trac中通过URL的querystring设置新ticket的默认属性
Trac中browser定位文件行数
Trac中wiki恢复历史版本