Edgewall Software

Opened 9 years ago

Last modified 9 years ago

#11855 closed enhancement

Workflow macro could use name/label attribute in place of action names — at Initial Version

Reported by: Ryan J Ollos Owned by:
Priority: normal Milestone: 1.0.3
Component: ticket system Version:
Severity: normal Keywords: workflow
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

It could be nice to use the action name/label (#11828) attribute in place of the action name when rendering the workflow graph. The tags/trac-1.0.2/contrib/workflow/opensource-workflow.ini demonstrates that the action names are often not visually appealing and don't represent what the user sees:

The following patch should work well on the trunk after #11828:

  • trac/ticket/default_workflow.py

    diff --git a/trac/ticket/default_workflow.py b/trac/ticket/default_workflow.py
    index 2310f2f..e6d3ee7 100644
    a b class WorkflowMacro(WikiMacroBase):  
    533533            [state for action in actions.itervalues()
    534534                   for state in action['oldstates']] +
    535535            [action['newstate'] for action in actions.itervalues()]))
     536        action_labels = [attrs['label']
     537                         for name, attrs in actions.items()]
    536538        action_names = actions.keys()
    537539        edges = []
    538540        for name, action in actions.items():
    class WorkflowMacro(WikiMacroBase):  
    545547        args = args or {}
    546548        width = args.get('width', 800)
    547549        height = args.get('height', 600)
    548         graph = {'nodes': states, 'actions': action_names, 'edges': edges,
     550        graph = {'nodes': states, 'actions': action_labels, 'edges': edges,
    549551                 'width': width, 'height': height}
    550552        graph_id = '%012x' % id(graph)
    551553        req = formatter.req

On 1.0-stable the patch differs slightly:

  • trac/ticket/default_workflow.py

    diff --git a/trac/ticket/default_workflow.py b/trac/ticket/default_workflow.py
    index 8cb0643..e705ab4 100644
    a b class WorkflowMacro(WikiMacroBase):  
    496496            [state for action in actions.itervalues()
    497497                   for state in action['oldstates']] +
    498498            [action['newstate'] for action in actions.itervalues()]))
     499        action_labels = [attrs.get('name', name)
     500                         for name, attrs in actions.items()]
    499501        action_names = actions.keys()
    500502        edges = []
    501503        for name, action in actions.items():
    class WorkflowMacro(WikiMacroBase):  
    508510        args = args or {}
    509511        width = args.get('width', 800)
    510512        height = args.get('height', 600)
    511         graph = {'nodes': states, 'actions': action_names, 'edges': edges,
     513        graph = {'nodes': states, 'actions': action_labels, 'edges': edges,
    512514                 'width': width, 'height': height}
    513515        graph_id = '%012x' % id(graph)
    514516        req = formatter.req

Change History (0)

Note: See TracTickets for help on using tickets.