mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-20 22:06:28 +00:00
[PUI] Mantine tree (#7357)
* Refactor part category tree - New "NavigationTree" using native mantine components - Make it generic, too * Replace existing <StockLocationTree /> component * Adjust API filtering for location tree endpoint * Added playwright tests * Update api filter classes * Fix for DetailsImage - Update to @mantine/core had changed the <AspectRatio> component * fix for identifierString function * Adjust playwright tests
This commit is contained in:
src
backend
InvenTree
frontend
@ -166,3 +166,5 @@ SEARCH_ORDER_FILTER_ALIAS = [
|
||||
]
|
||||
|
||||
ORDER_FILTER = [rest_filters.DjangoFilterBackend, filters.OrderingFilter]
|
||||
|
||||
ORDER_FILTER_ALIAS = [rest_filters.DjangoFilterBackend, InvenTreeOrderingFilter]
|
||||
|
@ -26,6 +26,7 @@ from InvenTree.api import (
|
||||
)
|
||||
from InvenTree.filters import (
|
||||
ORDER_FILTER,
|
||||
ORDER_FILTER_ALIAS,
|
||||
SEARCH_ORDER_FILTER,
|
||||
SEARCH_ORDER_FILTER_ALIAS,
|
||||
InvenTreeDateFilter,
|
||||
@ -303,10 +304,12 @@ class CategoryTree(ListAPI):
|
||||
queryset = PartCategory.objects.all()
|
||||
serializer_class = part_serializers.CategoryTree
|
||||
|
||||
filter_backends = ORDER_FILTER
|
||||
filter_backends = ORDER_FILTER_ALIAS
|
||||
|
||||
ordering_fields = ['level', 'name', 'subcategories']
|
||||
|
||||
ordering_field_aliases = {'level': ['level', 'name'], 'name': ['name', 'level']}
|
||||
|
||||
# Order by tree level (top levels first) and then name
|
||||
ordering = ['level', 'name']
|
||||
|
||||
|
@ -35,7 +35,7 @@ from InvenTree.api import (
|
||||
MetadataView,
|
||||
)
|
||||
from InvenTree.filters import (
|
||||
ORDER_FILTER,
|
||||
ORDER_FILTER_ALIAS,
|
||||
SEARCH_ORDER_FILTER,
|
||||
SEARCH_ORDER_FILTER_ALIAS,
|
||||
InvenTreeDateFilter,
|
||||
@ -429,13 +429,15 @@ class StockLocationTree(ListAPI):
|
||||
queryset = StockLocation.objects.all()
|
||||
serializer_class = StockSerializers.LocationTreeSerializer
|
||||
|
||||
filter_backends = ORDER_FILTER
|
||||
filter_backends = ORDER_FILTER_ALIAS
|
||||
|
||||
ordering_fields = ['level', 'name', 'sublocations']
|
||||
|
||||
# Order by tree level (top levels first) and then name
|
||||
ordering = ['level', 'name']
|
||||
|
||||
ordering_field_aliases = {'level': ['level', 'name'], 'name': ['name', 'level']}
|
||||
|
||||
def get_queryset(self, *args, **kwargs):
|
||||
"""Return annotated queryset for the StockLocationTree endpoint."""
|
||||
queryset = super().get_queryset(*args, **kwargs)
|
||||
|
Reference in New Issue
Block a user