diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index 6fa15e1df..b19ac0350 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -234,7 +234,7 @@ LOGGING = { # Internationalization # https://docs.djangoproject.com/en/1.10/topics/i18n/ -LANGUAGE_CODE = 'zh-cn' +LANGUAGE_CODE = 'en' TIME_ZONE = 'Asia/Shanghai' diff --git a/apps/terminal/backends/command/db.py b/apps/terminal/backends/command/db.py index 18652a26f..6e0ac961d 100644 --- a/apps/terminal/backends/command/db.py +++ b/apps/terminal/backends/command/db.py @@ -73,11 +73,11 @@ class CommandStore(CommandBase): session=session, ) queryset = self.model.objects.filter(**filter_kwargs) - return [command.to_dict() for command in queryset] + return queryset def count(self, date_from=None, date_to=None, - user=None, asset=None, system_user=None, - input=None, session=None): + user=None, asset=None, system_user=None, + input=None, session=None): filter_kwargs = self.make_filter_kwargs( date_from=date_from, date_to=date_to, user=user, asset=asset, system_user=system_user, input=input, diff --git a/apps/terminal/backends/command/es.py b/apps/terminal/backends/command/es.py index 2e0995ad9..9c75fc978 100644 --- a/apps/terminal/backends/command/es.py +++ b/apps/terminal/backends/command/es.py @@ -3,6 +3,7 @@ from jms_es_sdk import ESStore from .base import CommandBase +from .models import AbstractSessionCommand class CommandStore(CommandBase, ESStore): @@ -25,11 +26,13 @@ class CommandStore(CommandBase, ESStore): user=user, asset=asset, system_user=system_user, input=input, session=session ) - return [item["_source"] for item in data["hits"] if item] + return AbstractSessionCommand.from_multi_dict( + [item["_source"] for item in data["hits"] if item] + ) def count(self, date_from=None, date_to=None, - user=None, asset=None, system_user=None, - input=None, session=None): + user=None, asset=None, system_user=None, + input=None, session=None): amount = ESStore.count( self, date_from=date_from, date_to=date_to, user=user, asset=asset, system_user=system_user, diff --git a/apps/terminal/backends/command/multi.py b/apps/terminal/backends/command/multi.py index 1bd1623f8..1ac822a81 100644 --- a/apps/terminal/backends/command/multi.py +++ b/apps/terminal/backends/command/multi.py @@ -10,9 +10,10 @@ class CommandStore(CommandBase): def filter(self, **kwargs): queryset = [] + for storage in self.storage_list: queryset.extend(storage.filter(**kwargs)) - return sorted(queryset, key=lambda command: command["timestamp"], reverse=True) + return sorted(queryset, key=lambda command: command.timestamp, reverse=True) def count(self, **kwargs): amount = 0