diff --git a/CHANGELOG.md b/CHANGELOG.md index ab386ea477..c70ced72de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#11111](https://github.com/inventree/InvenTree/pull/11111) - removes legacy metadata APIs - [#9814](https://github.com/inventree/InvenTree/pull/9814) - removes legacy config path support +- [#11667](https://github.com/inventree/InvenTree/pull/11667) - removes legacy url patterns ## Unreleased - YYYY-MM-DD diff --git a/docs/docs/start/config.md b/docs/docs/start/config.md index a9ca613347..5286b2080f 100644 --- a/docs/docs/start/config.md +++ b/docs/docs/start/config.md @@ -514,7 +514,6 @@ Set the `INVENTREE_FRONTEND_SETTINGS` Environment variable to a JSON object or u | `debug` | Set the debug mode | *Server debug mode* | | `environment` | `development` or `production` | *development if Server is in debug mode* | | `show_server_selector` | In debug mode, show server selector by default. If no servers are specified, show server selector. | | -| `url_compatibility` | Support compatibility with "legacy" URLs? | `true` | | `sentry_dsn` | Set a Sentry DSN url | *Not specified* | | `mobile_mode` | Controls if InvenTree web UI can be used by mobile devices. There are 3 options: `default` - does not allow mobile devices; `allow-ignore` - shows a mobile device detected banner with a button to ignore this warning AT THE USERS OWN RISK; `allow-always` - skips the mobile check and allows mobile devices always (of course at the server admins OWN RISK) | `default` | diff --git a/docs/docs/start/processes.md b/docs/docs/start/processes.md index 826644a596..06bea14454 100644 --- a/docs/docs/start/processes.md +++ b/docs/docs/start/processes.md @@ -122,7 +122,7 @@ InvenTree uses the [Redis](https://redis.io/) cache server to manage cache data. !!! info "Redis on Docker" Docker adds an additional network layer - that might lead to lower performance than bare metal. - To optimize and configure your redis deployment follow the [official docker guide](https://redis.io/docs/getting-started/install-stack/docker/#configuration). + To optimize and configure your redis deployment follow the [official docker guide](https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/docker/). !!! tip "Enable Cache" While a redis container is provided in the default configuration, by default it is not enabled in the InvenTree server. You can enable redis cache support by following the [caching configuration guide](./config.md#caching) diff --git a/docs/docs/stock/index.md b/docs/docs/stock/index.md index d3c544a3c8..378a53e072 100644 --- a/docs/docs/stock/index.md +++ b/docs/docs/stock/index.md @@ -54,7 +54,7 @@ A stock location represents a physical real-world location where *Stock Items* a ### Icons -Stock locations can be assigned custom icons (either directly or through [Stock Location Types](#stock-location-type)). In the web interface there is a custom icon picker component available that can help to select the right icon. However in CUI the icon needs to be entered manually. +Stock locations can be assigned custom icons (either directly or through [Stock Location Types](#stock-location-type)). In the web interface there is a custom icon picker component available that can help to select the right icon. By default, the tabler icons package (with prefix: `ti`) is available. To manually select an item, search on the [tabler icons](https://tabler.io/icons) page for an icon and copy its name e.g. `bookmark`. Some icons have a filled and an outline version (if no variants are specified, it's an outline variant). Now these values can be put into the format: `::`. E.g. `ti:bookmark:outline` or `ti:bookmark:filled`. diff --git a/src/backend/InvenTree/InvenTree/config.py b/src/backend/InvenTree/InvenTree/config.py index 6f66a54f68..86ebe87339 100644 --- a/src/backend/InvenTree/InvenTree/config.py +++ b/src/backend/InvenTree/InvenTree/config.py @@ -565,15 +565,6 @@ def get_frontend_settings(debug=True): # If no servers are specified, show server selector frontend_settings['show_server_selector'] = True - # Support compatibility with "legacy" URLs? - try: - frontend_settings['url_compatibility'] = bool( - frontend_settings.get('url_compatibility', True) - ) - except Exception: - # If the value is not a boolean, set it to True - frontend_settings['url_compatibility'] = True - return frontend_settings diff --git a/src/backend/InvenTree/InvenTree/tests.py b/src/backend/InvenTree/InvenTree/tests.py index 7de3ba6d43..37497465c2 100644 --- a/src/backend/InvenTree/InvenTree/tests.py +++ b/src/backend/InvenTree/InvenTree/tests.py @@ -1789,25 +1789,3 @@ class SchemaPostprocessingTest(TestCase): self.assertNotIn('customer_detail', schemas_out.get('SalesOrder')['required']) # required key removed when empty self.assertNotIn('required', schemas_out.get('SalesOrderShipment')) - - -class URLCompatibilityTest(InvenTreeTestCase): - """Unit test for legacy URL compatibility.""" - - URL_MAPPINGS = [ - ('/index/', '/web'), - ('/part/1/', '/web/part/1/'), - ('/company/customers/', '/web/sales/index/customers'), - ('/build/3/', '/web/manufacturing/build-order/3'), - ('/stock/item/1/', '/web/stock/item/1/'), - ] - - @override_settings( - SITE_URL='http://testserver', CSRF_TRUSTED_ORIGINS=['http://testserver'] - ) - def test_legacy_urls(self): - """Test legacy URLs.""" - for old_url, new_url in self.URL_MAPPINGS: - response = self.client.get(old_url) - self.assertEqual(response.status_code, 302) - self.assertEqual(response['Location'], new_url) diff --git a/src/backend/InvenTree/InvenTree/urls.py b/src/backend/InvenTree/InvenTree/urls.py index 2820606347..89c49ca89b 100644 --- a/src/backend/InvenTree/InvenTree/urls.py +++ b/src/backend/InvenTree/InvenTree/urls.py @@ -28,7 +28,6 @@ import report.api import stock.api import users.api from plugin.urls import get_plugin_urls -from web.urls import cui_compatibility_urls from web.urls import urlpatterns as platform_urls from .api import ( @@ -182,10 +181,6 @@ urlpatterns.append( ) ) -# Compatibility layer for old (CUI) URLs -if settings.FRONTEND_SETTINGS.get('url_compatibility'): - urlpatterns += cui_compatibility_urls(settings.FRONTEND_URL_BASE) - if settings.DJANGO_SILK_ENABLED: urlpatterns += [path('silk/', include('silk.urls', namespace='silk'))] diff --git a/src/backend/InvenTree/web/urls.py b/src/backend/InvenTree/web/urls.py index b55b4937dd..2827fa257e 100644 --- a/src/backend/InvenTree/web/urls.py +++ b/src/backend/InvenTree/web/urls.py @@ -3,131 +3,10 @@ from django.conf import settings from django.urls import include, path, re_path from django.views.decorators.csrf import ensure_csrf_cookie -from django.views.generic import RedirectView, TemplateView +from django.views.generic import TemplateView spa_view = ensure_csrf_cookie(TemplateView.as_view(template_name='web/index.html')) - -def cui_compatibility_urls(base: str) -> list: - """Generate a list of URL patterns for compatibility with old (CUI) URLs. - - These URLs are provided for backwards compatibility with older versions of InvenTree, - before we moved to a SPA (Single Page Application) architecture in the 1.0.0 release. - - At some future point these may be removed? - - Args: - base (str): The base URL to use for generating the patterns. - - Returns: - list: A list of URL patterns. - """ - return [ - # Old 'index' view - reroute to the dashboard - path('index/', RedirectView.as_view(url=f'/{base}')), - path('settings/', RedirectView.as_view(url=f'/{base}/settings')), - # Company patterns - path( - 'company/', - include([ - path( - 'customers/', - RedirectView.as_view(url=f'/{base}/sales/index/customers'), - ), - path( - 'manufacturers/', - RedirectView.as_view(url=f'/{base}/purchasing/index/manufacturers'), - ), - path( - 'suppliers/', - RedirectView.as_view(url=f'/{base}/purchasing/index/suppliers'), - ), - re_path( - r'(?P\d+)/', RedirectView.as_view(url=f'/{base}/company/%(pk)s') - ), - ]), - ), - # "Part" app views - re_path( - r'^part/(?P.*)$', RedirectView.as_view(url=f'/{base}/part/%(path)s') - ), - # "Stock" app views - re_path( - r'^stock/(?P.*)$', RedirectView.as_view(url=f'/{base}/stock/%(path)s') - ), - # "Build" app views (requires some custom handling) - path( - 'build/', - include([ - re_path( - r'^(?P\d+)/', - RedirectView.as_view( - url=f'/{base}/manufacturing/build-order/%(pk)s' - ), - ), - re_path('.*', RedirectView.as_view(url=f'/{base}/manufacturing/')), - ]), - ), - # "Order" app views - path( - 'order/', - include([ - path( - 'purchase-order/', - include([ - re_path( - r'^(?P\d+)/', - RedirectView.as_view( - url=f'/{base}/purchasing/purchase-order/%(pk)s' - ), - ), - re_path( - '.*', - RedirectView.as_view( - url=f'/{base}/purchasing/index/purchaseorders/' - ), - ), - ]), - ), - path( - 'sales-order/', - include([ - re_path( - r'^(?P\d+)/', - RedirectView.as_view( - url=f'/{base}/sales/sales-order/%(pk)s' - ), - ), - re_path( - '.*', - RedirectView.as_view( - url=f'/{base}/sales/index/salesorders/' - ), - ), - ]), - ), - path( - 'return-order/', - include([ - re_path( - r'^(?P\d+)/', - RedirectView.as_view( - url=f'/{base}/sales/return-order/%(pk)s' - ), - ), - re_path( - '.*', - RedirectView.as_view( - url=f'/{base}/sales/index/returnorders/' - ), - ), - ]), - ), - ]), - ), - ] - - urlpatterns = [ path( f'{settings.FRONTEND_URL_BASE}/',