mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1053 from SchrodingersGat/modal-errors
Modal errors
This commit is contained in:
commit
416cfb99da
@ -354,7 +354,7 @@ function renderErrorMessage(xhr) {
|
||||
|
||||
var html = '<b>' + xhr.statusText + '</b><br>';
|
||||
|
||||
html += '<b>Status Code - ' + xhr.status + '</b><br><hr>';
|
||||
html += '<b>Error Code - ' + xhr.status + '</b><br><hr>';
|
||||
|
||||
html += `
|
||||
<div class='panel-group'>
|
||||
@ -811,16 +811,37 @@ function launchModalForm(url, options = {}) {
|
||||
$(modal).modal('hide');
|
||||
|
||||
// Permission denied!
|
||||
if (xhr.status == 403) {
|
||||
if (xhr.status == 400) {
|
||||
showAlertDialog(
|
||||
"Permission Denied",
|
||||
"Error 400: Bad Request",
|
||||
"Server returned error code 400"
|
||||
);
|
||||
} else if (xhr.status == 401) {
|
||||
showAlertDialog(
|
||||
"Error 401: Not Authenticated",
|
||||
"Authentication credentials not supplied"
|
||||
);
|
||||
} else if (xhr.status == 403) {
|
||||
showAlertDialog(
|
||||
"Error 403: Permission Denied",
|
||||
"You do not have the required permissions to access this function"
|
||||
);
|
||||
|
||||
return;
|
||||
} else if (xhr.status == 404) {
|
||||
showAlertDialog(
|
||||
"Error 404: Resource Not Found",
|
||||
"The requested resource could not be located on the server"
|
||||
);
|
||||
} else if (xhr.status == 408) {
|
||||
showAlertDialog(
|
||||
"Error 408: Timeout",
|
||||
"Connection timeout while requesting data from server"
|
||||
);
|
||||
} else {
|
||||
showAlertDialog('Error requesting form data', renderErrorMessage(xhr));
|
||||
}
|
||||
|
||||
showAlertDialog('Error requesting form data', renderErrorMessage(xhr));
|
||||
console.log("Modal form error: " + xhr.status);
|
||||
console.log("Message: " + xhr.responseText);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user