Closed asergeev-sc closed 5 years ago
Save
button in the top right corner of the Editor and look at the browser's console.Release guards
are conditions defined in schema per state like this:
states: [
{
name: "inspectionRequired",
release: [
{
to: string|array<string> // optional
guards: [
// same as in transitions
]
}
]
}
]
There's a property in Editor's component:
schemaConfig = {
state: {
releaseGuards: {
toState: 'single' // all, single, multiple (default)
},
}
}
toState
is optional. If not defined then the default value is multiple
.
It means release[i].to
is empty because guards are relevant for any target state. In this case, pressing Guards
button in States
editor page shows editor for a list of guards just like on Transitions
page. If guards are added/edited/deleted here, they appear in the schema in release
property of the corresponding state without to
field.
It means release[i].to
can be either a single string (name of a target state) or empty. In this case, pressing Guards
button in States
editor page shows editor for a list of release guards. Input for To
value allows to pick a single name or make it empty. On the right side, there's Guards
button which opens the same editor for a list of guards as mentioned in the previous case.
A list of options can come from 2 places:
schemaConfig.state.availableNames
is defined then this list is usedThe same as above, but to
can also be an array. Input for To
allows multiple selections. If only one name is selected then it's saved in a schema as a single string for to
; otherwise, an array is saved.
A list of options can come from 2 places:
schemaConfig.state.availableNames
is defined then this list is usedTwo new messages need to be translated into all supported languages (de
, sv
, fi
, no
, ru
): states.releaseGuards
block.
Where these messages are used on UI:
In code: https://github.com/OpusCapita/fsm-workflow/blob/issue-91/packages/editor/src/i18n/en.js#L46 (example for en
)
Tested. Guards are added correctly. Alerts about existing changes appear correctly while closing pop-ups. Please, merge with master branch.
We need to add "release" guards support into the editor (see new enhancements issue #90).
An editor UI should provide the possibility to define state release guards. This Ui should be supported by an additional configuration that optionally could be passed to the editor from the outside that defines which kind of target states could be defined at all:
depending on the configuration release guards UI should allow: