From 0ab6dfad1893e6fe86121ff703de9969761766d8 Mon Sep 17 00:00:00 2001 From: Viktor van Wijk Date: Tue, 17 Dec 2024 12:40:24 +0100 Subject: [PATCH] :truck: [#4908] Rename api endpoint to relative api endpoint API endpoint is relative, name should reflect that --- .../form_design/RegistrationFields.stories.js | 4 ++-- .../registrations/json/JSONOptionsForm.js | 19 ++++++++++--------- .../registrations/contrib/json/config.py | 2 +- .../registrations/contrib/json/plugin.py | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/openforms/js/components/admin/form_design/RegistrationFields.stories.js b/src/openforms/js/components/admin/form_design/RegistrationFields.stories.js index 986af24c15..73acca96c5 100644 --- a/src/openforms/js/components/admin/form_design/RegistrationFields.stories.js +++ b/src/openforms/js/components/admin/form_design/RegistrationFields.stories.js @@ -682,7 +682,7 @@ export const ConfiguredBackends = { key: 'backend11', name: 'JSON', backend: 'json', - options: {extraLine: 'We are checking.'}, + options: {relativeApiEndpoint: 'Example endpoint'}, }, ], validationErrors: [ @@ -941,7 +941,7 @@ export const JSON = { name: 'JSON', backend: 'json', options: { - extraLine: 'We are checking.', + relativeApiEndpoint: 'We are checking.', }, }, ], diff --git a/src/openforms/js/components/admin/form_design/registrations/json/JSONOptionsForm.js b/src/openforms/js/components/admin/form_design/registrations/json/JSONOptionsForm.js index 1dde8ff9f0..0b573447bd 100644 --- a/src/openforms/js/components/admin/form_design/registrations/json/JSONOptionsForm.js +++ b/src/openforms/js/components/admin/form_design/registrations/json/JSONOptionsForm.js @@ -15,20 +15,21 @@ import { } from 'components/admin/forms/ValidationErrors'; -const ExtraLine = () => { - const [fieldProps] = useField('extraLine'); +const RelativeAPIEndpoint = () => { + // TODO-4098: is this the serializer name? + const [fieldProps] = useField('relativeApiEndpoint'); return ( } > - + ); @@ -49,13 +50,13 @@ const JSONOptionsForm = ({name, label, formData, onChange}) => { defaultMessage="Plugin configuration: JSON" /> } - initialFormData={{extraLine: '', ...formData}} + initialFormData={{relativeApiEndpoint: '', ...formData}} onSubmit={values => onChange({formData: values})} modalSize="small" >
- +
@@ -66,7 +67,7 @@ JSONOptionsForm.propTypes = { name: PropTypes.string.isRequired, label: PropTypes.node.isRequired, formData: PropTypes.shape({ - extraLine: PropTypes.string, + apiEndpoint: PropTypes.string, }), onChange: PropTypes.func.isRequired, }; diff --git a/src/openforms/registrations/contrib/json/config.py b/src/openforms/registrations/contrib/json/config.py index 4ddc4f06a2..581c72ea35 100644 --- a/src/openforms/registrations/contrib/json/config.py +++ b/src/openforms/registrations/contrib/json/config.py @@ -16,7 +16,7 @@ class JSONOptionsSerializer(JsonSchemaSerializerMixin, serializers.Serializer): help_text=_("Which service to use."), ) # TODO-4098: show the complete API endpoint as a (tooltip) hint after user entry? - api_endpoint = serializers.CharField( + relative_api_endpoint = serializers.CharField( max_length=255, label=_("Relative API endpoint"), help_text=_("The API endpoint to send the data to (relative to the service API root)."), diff --git a/src/openforms/registrations/contrib/json/plugin.py b/src/openforms/registrations/contrib/json/plugin.py index 2d97154fdb..2474fe1a01 100644 --- a/src/openforms/registrations/contrib/json/plugin.py +++ b/src/openforms/registrations/contrib/json/plugin.py @@ -8,7 +8,7 @@ @register("json") class JSONPlugin(BasePlugin): - verbose_name = _("New fancy plugin") + verbose_name = _("JSON registration") configuration_options = JSONOptionsSerializer def register_submission(self, submission: Submission, options: OptionsT) -> None: