mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Cature all form AJAX errors
- remove all references to alert() - Display error modal instead
This commit is contained in:
parent
2b3094eac4
commit
109b6b868c
@ -273,13 +273,14 @@ function launchDeleteForm(url, options = {}) {
|
|||||||
modalSetContent(modal, response.html_data);
|
modalSetContent(modal, response.html_data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert('JSON response missing HTML data');
|
|
||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
|
showDialog('Invalid form response', 'JSON response missing HTML data');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, ajaxOptions, thrownError) {
|
error: function (xhr, ajaxOptions, thrownError) {
|
||||||
alert('Error requesting JSON data:\n' + thrownError);
|
|
||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
|
showDialog('Error requesting form data', renderErrorMessage(xhr));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -297,8 +298,8 @@ function launchDeleteForm(url, options = {}) {
|
|||||||
afterForm(response, options);
|
afterForm(response, options);
|
||||||
},
|
},
|
||||||
error: function (xhr, ajaxOptions, thrownError) {
|
error: function (xhr, ajaxOptions, thrownError) {
|
||||||
alert('Error deleting item:\n' + thrownError);
|
|
||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
|
showDialog('Error deleting item', renderErrorMessage(xhr));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -335,6 +336,7 @@ function handleModalForm(url, options) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
form.submit(function() {
|
form.submit(function() {
|
||||||
|
// We should never get here (form submission is overridden)
|
||||||
alert('form submit');
|
alert('form submit');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -362,7 +364,8 @@ function handleModalForm(url, options) {
|
|||||||
injectModalForm(modal, response.html_form);
|
injectModalForm(modal, response.html_form);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert('HTML form data missing from server response');
|
$(modal).modal('hide');
|
||||||
|
showDialog('Invalid response from server', 'Form data missing from server response');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -427,13 +430,13 @@ function launchModalForm(url, options = {}) {
|
|||||||
handleModalForm(url, options);
|
handleModalForm(url, options);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
alert('JSON response missing form data');
|
|
||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
|
showDialog('Invalid server response', 'JSON response missing form data');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, ajaxOptions, thrownError) {
|
error: function (xhr, ajaxOptions, thrownError) {
|
||||||
alert('Error requesting form data:\n' + thrownError);
|
|
||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
|
showDialog('Error requesting form data', renderErrorMessage(xhr));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user