mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge remote-tracking branch 'inventree/master' into stock-item-forms
This commit is contained in:
commit
be543ca3da
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,31 +1,47 @@
|
|||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug
|
||||||
about: Create a bug report to help us improve InvenTree
|
about: Create a bug report to help us improve InvenTree!
|
||||||
title: "[BUG] Enter bug description"
|
title: "[BUG] Enter bug description"
|
||||||
labels: bug, question
|
labels: bug, question
|
||||||
assignees: ''
|
assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Describe the bug**
|
<!---
|
||||||
A clear and concise description of what the bug is.
|
Everything inside these brackets is hidden - please remove them where you fill out information.
|
||||||
|
--->
|
||||||
|
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
<!---
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
--->
|
||||||
|
|
||||||
|
**Steps to Reproduce**
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior:
|
Steps to reproduce the behavior:
|
||||||
|
<!---
|
||||||
1. Go to '...'
|
1. Go to '...'
|
||||||
2. Click on '....'
|
2. Click on '....'
|
||||||
3. Scroll down to '....'
|
3. Scroll down to '....'
|
||||||
4. See error
|
4. See error
|
||||||
|
--->
|
||||||
|
|
||||||
**Expected behavior**
|
**Expected behavior**
|
||||||
|
<!---
|
||||||
A clear and concise description of what you expected to happen.
|
A clear and concise description of what you expected to happen.
|
||||||
|
--->
|
||||||
|
|
||||||
|
<!---
|
||||||
**Screenshots**
|
**Screenshots**
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
--->
|
||||||
|
|
||||||
**Deployment Method**
|
**Deployment Method**
|
||||||
Docker
|
- [ ] Docker
|
||||||
Bare Metal
|
- [ ] Bare Metal
|
||||||
|
|
||||||
**Version Information**
|
**Version Information**
|
||||||
You can get this by going to the "About InvenTree" section in the upper right corner and cicking on to the "copy version information"
|
<!---
|
||||||
|
You can get this by going to the "About InvenTree" section in the upper right corner and clicking on to the "copy version information"
|
||||||
|
--->
|
||||||
|
@ -28,9 +28,8 @@
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
padding-bottom: 35px;
|
padding-bottom: 35px;
|
||||||
background-color: rgba(50, 50, 50, 0.75);
|
background-color: rgba(50, 50, 50, 0.75);
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 330px;
|
max-width: 550px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
{% load inventree_extras %}
|
|
||||||
|
|
||||||
/* globals
|
/* globals
|
||||||
ClipboardJS,
|
ClipboardJS,
|
||||||
inventreeFormDataUpload,
|
inventreeFormDataUpload,
|
||||||
@ -130,6 +128,7 @@ function inventreeDocReady() {
|
|||||||
attachClipboard('.clip-btn-version', 'modal-about', 'about-copy-text');
|
attachClipboard('.clip-btn-version', 'modal-about', 'about-copy-text');
|
||||||
|
|
||||||
// Add autocomplete to the search-bar
|
// Add autocomplete to the search-bar
|
||||||
|
if ($('#search-bar').exists()) {
|
||||||
$('#search-bar').autocomplete({
|
$('#search-bar').autocomplete({
|
||||||
source: function(request, response) {
|
source: function(request, response) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -190,6 +189,7 @@ function inventreeDocReady() {
|
|||||||
'ui-autocomplete': 'dropdown-menu search-menu',
|
'ui-autocomplete': 'dropdown-menu search-menu',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Generate brand-icons
|
// Generate brand-icons
|
||||||
$('.brand-icon').each(function(i, obj) {
|
$('.brand-icon').each(function(i, obj) {
|
||||||
@ -202,6 +202,9 @@ function inventreeDocReady() {
|
|||||||
|
|
||||||
location.href = url;
|
location.href = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Display any cached alert messages
|
||||||
|
showCachedAlerts();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isFileTransfer(transfer) {
|
function isFileTransfer(transfer) {
|
@ -1,10 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Add a cached alert message to sesion storage
|
||||||
|
*/
|
||||||
|
function addCachedAlert(message, style) {
|
||||||
|
|
||||||
function showAlertOrCache(alertType, message, cache, timeout=5000) {
|
var alerts = sessionStorage.getItem('inventree-alerts');
|
||||||
if (cache) {
|
|
||||||
sessionStorage.setItem("inventree-" + alertType, message);
|
if (alerts) {
|
||||||
|
alerts = JSON.parse(alerts);
|
||||||
|
} else {
|
||||||
|
alerts = [];
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
showMessage('#' + alertType, message, timeout);
|
alerts.push({
|
||||||
|
message: message,
|
||||||
|
style: style
|
||||||
|
});
|
||||||
|
|
||||||
|
sessionStorage.setItem('inventree-alerts', JSON.stringify(alerts));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove all cached alert messages
|
||||||
|
*/
|
||||||
|
function clearCachedAlerts() {
|
||||||
|
sessionStorage.removeItem('inventree-alerts');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display an alert, or cache to display on reload
|
||||||
|
*/
|
||||||
|
function showAlertOrCache(message, style, cache=false) {
|
||||||
|
|
||||||
|
if (cache) {
|
||||||
|
addCachedAlert(message, style);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
showMessage(message, {style: style});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,25 +47,13 @@ function showAlertOrCache(alertType, message, cache, timeout=5000) {
|
|||||||
*/
|
*/
|
||||||
function showCachedAlerts() {
|
function showCachedAlerts() {
|
||||||
|
|
||||||
var styles = [
|
var alerts = JSON.parse(sessionStorage.getItem('inventree-alerts')) || [];
|
||||||
'primary',
|
|
||||||
'secondary',
|
|
||||||
'success',
|
|
||||||
'info',
|
|
||||||
'warning',
|
|
||||||
'danger',
|
|
||||||
];
|
|
||||||
|
|
||||||
styles.forEach(function(style) {
|
alerts.forEach(function(alert) {
|
||||||
|
showMessage(alert.message, {style: alert.style});
|
||||||
var msg = sessionStorage.getItem(`inventree-alert-${style}`);
|
|
||||||
|
|
||||||
if (msg) {
|
|
||||||
showMessage(msg, {
|
|
||||||
style: style,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
clearCachedAlerts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -54,6 +75,12 @@ function showMessage(message, options={}) {
|
|||||||
|
|
||||||
var timeout = options.timeout || 5000;
|
var timeout = options.timeout || 5000;
|
||||||
|
|
||||||
|
var details = '';
|
||||||
|
|
||||||
|
if (options.details) {
|
||||||
|
details = `<p><small>${options.details}</p></small>`;
|
||||||
|
}
|
||||||
|
|
||||||
// Hacky function to get the next available ID
|
// Hacky function to get the next available ID
|
||||||
var id = 1;
|
var id = 1;
|
||||||
|
|
||||||
@ -64,14 +91,15 @@ function showMessage(message, options={}) {
|
|||||||
var icon = '';
|
var icon = '';
|
||||||
|
|
||||||
if (options.icon) {
|
if (options.icon) {
|
||||||
icon = `<span class='${options.icon}></span>`;
|
icon = `<span class='${options.icon}'></span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct the alert
|
// Construct the alert
|
||||||
var html = `
|
var html = `
|
||||||
<div id='alert-${id}' class='alert alert-${style} alert-dismissible fade show' role='alert'>
|
<div id='alert-${id}' class='alert alert-${style} alert-dismissible fade show' role='alert'>
|
||||||
${icon}
|
${icon}
|
||||||
${message}
|
<b>${message}</b>
|
||||||
|
${details}
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@ -94,7 +94,6 @@ settings_urls = [
|
|||||||
|
|
||||||
# These javascript files are served "dynamically" - i.e. rendered on demand
|
# These javascript files are served "dynamically" - i.e. rendered on demand
|
||||||
dynamic_javascript_urls = [
|
dynamic_javascript_urls = [
|
||||||
url(r'^inventree.js', DynamicJsView.as_view(template_name='js/dynamic/inventree.js'), name='inventree.js'),
|
|
||||||
url(r'^calendar.js', DynamicJsView.as_view(template_name='js/dynamic/calendar.js'), name='calendar.js'),
|
url(r'^calendar.js', DynamicJsView.as_view(template_name='js/dynamic/calendar.js'), name='calendar.js'),
|
||||||
url(r'^nav.js', DynamicJsView.as_view(template_name='js/dynamic/nav.js'), name='nav.js'),
|
url(r'^nav.js', DynamicJsView.as_view(template_name='js/dynamic/nav.js'), name='nav.js'),
|
||||||
url(r'^settings.js', DynamicJsView.as_view(template_name='js/dynamic/settings.js'), name='settings.js'),
|
url(r'^settings.js', DynamicJsView.as_view(template_name='js/dynamic/settings.js'), name='settings.js'),
|
||||||
|
@ -10,6 +10,26 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<!-- Favicon -->
|
||||||
|
<link rel="apple-touch-icon" sizes="57x57" href="{% static 'img/favicon/apple-icon-57x57.png' %}">
|
||||||
|
<link rel="apple-touch-icon" sizes="60x60" href="{% static 'img/favicon/apple-icon-60x60.png' %}">
|
||||||
|
<link rel="apple-touch-icon" sizes="72x72" href="{% static 'img/favicon/apple-icon-72x72.png' %}">
|
||||||
|
<link rel="apple-touch-icon" sizes="76x76" href="{% static 'img/favicon/apple-icon-76x76.png' %}">
|
||||||
|
<link rel="apple-touch-icon" sizes="114x114" href="{% static 'img/favicon/apple-icon-114x114.png' %}">
|
||||||
|
<link rel="apple-touch-icon" sizes="120x120" href="{% static 'img/favicon/apple-icon-120x120.png' %}">
|
||||||
|
<link rel="apple-touch-icon" sizes="144x144" href="{% static 'img/favicon/apple-icon-144x144.png' %}">
|
||||||
|
<link rel="apple-touch-icon" sizes="152x152" href="{% static 'img/favicon/apple-icon-152x152.png' %}">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'img/favicon/apple-icon-180x180.png' %}">
|
||||||
|
<link rel="icon" type="image/png" sizes="192x192" href="{% static 'img/favicon/android-icon-192x192.png' %}">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'img/favicon/favicon-32x32.png' %}">
|
||||||
|
<link rel="icon" type="image/png" sizes="96x96" href="{% static 'img/favicon/favicon-96x96.png' %}">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'img/favicon/favicon-16x16.png' %}">
|
||||||
|
<link rel="manifest" href="{% static 'img/favicon/manifest.json' %}">
|
||||||
|
<meta name="msapplication-TileColor" content="#ffffff">
|
||||||
|
<meta name="msapplication-TileImage" content="{% static 'img/favicon/ms-icon-144x144.png' %}">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<link rel="stylesheet" href="{% static 'fontawesome/css/brands.css' %}">
|
<link rel="stylesheet" href="{% static 'fontawesome/css/brands.css' %}">
|
||||||
<link rel="stylesheet" href="{% static 'fontawesome/css/solid.css' %}">
|
<link rel="stylesheet" href="{% static 'fontawesome/css/solid.css' %}">
|
||||||
@ -33,16 +53,23 @@
|
|||||||
<!--
|
<!--
|
||||||
Background Image Attribution: https://unsplash.com/photos/Ixvv3YZkd7w
|
Background Image Attribution: https://unsplash.com/photos/Ixvv3YZkd7w
|
||||||
-->
|
-->
|
||||||
|
<div class='container-fluid'>
|
||||||
|
<div class='notification-area' id='alerts'>
|
||||||
|
<!-- Div for displayed alerts -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class='main body-wrapper login-screen d-flex'>
|
<div class='main body-wrapper login-screen d-flex'>
|
||||||
|
|
||||||
|
|
||||||
<div class='login-container'>
|
<div class='login-container'>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class='container-fluid'>
|
<div class='container-fluid'>
|
||||||
|
|
||||||
<div class='clearfix content-heading login-header'>
|
<div class='clearfix content-heading login-header d-flex flex-wrap'>
|
||||||
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
|
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
|
||||||
<span><h3>{% inventree_title %}</h3></span>
|
{% include "spacer.html" %}
|
||||||
|
<span class='float-right'><h3>{% inventree_title %}</h3></span>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class='container-fluid'>{% block content %}{% endblock %}</div>
|
<div class='container-fluid'>{% block content %}{% endblock %}</div>
|
||||||
@ -52,22 +79,31 @@
|
|||||||
|
|
||||||
{% block extra_body %}
|
{% block extra_body %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% include 'notification.html' %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script type="text/javascript" src="{% static 'script/jquery_3.3.1_jquery.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'script/jquery_3.3.1_jquery.min.js' %}"></script>
|
||||||
|
<script type='text/javascript' src="{% static 'script/jquery-ui/jquery-ui.min.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script>
|
||||||
|
|
||||||
<!-- general InvenTree -->
|
<!-- general InvenTree -->
|
||||||
|
<script type='text/javascript' src="{% static 'script/inventree/inventree.js' %}"></script>
|
||||||
<script type='text/javascript' src="{% static 'script/inventree/notification.js' %}"></script>
|
<script type='text/javascript' src="{% static 'script/inventree/notification.js' %}"></script>
|
||||||
|
|
||||||
<!-- dynamic javascript templates -->
|
<!-- fontawesome -->
|
||||||
<script type='text/javascript' src="{% url 'inventree.js' %}"></script>
|
|
||||||
|
|
||||||
<script type='text/javascript' src="{% static 'fontawesome/js/solid.js' %}"></script>
|
<script type='text/javascript' src="{% static 'fontawesome/js/solid.js' %}"></script>
|
||||||
<script type='text/javascript' src="{% static 'fontawesome/js/brands.js' %}"></script>
|
<script type='text/javascript' src="{% static 'fontawesome/js/brands.js' %}"></script>
|
||||||
<script type='text/javascript' src="{% static 'fontawesome/js/fontawesome.js' %}"></script>
|
<script type='text/javascript' src="{% static 'fontawesome/js/fontawesome.js' %}"></script>
|
||||||
|
|
||||||
|
<!-- 3rd party general js -->
|
||||||
|
<script type="text/javascript" src="{% static 'fullcalendar/main.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'fullcalendar/locales-all.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'select2/js/select2.full.js' %}"></script>
|
||||||
|
<script type='text/javascript' src="{% static 'script/moment.js' %}"></script>
|
||||||
|
<script type='text/javascript' src="{% static 'script/chart.min.js' %}"></script>
|
||||||
|
<script type='text/javascript' src="{% static 'script/clipboard.min.js' %}"></script>
|
||||||
|
<script type='text/javascript' src="{% static 'script/randomColor.min.js' %}"></script>
|
||||||
|
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
|
|
||||||
@ -75,12 +111,10 @@ $(document).ready(function () {
|
|||||||
// notifications
|
// notifications
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
{% for message in messages %}
|
{% for message in messages %}
|
||||||
showAlertOrCache('alert-info', '{{message}}', true);
|
showAlertOrCache('{{ message }}', 'info', true);
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
showCachedAlerts();
|
|
||||||
|
|
||||||
inventreeDocReady();
|
inventreeDocReady();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,12 +32,12 @@ for a account and sign in below:{% endblocktrans %}</p>
|
|||||||
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="btn-toolbar">
|
<div class="btn-group float-right" role="group">
|
||||||
<button class="btn btn-primary col-md-8" type="submit">{% trans "Sign In" %}</button>
|
<button class="btn btn-success" type="submit">{% trans "Sign In" %}</button>
|
||||||
|
</div>
|
||||||
{% if mail_conf and enable_pwd_forgot %}
|
{% if mail_conf and enable_pwd_forgot %}
|
||||||
<a class="btn btn-primary" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
|
<a class="" href="{% url 'account_reset_password' %}"><small>{% trans "Forgot Password?" %}</small></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% if enable_sso %}
|
{% if enable_sso %}
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
{% if redirect_field_value %}
|
{% if redirect_field_value %}
|
||||||
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
|
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<button type="submit" class="btn btn-primary btn-block">{% trans 'Sign Out' %}</button>
|
<div class='btn-group float-right' role='group'>
|
||||||
|
<a type='button' class='btn btn-secondary' href='{% url "index" %}'><span class='fas fa-undo-alt'></span> {% trans "Back to Site" %}</a>
|
||||||
|
<button type="submit" class="btn btn-danger btn-block">{% trans 'Sign Out' %}</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
<form method="POST" action="{{ action_url }}">
|
<form method="POST" action="{{ action_url }}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
<input type="submit" name="action" class="btn btn-primary btn-block" value="{% trans 'change password' %}"/>
|
<div class='btn-group float-right' role='group'>
|
||||||
|
<input type="submit" name="action" class="btn btn-success" value="{% trans 'Change password' %}"/>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>{% trans 'Your password is now changed.' %}</p>
|
<p>{% trans 'Your password is now changed.' %}</p>
|
||||||
|
@ -141,9 +141,9 @@
|
|||||||
|
|
||||||
<!-- general InvenTree -->
|
<!-- general InvenTree -->
|
||||||
<script type='text/javascript' src="{% static 'script/inventree/notification.js' %}"></script>
|
<script type='text/javascript' src="{% static 'script/inventree/notification.js' %}"></script>
|
||||||
|
<script type='text/javascript' src="{% static 'script/inventree/inventree.js' %}"></script>
|
||||||
|
|
||||||
<!-- dynamic javascript templates -->
|
<!-- dynamic javascript templates -->
|
||||||
<script type='text/javascript' src="{% url 'inventree.js' %}"></script>
|
|
||||||
<script type='text/javascript' src="{% url 'calendar.js' %}"></script>
|
<script type='text/javascript' src="{% url 'calendar.js' %}"></script>
|
||||||
<script type='text/javascript' src="{% url 'nav.js' %}"></script>
|
<script type='text/javascript' src="{% url 'nav.js' %}"></script>
|
||||||
<script type='text/javascript' src="{% url 'settings.js' %}"></script>
|
<script type='text/javascript' src="{% url 'settings.js' %}"></script>
|
||||||
@ -183,15 +183,13 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
inventreeDocReady();
|
inventreeDocReady();
|
||||||
|
|
||||||
showCachedAlerts();
|
|
||||||
|
|
||||||
{% if barcodes %}
|
{% if barcodes %}
|
||||||
$('#barcode-scan').click(function() {
|
$('#barcode-scan').click(function() {
|
||||||
barcodeScanDialog();
|
barcodeScanDialog();
|
||||||
});
|
});
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
moment.locale('{{request.LANGUAGE_CODE}}');
|
moment.locale('{{ request.LANGUAGE_CODE }}');
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
{% load inventree_extras %}
|
{% load inventree_extras %}
|
||||||
|
|
||||||
/* globals
|
/* globals
|
||||||
renderErrorMessage,
|
|
||||||
showAlertDialog,
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* exported
|
/* exported
|
||||||
@ -68,6 +66,8 @@ function inventreeGet(url, filters={}, options={}) {
|
|||||||
options.error({
|
options.error({
|
||||||
error: thrownError
|
error: thrownError
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
showApiError(xhr, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -104,6 +104,8 @@ function inventreeFormDataUpload(url, data, options={}) {
|
|||||||
|
|
||||||
if (options.error) {
|
if (options.error) {
|
||||||
options.error(xhr, status, error);
|
options.error(xhr, status, error);
|
||||||
|
} else {
|
||||||
|
showApiError(xhr, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -139,6 +141,8 @@ function inventreePut(url, data={}, options={}) {
|
|||||||
} else {
|
} else {
|
||||||
console.error(`Error on ${method} to '${url}' - STATUS ${xhr.status}`);
|
console.error(`Error on ${method} to '${url}' - STATUS ${xhr.status}`);
|
||||||
console.error(thrownError);
|
console.error(thrownError);
|
||||||
|
|
||||||
|
showApiError(xhr, url);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function(xhr, status) {
|
complete: function(xhr, status) {
|
||||||
@ -162,8 +166,10 @@ function inventreeDelete(url, options={}) {
|
|||||||
return inventreePut(url, {}, options);
|
return inventreePut(url, {}, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function showApiError(xhr) {
|
* Display a notification with error information
|
||||||
|
*/
|
||||||
|
function showApiError(xhr, url) {
|
||||||
|
|
||||||
var title = null;
|
var title = null;
|
||||||
var message = null;
|
var message = null;
|
||||||
@ -208,7 +214,11 @@ function showApiError(xhr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message += '<hr>';
|
message += '<hr>';
|
||||||
message += renderErrorMessage(xhr);
|
message += `URL: ${url}`;
|
||||||
|
|
||||||
showAlertDialog(title, message);
|
showMessage(title, {
|
||||||
|
style: 'danger',
|
||||||
|
icon: 'fas fa-server icon-red',
|
||||||
|
details: message,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -480,10 +480,10 @@ function barcodeCheckIn(location_id) {
|
|||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
if (status == 'success' && 'success' in response) {
|
if (status == 'success' && 'success' in response) {
|
||||||
|
|
||||||
showAlertOrCache('alert-success', response.success, true);
|
showAlertOrCache(response.success, 'success', true);
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} 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');
|
$(modal).modal('hide');
|
||||||
|
|
||||||
if (status == 'success' && 'success' in response) {
|
if (status == 'success' && 'success' in response) {
|
||||||
showAlertOrCache('alert-success', response.success, true);
|
showAlertOrCache(response.success, 'success', true);
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
showAlertOrCache('alert-danger', '{% trans "Error transferring stock" %}', false);
|
showAlertOrCache('{% trans "Error transferring stock" %}', 'danger', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ function completeBuildOutputs(build_id, outputs, options={}) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$(opts.modal).modal('hide');
|
$(opts.modal).modal('hide');
|
||||||
showApiError(xhr);
|
showApiError(xhr, opts.url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1527,7 +1527,7 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$(opts.modal).modal('hide');
|
$(opts.modal).modal('hide');
|
||||||
showApiError(xhr);
|
showApiError(xhr, opts.url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,9 +125,10 @@ function getApiEndpointOptions(url, callback) {
|
|||||||
json: 'application/json',
|
json: 'application/json',
|
||||||
},
|
},
|
||||||
success: callback,
|
success: callback,
|
||||||
error: function() {
|
error: function(xhr) {
|
||||||
// TODO: Handle error
|
// TODO: Handle error
|
||||||
console.log(`ERROR in getApiEndpointOptions at '${url}'`);
|
console.log(`ERROR in getApiEndpointOptions at '${url}'`);
|
||||||
|
showApiError(xhr, url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -216,9 +217,11 @@ function constructChangeForm(fields, options) {
|
|||||||
|
|
||||||
constructFormBody(fields, options);
|
constructFormBody(fields, options);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function(xhr) {
|
||||||
// TODO: Handle error here
|
// TODO: Handle error here
|
||||||
console.log(`ERROR in constructChangeForm at '${options.url}'`);
|
console.log(`ERROR in constructChangeForm at '${options.url}'`);
|
||||||
|
|
||||||
|
showApiError(xhr, options.url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -255,9 +258,11 @@ function constructDeleteForm(fields, options) {
|
|||||||
|
|
||||||
constructFormBody(fields, options);
|
constructFormBody(fields, options);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function(xhr) {
|
||||||
// TODO: Handle error here
|
// TODO: Handle error here
|
||||||
console.log(`ERROR in constructDeleteForm at '${options.url}`);
|
console.log(`ERROR in constructDeleteForm at '${options.url}`);
|
||||||
|
|
||||||
|
showApiError(xhr, options.url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -722,7 +727,7 @@ function submitFormData(fields, options) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$(options.modal).modal('hide');
|
$(options.modal).modal('hide');
|
||||||
showApiError(xhr);
|
showApiError(xhr, options.url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -899,19 +904,19 @@ function handleFormSuccess(response, options) {
|
|||||||
|
|
||||||
// Display any messages
|
// Display any messages
|
||||||
if (response && response.success) {
|
if (response && response.success) {
|
||||||
showAlertOrCache('alert-success', response.success, cache);
|
showAlertOrCache(response.success, 'success', cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response && response.info) {
|
if (response && response.info) {
|
||||||
showAlertOrCache('alert-info', response.info, cache);
|
showAlertOrCache(response.info, 'info', cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response && response.warning) {
|
if (response && response.warning) {
|
||||||
showAlertOrCache('alert-warning', response.warning, cache);
|
showAlertOrCache(response.warning, 'warning', cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response && response.danger) {
|
if (response && response.danger) {
|
||||||
showAlertOrCache('alert-danger', response.danger, cache);
|
showAlertOrCache(response.danger, 'dagner', cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.onSuccess) {
|
if (options.onSuccess) {
|
||||||
|
@ -399,19 +399,19 @@ function afterForm(response, options) {
|
|||||||
|
|
||||||
// Display any messages
|
// Display any messages
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
showAlertOrCache('alert-success', response.success, cache);
|
showAlertOrCache(response.success, 'success', cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.info) {
|
if (response.info) {
|
||||||
showAlertOrCache('alert-info', response.info, cache);
|
showAlertOrCache(response.info, 'info', cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.warning) {
|
if (response.warning) {
|
||||||
showAlertOrCache('alert-warning', response.warning, cache);
|
showAlertOrCache(response.warning, 'warning', cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.danger) {
|
if (response.danger) {
|
||||||
showAlertOrCache('alert-danger', response.danger, cache);
|
showAlertOrCache(response.danger, 'danger', cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Was a callback provided?
|
// Was a callback provided?
|
||||||
|
@ -555,7 +555,7 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$(opts.modal).modal('hide');
|
$(opts.modal).modal('hide');
|
||||||
showApiError(xhr);
|
showApiError(xhr, opts.url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ function adjustStock(action, items, options={}) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$(opts.modal).modal('hide');
|
$(opts.modal).modal('hide');
|
||||||
showApiError(xhr);
|
showApiError(xhr, opts.url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user