mirror of https://github.com/jumpserver/jumpserver
parent
07bb44dfc3
commit
11db46e61e
|
@ -177,9 +177,10 @@ class ES(object):
|
|||
body = self.get_query_body(**query)
|
||||
|
||||
data = self.es.search(
|
||||
index=self.query_index, doc_type=self.doc_type, body=body,
|
||||
index=self.query_index, body=body,
|
||||
from_=from_, size=size, sort=sort
|
||||
)
|
||||
|
||||
source_data = []
|
||||
for item in data['hits']['hits']:
|
||||
if item:
|
||||
|
@ -191,7 +192,7 @@ class ES(object):
|
|||
def count(self, **query):
|
||||
try:
|
||||
body = self.get_query_body(**query)
|
||||
data = self.es.count(index=self.query_index, doc_type=self.doc_type, body=body)
|
||||
data = self.es.count(index=self.query_index, body=body)
|
||||
count = data["count"]
|
||||
except Exception as e:
|
||||
logger.error('ES count error: {}'.format(e))
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from django.utils import translation
|
||||
from django.utils import timezone
|
||||
from rest_framework import generics
|
||||
from rest_framework.fields import DateTimeField
|
||||
from rest_framework.response import Response
|
||||
|
||||
from acls.models import CommandFilterACL, CommandGroup
|
||||
from terminal.models import CommandStorage, Session, Command
|
||||
from terminal.filters import CommandFilter
|
||||
from orgs.utils import current_org
|
||||
from common.api import JMSBulkModelViewSet
|
||||
from common.utils import get_logger
|
||||
from terminal.serializers import (
|
||||
SessionCommandSerializer, InsecureCommandAlertSerializer
|
||||
)
|
||||
from terminal.exceptions import StorageInvalid
|
||||
from orgs.utils import current_org
|
||||
from terminal.backends import (
|
||||
get_command_storage, get_multi_command_storage
|
||||
)
|
||||
from terminal.notifications import CommandAlertMessage, CommandWarningMessage
|
||||
from terminal.const import RiskLevelChoices
|
||||
from terminal.exceptions import StorageInvalid
|
||||
from terminal.filters import CommandFilter
|
||||
from terminal.models import CommandStorage, Session, Command
|
||||
from terminal.notifications import CommandAlertMessage, CommandWarningMessage
|
||||
from terminal.serializers import (
|
||||
SessionCommandSerializer, InsecureCommandAlertSerializer
|
||||
)
|
||||
|
||||
logger = get_logger(__name__)
|
||||
__all__ = ['CommandViewSet', 'InsecureCommandAlertAPI']
|
||||
|
@ -140,8 +139,8 @@ class CommandViewSet(JMSBulkModelViewSet):
|
|||
if session_id and not command_storage_id:
|
||||
# 会话里的命令列表肯定会提供 session_id,这里防止 merge 的时候取全量的数据
|
||||
return self.merge_all_storage_list(request, *args, **kwargs)
|
||||
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
queryset = self.get_queryset()
|
||||
queryset = self.filter_queryset(queryset)
|
||||
|
||||
page = self.paginate_queryset(queryset)
|
||||
if page is not None:
|
||||
|
|
Loading…
Reference in New Issue