Visualising JIRA Workflows

One of JIRA’s shortcomings is its inability to produce any sort of diagram of the workflows. Looking at the text representation of a workflow is not particularly enlightening:

There are several possibilities here… firstly, it’s an issue Atlassian is clearly aware of, they blog about it here - however, I’m too impatient to wait for this addition. Secondly, there is a beta version of a GUI tool for editing OSWorkflows, but I haven’t had much luck with that, it’s a bit fiddly and too much of a faff for end users to have to import an XML file in to the tool.

Having had some experience with GraphViz I thought it would make an interesting Friday afternoon project to write a JIRA report plugin to display an SVG digraph of the workflow.

That’s a lot better. I can think of a few improvements I’d like to make at some point:

  1. Show any transition screen on the workflow actions.
  2. Show any conditions, eg user must be in role/group.

Problem with these is you only get identifiers in the XML, not screen names, so would need a bit more grepping around in the database.

Installation

  1. Please download the later version.

You should see a new report called Workflow Report on the Browse Project page, for every project.

Note that this makes workflows available for viewing that users might not otherwise actually have access to. Personally this doesn’t bother me, I want people to see all workflows in use because it might encourage people to use an existing one rather than asking for a new one to be created.

Customising

If you want to customise the output for a single workflow, set the property keepDotFiles = true, modify the generated .dot file, and run it through GraphViz, eg

dot -Tsvg -o output.svg plot-29645.dot

If you want to make permanent changes, extract the .xsl file and edit. You will want to download a sample XML workflow from jira to work with. AFAIK, you can put the XSLT file somewhere in the classpath at the right package, /com/atlassian/jira/web/action/workflow.xsl, then you should be able to edit and then refresh the page to see your changes.

Problems

Would appreciate help with any of the following… as might be obvious I am not a java programmer.

Currently I write an SVG/PNG file to a temp directory under /images/tmp. It would be better to stream the file when requested… however to do this I’m not sure if I need to write a new servlet. I don’t see how I can do that from a plugin, not sure if there’s support for setting the response header. I tried to piggy-back on the DisplayChart servlet which takes care of deleting the temporary file after streaming it, but it seemed to only want to do it if it know about a corresponding Graph object.

So sticking with temporary files… I am using: File.deleteOnExit();, but it doesn’t seem to want to delete on exit. Currently I just stick something in to the jira start script to clean out that directory.

Given the above, I need to get the physical path on disk to /images, which I am doing by action.request.getRealPath("/images/tmp"). Problem with this is that JiraWebActionSupport.request has protected access… which explains why I put the WorkflowReport class in the same package: com.atlassian.jira.action.

I guess the solution to all of the above is to stream the image rather than use a temporary file…

7 Responses to “Visualising JIRA Workflows”


  1. 1 mdoar

    How about an option to leave the dot file so that I can open it myself in an editor and tweak the layout?

  2. 2 Jamie Echlin

    Good idea… will probably make that change and post an updated jar including source on Monday. As regards tweaking though, you’re probably best off extracting the .xsl file and editing that.

  3. 3 mdoar

    Cool, and thanks for the source jar too. I’ve got someone asking about tidying up the images, and I thought about using Inkscape to edit the svg output. It loads nicely and sees each object, but I don’t know enough svg to see how change the output so that the lines stay attached to the boxes - any ideas?

    ~Matt

  4. 4 Jamie Echlin

    I think the problem with editing the SVG is that there is no grouping of the entities, eg between the nodes and the edges. I reckon the way forward is to make any changes to the .dot file before processing. GraphViz has a GUI editor but I’ve never had too much luck with it. You can do quite a lot editing the .dot file, eg put weights on edges to try to make it display your workflow top-down or something, rather than the default algo which is probably to reduce edge crosses… the defaults can lead to the start and end states being next to each other with other states dotted around in what looks like an illogical order. Give us an example of the tweaks you want?

  5. 5 mdoar

    Hi,

    Ideally, the states would be placed in a grid from top to bottom, with minimal numbers of crossing edges. If the edges were connected to the nodes then a program such as Inksacpe could be used to tweak the SVG output. Weights and ranks might do it. From the dot guide:

    “In graphs with time-lines, or in drawings that emphasize source and sink nodes,
    you may need to constrain rank assignments. The rank of a subgraph may be set
    to same, min, source, max or sink. A value same causes all the nodes in the
    subgraph to occur on the same rank. If set to min, all the nodes in the subgraph
    are guaranteed to be on a rank at least as small as any other node in the layout7.
    This can be made strict by setting rank=source, which forces the nodes in the
    subgraph to be on some rank strictly smaller than the rank of any other nodes
    (except those also specified by min or source subgraphs). The values max or
    sink play an analogous role for the maximum rank. Note that these constraints
    induce equivalence classes of nodes. If one subgraph forces nodes A and B to be
    on the same rank, and another subgraph forces nodes C and B to share a rank, then
    all nodes in both subgraphs must be drawn on the same rank. Figures 9 and 10
    illustrate using subgraphs for controlling rank assignment.”

    ~Matt

  6. 6 Andy Slezak

    Thanks for the cool work! This will help me bigtime with my workflows!

    I had a problem with the latest version of graphviz 2.16 (and 2.17-dev) on a windows server box. The latest versions spit errors about having to reinstall the application to fix the configuration. I tried 2.10 after noticing the “ATT” version in Program Files. The latest version install under Graphviz under Program Files. I couldn’t find any documentation on how to fix this error, so I figured I would try and replicate the environment for which it looks like you built this project with. You can download the version that doesn’t spew errors with your plugin from http://www.graphviz.org/pub/graphviz/ARCHIVE/2.10/, and you should have success as I did.

    Hope this helps someone!

    -Andy

  7. 7 jdoklovic

    Sysbliss has just released the JIRA Workflow Designer.
    check it out:
    http://www.sysbliss.com/software/jira-workflow-designer

Leave a Reply

You must login to post a comment.






; Maximum allowed size for uploaded files. upload_max_filesize = 100M