-
Notifications
You must be signed in to change notification settings - Fork 2
feat: status-transition flows #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@to: $flow.previous)
@to: $flow.previous)
danjoa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 👍
Please see my comments before merging...
| // Define flow for Travels | ||
| annotate Travels with @flow.status: Status actions { | ||
| rejectTravel @from: #Open @to: #Canceled; | ||
| acceptTravel @from: #Open @to: #Accepted; | ||
| deductDiscount @from: #Open; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move that to a separate file srv/travel-flow.cds ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately leads to an interesting error with profile flow:
xtravels % cds w --profile flow
cds serve all --with-mocks --in-memory? --profile flow
( live reload enabled for browsers )
___________________________
[ERROR] srv/travel-flow.cds:5:20-24: Duplicate assignment with “@from” (in annotate:“TravelService.Travels”/action:“rejectTravel”)
[ERROR] srv/travel-flow.cds:6:20-24: Duplicate assignment with “@from” (in annotate:“TravelService.Travels”/action:“acceptTravel”)
[ERROR] xmpls/flow/flow-previous.cds:18:20-24: Duplicate assignment with “@from” (in annotate:“TravelService.Travels”/action:“acceptTravel”)
[ERROR] xmpls/flow/flow-previous.cds:19:20-24: Duplicate assignment with “@from” (in annotate:“TravelService.Travels”/action:“rejectTravel”)→ i'll follow up with the compiler team
### summary makes use of new status-transition flows feature of cds-services^4.5 and cds^9.5: - check entry state(s) for action → previously unchecked → TODO: true? - set to exit state for action → remove custom handlers - automatically add ui artifacts → remove unnecessary annotations ### `CDS_ENV=flow mvn cds:watch` extends to a more complex flow incl. usage of `@to: $flow.previous`. for that, status `InReview` and `Blocked` as well as actions `reviewTravel`, `reopenTravel`, `blockTravel`, and `unblockTravel` were added in order to create a scenario where the previous state of `Blocked` can be either `Open` or `InReview`. visualization of the flow: <img width="913" height="444" alt="image" src="https://github.com/user-attachments/assets/8dd98cdf-7a01-4e55-85bc-a2a7d69fdd16" /> --- ### related - capire/xtravels#12
summary
makes use of new status-transition flows feature of cds^9.5:
cds w --profile flowextends to a more complex flow incl. usage of
@to: $flow.previous.for that, status
InReviewandBlockedas well as actionsreviewTravel,reopenTravel,blockTravel, andunblockTravelwere added in order to create a scenario where the previous state ofBlockedcan be eitherOpenorInReview.visualization of the flow:

related