•  
     
    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_enalean)
Status
Empty
Done
Development
  • [ ] Does it involves User Interface? 
  • [ ] Are there any mockups?
  • [ ] Are permissions checked?
  • [ ] Does it need Javascript development?
  • [ ] Does it need a forge upgrade bucket?
  • [ ] Does it need to execute things in system events?
  • [ ] Does it impact project creation (templates)?
  • [ ] Is it exploratory?
Empty
Details
#12187
Manuel Vacelet (vaceletm)
2019-02-27 16:30
2018-08-27 16:10
4076

References
Referencing story #12187
Referenced by story #12187

Other

gerrit #13099
gerrit #13102
gerrit #13106
gerrit #13108
gerrit #13109
gerrit #13113
gerrit #13118
gerrit #13124
gerrit #13139
gerrit #13150
gerrit #13151
gerrit #13153
gerrit #13155
gerrit #13162
gerrit #13163
gerrit #13199
gerrit #13200
gerrit #13209
gerrit #13219
gerrit #13221
gerrit #13222
gerrit #13225
gerrit #13231
gerrit #13258
gerrit #13261
gerrit #13263
gerrit #13266
gerrit #13273
gerrit #13275
gerrit #13282
gerrit #13295
gerrit #13296
gerrit #13336
gerrit #13427
gerrit #13428
gerrit #13433
gerrit #13442
gerrit #13448
gerrit #13463
gerrit #13464
gerrit #13470
gerrit #13482
gerrit #13496
gerrit #13499
gerrit #13522
gerrit #13550
gerrit #13557
gerrit #13565
gerrit #13571
gerrit #13573
gerrit #13574
gerrit #13583
gerrit #13584
gerrit #13587
gerrit #13588
gerrit #13604
gerrit #13607
gerrit #13610
gerrit #13619
gerrit #13620
gerrit #13621
gerrit #13624
gerrit #13625
gerrit #13640
gerrit #13645
gerrit #13647
gerrit #13649
gerrit #13702
gerrit #13727
gerrit #13737
gerrit #13742
gerrit #13743
gerrit #13745
gerrit #13756
gerrit #13768
gerrit #13772
gerrit #13773
gerrit #13775
gerrit #13776
gerrit #13779
gerrit #13780
gerrit #13785
gerrit #13790
gerrit #13791
gerrit #13802
gerrit #13808
gerrit #13810
gerrit #13811
gerrit #13814
gerrit #13822
gerrit #13829
gerrit #13839
gerrit #13848
gerrit #13850
gerrit #13853
gerrit #13858
gerrit #13863
gerrit #13865
gerrit #13867
gerrit #13868
gerrit #13869
gerrit #13874
gerrit #13877
gerrit #13878
gerrit #13927
gerrit #13929
gerrit #13930
gerrit #13934
gerrit #13935
gerrit #13936
gerrit #13943
gerrit #13944
gerrit #13948
gerrit #13954
gerrit #13956
gerrit #13958
gerrit #13961
gerrit #13962
gerrit #13966
gerrit #13974
gerrit #13983
gerrit #13991
gerrit #13993
gerrit #14000
gerrit #14010
gerrit #14021
gerrit #14031
gerrit #14039
gerrit #14040
gerrit #14056
gerrit #14057
gerrit #14070
gerrit #14075
gerrit #14078
gerrit #14087
gerrit #14090
gerrit #14093
gerrit #14094
gerrit #14100
gerrit #14107
gerrit #14109
gerrit #14110
gerrit #14114
gerrit #14115
gerrit #14120
gerrit #14121
gerrit #14126
gerrit #14130
gerrit #14136
gerrit #14162
gerrit #14187
gerrit #14196

Follow-ups

User avatar
Joris MASSON (jmasson)2019-01-07 10:49
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2018-12-21 11:47
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
gerrit #13336 integrated into Tuleap 10.8.99.37

  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Thi Mai (thimai)2018-12-04 10:03
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar

Added live mock-up


  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • So that
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
  • CC list set to Benjamin Dauton (bdauton_enalean)