Edgewall Software

Field Refactoring

This is a development scratch pad to outline a few of the requirements and ideas about how to better handle the ticket fields.

For now, this puts aside the generalization of such fields to other objects/resources than Tickets (see GenericTrac for that, 0.12 material).

Goals

Get an "adapted" rendering of standard and custom fields, in the following situations:

  1. Display of the field's value in the Ticket Box and other similar places (e.g. query and report results)
  2. Display of the field's value changes, in the Change History and other similar places (e.g. timeline, notification)
  3. Display of a field editor in the "Properties" fieldset and other similar places (e.g. bulk editor)
  4. Display of a field selector in the Query view

Some points to consider:

Proposal

A new API for dealing with fields according to the 4 points detailed above should be introduced. The old 0.9 - 0.11 API should be preserved, as there's a bunch of scripts all over the Trac world that probably depend on it, so ideally no existing method should be modified (I'm thinking in particular to TicketSystem.get_ticket_fields).

Instead, a new set of methods and objects should be introduced. In order to avoid any confusion between the old and new ways, I propose to use the term property instead of field. This matches the user-visible Properties label displayed in the ticket UI.

There will be a Property class and a set of basic subclasses that correspond to the main types of fields. A resource (tickets only for now) will define the set of properties that it provides (first in TicketSystem.get_ticket_properties(), but preferably later in TicketDescriptor.get_properties(), with TicketDescriptor a subclass of ResourceDescriptor, the generic handle for resources).

A Property subclass will have methods and attributes for answering the needs enumerated above.

  1. render(context, name, mode, value) - similar to the render_property of the trac.versioncontrol.browser.IPropertyRenderer (probably some kind of unification is in order)
    • multiple other methods checking for the 'visibility' status of the field, 'row' display mode, etc. Each time with a given 'mode', which would be one of: 'ticket', 'ticket_preview', 'query'
  2. render_change(old_context, new_context, name, mode, old_value, new_value) - similar to the render_property_diff of the trac.versioncontrol.changeset.IPropertyDiffRenderer
  3. render_editor(context, name, mode, value). There could also be a validation method supporting validation requests that would be handled by a generic property module.
  4. render_selector(context, name, mode, values), for e.g. the query module.

Related Tickets

#31
Bug dependencies/relations feature
#925
[PATCH] Allow wiki syntax in labels for custom fields
#1084
Percentage complete
#2464
Conditional fields in tickets
#3080
Custom field sorts only as text
#4374
Custom Tickets Select Box Auto-generation
#4549
[PATCH] Ticket std/custom fields improvements - sql based values, order by, labels, value evals, ...
#5367
New Priority Schema?
#5526
Support LIKE and wildcards in custom queries
#5641
Allow enums to be used in ticket custom value sets
#7196
restrict ticket properties to add/edit only/...
#7884
Ticket should contain a field for the expected time to complete/fix it
#7911
Optional validation for custom fields
#8069
[PATCH] Support list of users as options list in ticket custom field
#8403
Encourage users to select meaningful values for 'required' fields
#9263
if SVN is used, milestone should manage/allowtoassign links for branch and tag
#9550
Ticket should be divisible
#9648
[PATCH] Improve ticket fields with tooltips
#9740
Impossible to CC a username with spaces
#10027
TicketQuery groups without translation
#10665
Search through all text fields
#11197
Batch Modification of Custom Text Area
#11469
Add a custom field admin panel
#13206
Add ICustomFieldTypeProvider interface


See: log:sandbox/field-refactoring-tmp@5817 (closed in [5818])

Last modified 12 years ago Last modified on Jun 1, 2013, 5:41:52 AM
Note: See TracWiki for help on using the wiki.