•  
     
    story #12187 configure workflow pre & post actions at target state level
Summary
tracker admin
configure workflow pre & post actions at target state level

I get a easier interface to configure the worklow and I reduce risks of errors
 

Overview

The goal of this story is to propose, by default, the configuration of workflow pre-conditions and post-actions at target state globally instead of having to define it for each transition.

For instance I would configure what happens when artifact status becomes "On going", regardless of previous state, rather than having to define what happens when artifact goes from "new" to "On going" + "todo" to "On going" + "review" to "On going", etc.

As pre-conditions and post actions tends to be the same for a given state it reduces the risk of having one specific transition that, un-expectedly behaves diffrently.

The "per transition" configuration would remain possible (at minimum for backward compatibility) but not shown by default.

See live mockup: https://s.codepen.io/enalean/debug/dace752a350bcecdad1003e505bc9992

Functional overview

Tracker administrator point of view

The worflow configuration matrix overall design is improved to be easier to read

By default, a click on a transition cell only allow/disallow the transition it self (eg. I allow change from "To do" to "On going") but I don't have a "[details]" link.

The transition configuration screen is accessible by a click on the target state "On going".

A tracker administrator can activate "Advanced mode" where each transition can be configured independently. It's the default mode for all existing trackers. When tracker admin switch from "Simple mode" to "Advanced mode", all configurations are done at transition level (no longer at state level) and switch will copy all configurations (pre-conditions, post-actions that were defined at state level into each defined transition).

On workflow in "Advanced mode", a tracker administrator can activate "Simple mode" (to only have 1 configuration). In this case the first configuration in the target column is selected and applied the whole state. As this operation can break something, a warning message is displayed to ensure tracker admin is sure he wants to continue.

End user point of view

Nothing change. On artifact creation and update, the pre-conditions and post-actions are applied as soon as the target state is reached (given the transition exists in the workflow).

Technical Overview

REST routes

  • Get workflow field
  • Get configuration mode (advanced or simple)
  • Get transition rule activation
  • Get all transitions of a tracker

GET /trackers/:id with response content:

{
    "workflow": {
        "field_id": 0,
        "is_used": false,
        "transitions": [],
...
    },
}

Info: this route already exists

  • Set new workflow field:

PATCH /trackers/:id with request content:

{ workflow: {
  set_transitions_rules: {
    field_id: 123
  }
}}

Warning: "400 Bad Request" if a field is already defined.
Info: transition rule is disabled by default.

  • Remove current workflow field:

PATCH /trackers/:id with request content:

{ workflow: {
  delete_transitions_rules: true
}}

Info: this will remove all associated transitions and rules.

  • Enable / disable transition rules:

PATCH /trackers/:id with request content:

{ workflow: {
  set_transitions_rules: {
    is_used: true
  }
}}
  • Switch between simple and advanced mode:

PATCH /trackers/:id with request content:

{ workflow: {
  set_transitions_rules: {
    is_advanced: true
  }
}}

Info: when switching from advanced mode to simple mode, transitions rules are updated to have same rules by target state.

  • Add new transition

POST /tracker_workflow_transitions with request content:

{
    "tracker_id": int,
    "from": int,
    "to": int
}

with response content:

{
    "id": int,
    "uri": string
}

Info: when simple mode, rules of target state is added to this transition

  • Remove a transition

DELETE /tracker_workflow_transitions/:id

  • [advanced mode] Get conditions of a transition

GET /tracker_workflow_transitions/:id with response content:

{
    "id": int,
    "uri": string,
    "comment_not_empty": bool,
    "fields_not_empty": [ field_id ],
    "allowed_ugroups": [ ugroup_id ]
}

Note: tracker_id, from and to are note present here

  • [advanced mode] Get all actions of a transition

GET /tracker_workflow_transitions/id/actions with response content:

[
    {
        "id",
        "type",
        "settings": {}
    },
    ...
]
  • Update rules of a transition

PUT /tracker_workflow_transitions/id/actions with request content:

