Skip to content

Conversation

@sjvans
Copy link
Contributor

@sjvans sjvans commented Nov 23, 2025

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:
image


related

@sjvans sjvans changed the title feat: add status transition flows (incl. @to: $flow.previous) feat: status-transition flows Dec 1, 2025
@sjvans sjvans marked this pull request as ready for review December 3, 2025 10:42
@sjvans sjvans requested review from agoerler and beckermarc December 3, 2025 10:53
@sjvans sjvans enabled auto-merge (squash) December 5, 2025 15:06
@sjvans sjvans requested a review from vmikhailenko December 5, 2025 15:07
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image is hardly readable when using dark mode, I think it should not have a transparent background.

action rejectTravel();
action reopenTravel();
action deductDiscount( percent: Percentage not null ) returns Travels;
action draftEdit(PreserveChanges: Boolean) returns Travels; // define to annotate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a little unfortunate if edit is now always present, as that no longer produces a reasonable behaviour together with the field control annotations. I readded the flow with the draftEdit action for the time being.

annotate Travels with @flow.status: (Status) actions {
deductDiscount @from: [ #Open ]; // can only be called on #Open travels
acceptTravel @from: [ #Open ] @to: #Accepted;
rejectTravel @from: [ #Open ] @to: #Canceled;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed #Rejected to #Canceled as the other enum value actually doesn't exist. It also matches the picture in the README. If you want to rename to #Rejected please do so consistently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy paste error. daniel had changed to #Rejected in xtravels. i'll align...

@sjvans sjvans merged commit 736964a into main Dec 15, 2025
6 checks passed
@sjvans sjvans deleted the flows branch December 15, 2025 11:44
@beckermarc
Copy link
Collaborator

beckermarc commented Dec 15, 2025

I didn't notice the auto merge when approving. Please double-check my comments and feel free to make adjustments as required :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants