Skip to content

Commit

Permalink
[#4709] Updated generic error message for errors in a form,added a li…
Browse files Browse the repository at this point in the history
…nk to the requests logs
  • Loading branch information
vaszig authored and robinmolen committed Oct 15, 2024
1 parent 5fafc78 commit e390957
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
data-form-history-url="{{ history_url }}"
data-csrftoken="{{ csrf_token }}"
data-tinymce-url="{% static 'tinymce/tinymce.min.js' %}"
data-outgoing-requests-url="{% url 'admin:log_outgoing_requests_outgoingrequestslog_changelist' %}"
> {# Managed by React #} </div>
{% endblock %}

Expand Down
36 changes: 30 additions & 6 deletions src/openforms/js/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,36 @@
"value": "and"
}
],
"9fW2NX": [
{
"type": 0,
"value": "Sorry! Something unexpected went wrong."
},
{
"children": [
],
"type": 8,
"value": "br"
},
{
"type": 0,
"value": "Contact your technical administrator to investigate, or perhaps more information is available in the "
},
{
"children": [
{
"type": 0,
"value": "outgoing request logs"
}
],
"type": 8,
"value": "link"
},
{
"type": 0,
"value": "."
}
],
"9lk1eS": [
{
"type": 0,
Expand Down Expand Up @@ -5165,12 +5195,6 @@
"value": "The regular expression pattern test that the city field value must pass before the form can be submitted."
}
],
"ow5AAO": [
{
"type": 0,
"value": "The form is invalid. Please correct the errors below."
}
],
"oxYXJX": [
{
"type": 0,
Expand Down
36 changes: 30 additions & 6 deletions src/openforms/js/compiled-lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,36 @@
"value": "en"
}
],
"9fW2NX": [
{
"type": 0,
"value": "Sorry! Er is iets onverwachts misgegaan."
},
{
"children": [
],
"type": 8,
"value": "br"
},
{
"type": 0,
"value": "Neem contact op met je technische beheerder om dit te onderzoeken, of misschien is er meer informatie beschikbaar in de "
},
{
"children": [
{
"type": 0,
"value": "logboeken van uitgaande verzoeken"
}
],
"type": 8,
"value": "link"
},
{
"type": 0,
"value": "."
}
],
"9lk1eS": [
{
"type": 0,
Expand Down Expand Up @@ -5187,12 +5217,6 @@
"value": "Het patroon van reguliere expressie waar de stad aan moet voldoen voor het formulier kan verstuurd worden."
}
],
"ow5AAO": [
{
"type": 0,
"value": "De gegevens zijn ongeldig. Los de problemen hieronder op."
}
],
"oxYXJX": [
{
"type": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ StepsFieldSet.propTypes = {
/**
* Component to render the form edit page.
*/
const FormCreationForm = ({formUuid, formUrl, formHistoryUrl}) => {
const FormCreationForm = ({formUuid, formUrl, formHistoryUrl, outgoingRequestsUrl}) => {
const {csrftoken} = useContext(APIContext);
const intl = useIntl();
const initialState = {
Expand Down Expand Up @@ -1267,8 +1267,18 @@ const FormCreationForm = ({formUuid, formUrl, formHistoryUrl}) => {
{Object.keys(state.errors).length ? (
<div className="fetch-error">
<FormattedMessage
defaultMessage="The form is invalid. Please correct the errors below."
description="Generic error message"
description="Generic admin error message"
defaultMessage={`Sorry! Something unexpected went wrong.<br></br>Contact your
technical administrator to investigate, or perhaps more information is
available in the <link>outgoing request logs</link>.`}
values={{
br: () => <br />,
link: chunks => (
<a href={outgoingRequestsUrl} target="_blank">
{chunks}
</a>
),
}}
/>
</div>
) : null}
Expand Down
10 changes: 8 additions & 2 deletions src/openforms/js/components/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const mountForm = wrapperProps => {
if (!formCreationFormNodes.length) return;

for (const formCreationFormNode of formCreationFormNodes) {
const {csrftoken, formUuid, formUrl, tinymceUrl, formHistoryUrl} = formCreationFormNode.dataset;
const {csrftoken, formUuid, formUrl, tinymceUrl, formHistoryUrl, outgoingRequestsUrl} =
formCreationFormNode.dataset;

ReactModal.setAppElement(formCreationFormNode);
const root = createRoot(formCreationFormNode);
Expand All @@ -28,7 +29,12 @@ const mountForm = wrapperProps => {
// Strict mode is likely only viable once we've simplified the code substantially.
<AppWrapper {...wrapperProps} csrftoken={csrftoken} strict={false}>
<TinyMceContext.Provider value={tinymceUrl}>
<FormCreationForm formUuid={formUuid} formUrl={formUrl} formHistoryUrl={formHistoryUrl} />
<FormCreationForm
formUuid={formUuid}
formUrl={formUrl}
formHistoryUrl={formHistoryUrl}
outgoingRequestsUrl={outgoingRequestsUrl}
/>
</TinyMceContext.Provider>
</AppWrapper>
);
Expand Down
10 changes: 5 additions & 5 deletions src/openforms/js/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@
"description": "Extra logic action prefix",
"originalDefault": "and"
},
"9fW2NX": {
"defaultMessage": "Sorry! Something unexpected went wrong.<br></br>Contact your technical administrator to investigate, or perhaps more information is available in the <link>outgoing request logs</link>.",
"description": "Generic admin error message",
"originalDefault": "Sorry! Something unexpected went wrong.<br></br>Contact your technical administrator to investigate, or perhaps more information is available in the <link>outgoing request logs</link>."
},
"9y3/ek": {
"defaultMessage": "Confirm",
"description": "JSON editor: confirm edited variable definition",
Expand Down Expand Up @@ -2309,11 +2314,6 @@
"description": "Include confirmation page content in PDF",
"originalDefault": "Whether to include the content of the confirmation page in the PDF."
},
"ow5AAO": {
"defaultMessage": "The form is invalid. Please correct the errors below.",
"description": "Generic error message",
"originalDefault": "The form is invalid. Please correct the errors below."
},
"oxYXJX": {
"defaultMessage": "How successful submissions of this form will be removed after the limit. Leave blank to use value in General Configuration.",
"description": "Successful Submissions Removal Method help text",
Expand Down
10 changes: 5 additions & 5 deletions src/openforms/js/lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@
"description": "Extra logic action prefix",
"originalDefault": "and"
},
"9fW2NX": {
"defaultMessage": "Sorry! Er is iets onverwachts misgegaan.<br></br>Neem contact op met je technische beheerder om dit te onderzoeken, of misschien is er meer informatie beschikbaar in de <link>logboeken van uitgaande verzoeken</link>.",
"description": "Generic admin error message",
"originalDefault": "Sorry! Something unexpected went wrong.<br></br>Contact your technical administrator to investigate, or perhaps more information is available in the <link>outgoing request logs</link>."
},
"9y3/ek": {
"defaultMessage": "Bevestigen",
"description": "JSON editor: confirm edited variable definition",
Expand Down Expand Up @@ -2328,11 +2333,6 @@
"description": "Include confirmation page content in PDF",
"originalDefault": "Whether to include the content of the confirmation page in the PDF."
},
"ow5AAO": {
"defaultMessage": "De gegevens zijn ongeldig. Los de problemen hieronder op.",
"description": "Generic error message",
"originalDefault": "The form is invalid. Please correct the errors below."
},
"oxYXJX": {
"defaultMessage": "Geeft aan hoe voltooide inzendingen worden opgeschoond na de bewaartermijn. Laat leeg om de waarde van de algemene configuratie te gebruiken.",
"description": "Successful Submissions Removal Method help text",
Expand Down

0 comments on commit e390957

Please sign in to comment.