[ 
    { 
        "type", 
        "settings": {}
    },
    ...
]

with response content:

{
    "id": int,
    "uri": string
}

Info: in simple mode, this will update all other transitions with same target state.

  • [simple mode] Get conditions of all transitions to a state

Use "[advanced mode] Get conditions of a transition" with first transition of the state

  • [simple mode] Get all actions of all transitions to a state

Use "[advanced mode] Get all actions of a transition" with first transition of the state

  • Additional routes to create
OPTIONS /tracker_workflow_transitions
OPTIONS /tracker_workflow_transitions/:id

Frontend

Matrix + modale are made with vue/vuex

Warning: transition from "New artifact" -> XXX some pre-conditions cannot apply (comment not empty). Be carful to handle that properly

On "Simple" mode

The new "simple" mode is actually wrapped around the existing structure and data model where each transition owns pre-conditions and transations. This way there is no modification of workflow checking on the platform, the database layout is not changed, etc. This saves a lot of pain.

However, the backend must ensure the consistency, hence modification of one transition will be propagated to sibling transactions transparently.

When a pre-condition or post-action is applied on 1 transition, the backend force apply on all transitions by truncating existing values and re-creating.

Example, given the following configuration

|from/to    |        "on going"          |
|-----------|--------------------------- |
|"new"      |  [                         |
|           |   {1, int, {0}},           |
|           |   {2, jenkins, {"url1"}},  |
|           |   {3, jenkins, {"url2"}}   |
|           |  ]                         |
|--------------------------------------- |
|"on going" |           X                |
|--------------------------------------- |
|"done"     | [                          |
|           |   {10, int, {0}},          |
|           |   {11, jenkins, {"url1"}}, |
|           |   {12, jenkins, {"url2"}}  |
|           | ]                          |
|--------------------------------------- |

When there is a PATCH/PUT on /tracker_workflow_transitions/id/actions to set {2, jenkins, {"url10"}}

This applies to both "new" -> "on going" and "done" -> "on going" transitions and the second one is truncated, hence ids change:

|from/to    |        "on going"          |
|-----------|--------------------------- |
|"new"      |  [                         |
|           |   {1, int, {0}},           |
|           |   {2, jenkins, {"url10"}}, |
|           |   {3, jenkins, {"url2"}}   |
|           |  ]                         |
|--------------------------------------- |
|"on going" |           X                |
|--------------------------------------- |
|"done"     | [                          |
|           |   {15, int, {0}},          |
|           |   {16, jenkins, {"url10"}},|
|           |   {17, jenkins, {"url2"}}  |
|           | ]                          |
|--------------------------------------- |

Adding a new field value in Simple mode

When a new field value is added, there is no impact on the transitions themselves. Let say your workflow looks like the following matrix with pre-conditions and post-actions set on Done (materialized with the []).

     | Todo | [Done] |
-----|------|--------|
Todo |      |   x    |
-----|------|--------|
Done |      |        |
-----|------|--------|

When "Archived" state is added, the matrix looks like this

     | Todo | [Done] | Archived |
-----|------|--------|----------|
Todo |      |   x    |          |
-----|------|--------|----------|
Done |      |        |          |
-----|------|--------|----------|
Arch |      |        |          |
-----|------|--------|----------|

No transition is modified by the addition of this value. However if the transition Arch -> Done is added, the configuration made on [Done] must be applied on Arch -> Done transition.

     | Todo | [Done] | Archived |
-----|------|--------|----------|
Todo |      |   x    |          |
-----|------|--------|----------|
Done |      |        |          |
-----|------|--------|----------|
Arch |      |   x    |          |
-----|------|--------|----------|

Development

The new interface is developed in a new route alongside the existing one. The switch will be done when the new interface will be complete.

In order to not block people with unforeseen use cases and/or work around issues, the switch to the new interface will be progressive. First, there will be a feature flag configuration value to allow users access to the new interface for specific trackers. The old interface will be accessible again after unsetting the configuration value.
Once project admins have added new post actions to their workflow, they will not be able to see, edit or delete them in the old interface. If they want to go back to the old interface, they will first need to clear (delete) their workflow or remove the new post actions with the new interface.

Story split

  1. Introduce new page (the existing page is left untouched and is still used by default, one should know the new page URL to get access)
    1. New end-point for WF admin
    2. The breadcrumbs
    3. The 2 tab list (2 levels of menu for workflow admin)
    4. Ability to choose the field on which WF applies (REST PATCH)
    5. Ability to enable/disable the WF (REST PATCH)

        For 4 & 5 see the live mockup here https://s.codepen.io/enalean/debug/5c3599ce2bd94287bb30112569c2d85b#

  1. Read only matrix
    1. Display the matrix with CSS helps on big tables
    2. Display the transitions
  2. Transitions
    1. click to activate & desactivate transition
    2. REST route to save that
  3. Modale
    1. Introduce modale to edit transitions. Only pre-conditions can be set
  4. Modale full
    1. Modale can be used to configura post-actions
    2. Introduce a configuration value "feature flag" to allow specific trackers to switch to the new UI. Once set, the "Transitions" button links to the new UI.
  5. Finalise with "Simple" mode
    1. Introduce UI to switch from Simple to Advanced mode
    2. Update REST routes to take into account propagation is "Advanced" mode
    3. Deprecate old UI
Benjamin Dauton (bdauton)
Status
Done
Development
Empty
Empty
Details
#12187
Manuel Vacelet (vaceletm)
2019-02-27 16:30
2018-08-27 16:10
3366

References

List of items referenced by or referencing this item.

Git commit

Other

