-
Notifications
You must be signed in to change notification settings - Fork 26
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
✨ [#4344] Configurable objects API group in ZGW registration #4758
base: master
Are you sure you want to change the base?
✨ [#4344] Configurable objects API group in ZGW registration #4758
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4758 +/- ##
=======================================
Coverage 96.56% 96.56%
=======================================
Files 746 746
Lines 25202 25205 +3
Branches 3318 3318
=======================================
+ Hits 24336 24339 +3
Misses 602 602
Partials 264 264 ☔ View full report in Codecov by Sentry. |
59eab2f
to
89df9de
Compare
previously this was not configurable and always used the ObjectsAPIGroup with the lowest pk to create the client when registering the submission
89df9de
to
0c7ae1c
Compare
src/openforms/js/components/admin/form_design/registrations/zgw/ZGWOptionsFormFields.js
Show resolved
Hide resolved
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.
You'll also need to update some stories since they now fail to render in chromatic :)
@@ -18,8 +18,12 @@ const ZGWOptionsForm = ({index, name, label, schema, formData, onChange}) => { | |||
const [modalOpen, setModalOpen] = useState(false); | |||
const validationErrors = useContext(ValidationErrorContext); | |||
|
|||
const {zgwApiGroup, zaakVertrouwelijkheidaanduiding} = schema.properties; | |||
const {zgwApiGroup, zaakVertrouwelijkheidaanduiding, objectsApiGroup} = schema.properties; |
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.
please update the component prop types accordingly
api_group = options.get( | ||
"objects_api_group", ObjectsAPIGroupConfig.objects.order_by("pk").first() | ||
) |
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.
I'd prefer to remove this default/fallback behaviour entirely so that all configuration is explicit, and we can then also define this accordingly in the options type declarations.
api_group = options["objects_api_group"]
assert api_group is not None
@@ -37,6 +39,7 @@ class RegistrationOptions(TypedDict): | |||
organisatie_rsin: NotRequired[str] | |||
zaak_vertrouwelijkheidaanduiding: NotRequired[VertrouwelijkheidAanduiding] | |||
medewerker_roltype: NotRequired[str] | |||
objects_api_group: NotRequired[ObjectsAPIGroupConfig] |
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.
objects_api_group: NotRequired[ObjectsAPIGroupConfig] | |
objects_api_group: ObjectsAPIGroupConfig | None |
I think we can enforce this key being set at all times. If the value is None
, then no objects API registration is enabled (and we expect objecttype
and objecttype_version
to not be set at all, but either way they're ignored)
<ObjectsAPIGroup | ||
apiGroupChoices={objectsApiGroupChoices} | ||
onApiGroupChange={onApiGroupChange} | ||
/> |
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.
I think this one should be isClearable
to disable objects API integration again? Though clearing the objecttype field has the same effect
), | ||
help_text=_("Which Objects API set to use."), | ||
label=_("Objects API set"), | ||
required=False, |
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.
I think we may need an allow_null=True
to make it explicit that no objects API integration is done.
There's some more steps involved in this PR I think:
- A data migration that updates existing registration backends
- if no
objecttype
is specified, ensure thatobjects_api_group
is set toNone
- if an objecttype is specified, set the
objects_api_group
to the lowest PK (use that queryset that is now used at runtime) - this behaviour also needs to be applied during form import time when legacy forms are being imported (!), we can probably do something with the
DEFINITION_CONVERTERS
- if no
- Validation! Once we know which API group is used, we know the API root URl of the objecttypes API, and can check the URL provided. We can even look up the provided object type and check that it exists, but let's not do that yet because credentials to the object types API may not be configured yet. This should only come up when people edit the form again, and should not affect existing runtime behaviour of forms.
previously this was not configurable and always used the ObjectsAPIGroup with the lowest pk to create the client when registering the submission
Closes #4344
Changes
Checklist
Check off the items that are completed or not relevant.
Impact on features
Release management
I have updated the translations assets (you do NOT need to provide translations)
./bin/makemessages_js.sh
./bin/compilemessages_js.sh
Commit hygiene