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): 533 533 [state for action in actions.itervalues() 534 534 for state in action['oldstates']] + 535 535 [action['newstate'] for action in actions.itervalues()])) 536 action_labels = [attrs['label'] 537 for name, attrs in actions.items()] 536 538 action_names = actions.keys() 537 539 edges = [] 538 540 for name, action in actions.items(): … … class WorkflowMacro(WikiMacroBase): 545 547 args = args or {} 546 548 width = args.get('width', 800) 547 549 height = args.get('height', 600) 548 graph = {'nodes': states, 'actions': action_ names, 'edges': edges,550 graph = {'nodes': states, 'actions': action_labels, 'edges': edges, 549 551 'width': width, 'height': height} 550 552 graph_id = '%012x' % id(graph) 551 553 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): 496 496 [state for action in actions.itervalues() 497 497 for state in action['oldstates']] + 498 498 [action['newstate'] for action in actions.itervalues()])) 499 action_labels = [attrs.get('name', name) 500 for name, attrs in actions.items()] 499 501 action_names = actions.keys() 500 502 edges = [] 501 503 for name, action in actions.items(): … … class WorkflowMacro(WikiMacroBase): 508 510 args = args or {} 509 511 width = args.get('width', 800) 510 512 height = args.get('height', 600) 511 graph = {'nodes': states, 'actions': action_ names, 'edges': edges,513 graph = {'nodes': states, 'actions': action_labels, 'edges': edges, 512 514 'width': width, 'height': height} 513 515 graph_id = '%012x' % id(graph) 514 516 req = formatter.req
Note:
See TracTickets
for help on using tickets.