-
Notifications
You must be signed in to change notification settings - Fork 4
AAP-57069 Optimize initial loading #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4a881ac
Improve performance of filter data loading
kcagran 5d399d4
Update UI to match optimized filter loading
kcagran a3be30b
Update playwright tests to handle updated response structures
tamarapoluga 802c997
BE fixes
kcagran ad511ab
FE fixes and error handling
kcagran ec66d6e
Fixes
kcagran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from backend.api.v1.template_options.serializers import FilterKeyValueSerializer | ||
| from backend.apps.clusters.models import Label | ||
|
|
||
|
|
||
| class LabelSerializer(FilterKeyValueSerializer[Label]): | ||
| class Meta: | ||
| model = Label |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from django.urls import path, include | ||
| from rest_framework import routers | ||
|
|
||
| from backend.api.v1.labels.views import LabelView | ||
|
|
||
| base_router = routers.DefaultRouter() | ||
| base_router.register(r"", LabelView, basename="labels") | ||
| urlpatterns = [ | ||
| path("", include(base_router.urls)), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| from django.db.models import QuerySet | ||
| from django_filters.rest_framework import DjangoFilterBackend | ||
| from rest_framework import mixins, filters | ||
| from rest_framework.viewsets import GenericViewSet | ||
|
|
||
| from backend.api.v1.labels.serializers import LabelSerializer | ||
| from backend.api.v1.mixins import AdminOnlyViewSet | ||
| from backend.apps.clusters.models import Label | ||
|
|
||
|
|
||
| class LabelView( | ||
| AdminOnlyViewSet, | ||
| mixins.ListModelMixin, | ||
| mixins.RetrieveModelMixin, | ||
| GenericViewSet | ||
| ): | ||
| serializer_class = LabelSerializer | ||
| filter_backends = [DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter] | ||
|
|
||
| search_fields = ["name"] | ||
| ordering = ["name"] | ||
|
|
||
| def get_queryset(self) -> QuerySet[Label]: | ||
| return Label.objects.all() | ||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from backend.api.v1.template_options.serializers import FilterKeyValueSerializer | ||
| from backend.apps.clusters.models import Organization | ||
|
|
||
|
|
||
| class OrganizationSerializer(FilterKeyValueSerializer[Organization]): | ||
| class Meta: | ||
| model = Organization |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from django.urls import path, include | ||
| from rest_framework import routers | ||
|
|
||
| from backend.api.v1.organizations.views import OrganizationView | ||
|
|
||
| base_router = routers.DefaultRouter() | ||
| base_router.register(r"", OrganizationView, basename="organizations") | ||
| urlpatterns = [ | ||
| path("", include(base_router.urls)), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| from django.db.models import QuerySet | ||
| from django_filters.rest_framework import DjangoFilterBackend | ||
| from rest_framework import mixins, filters | ||
| from rest_framework.viewsets import GenericViewSet | ||
|
|
||
| from backend.api.v1.mixins import AdminOnlyViewSet | ||
| from backend.api.v1.organizations.serializers import OrganizationSerializer | ||
| from backend.apps.clusters.models import Organization | ||
|
|
||
|
|
||
| class OrganizationView( | ||
| AdminOnlyViewSet, | ||
| mixins.ListModelMixin, | ||
| mixins.RetrieveModelMixin, | ||
| GenericViewSet | ||
| ): | ||
| serializer_class = OrganizationSerializer | ||
| filter_backends = [DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter] | ||
|
|
||
| search_fields = ["name"] | ||
| ordering = ["name"] | ||
|
|
||
| def get_queryset(self) -> QuerySet[Organization]: | ||
| return Organization.objects.all() |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from backend.api.v1.template_options.serializers import FilterKeyValueSerializer | ||
| from backend.apps.clusters.models import Project | ||
|
|
||
|
|
||
| class ProjectSerializer(FilterKeyValueSerializer[Project]): | ||
| class Meta: | ||
| model = Project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from django.urls import path, include | ||
| from rest_framework import routers | ||
|
|
||
| from backend.api.v1.projects.views import ProjectView | ||
|
|
||
| base_router = routers.DefaultRouter() | ||
| base_router.register(r"", ProjectView, basename="projects") | ||
| urlpatterns = [ | ||
| path("", include(base_router.urls)), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| from django.db.models import QuerySet | ||
| from django_filters.rest_framework import DjangoFilterBackend | ||
| from rest_framework import mixins, filters | ||
| from rest_framework.viewsets import GenericViewSet | ||
|
|
||
| from backend.api.v1.mixins import AdminOnlyViewSet | ||
| from backend.api.v1.projects.serializers import ProjectSerializer | ||
| from backend.apps.clusters.models import Project | ||
|
|
||
|
|
||
| class ProjectView( | ||
| AdminOnlyViewSet, | ||
| mixins.ListModelMixin, | ||
| mixins.RetrieveModelMixin, | ||
| GenericViewSet | ||
| ): | ||
| serializer_class = ProjectSerializer | ||
| filter_backends = [DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter] | ||
|
|
||
| search_fields = ["name"] | ||
| ordering = ["name"] | ||
|
|
||
| def get_queryset(self) -> QuerySet[Project]: | ||
| return Project.objects.all() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,31 @@ | ||
| from django.db.models import QuerySet | ||
| from rest_framework import mixins | ||
| from django_filters.rest_framework import DjangoFilterBackend | ||
| from rest_framework import mixins, filters, serializers | ||
| from rest_framework.viewsets import GenericViewSet | ||
|
|
||
| from backend.api.v1.mixins import AdminOnlyViewSet | ||
| from backend.api.v1.template.serializers import TemplateSerializer | ||
| from backend.api.v1.template.serializers import TemplatesSerializer, JobTemplateSerializer | ||
| from backend.apps.clusters.models import JobTemplate | ||
|
|
||
|
|
||
| class TemplateView(AdminOnlyViewSet, mixins.ListModelMixin, mixins.UpdateModelMixin, GenericViewSet): | ||
| serializer_class = TemplateSerializer | ||
| class TemplateView( | ||
| AdminOnlyViewSet, | ||
| mixins.ListModelMixin, | ||
| mixins.RetrieveModelMixin, | ||
| mixins.UpdateModelMixin, | ||
| GenericViewSet | ||
| ): | ||
| serializer_class = TemplatesSerializer | ||
|
|
||
| filter_backends = [DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter] | ||
|
|
||
| search_fields = ["name"] | ||
| ordering = ["name"] | ||
|
|
||
| def get_serializer_class(self) -> type[serializers.ModelSerializer[JobTemplate]]: | ||
| if self.action == "list" or self.action == "retrieve": | ||
| return JobTemplateSerializer | ||
| return TemplatesSerializer | ||
|
|
||
| def get_queryset(self) -> QuerySet[JobTemplate]: | ||
| return JobTemplate.objects.all() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.