2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 20:45:44 +00:00

[PUI] Added Server Info Modal (#5810)

* updated typing to allow either link or action

* fixed typing

* made it possible to use an action instead of a link

* added ServerInfo Modal skeleton

* fixed anchor

* added content to ServerInfo

* Factored database lookup out

* Extended status API to CUI level

* extended ServerInfo to CUI level

* Made modal larger

* fixed default settings
This commit is contained in:
Matthias Mair
2023-10-29 23:56:07 +01:00
committed by GitHub
parent 7ff3f99dc9
commit 8aad3eeefa
11 changed files with 257 additions and 33 deletions

View File

@ -18,10 +18,11 @@ from InvenTree.permissions import RolePermission
from part.templatetags.inventree_extras import plugins_info
from plugin.serializers import MetadataSerializer
from .email import is_email_configured
from .mixins import RetrieveUpdateAPI
from .status import is_worker_running
from .version import (inventreeApiVersion, inventreeInstanceName,
inventreeVersion)
from .status import check_system_health, is_worker_running
from .version import (inventreeApiVersion, inventreeDatabase,
inventreeInstanceName, inventreeVersion)
from .views import AjaxView
@ -48,6 +49,11 @@ class InfoView(AjaxView):
'worker_pending_tasks': self.worker_pending_tasks(),
'plugins_enabled': settings.PLUGINS_ENABLED,
'active_plugins': plugins_info(),
'email_configured': is_email_configured(),
'debug_mode': settings.DEBUG,
'docker_mode': settings.DOCKER,
'system_health': check_system_health() if request.user.is_staff else None,
'database': inventreeDatabase()if request.user.is_staff else None
}
return JsonResponse(data)

View File

@ -2,11 +2,14 @@
# InvenTree API version
INVENTREE_API_VERSION = 142
INVENTREE_API_VERSION = 143
"""
Increment this API version number whenever there is a significant change to the API that any clients need to know about
v143 -> 2023-10-29: https://github.com/inventree/InvenTree/pull/5810
- Extends the status endpoint to include information about system status and health
v142 -> 2023-10-20: https://github.com/inventree/InvenTree/pull/5759
- Adds generic API endpoints for looking up status models

View File

@ -199,3 +199,9 @@ def inventreeTarget():
def inventreePlatform():
"""Returns the platform for the instance."""
return platform.platform(aliased=True)
def inventreeDatabase():
"""Return the InvenTree database backend e.g. 'postgresql'."""
db = settings.DATABASES['default']
return db.get('ENGINE', None).replace('django.db.backends.', '')

View File

@ -183,13 +183,7 @@ def plugins_info(*args, **kwargs):
@register.simple_tag()
def inventree_db_engine(*args, **kwargs):
"""Return the InvenTree database backend e.g. 'postgresql'."""
db = djangosettings.DATABASES['default']
engine = db.get('ENGINE', _('Unknown database'))
engine = engine.replace('django.db.backends.', '')
return engine
return version.inventreeDatabase() or _('Unknown database')
@register.simple_tag()