https://community.openproject.org/wp/65303
When there are errors on the work package when saving the progress
tracking values, the modal is rendered again with those errors so that
the invalid fields are highlighted and have a validation error message.
When the error is external to the progress modal, for instance a
mandatory custom field or an invalid project phase, it is displayed in a
top banner with a flash message. Before the error was not displayed at
all, leaving users confused as why the progress values could not be
saved.
Render it using our component wrapper and
`update_via_turbo_stream(method: "morph")`. Move `<turbo-frame>` of
progress modal from component to the view to avoid double rendering of
the turbo-frame tag.
Inspired by PR #18152 where a similar was done for date picker modal.
This helps differentiating the form when it is initially rendered, or
due to a modification. This distinction is important to decide whether
the live_messages should be rendered or not. Initial rendering of the
dialog should not display live messages, as nothing has changed.
https://community.openproject.org/wp/62580
The contract class being used was always `WorkPackages::CreateContract`.
It needs to be `WorkPackages::UpdateContract` when the user edits fields
so that the correct permissions are checked.
When submitting with invalid values, the progress popover was updated
via turbo-stream with a modal which did not include the touched fields.
This caused the fields to be ignored on the second submit, even if they
appeared to be invalid. This was also causing the preview to not work as
expected.
This has been changed:
- the update is done through a turbo-stream morph instead of an update.
It avoids disconnecting and reconnecting the stimulus controllers.
- the touched fields are now correctly sent to the component for
rendering. The state is maintained in the stimulus controller instead
of the hidden fields. Fields are still needed for form submission.
- the fields sent to the server when previewing are exactly the same as
the ones being sent on submit.
- the turbo_stream commands are sent directly from the controller. None
are sent if the update completed successfully as the modal will be
closed by client side javascript anyway.
- the referrer-field is now just the field name instead of the full
work package key, to reduce noise.
Feature flag is percent_complete_edition. So % complete edition will be
shipped but disabled in 14.4.
It will eventually be activated in 15.0 when there will be a total %
complete calculation mode so that we can bundle both features together
in one release.
The values were not retained between modifications of percent values, so
a new parameter `initial` was introduced to "save" the entered values
between edits.
It also fixed the progress modal having empty values when opening it a
second time in the create work package page.
Strings such as "Hello world" aren't durations and hence, should not
be parsed or continue through to the services. An early validation at
the controller level guards against these.
* Renders a modal with an edit form for work and remaining work fields.
* Renders a turbo frame within a spot-drop-modal.
* Handles propagating changes from Rails form submissions in an Angular
context.