Browse Source

fix: 修复会话详情页命令列表排序失效bug

pull/7367/head
halo 3 years ago committed by 老广
parent
commit
84924bc3f6
  1. 5
      apps/terminal/api/command.py

5
apps/terminal/api/command.py

@ -121,7 +121,10 @@ class CommandViewSet(JMSBulkModelViewSet):
qs = storage.get_command_queryset()
commands = self.filter_queryset(qs)
merged_commands.extend(commands[:]) # ES 默认只取 10 条数据
order = self.request.query_params.get('order', None)
if order == 'timestamp':
merged_commands.sort(key=lambda command: command.timestamp)
else:
merged_commands.sort(key=lambda command: command.timestamp, reverse=True)
page = self.paginate_queryset(merged_commands)
if page is not None:

Loading…
Cancel
Save