Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
32de851f
Commit
32de851f
authored
Feb 01, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
Feb 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Dialog shows custom portal_message if included in HTTP500
/reviewed-on
nexedi/erp5!570
parent
51b90925
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
...Item/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
+17
-5
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
View file @
32de851f
...
...
@@ -181,17 +181,29 @@
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
target
!==
undefined
)
{
var
error_text
=
'
Encountered an unknown error. Try to resubmit
'
,
promise
;
// if we know what the error was, try to precise it for the user
promise
_queue
=
new
RSVP
.
Queue
()
;
// if we know what the error was, try to precise it for the user
if
(
error
.
target
.
status
===
400
)
{
error_text
=
'
Input data has errors
'
;
}
else
if
(
error
.
target
.
status
===
403
)
{
error_text
=
'
You do not have the permissions to edit the object
'
;
}
else
if
(
error
.
target
.
status
===
0
)
{
error_text
=
'
Document was not saved! Resubmit when you are online or the document accessible
'
;
}
else
if
(
error
.
target
.
status
===
500
&&
error
.
target
.
response
.
type
===
"
application/json
"
)
{
promise_queue
.
push
(
function
()
{
return
jIO
.
util
.
readBlobAsText
(
error
.
target
.
response
);
})
.
push
(
function
(
response_text
)
{
var
response
=
JSON
.
parse
(
response_text
.
target
.
result
);
error_text
=
response
.
portal_status_message
;
});
}
// display translated error_text to user
promise
=
form_gadget
.
notifySubmitted
()
promise_queue
.
push
(
function
()
{
return
form_gadget
.
notifySubmitted
();
})
.
push
(
function
()
{
return
form_gadget
.
translate
(
error_text
);
})
...
...
@@ -204,7 +216,7 @@
// if server validation of form data failed (indicated by response code 400)
// we parse out field errors and display them to the user
if
(
error
.
target
.
status
===
400
)
{
promise
promise
_queue
.
push
(
function
()
{
// when the server-side validation returns the error description
if
(
error
.
target
.
responseType
===
"
blob
"
)
{
...
...
@@ -217,7 +229,7 @@
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
event
.
target
.
result
));
});
}
return
promise
;
return
promise
_queue
;
}
throw
error
;
});
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
View file @
32de851f
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
965.1
0338.33096.47104
</string>
</value>
<value>
<string>
965.1
3214.39160.9318
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1517
305313.45
</float>
<float>
1517
480919.98
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment