mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
[P_UI] Added django settings for p_ui (#5343)
* Added django settings for pui * Fix: server version is not loaded on initial load * Moved server version out of server selector icon * Use polling only for WSL * Added comment and extracted to constant instead of function * Default show server selector to false if not in dev mode * Refactored hostList settings * Move json serialization into global scope * Show server selector in netlify builds * Use demo server for netlify * Renamed netilfy mode to dev or demo mode * Translate for netlify * Dont use translation in main as the are not working there
This commit is contained in:
@ -979,6 +979,10 @@ CUSTOM_LOGO = get_custom_file('INVENTREE_CUSTOM_LOGO', 'customize.logo', 'custom
|
||||
CUSTOM_SPLASH = get_custom_file('INVENTREE_CUSTOM_SPLASH', 'customize.splash', 'custom splash')
|
||||
|
||||
CUSTOMIZE = get_setting('INVENTREE_CUSTOMIZE', 'customize', {})
|
||||
|
||||
# Frontend settings
|
||||
PUI_SETTINGS = get_setting("INVENTREE_PUI_SETTINGS", "pui_settings", {})
|
||||
|
||||
if DEBUG:
|
||||
logger.info("InvenTree running with DEBUG enabled")
|
||||
|
||||
|
@ -240,6 +240,15 @@ remote_login_header: HTTP_REMOTE_USER
|
||||
# hide_admin_link: true
|
||||
# hide_password_reset: true
|
||||
|
||||
# Platform UI options
|
||||
# pui_settings:
|
||||
# server_list:
|
||||
# my_server1:
|
||||
# host: https://demo.inventree.org/api/
|
||||
# name: InvenTree Demo
|
||||
# default_server: my_server1
|
||||
# show_server_selector: false
|
||||
|
||||
# Custom flags
|
||||
# InvenTree uses django-flags; read more in their docs at https://cfpb.github.io/django-flags/conditions/
|
||||
# Use environment variable INVENTREE_FLAGS or the settings below
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
{% spa_settings %}
|
||||
{% spa_bundle %}
|
||||
</body>
|
||||
|
||||
|
@ -7,9 +7,11 @@ from django import template
|
||||
from django.conf import settings
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
logger = getLogger("gwaesser_backend")
|
||||
logger = getLogger("InvenTree")
|
||||
register = template.Library()
|
||||
|
||||
PUI_SETTINGS = json.dumps(settings.PUI_SETTINGS)
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def spa_bundle():
|
||||
@ -36,3 +38,9 @@ def spa_bundle():
|
||||
f"""<link rel="stylesheet" href="{settings.STATIC_URL}web/{css_index['file']}" />
|
||||
<script type="module" src="{settings.STATIC_URL}web/{index['file']}"></script>{imports_files}"""
|
||||
)
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def spa_settings():
|
||||
"""Render settings for spa."""
|
||||
return mark_safe(f"""<script>window.INVENTREE_SETTINGS={PUI_SETTINGS}</script>""")
|
||||
|
Reference in New Issue
Block a user