Follow-ups

  • User avatar
    • Status changed from On going to Done
  • User avatar
    gerrit #14196 integrated into Tuleap 10.10.99.221
  • User avatar
    gerrit #14187 integrated into Tuleap 10.10.99.216
  • User avatar
    gerrit #14136 integrated into Tuleap 10.10.99.200
  • User avatar
    gerrit #14162 integrated into Tuleap 10.10.99.203
  • User avatar
    gerrit #14130 integrated into Tuleap 10.10.99.187
  • User avatar
    gerrit #14126 integrated into Tuleap 10.10.99.182
  • User avatar
    gerrit #14120 integrated into Tuleap 10.10.99.176
  • User avatar
    gerrit #14121 integrated into Tuleap 10.10.99.175
  • User avatar
    gerrit #14115 integrated into Tuleap 10.10.99.173
  • User avatar
    gerrit #14114 integrated into Tuleap 10.10.99.167
  • User avatar
    gerrit #14110 integrated into Tuleap 10.10.99.166.
  • User avatar
    gerrit #14107 integrated into Tuleap 10.10.99.165
  • User avatar
    gerrit #14109 integrated into Tuleap 10.10.99.164
  • User avatar
    gerrit #14087 integrated into Tuleap 10.10.99.157
  • User avatar
    gerrit #14094 integrated into Tuleap 10.10.99.156.
  • User avatar
    gerrit #14100 integrated into Tuleap 10.10.99.154
  • User avatar
    gerrit #14090 integrated into Tuleap 10.10.99.153
  • User avatar
    gerrit #14093 integrated into Tuleap 10.10.99.148
  • User avatar
    gerrit #14075 integrated into Tuleap 10.10.99.146
  • User avatar
    gerrit #14078 integrated into Tuleap 10.10.99.142.
  • User avatar
    gerrit #14070 integrated into Tuleap 10.10.99.131
  • User avatar
    gerrit #14057 integrated into Tuleap 10.10.99.129
  • User avatar
    gerrit #14056 integrated into Tuleap 10.10.99.125.
  • User avatar
    gerrit #14040 integrated into Tuleap 10.10.99.116
  • User avatar
    gerrit #14039 integrated into Tuleap 10.10.99.113
  • User avatar
    gerrit #14031 integrated into Tuleap 10.10.99.110
  • User avatar
    gerrit #14021 integrated into Tuleap 10.10.99.99
  • User avatar
    gerrit #14010 integrated into Tuleap 10.10.99.92
  • User avatar
    gerrit #14000 integrated into Tuleap 10.10.99.88
  • User avatar
    gerrit #13993 integrated into Tuleap 10.10.99.81.
  • User avatar
    gerrit #13991 integrated into Tuleap 10.10.99.77.
  • User avatar
    gerrit #13983 integrated into Tuleap 10.10.99.72
  • User avatar
    gerrit #13974 integrated into Tuleap 10.10.99.71.
  • User avatar
    gerrit #13966 integrated into Tuleap 10.10.99.61
  • User avatar
    gerrit #13962 integrated into Tuleap 10.10.99.59
  • User avatar
    gerrit #13958 integrated into Tuleap 10.10.99.58
  • User avatar
    gerrit #13961 integrated into Tuleap 10.10.99.55
  • User avatar
    gerrit #13956 integrated into Tuleap 10.10.99.53
  • User avatar
    gerrit #13954 integrated into Tuleap 10.10.99.52
  • User avatar
    gerrit #13948 integrated into Tuleap 10.10.99.49
  • User avatar
    gerrit #13944 integrated into Tuleap 10.10.99.48
  • User avatar
    gerrit #13936 integrated into Tuleap 10.10.99.47
  • User avatar
    gerrit #13943 integrated into Tuleap 10.10.99.43.
  • User avatar
    gerrit #13934 integrated into Tuleap 10.10.99.38
  • User avatar
    gerrit #13935 integrated into Tuleap 10.10.99.36.
  • User avatar
    gerrit #13929 integrated into Tuleap 10.10.99.33.
  • User avatar
    gerrit #13930 integrated into Tuleap 10.10.99.32
  • User avatar
    gerrit #13927 integrated into Tuleap 10.10.99.29
  • User avatar
    gerrit #13869 integrated into Tuleap 10.10.99.28
  • User avatar
    gerrit #13874 integrated into Tuleap 10.10.99.24
  • User avatar
    gerrit #13867 integrated into Tuleap 10.10.99.21
  • User avatar
    gerrit #13850 integrated into Tuleap 10.10.99.14
  • User avatar
    gerrit #13877 integrated into Tuleap 10.10.99.13
  • User avatar
    gerrit #13863 integrated into Tuleap 10.10.99.12
  • User avatar
    gerrit #13878 integrated into Tuleap 10.10.99.11
  • User avatar
    gerrit #13868 integrated into Tuleap 10.10.99.1.
  • User avatar
    gerrit #13865 integrated into Tuleap 10.9.99.216.
  • User avatar
    gerrit #13829 integrated into Tuleap 10.9.99.210
  • User avatar
    gerrit #13858 integrated into Tuleap 10.9.99.208
  • User avatar
    gerrit #13853 integrated into Tuleap 10.9.99.201
  • User avatar
    last edited by: Joris MASSON (jmasson) 5 months ago
    gerrit #13848 integrated into Tuleap 10.9.99.200
  • User avatar
    gerrit #13839 integrated into Tuleap 10.9.99.197
  • User avatar
    gerrit #13814 integrated into Tuleap 10.9.99.193
  • User avatar
    gerrit #13822 integrated into Tuleap 10.9.99.189
  • User avatar
    gerrit #13811 integrated into Tuleap 10.9.99.184
  • User avatar
    gerrit #13802 integrated into Tuleap 10.9.99.181
  • User avatar
    gerrit #13810 integrated into Tuleap 10.9.99.179
  • User avatar
    gerrit #13808 integrated into Tuleap 10.9.99.178
  • User avatar
    gerrit #13785 integrated into Tuleap 10.9.99.175
  • User avatar
    gerrit #13775 integrated into Tuleap 10.9.99.171
  • User avatar
    gerrit #13790 integrated into Tuleap 10.9.99.166
  • User avatar
    gerrit #13791 integrated into Tuleap 10.9.99.162
  • User avatar
    gerrit #13768 integrated into Tuleap 10.9.99.160
  • User avatar
    gerrit #13780 integrated into Tuleap 10.9.99.153
  • User avatar
    gerrit #13776 integrated into Tuleap 10.9.99.152
  • User avatar
    gerrit #13779 integrated into Tuleap 10.9.99.151
  • User avatar
    gerrit #13773 integrated into Tuleap 10.9.99.148
  • User avatar
    gerrit #13772 integrated into Tuleap 10.9.99.144
  • User avatar
    gerrit #13756 integrated into Tuleap 10.9.99.133
  • User avatar
    gerrit #13743 integrated into Tuleap 10.9.99.125
  • User avatar
    gerrit #13745 integrated into Tuleap 10.9.99.114
  • User avatar
    gerrit #13742 integrated into Tuleap 10.9.99.112
  • User avatar

    gerrit #13737 integrated into Tuleap 10.9.99.109

  • User avatar
    gerrit #13727 integrated into Tuleap 10.9.99.107
  • User avatar
    gerrit #13702 integrated into Tuleap 10.9.99.93
  • User avatar
    gerrit #13640 integrated into Tuleap 10.9.99.78
  • User avatar
    gerrit #13607 integrated into Tuleap 10.9.99.69
  • User avatar
    gerrit #13649 integrated into Tuleap 10.9.99.62.
  • User avatar
    gerrit #13647 integrated into Tuleap 10.9.99.60
  • User avatar
    gerrit #13645 integrated into Tuleap 10.9.99.53
  • User avatar
    gerrit #13621 integrated into Tuleap 10.9.99.51
  • User avatar
    gerrit #13619 integrated into Tuleap 10.9.99.47
  • User avatar
    gerrit #13625 integrated into Tuleap 10.9.99.45
  • User avatar
    gerrit #13624 integrated into Tuleap 10.9.99.44
  • User avatar
    gerrit #13588 integrated into Tuleap 10.9.99.42
  • User avatar
    gerrit #13620 integrated into Tuleap 10.9.99.37
  • User avatar
    gerrit #13604 integrated into Tuleap 10.9.99.32
  • User avatar
    gerrit #13610 integrated into Tuleap 10.9.99.29
  • User avatar
    • Acceptance criteria
  • User avatar
    gerrit #13550 integrated into Tuleap 10.9.99.17
  • User avatar
    gerrit #13587 integrated into Tuleap 10.9.99.14
  • User avatar
    gerrit #13583 integrated into Tuleap 10.9.99.12
  • User avatar
    gerrit #13574 integrated into Tuleap 10.9.99.6
  • User avatar
    gerrit #13571 integrated into Tuleap 10.9.99.4
  • User avatar
    gerrit #13573 integrated into Tuleap 10.9.99.2
  • User avatar
    gerrit #13584 integrated into Tuleap 10.9.99.1
  • User avatar
    gerrit #13565 integrated into Tuleap 10.8.99.159.
  • User avatar
    gerrit #13557 integrated into Tuleap 10.8.99.149.
  • User avatar
    gerrit #13522 integrated into Tuleap 10.8.99.139
  • User avatar
    gerrit #13499 integrated into Tuleap 10.8.99.127
  • User avatar
    gerrit #13496 integrated into Tuleap 10.8.99.123
  • User avatar
    • Acceptance criteria
  • User avatar
    last edited by: Joris MASSON (jmasson) 6 months ago
    gerrit #13482 integrated into Tuleap 10.8.99.118
  • User avatar
    gerrit #13442 integrated into Tuleap 10.8.99.109
  • User avatar
    gerrit #13470 integrated into Tuleap 10.8.99.105
  • User avatar
    gerrit #13464 integrated into Tuleap 10.8.99.95
  • User avatar
    gerrit #13463 integrated into Tuleap 10.8.99.89
  • User avatar
    gerrit #13448 integrated into Tuleap 10.8.99.87
  • User avatar
    gerrit #13261 integrated into Tuleap 10.8.99.84
  • User avatar
    gerrit #13428 integrated into Tuleap 10.8.99.65
  • User avatar
    gerrit #13433 integrated into Tuleap 10.8.99.61
  • User avatar
    gerrit #13427 integrated into Tuleap 10.8.99.58
  • User avatar
    gerrit #13296 integrated into Tuleap 10.8.99.57
  • User avatar
    gerrit #13231 integrated into Tuleap 10.8.99.41
  • User avatar
    gerrit #13336 integrated into Tuleap 10.8.99.37

    • Acceptance criteria
  • User avatar
    • Acceptance criteria
  • User avatar
    gerrit #13282 integrated into Tuleap 10.8.99.1
  • User avatar
    gerrit #13295 integrated into Tuleap 10.7.99.169
  • User avatar
    gerrit #13263 integrated into Tuleap 10.7.99.167
  • User avatar
    gerrit #13273 integrated into Tuleap 10.7.99.163
  • User avatar
    Thi Mai (thimai)7 months ago
    • Acceptance criteria
  • User avatar
    gerrit #13153 integrated into Tuleap 10.7.99.154
  • User avatar
    gerrit #13275 integrated into Tuleap 10.7.99.152
  • User avatar
    gerrit #13266 integrated into Tuleap 10.7.99.148
  • User avatar
    gerrit #13258 integrated into Tuleap 10.7.99.145
  • User avatar
    gerrit #13150 integrated into Tuleap 10.7.99.120
  • User avatar
    gerrit #13225 integrated into Tuleap 10.7.99.110
  • User avatar
    • Status changed from To be done to On going
  • User avatar
    gerrit #13222 integrated into Tuleap 10.7.99.101
  • User avatar
    gerrit #13162 integrated into Tuleap 10.7.99.99
  • User avatar
    gerrit #13221 integrated into Tuleap 10.7.99.98.
  • User avatar
    gerrit #13219 integrated into Tuleap 10.7.99.97.
  • User avatar
    gerrit #13209 integrated into Tuleap 10.7.99.84
  • User avatar
    gerrit #13199 integrated into Tuleap 10.7.99.83
  • User avatar
    gerrit #13200 integrated into Tuleap 10.7.99.81
  • User avatar
    gerrit #13163 integrated into Tuleap 10.7.99.70
  • User avatar
    • Acceptance criteria
  • User avatar
    • Acceptance criteria
  • User avatar
    gerrit #13124 integrated into Tuleap 10.7.99.63
  • User avatar
    gerrit #13151 integrated into Tuleap 10.7.99.50
  • User avatar
    gerrit #13155 integrated into Tuleap 10.7.99.49
  • User avatar
    gerrit #13118 integrated into Tuleap 10.7.99.42
  • User avatar
    gerrit #13139 integrated into Tuleap 10.7.99.37
  • User avatar
    gerrit #13113 integrated into Tuleap 10.7.99.34
  • User avatar
    gerrit #13108 integrated into Tuleap 10.7.99.26
  • User avatar
    gerrit #13102 integrated into Tuleap 10.7.99.21
  • User avatar
    gerrit #13109 integrated into Tuleap 10.7.99.20
  • User avatar
    gerrit #13106 integrated into Tuleap 10.7.99.19
  • User avatar
    • Acceptance criteria
    • Attachments error-modal.gif added
  • User avatar

    First contribution by @thimai & @jibidus (gerrit #13099) integrated into Tuleap 10.7.99.16.

    Welcome!

  • User avatar
    • Acceptance criteria
  • User avatar
  • User avatar
    • Acceptance criteria
  • User avatar
    • Acceptance criteria
  • User avatar
    • Acceptance criteria
  • User avatar

    Added live mock-up


    • Acceptance criteria
  • User avatar
    • Acceptance criteria
  • User avatar
    • So that
    • Acceptance criteria
    • CC list set to Benjamin Dauton (bdauton)