mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55:44 +00:00
[P-UI] Home page (#5344)
* Add new start page * [FR/P-UI] Home/Start page - widgets * load widgets dynamic * code cleanup * remove lodash * refactor and rename to WidgetLayout * Add CSS serving * removed unneeded complexity * clean up UI; switch to menu for controls * change signature * added hotkey * removed hover * removed dummy widget * Add translations * fix test * uses real data for getting started * adapted style for GettingStartedCard * added placeholder usage to GettingStartedCard
This commit is contained in:
@ -64,7 +64,7 @@ class AuthRequiredMiddleware(object):
|
||||
elif request.path_info.startswith('/accounts/'):
|
||||
authorized = True
|
||||
|
||||
elif request.path_info.startswith('/platform/') or request.path_info == '/platform':
|
||||
elif request.path_info.startswith('/platform/') or request.path_info.startswith('/assets/') or request.path_info == '/platform':
|
||||
authorized = True
|
||||
|
||||
elif 'Authorization' in request.headers.keys() or 'authorization' in request.headers.keys():
|
||||
|
@ -34,7 +34,6 @@ from report.api import report_api_urls
|
||||
from stock.api import stock_api_urls
|
||||
from stock.urls import stock_urls
|
||||
from users.api import user_urls
|
||||
from web.urls import spa_view
|
||||
from web.urls import urlpatterns as platform_urls
|
||||
|
||||
from .api import APISearchView, InfoView, NotFoundView
|
||||
@ -212,11 +211,7 @@ classic_frontendpatterns = [
|
||||
]
|
||||
|
||||
|
||||
new_frontendpatterns = [
|
||||
# Platform urls
|
||||
re_path(r'^platform/', include(platform_urls)),
|
||||
re_path(r'^platform', spa_view, name='platform'),
|
||||
]
|
||||
new_frontendpatterns = platform_urls
|
||||
|
||||
# Load patterns for frontend according to settings
|
||||
frontendpatterns = []
|
||||
|
@ -22,6 +22,7 @@ def spa_bundle():
|
||||
|
||||
manifest_data = json.load(manifest.open())
|
||||
index = manifest_data.get("index.html")
|
||||
css_index = manifest_data.get("index.css")
|
||||
|
||||
dynmanic_files = index.get("dynamicImports", [])
|
||||
imports_files = "".join(
|
||||
@ -32,5 +33,6 @@ def spa_bundle():
|
||||
)
|
||||
|
||||
return mark_safe(
|
||||
f"""<script type="module" src="{settings.STATIC_URL}web/{index['file']}"></script>{imports_files}"""
|
||||
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}"""
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""URLs for web app."""
|
||||
from django.conf import settings
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import path, re_path
|
||||
from django.urls import include, path, re_path
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
@ -20,8 +20,12 @@ spa_view = ensure_csrf_cookie(TemplateView.as_view(template_name="web/index.html
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('platform/', include([
|
||||
path("assets/<path:path>", RedirectAssetView.as_view()),
|
||||
re_path(r"^(?P<path>.*)/$", spa_view),
|
||||
path("set-password?uid=<uid>&token=<token>", spa_view, name="password_reset_confirm"),
|
||||
path("", spa_view),]
|
||||
)),
|
||||
re_path(r'^platform', spa_view, name='platform'),
|
||||
path("assets/<path:path>", RedirectAssetView.as_view()),
|
||||
re_path(r"^(?P<path>.*)/$", spa_view),
|
||||
path("set-password?uid=<uid>&token=<token>", spa_view, name="password_reset_confirm"),
|
||||
path("", spa_view),
|
||||
]
|
||||
|
Reference in New Issue
Block a user