From 0ddb9476ba68f03ea6507af1ebe3535ec202fd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=B3=B0=E4=BB=BB1049851?= Date: Mon, 9 Jul 2018 15:55:07 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 资产授权页面增加分页 --- apps/perms/api.py | 2 ++ apps/perms/templates/perms/asset_permission_list.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/perms/api.py b/apps/perms/api.py index 33a027064..ece7c1011 100644 --- a/apps/perms/api.py +++ b/apps/perms/api.py @@ -5,6 +5,7 @@ from django.shortcuts import get_object_or_404 from rest_framework.views import APIView, Response from rest_framework.generics import ListAPIView, get_object_or_404, RetrieveUpdateAPIView from rest_framework import viewsets +from rest_framework.pagination import LimitOffsetPagination from common.utils import set_or_append_attr_bulk, get_object_or_none from users.permissions import IsValidUser, IsSuperUser, IsSuperUserOrAppUser @@ -22,6 +23,7 @@ class AssetPermissionViewSet(viewsets.ModelViewSet): queryset = AssetPermission.objects.all() serializer_class = serializers.AssetPermissionCreateUpdateSerializer permission_classes = (IsSuperUser,) + pagination_class = LimitOffsetPagination def get_serializer_class(self): if self.action in ("list", 'retrieve'): diff --git a/apps/perms/templates/perms/asset_permission_list.html b/apps/perms/templates/perms/asset_permission_list.html index c18f12224..2f0f74312 100644 --- a/apps/perms/templates/perms/asset_permission_list.html +++ b/apps/perms/templates/perms/asset_permission_list.html @@ -208,7 +208,7 @@ function initTable() { select: {}, op_html: $('#actions').html() }; - table = jumpserver.initDataTable(options); + table = jumpserver.initServerSideDataTable(options); return table } From eaefb5c669bce925062c6fa65bbf96250e0984fa Mon Sep 17 00:00:00 2001 From: ycfuck Date: Mon, 9 Jul 2018 16:00:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?Revert=20"=E8=B5=84=E4=BA=A7=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0ddb9476ba68f03ea6507af1ebe3535ec202fd30. --- apps/perms/api.py | 2 -- apps/perms/templates/perms/asset_permission_list.html | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/perms/api.py b/apps/perms/api.py index ece7c1011..33a027064 100644 --- a/apps/perms/api.py +++ b/apps/perms/api.py @@ -5,7 +5,6 @@ from django.shortcuts import get_object_or_404 from rest_framework.views import APIView, Response from rest_framework.generics import ListAPIView, get_object_or_404, RetrieveUpdateAPIView from rest_framework import viewsets -from rest_framework.pagination import LimitOffsetPagination from common.utils import set_or_append_attr_bulk, get_object_or_none from users.permissions import IsValidUser, IsSuperUser, IsSuperUserOrAppUser @@ -23,7 +22,6 @@ class AssetPermissionViewSet(viewsets.ModelViewSet): queryset = AssetPermission.objects.all() serializer_class = serializers.AssetPermissionCreateUpdateSerializer permission_classes = (IsSuperUser,) - pagination_class = LimitOffsetPagination def get_serializer_class(self): if self.action in ("list", 'retrieve'): diff --git a/apps/perms/templates/perms/asset_permission_list.html b/apps/perms/templates/perms/asset_permission_list.html index 2f0f74312..c18f12224 100644 --- a/apps/perms/templates/perms/asset_permission_list.html +++ b/apps/perms/templates/perms/asset_permission_list.html @@ -208,7 +208,7 @@ function initTable() { select: {}, op_html: $('#actions').html() }; - table = jumpserver.initServerSideDataTable(options); + table = jumpserver.initDataTable(options); return table } From 72517a2c724388d0244196e074c34d7e51571564 Mon Sep 17 00:00:00 2001 From: ycfuck Date: Tue, 10 Jul 2018 16:33:28 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8E=88=E6=9D=83=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 授权页面分页 --- apps/perms/api.py | 4 ++++ apps/perms/templates/perms/asset_permission_list.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/perms/api.py b/apps/perms/api.py index 33a027064..d9863d2a2 100644 --- a/apps/perms/api.py +++ b/apps/perms/api.py @@ -5,6 +5,7 @@ from django.shortcuts import get_object_or_404 from rest_framework.views import APIView, Response from rest_framework.generics import ListAPIView, get_object_or_404, RetrieveUpdateAPIView from rest_framework import viewsets +from rest_framework.pagination import LimitOffsetPagination from common.utils import set_or_append_attr_bulk, get_object_or_none from users.permissions import IsValidUser, IsSuperUser, IsSuperUserOrAppUser @@ -19,9 +20,12 @@ class AssetPermissionViewSet(viewsets.ModelViewSet): """ 资产授权列表的增删改查api """ + filter_fields = ("name",) + search_fields = filter_fields queryset = AssetPermission.objects.all() serializer_class = serializers.AssetPermissionCreateUpdateSerializer permission_classes = (IsSuperUser,) + pagination_class = LimitOffsetPagination def get_serializer_class(self): if self.action in ("list", 'retrieve'): diff --git a/apps/perms/templates/perms/asset_permission_list.html b/apps/perms/templates/perms/asset_permission_list.html index c18f12224..2f0f74312 100644 --- a/apps/perms/templates/perms/asset_permission_list.html +++ b/apps/perms/templates/perms/asset_permission_list.html @@ -208,7 +208,7 @@ function initTable() { select: {}, op_html: $('#actions').html() }; - table = jumpserver.initDataTable(options); + table = jumpserver.initServerSideDataTable(options); return table } From fd3df81a64dd2e51d942ba1517df675667b9a840 Mon Sep 17 00:00:00 2001 From: wstart <371475305@qq.com> Date: Tue, 10 Jul 2018 17:03:31 +0800 Subject: [PATCH 4/4] Update api.py --- apps/perms/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/perms/api.py b/apps/perms/api.py index d9863d2a2..d990d4db4 100644 --- a/apps/perms/api.py +++ b/apps/perms/api.py @@ -25,7 +25,7 @@ class AssetPermissionViewSet(viewsets.ModelViewSet): queryset = AssetPermission.objects.all() serializer_class = serializers.AssetPermissionCreateUpdateSerializer permission_classes = (IsSuperUser,) - pagination_class = LimitOffsetPagination + pagination_class = LimitOffsetPagination def get_serializer_class(self): if self.action in ("list", 'retrieve'):