
{% inventree_title %}
+ {% include "spacer.html" %} +{% inventree_title %}
'; - message += renderErrorMessage(xhr); + message += `URL: ${url}`; - showAlertDialog(title, message); + showMessage(title, { + style: 'danger', + icon: 'fas fa-server icon-red', + details: message, + }); } diff --git a/InvenTree/templates/js/translated/barcode.js b/InvenTree/templates/js/translated/barcode.js index a1d6fb7adf..fcced46f53 100644 --- a/InvenTree/templates/js/translated/barcode.js +++ b/InvenTree/templates/js/translated/barcode.js @@ -480,10 +480,10 @@ function barcodeCheckIn(location_id) { $(modal).modal('hide'); if (status == 'success' && 'success' in response) { - showAlertOrCache('alert-success', response.success, true); + showAlertOrCache(response.success, 'success', true); location.reload(); } else { - showAlertOrCache('alert-success', '{% trans "Error transferring stock" %}', false); + showAlertOrCache('{% trans "Error transferring stock" %}', 'danger', false); } } } @@ -604,10 +604,10 @@ function scanItemsIntoLocation(item_id_list, options={}) { $(modal).modal('hide'); if (status == 'success' && 'success' in response) { - showAlertOrCache('alert-success', response.success, true); + showAlertOrCache(response.success, 'success', true); location.reload(); } else { - showAlertOrCache('alert-danger', '{% trans "Error transferring stock" %}', false); + showAlertOrCache('{% trans "Error transferring stock" %}', 'danger', false); } } } diff --git a/InvenTree/templates/js/translated/build.js b/InvenTree/templates/js/translated/build.js index dec9a4aaf7..499fde9bec 100644 --- a/InvenTree/templates/js/translated/build.js +++ b/InvenTree/templates/js/translated/build.js @@ -339,7 +339,7 @@ function completeBuildOutputs(build_id, outputs, options={}) { break; default: $(opts.modal).modal('hide'); - showApiError(xhr); + showApiError(xhr, opts.url); break; } } @@ -1527,7 +1527,7 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) { break; default: $(opts.modal).modal('hide'); - showApiError(xhr); + showApiError(xhr, opts.url); break; } } diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index 396226d52b..7ca2e77a3f 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -123,9 +123,10 @@ function getApiEndpointOptions(url, callback) { json: 'application/json', }, success: callback, - error: function() { + error: function(xhr) { // TODO: Handle error console.log(`ERROR in getApiEndpointOptions at '${url}'`); + showApiError(xhr, url); } }); } @@ -199,12 +200,14 @@ function constructChangeForm(fields, options) { // Store the entire data object options.instance = data; - + constructFormBody(fields, options); }, - error: function() { + error: function(xhr) { // TODO: Handle error here console.log(`ERROR in constructChangeForm at '${options.url}'`); + + showApiError(xhr, options.url); } }); } @@ -241,9 +244,11 @@ function constructDeleteForm(fields, options) { constructFormBody(fields, options); }, - error: function() { + error: function(xhr) { // TODO: Handle error here console.log(`ERROR in constructDeleteForm at '${options.url}`); + + showApiError(xhr, options.url); } }); } @@ -708,7 +713,7 @@ function submitFormData(fields, options) { break; default: $(options.modal).modal('hide'); - showApiError(xhr); + showApiError(xhr, options.url); break; } } @@ -885,19 +890,19 @@ function handleFormSuccess(response, options) { // Display any messages if (response && response.success) { - showAlertOrCache('alert-success', response.success, cache); + showAlertOrCache(response.success, 'success', cache); } if (response && response.info) { - showAlertOrCache('alert-info', response.info, cache); + showAlertOrCache(response.info, 'info', cache); } if (response && response.warning) { - showAlertOrCache('alert-warning', response.warning, cache); + showAlertOrCache(response.warning, 'warning', cache); } if (response && response.danger) { - showAlertOrCache('alert-danger', response.danger, cache); + showAlertOrCache(response.danger, 'dagner', cache); } if (options.onSuccess) { diff --git a/InvenTree/templates/js/translated/modals.js b/InvenTree/templates/js/translated/modals.js index 32b5260e76..aefdba604f 100644 --- a/InvenTree/templates/js/translated/modals.js +++ b/InvenTree/templates/js/translated/modals.js @@ -399,19 +399,19 @@ function afterForm(response, options) { // Display any messages if (response.success) { - showAlertOrCache('alert-success', response.success, cache); + showAlertOrCache(response.success, 'success', cache); } if (response.info) { - showAlertOrCache('alert-info', response.info, cache); + showAlertOrCache(response.info, 'info', cache); } if (response.warning) { - showAlertOrCache('alert-warning', response.warning, cache); + showAlertOrCache(response.warning, 'warning', cache); } if (response.danger) { - showAlertOrCache('alert-danger', response.danger, cache); + showAlertOrCache(response.danger, 'danger', cache); } // Was a callback provided? diff --git a/InvenTree/templates/js/translated/order.js b/InvenTree/templates/js/translated/order.js index 1008c77909..b0e3009720 100644 --- a/InvenTree/templates/js/translated/order.js +++ b/InvenTree/templates/js/translated/order.js @@ -555,7 +555,7 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) { break; default: $(opts.modal).modal('hide'); - showApiError(xhr); + showApiError(xhr, opts.url); break; } } diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js index 261cb4d1d6..07689b7638 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -427,7 +427,7 @@ function adjustStock(action, items, options={}) { break; default: $(opts.modal).modal('hide'); - showApiError(xhr); + showApiError(xhr, opts.url); break; } }