mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use InstanceName around the place
- Report in /api/ endpoint - Display in About window - Include in any generated barcode
This commit is contained in:
parent
071c317bae
commit
751937e0c2
@ -13,6 +13,8 @@ from django.http import StreamingHttpResponse
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from .version import inventreeVersion, inventreeInstanceName
|
||||
|
||||
|
||||
def TestIfImage(img):
|
||||
""" Test if an image file is indeed an image """
|
||||
@ -134,6 +136,8 @@ def MakeBarcode(object_type, object_id, object_url, data={}):
|
||||
data['id'] = object_id
|
||||
data['url'] = object_url
|
||||
data['tool'] = 'InvenTree'
|
||||
data['instance'] = inventreeInstanceName()
|
||||
data['version'] = inventreeVersion()
|
||||
|
||||
return json.dumps(data, sort_keys=True)
|
||||
|
||||
|
@ -3,9 +3,15 @@ Provides information on the current InvenTree version
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
from common.models import InvenTreeSetting
|
||||
|
||||
|
||||
INVENTREE_SW_VERSION = "0.0.10"
|
||||
|
||||
def inventreeInstanceName():
|
||||
""" Returns the InstanceName settings for the current database """
|
||||
return InvenTreeSetting.get_setting("InstanceName", "")
|
||||
|
||||
|
||||
def inventreeVersion():
|
||||
""" Returns the InvenTree version string """
|
||||
|
@ -22,7 +22,7 @@ from common.models import InvenTreeSetting
|
||||
|
||||
from .forms import DeleteForm, EditUserForm, SetPasswordForm
|
||||
from .helpers import str2bool
|
||||
from .version import inventreeVersion
|
||||
from .version import inventreeVersion, inventreeInstanceName
|
||||
|
||||
from rest_framework import views
|
||||
|
||||
@ -422,7 +422,8 @@ class InfoView(AjaxView):
|
||||
|
||||
data = {
|
||||
'server': 'InvenTree',
|
||||
'version': inventreeVersion()
|
||||
'version': inventreeVersion(),
|
||||
'instance': inventreeInstanceName(),
|
||||
}
|
||||
|
||||
return JsonResponse(data)
|
||||
|
@ -43,6 +43,12 @@ def part_allocation_count(build, part, *args, **kwargs):
|
||||
return decimal2string(build.getAllocatedQuantity(part))
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def inventree_instance_name(*args, **kwargs):
|
||||
""" Return the InstanceName associated with the current database """
|
||||
return version.inventreeInstanceName()
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def inventree_version(*args, **kwargs):
|
||||
""" Return InvenTree version string """
|
||||
|
@ -10,35 +10,41 @@
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<img src="{% static 'img/inventree.png' %}" height='60' style='float: left;' alt='Inventree Logo'>
|
||||
<h3>{% trans "InvenTree Version Information" %}</h3>
|
||||
</div>
|
||||
<div class='modal-form-content'>
|
||||
<div>
|
||||
<!--
|
||||
-->
|
||||
<h4>{% trans "InvenTree Version Information" %}</h4>
|
||||
<table class='table table-striped table-condensed'>
|
||||
<tr>
|
||||
<td>{% trans "Version" %}</td><td><a href="https://github.com/inventree/InvenTree/releases">{% inventree_version %}</a></td>
|
||||
<td></td>
|
||||
<td>{% trans "Instance Name" %}</td>
|
||||
<td>{% inventree_instance_name %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>{% trans "InvenTree Version" %}</td><td><a href="https://github.com/inventree/InvenTree/releases">{% inventree_version %}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-code-branch'></span></td>
|
||||
<td>{% trans "Commit Hash" %}</td><td><a href="https://github.com/inventree/InvenTree/commit/{% inventree_commit_hash %}">{% inventree_commit_hash %}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Commit Date" %}</td><td>{% inventree_commit_date %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-book'></span></td>
|
||||
<td>{% trans "InvenTree Documentation" %}</td>
|
||||
<td><a href="{% inventree_docs_url %}">{% inventree_docs_url %}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-github'></span></td>
|
||||
<td>{% trans "View Code on GitHub" %}</td><td><a href="{% inventree_github_url %}">{% inventree_github_url %}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><a href='https://github.com/inventree/InvenTree/issues'><button class='btn btn-default'>Submit Bug Report</button></a></td>
|
||||
<td><span class='fas fa-exclamation-circle'></span></td>
|
||||
<td>{% trans "Submit Bug Report" %}</td>
|
||||
<td><a href='{% inventree_github_url %}/issues'>{% inventree_github_url %}/issues</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="{% static 'fontawesome/css/solid.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'fontawesome/css/brands.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/bootstrap_3.3.7_css_bootstrap.min.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/bootstrap-table.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/bootstrap-table-group-by.css' %}">
|
||||
@ -108,6 +109,7 @@ InvenTree
|
||||
<script type='text/javascript' src="{% static 'script/inventree/sidenav.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/fontawesome.js' %}"></script>
|
||||
|
||||
{% block js_load %}
|
||||
|
Loading…
Reference in New Issue
Block a user